about summary refs log tree commit diff stats
path: root/WWW/Library/Implementation/HTAccess.c
diff options
context:
space:
mode:
Diffstat (limited to 'WWW/Library/Implementation/HTAccess.c')
-rw-r--r--WWW/Library/Implementation/HTAccess.c554
1 files changed, 277 insertions, 277 deletions
diff --git a/WWW/Library/Implementation/HTAccess.c b/WWW/Library/Implementation/HTAccess.c
index c2e75d41..edb91b51 100644
--- a/WWW/Library/Implementation/HTAccess.c
+++ b/WWW/Library/Implementation/HTAccess.c
@@ -6,10 +6,10 @@
 **	JFG	Jean-Francois Groff jfg@dxcern.cern.ch
 **	DD	Denis DeLaRoca (310) 825-4580  <CSP1DWD@mvs.oac.ucla.edu>
 **	FM	Foteos Macrides macrides@sci.wfeb.edu
-**      PDM     Danny Mayer mayer@ljo.dec.com
+**	PDM	Danny Mayer mayer@ljo.dec.com
 **
 **  History
-**       8 Jun 92 Telnet hopping prohibited as telnet is not secure TBL
+**	 8 Jun 92 Telnet hopping prohibited as telnet is not secure TBL
 **	26 Jun 92 When over DECnet, suppressed FTP, Gopher and News. JFG
 **	 6 Oct 92 Moved HTClientHost and logfile into here. TBL
 **	17 Dec 92 Tn3270 added, bug fix. DD
@@ -17,12 +17,12 @@
 **		  PARAMETERS TO HTSEARCH AND HTLOADRELATIVE CHANGED
 **	28 May 93 WAIS gateway explicit if no WAIS library linked in.
 **	31 May 94 Added DIRECT_WAIS support for VMS. FM
-**      27 Jan 95 Fixed proxy support to use NNTPSERVER for checking
-**                whether or not to use the proxy server. PDM
-**      27 Jan 95 Ensured that proxy service will be overridden for files
+**	27 Jan 95 Fixed proxy support to use NNTPSERVER for checking
+**		  whether or not to use the proxy server. PDM
+**	27 Jan 95 Ensured that proxy service will be overridden for files
 **		  on the local host (because HTLoadFile() doesn't try ftp
 **		  for those) and will substitute ftp for remote files. FM
-**      28 Jan 95 Tweeked PDM's proxy override mods to handle port info
+**	28 Jan 95 Tweeked PDM's proxy override mods to handle port info
 **		  for news and wais URL's. FM
 **
 **  Bugs
@@ -70,7 +70,7 @@ extern HTCJKlang HTCJK;
 **  These flags may be set to modify the operation of this module
 */
 PUBLIC char * HTClientHost = NULL; /* Name of remote login host if any */
-PUBLIC FILE * HTlogfile = NULL;	   /* File to which to output one-liners */
+PUBLIC FILE * HTlogfile = NULL;    /* File to which to output one-liners */
 PUBLIC BOOL HTSecure = NO;	   /* Disable access for telnet users? */
 
 PUBLIC BOOL using_proxy = NO; /* are we using a proxy gateway? */
@@ -79,7 +79,7 @@ PUBLIC BOOL using_proxy = NO; /* are we using a proxy gateway? */
 **  To generate other things, play with these:
 */
 PUBLIC HTFormat HTOutputFormat = NULL;
-PUBLIC HTStream* HTOutputStream = NULL;	/* For non-interactive, set this */ 
+PUBLIC HTStream* HTOutputStream = NULL; /* For non-interactive, set this */
 
 PRIVATE HTList * protocols = NULL; /* List of registered protocol descriptors */
 
@@ -102,7 +102,7 @@ PUBLIC BOOL HTRegisterProtocol ARGS1(
 	HTProtocol *,	protocol)
 {
     if (!protocols) {
-        protocols = HTList_new();
+	protocols = HTList_new();
 	atexit(free_protocols);
     }
     HTList_addObject(protocols, protocol);
@@ -116,7 +116,7 @@ PUBLIC BOOL HTRegisterProtocol ARGS1(
 **	Add to or subtract from this list if you add or remove protocol
 **	modules. This routine is called the first time the protocol list
 **	is needed, unless any protocols are already registered, in which
-**	case it is not called.  Therefore the application can override
+**	case it is not called.	Therefore the application can override
 **	this list.
 **
 **	Compiling with NO_INIT prevents all known protocols from being
@@ -197,7 +197,7 @@ PRIVATE void HTAccessInit NOARGS			/* Call me once */
 **	part is present, it applies to all ports on that domain.
 **
 **  Example:
-**          no_proxy="cern.ch,some.domain:8001"
+**	    no_proxy="cern.ch,some.domain:8001"
 **
 **  Use "*" to override all proxy service:
 **	     no_proxy="*"
@@ -218,35 +218,35 @@ PUBLIC BOOL override_proxy ARGS1(
      * Check for global override.
      */
     if (no_proxy) {
-        if (!strcmp(no_proxy, "*"))
-            return YES;
+	if (!strcmp(no_proxy, "*"))
+	    return YES;
     }
 
     /*
-     *  Never proxy file:// URLs if they are on the local host.
-     *  HTLoadFile() will not attempt ftp for those if direct
-     *  access fails.  We'll check that first, in case no_proxy
-     *  hasn't been defined. - FM
+     *	Never proxy file:// URLs if they are on the local host.
+     *	HTLoadFile() will not attempt ftp for those if direct
+     *	access fails.  We'll check that first, in case no_proxy
+     *	hasn't been defined. - FM
      */
     if (!addr)
-        return NO;
+	return NO;
     if (!(host = HTParse(addr, "", PARSE_HOST)))
-        return NO;
+	return NO;
     if (!*host) {
-        FREE(host);
+	FREE(host);
 	return NO;
     }
     Host = (((at = strchr(host, '@')) != NULL) ? (at+1) : host);
 
     if ((acc_method = HTParse(addr, "", PARSE_ACCESS))) {
-        if (!strcmp("file", acc_method) &&
+	if (!strcmp("file", acc_method) &&
 	    (!strcmp(Host, "localhost") ||
 #ifdef VMS
-             !strcasecomp(Host, HTHostName())
+	     !strcasecomp(Host, HTHostName())
 #else
-             !strcmp(Host, HTHostName())
+	     !strcmp(Host, HTHostName())
 #endif /* VMS */
-        )) {
+	)) {
 	    FREE(host);
 	    FREE(acc_method);
 	    return YES;
@@ -255,69 +255,69 @@ PUBLIC BOOL override_proxy ARGS1(
     }
 
     if (!no_proxy) {
-        FREE(host);
-        return NO;
+	FREE(host);
+	return NO;
     }
 
     if (NULL != (p = strrchr(Host, ':'))) {	/* Port specified */
-        *p++ = 0;                   		/* Chop off port */
-        port = atoi(p);
+	*p++ = 0;				/* Chop off port */
+	port = atoi(p);
     } else {					/* Use default port */
-        acc_method = HTParse(addr, "", PARSE_ACCESS);
-        if (acc_method != NULL) {
-            if      (!strcmp(acc_method, "http"))	port = 80;
-            else if (!strcmp(acc_method, "https"))	port = 443;
-            else if (!strcmp(acc_method, "ftp"))	port = 21;
-            else if (!strcmp(acc_method, "gopher"))	port = 70;
-            else if (!strcmp(acc_method, "cso"))	port = 105;
+	acc_method = HTParse(addr, "", PARSE_ACCESS);
+	if (acc_method != NULL) {
+	    if	    (!strcmp(acc_method, "http"))	port = 80;
+	    else if (!strcmp(acc_method, "https"))	port = 443;
+	    else if (!strcmp(acc_method, "ftp"))	port = 21;
+	    else if (!strcmp(acc_method, "gopher"))	port = 70;
+	    else if (!strcmp(acc_method, "cso"))	port = 105;
 	    else if (!strcmp(acc_method, "news"))	port = 119;
 	    else if (!strcmp(acc_method, "nntp"))	port = 119;
 	    else if (!strcmp(acc_method, "newspost"))	port = 119;
 	    else if (!strcmp(acc_method, "newsreply"))	port = 119;
 	    else if (!strcmp(acc_method, "snews"))	port = 563;
 	    else if (!strcmp(acc_method, "snewspost"))	port = 563;
-	    else if (!strcmp(acc_method, "snewsreply"))	port = 563;
+	    else if (!strcmp(acc_method, "snewsreply")) port = 563;
 	    else if (!strcmp(acc_method, "wais"))	port = 210;
 	    else if (!strcmp(acc_method, "finger"))	port = 79;
-            FREE(acc_method);
-        }
+	    FREE(acc_method);
+	}
     }
     if (!port)
-        port = 80;                  /* Default */
+	port = 80;		    /* Default */
     h_len = strlen(Host);
 
     while (*no_proxy) {
-        CONST char * end;
-        CONST char * colon = NULL;
-        int templ_port = 0;
-        int t_len;
-
-        while (*no_proxy && (WHITE(*no_proxy) || *no_proxy == ','))
-            no_proxy++;             /* Skip whitespace and separators */
-
-        end = no_proxy;
-        while (*end && !WHITE(*end) && *end != ',') {	/* Find separator */
-            if (*end == ':') colon = end;		/* Port number given */
-            end++;
-        }
-
-        if (colon) {
-            templ_port = atoi(colon+1);
-            t_len = colon - no_proxy;
-        }
-        else {
-            t_len = end - no_proxy;
-        }
-
-        if ((!templ_port || templ_port == port)  &&
-            (t_len > 0  &&  t_len <= h_len  &&
-             !strncmp(Host + h_len - t_len, no_proxy, t_len))) {
-            FREE(host);
-            return YES;
-        }
-        if (*end)
+	CONST char * end;
+	CONST char * colon = NULL;
+	int templ_port = 0;
+	int t_len;
+
+	while (*no_proxy && (WHITE(*no_proxy) || *no_proxy == ','))
+	    no_proxy++; 	    /* Skip whitespace and separators */
+
+	end = no_proxy;
+	while (*end && !WHITE(*end) && *end != ',') {	/* Find separator */
+	    if (*end == ':') colon = end;		/* Port number given */
+	    end++;
+	}
+
+	if (colon) {
+	    templ_port = atoi(colon+1);
+	    t_len = colon - no_proxy;
+	}
+	else {
+	    t_len = end - no_proxy;
+	}
+
+	if ((!templ_port || templ_port == port)  &&
+	    (t_len > 0	&&  t_len <= h_len  &&
+	     !strncmp(Host + h_len - t_len, no_proxy, t_len))) {
+	    FREE(host);
+	    return YES;
+	}
+	if (*end)
 	    no_proxy = (end + 1);
-        else
+	else
 	    break;
     }
 
@@ -333,7 +333,7 @@ PUBLIC BOOL override_proxy ARGS1(
 **	anchor		a pareent anchor with whose address is addr
 **
 **  On exit,
-**	returns		HT_NO_ACCESS		Error has occured.
+**	returns 	HT_NO_ACCESS		Error has occured.
 **			HT_OK			Success
 */
 PRIVATE int get_physical ARGS2(
@@ -350,7 +350,7 @@ PRIVATE int get_physical ARGS2(
 	return HT_FORBIDDEN;
     }
     if (anchor->isISMAPScript == TRUE) {
-        StrAllocCat(physical, "?0,0");
+	StrAllocCat(physical, "?0,0");
 	if (TRACE)
 	    fprintf(stderr, "HTAccess: Appending '?0,0' coordinate pair.\n");
     }
@@ -358,24 +358,24 @@ PRIVATE int get_physical ARGS2(
     FREE(physical);			/* free our copy */
 #else
     if (anchor->isISMAPScript == TRUE) {
-        StrAllocCopy(physical, addr);
+	StrAllocCopy(physical, addr);
 	StrAllocCat(physical, "?0,0");
 	if (TRACE)
 	    fprintf(stderr, "HTAccess: Appending '?0,0' coordinate pair.\n");
 	HTAnchor_setPhysical(anchor, physical);
-	FREE(physical);			/* free our copy */
+	FREE(physical); 		/* free our copy */
     } else {
-        HTAnchor_setPhysical(anchor, addr);
+	HTAnchor_setPhysical(anchor, addr);
     }
 #endif /* NO_RULES */
 
     acc_method =  HTParse(HTAnchor_physical(anchor),
-    		"file:", PARSE_ACCESS);
+		"file:", PARSE_ACCESS);
 
     /*
-    **  Check whether gateway access has been set up for this.
+    **	Check whether gateway access has been set up for this.
     **
-    **  This function can be replaced by the rule system above.
+    **	This function can be replaced by the rule system above.
     */
 #define USE_GATEWAYS
 #ifdef USE_GATEWAYS
@@ -392,34 +392,34 @@ PRIVATE int get_physical ARGS2(
 	char *host = NULL;
 	if ((host = HTParse(addr, "", PARSE_HOST))) {
 	    if (strchr(host, ':') == NULL) {
-	        StrAllocCopy(Server_addr, "news://");
-	        StrAllocCat(Server_addr, host);
+		StrAllocCopy(Server_addr, "news://");
+		StrAllocCat(Server_addr, host);
 		StrAllocCat(Server_addr, ":119/");
 	    }
 	    FREE(host);
-        } else if (getenv("NNTPSERVER") != NULL) {
-            StrAllocCopy(Server_addr, "news://");
-            StrAllocCat(Server_addr, (char *)getenv("NNTPSERVER"));
-            StrAllocCat(Server_addr, ":119/");
-         }
+	} else if (getenv("NNTPSERVER") != NULL) {
+	    StrAllocCopy(Server_addr, "news://");
+	    StrAllocCat(Server_addr, (char *)getenv("NNTPSERVER"));
+	    StrAllocCat(Server_addr, ":119/");
+	 }
     } else if (!strcasecomp(acc_method, "wais")) {
-    	/*
+	/*
 	**  Wais also needs checking of the default port
 	**  for selective exclusions.
 	*/
 	char *host = NULL;
 	if ((host = HTParse(addr, "", PARSE_HOST))) {
 	    if (!(strchr(host, ':'))) {
-	        StrAllocCopy(Server_addr, "wais://");
-	        StrAllocCat(Server_addr, host);
+		StrAllocCopy(Server_addr, "wais://");
+		StrAllocCat(Server_addr, host);
 		StrAllocCat(Server_addr, ":210/");
 	    }
 	    FREE(host);
 	}
 	else
-            StrAllocCopy(Server_addr, addr);
+	    StrAllocCopy(Server_addr, addr);
     } else {
-        StrAllocCopy(Server_addr, addr);
+	StrAllocCopy(Server_addr, addr);
     }
 
     if (!override_proxy(Server_addr)) {
@@ -446,7 +446,7 @@ PRIVATE int get_physical ARGS2(
 	    strcpy(gateway_parameter, "ftp");
 	else
 	    strcpy(gateway_parameter, acc_method);
-        strcat(gateway_parameter, "_proxy");
+	strcat(gateway_parameter, "_proxy");
 	proxy = (char *)getenv(gateway_parameter);
 	FREE(gateway_parameter);
 
@@ -454,55 +454,55 @@ PRIVATE int get_physical ARGS2(
 	    fprintf(stderr, "Gateway found: %s\n", gateway);
 	if (TRACE && proxy)
 	    fprintf(stderr, "proxy server found: %s\n", proxy);
-	
+
 	/*
 	**  Proxy servers have precedence over gateway servers.
 	*/
 	if (proxy) {
 	    char * gatewayed = NULL;
-            StrAllocCopy(gatewayed,proxy);
+	    StrAllocCopy(gatewayed,proxy);
 	    /*
 	    ** Ensure that the proxy server uses ftp for file URLs. - FM
 	    */
 	    if (!strncmp(addr, "file", 4)) {
-                StrAllocCat(gatewayed, "ftp");
-                StrAllocCat(gatewayed, (addr + 4));
+		StrAllocCat(gatewayed, "ftp");
+		StrAllocCat(gatewayed, (addr + 4));
 	    } else
-                StrAllocCat(gatewayed, addr);
-            using_proxy = YES;
+		StrAllocCat(gatewayed, addr);
+	    using_proxy = YES;
 	    if (anchor->isISMAPScript == TRUE)
-	        StrAllocCat(gatewayed, "?0,0");
-            HTAnchor_setPhysical(anchor, gatewayed);
+		StrAllocCat(gatewayed, "?0,0");
+	    HTAnchor_setPhysical(anchor, gatewayed);
 	    FREE(gatewayed);
 	    FREE(acc_method);
 
-    	    acc_method =  HTParse(HTAnchor_physical(anchor),
-    		"http:", PARSE_ACCESS);
+	    acc_method =  HTParse(HTAnchor_physical(anchor),
+		"http:", PARSE_ACCESS);
 
 	} else if (gateway) {
 	    char * path = HTParse(addr, "",
-	    	PARSE_HOST + PARSE_PATH + PARSE_PUNCTUATION);
+		PARSE_HOST + PARSE_PATH + PARSE_PUNCTUATION);
 		/* Chop leading / off to make host into part of path */
 	    char * gatewayed = HTParse(path+1, gateway, PARSE_ALL);
 	    FREE(path);
-            HTAnchor_setPhysical(anchor, gatewayed);
+	    HTAnchor_setPhysical(anchor, gatewayed);
 	    FREE(gatewayed);
 	    FREE(acc_method);
-	    
-    	    acc_method =  HTParse(HTAnchor_physical(anchor),
-    		"http:", PARSE_ACCESS);
-	} 
+
+	    acc_method =  HTParse(HTAnchor_physical(anchor),
+		"http:", PARSE_ACCESS);
+	}
     }
     FREE(Server_addr);
 #endif /* use gateways */
 
     /*
-    **  Search registered protocols to find suitable one.
+    **	Search registered protocols to find suitable one.
     */
     {
 	int i, n;
 #ifndef NO_INIT
-        if (!protocols) HTAccessInit();
+	if (!protocols) HTAccessInit();
 #endif
 	n = HTList_count(protocols);
 	for (i = 0; i < n; i++) {
@@ -526,7 +526,7 @@ PRIVATE int get_physical ARGS2(
  *  values for later restoration. - kw
  *  @@@ These functions may not really belong here, but where else?
  *  I want the "pop" to occur as soon as possible after loading
- *  has finished. - kw @@@   
+ *  has finished. - kw @@@
  */
 
 extern char*UCAssume_MIMEcharset;
@@ -571,7 +571,7 @@ PRIVATE int LYUCPopAssumed NOARGS
     return -1;
 }
 
-/*	Load a document					HTLoad()
+/*	Load a document 				HTLoad()
 **	---------------
 **
 **	This is an internal routine, which has an address AND a matching
@@ -582,7 +582,7 @@ PRIVATE int LYUCPopAssumed NOARGS
 **	anchor		a pareent anchor with whose address is addr
 **
 **  On exit,
-**	returns		<0		Error has occured.
+**	returns 	<0		Error has occured.
 **			HT_LOADED	Success
 **			HT_NO_DATA	Success, but no document loaded.
 **					(telnet sesssion started etc)
@@ -596,15 +596,15 @@ PRIVATE int HTLoad ARGS4(
     HTProtocol *p;
     int status = get_physical(addr, anchor);
     if (status == HT_FORBIDDEN) {
-        return HTLoadError(sink, 500, "Access forbidden by rule");
+	return HTLoadError(sink, 500, "Access forbidden by rule");
     }
     if (status < 0)
-        return status;	/* Can't resolve or forbidden */
-    
+	return status;	/* Can't resolve or forbidden */
+
     p = (HTProtocol *)HTAnchor_protocol(anchor);
-    anchor->underway = TRUE;            /* Hack to deal with caching */
+    anchor->underway = TRUE;		/* Hack to deal with caching */
     status= (*(p->load))(HTAnchor_physical(anchor),
-    			anchor, format_out, sink);
+			anchor, format_out, sink);
     anchor->underway = FALSE;
     LYUCPopAssumed();
     return status;
@@ -618,8 +618,8 @@ PUBLIC HTStream *HTSaveStream ARGS1(
 {
     HTProtocol *p = (HTProtocol *)HTAnchor_protocol(anchor);
     if (!p)
-        return NULL;
-    
+	return NULL;
+
     return (*p->saveStream)(anchor);
 }
 
@@ -635,18 +635,18 @@ extern char LYinternal_flag;		       /* from LYMainLoop.c */
 **
 **  On Entry,
 **	  anchor	    is the node_anchor for the document
-**        full_address      The address of the document to be accessed.
-**        filter            if YES, treat stdin as HTML
+**	  full_address	    The address of the document to be accessed.
+**	  filter	    if YES, treat stdin as HTML
 **
 **  On Exit,
-**        returns    YES     Success in opening document
-**                   NO      Failure 
+**	  returns    YES     Success in opening document
+**		     NO      Failure
 */
 
-extern char LYforce_no_cache;			         /* from GridText.c */
+extern char LYforce_no_cache;				 /* from GridText.c */
 extern char LYoverride_no_cache;		       /* from LYMainLoop.c */
 extern char * HTLoadedDocumentURL NOPARAMS;		   /* in GridText.c */
-extern BOOL HText_hasNoCacheSet PARAMS((HText *text));     /* in GridText.c */
+extern BOOL HText_hasNoCacheSet PARAMS((HText *text));	   /* in GridText.c */
 extern BOOL reloading;
 extern BOOL permanent_redirection;
 #ifdef DIRED_SUPPORT
@@ -659,7 +659,7 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 	HTFormat,		format_out,
 	HTStream*,		sink)
 {
-    int	        status;
+    int 	status;
     HText *	text;
     CONST char * address_to_load = full_address;
     char *cp;
@@ -667,40 +667,40 @@ PRIVATE BOOL HTLoadDocument ARGS4(
     static int redirection_attempts = 0;
 
     if (TRACE)
-        fprintf (stderr, "HTAccess: loading document %s\n", address_to_load);
+	fprintf (stderr, "HTAccess: loading document %s\n", address_to_load);
 
     /*
-    **  Free use_this_url_instead and reset permanent_redirection
-    **  if not done elsewhere. - FM
+    **	Free use_this_url_instead and reset permanent_redirection
+    **	if not done elsewhere. - FM
     */
     FREE(use_this_url_instead);
     permanent_redirection = FALSE;
 
     /*
-    **  Make sure some yoyo doesn't send us 'round in circles
-    **  with redirecting URLs that point back to themselves.
-    **  We'll set the original Lynx limit of 10 redirections
-    **  per requested URL from a user, because the HTTP/1.1
-    **  will no longer specify a restriction to 5, but will
-    **  leave it up to the browser's discretion, in deference
-    **  to MicroSoft.  - FM
+    **	Make sure some yoyo doesn't send us 'round in circles
+    **	with redirecting URLs that point back to themselves.
+    **	We'll set the original Lynx limit of 10 redirections
+    **	per requested URL from a user, because the HTTP/1.1
+    **	will no longer specify a restriction to 5, but will
+    **	leave it up to the browser's discretion, in deference
+    **	to MicroSoft.  - FM
     */
     if (redirection_attempts > 10) {
-        redirection_attempts = 0;
-	HTAlert("Redirection limit of 10 URLs reached.");
-        return NO;
+	redirection_attempts = 0;
+	HTAlert("Redirection limit of 10 URL's reached.");
+	return NO;
     }
 
     /*
-     *  If this is marked as an internal link but we don't have the
-     *  document loaded any more, and we haven't explicitly flagged
-     *  that we want to reload with LYforce_no_cache, then something
-     *  has disappeared from the cache when we expected it to be still
-     *  there.  The user probably doesn't expect a new network access.
-     *  So if we have POST data and safe is not set in the anchor,
-     *  ask for confirmation, and fail if not granted.  The exception
-     *  are LYNXIMGMAP documents, for which we defer to LYLoadIMGmap
-     *  for prompting if necessary. - kw
+     *	If this is marked as an internal link but we don't have the
+     *	document loaded any more, and we haven't explicitly flagged
+     *	that we want to reload with LYforce_no_cache, then something
+     *	has disappeared from the cache when we expected it to be still
+     *	there.	The user probably doesn't expect a new network access.
+     *	So if we have POST data and safe is not set in the anchor,
+     *	ask for confirmation, and fail if not granted.	The exception
+     *	are LYNXIMGMAP documents, for which we defer to LYLoadIMGmap
+     *	for prompting if necessary. - kw
      */
     if (LYinternal_flag && !LYforce_no_cache &&
 	anchor->post_data && !anchor->safe &&
@@ -712,14 +712,14 @@ PRIVATE BOOL HTLoadDocument ARGS4(
     }
 
     /*
-    **  If we don't have POST content, check whether this is a previous
-    **  redirecting URL, and keep re-checking until we get to the final
-    **  destination or redirection limit.  If we do have POST content,
-    **  we didn't allow permanent redirection, and an interactive user
-    **  will be deciding whether to keep redirecting. - FM
+    **	If we don't have POST content, check whether this is a previous
+    **	redirecting URL, and keep re-checking until we get to the final
+    **	destination or redirection limit.  If we do have POST content,
+    **	we didn't allow permanent redirection, and an interactive user
+    **	will be deciding whether to keep redirecting. - FM
     */
     if (!anchor->post_data) {
-        while ((cp = HTAnchor_physical(anchor)) != NULL &&
+	while ((cp = HTAnchor_physical(anchor)) != NULL &&
 	       !strncmp(cp, "Location=", 9)) {
 	    DocAddress NewDoc;
 
@@ -730,13 +730,13 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 	    }
 
 	    /*
-	    **  Don't exceed the redirection_attempts limit. - FM
+	    **	Don't exceed the redirection_attempts limit. - FM
 	    */
 	    if (++redirection_attempts > 10) {
-		HTAlert("Redirection limit of 10 URLs reached.");
+		HTAlert("Redirection limit of 10 URL's reached.");
 		redirection_attempts = 0;
 		FREE(use_this_url_instead);
- 		return NO;
+		return NO;
 	    }
 
 	    /*
@@ -753,31 +753,31 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 	}
     }
     /*
-    **  If we had previous redirection, go back and check out
-    **  that the URL under the current restrictions. - FM
+    **	If we had previous redirection, go back and check out
+    **	that the URL under the current restrictions. - FM
     */
     if (use_this_url_instead) {
 	FREE(redirecting_url);
-        return(NO);
+	return(NO);
     }
 
     /*
-    **  See if we can use an already loaded document.
+    **	See if we can use an already loaded document.
     */
-    if (!LYforce_no_cache && (text = (HText *)HTAnchor_document(anchor))) {	
+    if (!LYforce_no_cache && (text = (HText *)HTAnchor_document(anchor))) {
 	/*
 	**  We have a cached rendition of the target document.
 	**  Check if it's OK to re-use it.  We consider it OK if:
 	**   (1) the anchor does not have the no_cache element set, or
 	**   (2) we've overridden it, e.g., because we are acting on
-	**       a PREV_DOC command or a link in the History Page and
-	**       it's not a reply from a POST with the LYresubmit_posts
-	**       flag set, or
+	**	 a PREV_DOC command or a link in the History Page and
+	**	 it's not a reply from a POST with the LYresubmit_posts
+	**	 flag set, or
 	**   (3) we are repositioning within the currently loaded document
-	**       based on the target anchor's address (URL_Reference).
+	**	 based on the target anchor's address (URL_Reference).
 	*
 	*    If DONT_TRACK_INTERNAL_LINKS is defined, HText_AreDifferent()
-	*    is used to determine whether (3) applies.  If the target address
+	*    is used to determine whether (3) applies.	If the target address
 	*    differs from that of the current document only by a fragment
 	*    and the taget address has an appended fragment, repositioning
 	*    without reloading is always assumed.
@@ -825,13 +825,13 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 	     strncmp(full_address, "LYNXIMGMAP:", 11)))
 #endif /* TRACK_INTERNAL_LINKS */
 	{
-            if (TRACE)
-	        fprintf(stderr, "HTAccess: Document already in memory.\n");
-            HText_select(text);
+	    if (TRACE)
+		fprintf(stderr, "HTAccess: Document already in memory.\n");
+	    HText_select(text);
 
 #ifdef DIRED_SUPPORT
 	    if (HTAnchor_format(anchor) == WWW_DIRED)
-	        lynx_edit_mode = TRUE;
+		lynx_edit_mode = TRUE;
 #endif
 	    redirection_attempts = 0;
 	    return YES;
@@ -843,17 +843,17 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 	    reloading = TRUE;
 #endif
 	    ForcingNoCache = YES;
-            if (TRACE) {
-	        fprintf(stderr, "HTAccess: Auto-reloading document.\n");
+	    if (TRACE) {
+		fprintf(stderr, "HTAccess: Auto-reloading document.\n");
 	    }
 	}
     }
 
     /*
-    **  Get the document from the net.  If we are auto-reloading,
-    **  the mutable anchor elements from the previous rendition
-    **  should be freed in conjunction with loading of the new
-    **  rendition. - FM
+    **	Get the document from the net.	If we are auto-reloading,
+    **	the mutable anchor elements from the previous rendition
+    **	should be freed in conjunction with loading of the new
+    **	rendition. - FM
     */
     LYforce_no_cache = NO;  /* reset after each time through */
     if (ForcingNoCache) {
@@ -863,9 +863,9 @@ PRIVATE BOOL HTLoadDocument ARGS4(
     if (TRACE) {
 	fprintf(stderr, "HTAccess:  status=%d\n", status);
     }
-    
+
     /*
-    **  Log the access if necessary.
+    **	Log the access if necessary.
     */
     if (HTlogfile) {
 	time_t theTime;
@@ -883,12 +883,12 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 		    status < 0 ? "FAIL" : "GET",
 		    full_address);
     }
-    
+
     /*
-    **  Check out what we received from the net.
+    **	Check out what we received from the net.
     */
     if (status == HT_REDIRECTING) {
-        /*  Exported from HTMIME.c, of all places. *//** NO!! - FM **/
+	/*  Exported from HTMIME.c, of all places. *//** NO!! - FM **/
 	/*
 	**  Doing this via HTMIME.c meant that the redirection cover
 	**  page was already loaded before we learned that we want a
@@ -906,32 +906,32 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 	**  in LYGetFile.c when the status is HT_REDIRECTING.  This may
 	**  seem bizarre, but it works like a charm! - FM
 	*/
-        if (TRACE) {
-            fprintf(stderr, "HTAccess: '%s' is a redirection URL.\n",
+	if (TRACE) {
+	    fprintf(stderr, "HTAccess: '%s' is a redirection URL.\n",
 			    address_to_load);
-            fprintf(stderr, "HTAccess: Redirecting to '%s'\n",
+	    fprintf(stderr, "HTAccess: Redirecting to '%s'\n",
 			     redirecting_url);
-        }
+	}
 	/*
-	**  Prevent circular references. 
+	**  Prevent circular references.
 	*/
 	if (strcmp(address_to_load, redirecting_url)) { /* if different */
 	    /*
-	    **  Load token and redirecting url into anchor->physical
-	    **  if we had 301 Permanent redirection.  HTTP.c does not
-	    **  allow this if we have POST content. - FM
+	    **	Load token and redirecting url into anchor->physical
+	    **	if we had 301 Permanent redirection.  HTTP.c does not
+	    **	allow this if we have POST content. - FM
 	    */
 	    if (permanent_redirection) {
-	        StrAllocCopy(anchor->physical, "Location=");
-	        StrAllocCat(anchor->physical, redirecting_url);
+		StrAllocCopy(anchor->physical, "Location=");
+		StrAllocCat(anchor->physical, redirecting_url);
 	    }
 
-            /*
-	    **  Set up flags before return to getfile. - FM
+	    /*
+	    **	Set up flags before return to getfile. - FM
 	    */
-            StrAllocCopy(use_this_url_instead, redirecting_url);
+	    StrAllocCopy(use_this_url_instead, redirecting_url);
 	    if (ForcingNoCache)
-	        LYforce_no_cache = YES;
+		LYforce_no_cache = YES;
 	    ++redirection_attempts;
 	    FREE(redirecting_url);
 	    permanent_redirection = FALSE;
@@ -944,7 +944,7 @@ PRIVATE BOOL HTLoadDocument ARGS4(
     }
 
     /*
-    **  We did not receive a redirecting URL. - FM
+    **	We did not receive a redirecting URL. - FM
     */
     redirection_attempts = 0;
     FREE(redirecting_url);
@@ -968,25 +968,25 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 
     if (status == HT_NO_DATA) {
 	if (TRACE) {
-	    fprintf(stderr, 
+	    fprintf(stderr,
 	    "HTAccess: `%s' has been accessed, No data left.\n",
 	    full_address);
 	}
 	return NO;
     }
-    
+
     if (status == HT_NOT_LOADED) {
 	if (TRACE) {
-	    fprintf(stderr, 
+	    fprintf(stderr,
 	    "HTAccess: `%s' has been accessed, No data loaded.\n",
 	    full_address);
 	}
 	return NO;
     }
-    
+
     if (status == HT_INTERRUPTED) {
 	if (TRACE) {
-	    fprintf(stderr, 
+	    fprintf(stderr,
 	    "HTAccess: `%s' has been accessed, transfer interrupted.\n",
 	    full_address);
 	}
@@ -1001,15 +1001,15 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 	StrAllocCat(temp, "'");
 	_HTProgress(temp);
 	FREE(temp);
-	if (TRACE) fprintf(stderr, 
+	if (TRACE) fprintf(stderr,
 		"HTAccess: Can't access `%s'\n", full_address);
 	HTLoadError(sink, 500, "Unable to access document.");
 	return NO;
     }
- 
+
     /*
-    **  If you get this, then please find which routine is returning
-    **  a positive unrecognised error code!
+    **	If you get this, then please find which routine is returning
+    **	a positive unrecognised error code!
     */
     fprintf(stderr,
  "**** HTAccess: socket or file number returned by obsolete load routine!\n");
@@ -1024,12 +1024,12 @@ PRIVATE BOOL HTLoadDocument ARGS4(
 **	-----------------------------------
 **
 **  On Entry,
-**        addr     The absolute address of the document to be accessed.
-**        filter   if YES, treat document as HTML
+**	  addr	   The absolute address of the document to be accessed.
+**	  filter   if YES, treat document as HTML
 **
 **  On Exit,
-**        returns    YES     Success in opening document
-**                   NO      Failure 
+**	  returns    YES     Success in opening document
+**		     NO      Failure
 */
 PUBLIC BOOL HTLoadAbsolute ARGS1(
 	CONST DocAddress *,	docaddr)
@@ -1045,17 +1045,17 @@ PUBLIC BOOL HTLoadAbsolute ARGS1(
 **	---------------------------------------------
 **
 **  On Entry,
-**        addr     The absolute address of the document to be accessed.
-**        sink     if non-NULL, send data down this stream
+**	  addr	   The absolute address of the document to be accessed.
+**	  sink	   if non-NULL, send data down this stream
 **
 **  On Exit,
-**        returns    YES     Success in opening document
-**                   NO      Failure 
+**	  returns    YES     Success in opening document
+**		     NO      Failure
 */
 PUBLIC BOOL HTLoadToStream ARGS3(
 	CONST char *,	addr,
-	BOOL, 		filter,
-	HTStream *, 	sink)
+	BOOL,		filter,
+	HTStream *,	sink)
 {
     return HTLoadDocument(addr,
 			  HTAnchor_parent(HTAnchor_findAddress(addr)),
@@ -1068,12 +1068,12 @@ PUBLIC BOOL HTLoadToStream ARGS3(
 **	-----------------------------------
 **
 **  On Entry,
-**        relative_name     The relative address of the document
-**	  		    to be accessed.
+**	  relative_name     The relative address of the document
+**			    to be accessed.
 **
 **  On Exit,
-**        returns    YES     Success in opening document
-**                   NO      Failure 
+**	  returns    YES     Success in opening document
+**		     NO      Failure
 */
 PUBLIC BOOL HTLoadRelative ARGS2(
 	CONST char *,		relative_name,
@@ -1096,14 +1096,14 @@ PUBLIC BOOL HTLoadRelative ARGS2(
 
     stripped = HTStrip(mycopy);
     full_address.address =
-    		HTParse(stripped,
+		HTParse(stripped,
 			current_address,
 			PARSE_ACCESS|PARSE_HOST|PARSE_PATH|PARSE_PUNCTUATION);
     result = HTLoadAbsolute(&full_address);
     /*
-    **  If we got redirection, result will be NO, but use_this_url_instead
-    **  will be set.  The calling routine should check both and do whatever
-    **  is appropriate. - FM
+    **	If we got redirection, result will be NO, but use_this_url_instead
+    **	will be set.  The calling routine should check both and do whatever
+    **	is appropriate. - FM
     */
     FREE(full_address.address);
     FREE(current_address);
@@ -1115,11 +1115,11 @@ PUBLIC BOOL HTLoadRelative ARGS2(
 **	----------------------------------------
 **
 **  On Entry,
-**        destination      	    The child or parenet anchor to be loaded.
+**	  destination		    The child or parenet anchor to be loaded.
 **
 **  On Exit,
-**        returns    YES     Success
-**                   NO      Failure 
+**	  returns    YES     Success
+**		     NO      Failure
 */
 PUBLIC BOOL HTLoadAnchor ARGS1(
 	HTAnchor *,	destination)
@@ -1127,14 +1127,14 @@ PUBLIC BOOL HTLoadAnchor ARGS1(
     HTParentAnchor * parent;
     BOOL loaded = NO;
     if (!destination)
-        return NO;	/* No link */
-    
+	return NO;	/* No link */
+
     parent = HTAnchor_parent(destination);
-    
+
     if (HTAnchor_document(parent) == NULL) {	/* If not alread loaded */
-    						/* TBL 921202 */
-        BOOL result;
-        char * address = HTAnchor_address((HTAnchor*) parent);
+						/* TBL 921202 */
+	BOOL result;
+	char * address = HTAnchor_address((HTAnchor*) parent);
 
 	result = HTLoadDocument(address,
 				parent,
@@ -1145,23 +1145,23 @@ PUBLIC BOOL HTLoadAnchor ARGS1(
 	if (!result) return NO;
 	loaded = YES;
     }
-    
+
     {
 	HText *text = (HText*)HTAnchor_document(parent);
 
 	if (destination != (HTAnchor *)parent) {  /* If child anchor */
-	    HText_selectAnchor(text, 		  /* Double display? @@ */
+	    HText_selectAnchor(text,		  /* Double display? @@ */
 			       (HTChildAnchor*)destination);
 	} else {
 	    if (!loaded)
-	        HText_select(text);
+		HText_select(text);
 	}
     }
     return YES;
-	
+
 } /* HTLoadAnchor */
 
-/*	Search.						HTSearch()
+/*	Search. 					HTSearch()
 **	-------
 **
 **	Performs a keyword search on word given by the user.  Adds the
@@ -1169,7 +1169,7 @@ PUBLIC BOOL HTLoadAnchor ARGS1(
 **	the new address.
 **
 **  On Entry,
-**       *keywords  	space-separated keyword list or similar search list
+**	 *keywords	space-separated keyword list or similar search list
 **	here		is anchor search is to be done on.
 */
 PRIVATE char hex ARGS1(
@@ -1180,8 +1180,8 @@ PRIVATE char hex ARGS1(
 }
 
 PUBLIC BOOL HTSearch ARGS2(
-	CONST char *, 		keywords,
-	HTParentAnchor *, 	here)
+	CONST char *,		keywords,
+	HTParentAnchor *,	here)
 {
 #define acceptable \
 "1234567890abcdefghijlkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-_"
@@ -1193,29 +1193,29 @@ PUBLIC BOOL HTSearch ARGS2(
     char * escaped = (char *)calloc(1, ((strlen(keywords)*3) + 1));
     static CONST BOOL isAcceptable[96] =
 
-    /*   0 1 2 3 4 5 6 7 8 9 A B C D E F */
-    {    0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,	/* 2x   !"#$%&'()*+,-./	 */
-         1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,	/* 3x  0123456789:;<=>?	 */
+    /*	 0 1 2 3 4 5 6 7 8 9 A B C D E F */
+    {	 0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,	/* 2x	!"#$%&'()*+,-./  */
+	 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,	/* 3x  0123456789:;<=>?  */
 	 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,	/* 4x  @ABCDEFGHIJKLMNO  */
-	 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,	/* 5X  PQRSTUVWXYZ[\]^_	 */
-	 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,	/* 6x  `abcdefghijklmno	 */
+	 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,	/* 5X  PQRSTUVWXYZ[\]^_  */
+	 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,	/* 6x  `abcdefghijklmno  */
 	 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0 };	/* 7X  pqrstuvwxyz{\}~	DEL */
 
     if (escaped == NULL)
-        outofmem(__FILE__, "HTSearch");
-    
+	outofmem(__FILE__, "HTSearch");
+
     StrAllocCopy(address, here->isIndexAction);
 
     /*
-    **  Convert spaces to + and hex escape unacceptable characters.
+    **	Convert spaces to + and hex escape unacceptable characters.
     */
     for (s = keywords; *s && WHITE(*s); s++)		 /* Scan */
-        ;	/* Skip white space */
+	;	/* Skip white space */
     for (e = s + strlen(s); e > s && WHITE(*(e-1)); e--) /* Scan */
-        ;	/* Skip trailers */
+	;	/* Skip trailers */
     for (q = escaped, p = s; p < e; p++) {	/* Scan stripped field */
-        unsigned char c = (unsigned char)TOASCII(*p);
-        if (WHITE(*p)) {
+	unsigned char c = (unsigned char)TOASCII(*p);
+	if (WHITE(*p)) {
 	    *q++ = '+';
 	} else if (HTCJK != NOCJK) {
 	    *q++ = *p;
@@ -1230,26 +1230,26 @@ PUBLIC BOOL HTSearch ARGS2(
     *q = '\0';			/* Terminate escaped string */
     u = strchr(address, '?');	/* Find old search string */
     if (u != NULL)
-        *u = '\0';		/* Chop old search off */
+	*u = '\0';		/* Chop old search off */
 
     StrAllocCat(address, "?");
     StrAllocCat(address, escaped);
     FREE(escaped);
     result = HTLoadRelative(address, here);
     FREE(address);
-    
+
     /*
-    **  If we got redirection, result will be NO, but use_this_url_instead
-    **  will be set.  The calling routine should check both and do whatever
-    **  is appropriate.  Only an http server (not a gopher or wais server)
-    **  could return redirection.  Lynx will go all the way back to its
-    **  mainloop() and subject a redirecting URL to all of its security and
-    **  restrictions checks. - FM
+    **	If we got redirection, result will be NO, but use_this_url_instead
+    **	will be set.  The calling routine should check both and do whatever
+    **	is appropriate.  Only an http server (not a gopher or wais server)
+    **	could return redirection.  Lynx will go all the way back to its
+    **	mainloop() and subject a redirecting URL to all of its security and
+    **	restrictions checks. - FM
     */
     return result;
 }
 
-/*	Search Given Indexname.			HTSearchAbsolute()
+/*	Search Given Indexname. 		HTSearchAbsolute()
 **	-----------------------
 **
 **	Performs a keyword search on word given by the user.  Adds the
@@ -1257,12 +1257,12 @@ PUBLIC BOOL HTSearch ARGS2(
 **	the new address.
 **
 **  On Entry,
-**       *keywords  	space-separated keyword list or similar search list
-**	*addres		is name of object search is to be done on.
+**	 *keywords	space-separated keyword list or similar search list
+**	*addres 	is name of object search is to be done on.
 */
 PUBLIC BOOL HTSearchAbsolute ARGS2(
-	CONST char *, 	keywords,
-	CONST char *, 	indexname)
+	CONST char *,	keywords,
+	CONST char *,	indexname)
 {
     DocAddress abs_doc;
     HTParentAnchor * anchor;
@@ -1298,23 +1298,23 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS
     char * home = (char *)getenv(LOGICAL_DEFAULT);
     char * ref;
     HTParentAnchor * anchor;
-    
+
     if (home) {
-        StrAllocCopy(my_home_document, home);
+	StrAllocCopy(my_home_document, home);
 #define MAX_FILE_NAME 1024			/* @@@ */
     } else if (HTClientHost) {			/* Telnet server */
-	/* 
+	/*
 	**  Someone telnets in, they get a special home.
 	*/
-    	FILE * fp = fopen(REMOTE_POINTER, "r");
+	FILE * fp = fopen(REMOTE_POINTER, "r");
 	char * status;
 	if (fp) {
 	    my_home_document = (char*)calloc(1, MAX_FILE_NAME);
 	    if (my_home_document == NULL)
-	        outofmem(__FILE__, "HTHomeAnchor");
+		outofmem(__FILE__, "HTHomeAnchor");
 	    status = fgets(my_home_document, MAX_FILE_NAME, fp);
 	    if (!status) {
-	        FREE(my_home_document);
+		FREE(my_home_document);
 	    }
 	    fclose(fp);
 	}
@@ -1326,15 +1326,15 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS
     if (my_home_document == NULL) {
 	FILE * fp = NULL;
 	CONST char * home =  (CONST char*)getenv("HOME");
-	if (home != null) { 
+	if (home != null) {
 	    my_home_document = (char *)calloc(1,
 		(strlen(home) + 1 + strlen(PERSONAL_DEFAULT) + 1));
 	    if (my_home_document == NULL)
-	        outofmem(__FILE__, "HTAnchorHome");
+		outofmem(__FILE__, "HTAnchorHome");
 	    sprintf(my_home_document, "%s/%s", home, PERSONAL_DEFAULT);
 	    fp = fopen(my_home_document, "r");
 	}
-	
+
 	if (!fp) {
 	    StrAllocCopy(my_home_document, LOCAL_DEFAULT_FILE);
 	    fp = fopen(my_home_document, "r");
@@ -1343,7 +1343,7 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS
 	    fclose(fp);
 	} else {
 	    if (TRACE)
-	        fprintf(stderr,
+		fprintf(stderr,
 			"HTBrowse: No local home document ~/%s or %s\n",
 			PERSONAL_DEFAULT, LOCAL_DEFAULT_FILE);
 	    FREE(my_home_document);
@@ -1351,8 +1351,8 @@ PUBLIC HTParentAnchor * HTHomeAnchor NOARGS
     }
 #endif /* unix */
     ref = HTParse((my_home_document ?
-    		   my_home_document : (HTClientHost ?
-		   		     REMOTE_ADDRESS : LAST_RESORT)),
+		   my_home_document : (HTClientHost ?
+				     REMOTE_ADDRESS : LAST_RESORT)),
 		  "file:",
 		  PARSE_ACCESS|PARSE_HOST|PARSE_PATH|PARSE_PUNCTUATION);
     if (my_home_document) {