httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject ApacheWeek is killing me!
Date Fri, 10 Jan 1997 18:41:02 GMT
I've been flooded with complaints about the fact that the 
"ibm" -> "" proxy patch I contributed doesn't patch cleanly
into 1.2b4.  It actually does patch cleanly, but I suspect people are
cutting and pasting it from their browser window and then run patch without
-l.  I'll fix up the patch and add some helpful hints, but I can see this 
being an ongoing and everlasting problem.  I'm tempted to remove my name and
email address from the patch, but that would just mean the messages would 
end up in the bugs mailbox.

I don't have a suggested solution for it.  I agree that the right place for
the patch is in the contrib dir, I just wish there was some way to maintain
the patches in the contrib dir without having to fix them every time someone
adds a line of code somewhere in any of the files that the patches modify.

Anyway, could somebody please replace the netscapehost.patch file in the
contrib directory with the following:

Here is the ultra-controversial "host" -> "" 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 "".

Please download this patch by holding down your shift buttong and clicking
on the link.  If you just copy and paste it from your browser window, you 
will lose whitespace formatting.  You can do this, but then you have to
remember to add the "-l" flag when you run patch.  The -l argument to patch
will tell it to ignore whitespace differences.

In order to install this patch, copy this file to your Apache 
src/modules/proxy directory and type: patch -p1 -l <filename
Then recompile Apache.

*** proxy_http.c.orig	Mon Dec  9 23:16:44 1996
--- proxy_http.c	Fri Jan 10 13:31:15 1997
*** 203,209 ****
  	server.sin_port = htons(destport);
  	err = proxy_host2addr(desthost, &server.sin_addr);
! 	if (err != NULL) return proxyerror(r, err); /* give up */
      sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
--- 203,236 ----
  	server.sin_port = htons(destport);
  	err = proxy_host2addr(desthost, &server.sin_addr);
! 	if (err != NULL) {
! 	        char try[HUGE_STRING_LEN];
! 		int l, changed=0;
! 		if(strncmp(host,"www.",4))
! 		{
! 			strcpy(try,"http://www.");
! 			strcat(try,host);
! 			changed=1;
! 		} else
! 			strcpy(try,host);
! 		l = strlen(host);
! 		if(l<=4 || strncmp(&host[l-4],".com",4)) {
! 			changed=1;
! 			strcat(try,".com");
! 			strcat(try,url);
! 		}
! 		if(changed && !strchr(host,'.'))
! 		{
! 			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);

View raw message