cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: [ curl-Bugs-405541 ] problem downloading gifs

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 3 Mar 2001 18:22:26 +0100 (MET)

On Sat, 3 Mar 2001, Erdmut Pfeifer wrote:

[Thanks for a skilled and detailed protocol analysis.]

> for reasons probably best known to the webmaster of that site, the server
> will only deliver content if it gets the "Host:" header without trailing
> port number. Funny, but true.

Funny is the word, indeed. (I just closed the bug report.)

> Netscape for example sends the header "Host: www.e-speak.net" while curl
> sends "Host: www.e-speak.net:80". Although both are equally correct
> generally (as far as I know), the server somehow doesn't like the latter.

Curl _did_ send the host header that way, since I was (silly enough)
following the HTTP 1.1 spec that clearly explains that the port number can be
in that header and it has no clause saying when the port number should not be
there.

But since there obviously are a lot of servers that don't support this (and I
am still puzzled why or even how they make their apaches behave that way) I
had to make curl only send the port numbers when connecting to non-default
ports. I.e not 80 on HTTP or no 443 on HTTPS. Weird but true.

> As a workaround you can force the accepted header format by explicitly
> specifying the header with
>
> curl -H "Host: www.e-speak.net" ...
>
> Don't know whether there is a specific curl option for cases like these
> (i.e. for suppressing the port in the "Host" header), at least I haven't
> seen one in the manpage. Actually, IMHO, one can live without... ;)

As said, the behaviour was inversed. Now (7.4.2 and later), if you do want
the :80 in the host header, you need to set the Host: header yourself like
you show above.

-- 
  Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/
Received on 2001-03-03