cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: -H 'Host: foo'

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 8 Feb 2001 08:29:10 +0100 (MET)

On Wed, 7 Feb 2001, Jonathan H. Landis wrote:

> I don't seem to be able to override the Host: header that curl sets
> automatically. Is there an easy way to do this? I've tried using curl
> -H 'Host: foo' and according to the docs, -H will override the existing
> header.
>
> curl -v -H 'Host: foo' -o /dev/null http://curl.haxx.se/mail/
>
> yields:
>
> * Connected to curl.haxx.se (193.15.23.1)
> > GET /mail HTTP/1.0
> User-Agent: curl/6.0 (i686-pc-linux-gnu) libcurl 6.0 (SSL version 0.9.4)
> Host: curl.haxx.se
> Pragma: no-cache
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
> > Host: foo

That user-agent line explains it all. You're using a version that is more
than 1 year old and may not work like that.

Do upgrade to a modern version and retry that operation.

> Though from a packet sniff, curl hasn't modified the 'Host:' header (or
> added another one...)

As shown above, it did add another one. Your packet sniff obviously only
included the initial packet and not the additional one with the extra Host:
header.

> Is the 'Host:' header a special case? I'd like to use curl as a
> debugging tool, but I need to be able to spoof host headers.

Host: is a special case, but you should be able to replace it anyway.

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