home *** CD-ROM | disk | FTP | other *** search
- From: "Michiel van Loon" <mfvl@xs4all.nl>
- To: <brian@hyperreal.org>
- Subject: RE: mod_proxy/1583: Error in netscapehost.patch
- Date: Wed, 20 May 1998 18:48:28 +0200
-
- Here is the ultra-controversial "host" -> "www.host.com" proxy patch.
- This allows the Apache proxy server to behave the same way Netscape
- does when given incomplete hostname information; i.e., asked to
- look for "ibm" instead of "www.ibm.com".
-
-
- --- proxy_http.c.orig Fri Jan 30 10:14:28 1998
- +++ proxy_http.c Fri Apr 10 21:45:39 1998
- @@ -217,7 +217,34 @@
- {
- server.sin_port = htons(destport);
- err = proxy_host2addr(desthost, &server_hp);
- - if (err != NULL) return proxyerror(r, err); /* give up */
- + if (err != NULL) {
- + char try[HUGE_STRING_LEN];
- + int l, changed=0;
- +
- + if(strncmp(desthost,"www.",4))
- + {
- + strcpy(try,"http://www.");
- + strcat(try,desthost);
- + changed=1;
- + } else
- + strcpy(try,desthost);
- +
- + l = strlen(desthost);
- + if(l<=4 || strncmp(&desthost[l-4],".com",4)) {
- + changed=1;
- + strcat(try,".com");
- + strcat(try,urlptr);
- + }
- +
- + if(changed && !strchr(desthost,'.'))
- + {
- + r->status = 302;
- + table_set(r->headers_out, "Location", try);
- + send_http_header(r);
- + return REDIRECT;
- + }
- + return proxyerror(r, err); /* give up */
- + }
- }
-
- sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
-