This is the mail archive of the
cygwin-apps@cygwin.com
mailing list for the Cygwin project.
Re: setup.exe and HTTP Host header
- From: "Max Bowsher" <maxb at ukf dot net>
- To: "Abraham Backus" <abraham at backus dot com>,<cygwin-apps at cygwin dot com>
- Date: Wed, 11 Dec 2002 15:22:36 -0000
- Subject: Re: setup.exe and HTTP Host header
- References: <006101c29a9d$4e5a5100$1c00a8c0@xypoint.com>
Been digging through some back email...
Robert: This seems to have been slipped past unnoticed. As it is both
sensible and simple, shall I commit it?
One-liner summary: Don't append :80 to Host HTTP header, as 80 is the
default port.
Max.
#################### Patch Inlined
#############################################
Index: nio-http.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/nio-http.cc,v
retrieving revision 2.13
diff -u -r2.13 nio-http.cc
--- nio-http.cc 29 Apr 2002 11:07:40 -0000 2.13
+++ nio-http.cc 3 Dec 2002 07:08:48 -0000
@@ -113,7 +113,14 @@
s->printf ("GET %s HTTP/1.0\r\n", Purl);
else
s->printf ("GET %s HTTP/1.0\r\n", path);
- s->printf ("Host: %s:%d\r\n", host, port);
+
+ // default HTTP port of 80, Host header can have no port if requested
port
+ // is the same as the default. Some HTTP servers don't behave as
expected
+ // when they receive a Host header with the unnecessary default port
value.
+ if (port == 80)
+ s->printf ("Host: %s\r\n", host);
+ else
+ s->printf ("Host: %s:%d\r\n", host, port);
if (net_user && net_passwd)
s->printf ("Authorization: Basic %s\r\n",
###########################################################################
Abraham Backus <abraham@backus.com> wrote:
> I've discovered that in some cases I'm not getting the response that I
> expect from the HTTP request that setup.exe issues. I believe my
> particular case is probably a misconfiguration of the Apache server
> that hosts my website, but in any case I think it might make the
> setup.exe user experience a little better if, when generating the
> HTTP "Host:" header, that it shouldn't include the (optional) port
> parameter if it is the default port of
> 80.
>
> Here's an example of my problem...
> This is pretty much what setup.exe is sending:
>> telnet abraham.backus.com 80
> GET /setup.ini HTTP/1.0
> Host: abraham.backus.com:80
>
> ...spits back some default stuff from netidentity.com, the company
> that hosts my site...
>
> This is what works with the way the web server is configured:
>> telnet abraham.backus.com 80
> GET /setup.ini HTTP/1.0
> Host: abraham.backus.com
>
> ...spits back the content of my setup.ini...
>
> I've attached a patch for nio-http.cc that should help setup.exe work
> through this problem. I haven't been able to unit test this fix as I
> can't seem to get setup.exe to build. This sounds familiar so I will
> of course search the archives for why I can't get it to build :)
>
> thanks!
> -Abe