curl-users
Re: -H 'Host: foo'
Date: Thu, 8 Feb 2001 10:47:07 -0500
Thanks for the response. It appears to work 100% correctly with
curl 7.6. Now that I look back at the packet sniff I did, I think I didn't
capture enough data per packet and the second 'Host:' header got cut off...
Thanks again,
Jon
On Thu, Feb 08, 2001 at 08:29:10AM +0100, Daniel Stenberg wrote:
> 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/
>
-- Jonathan Landis Akamai Technologies Service Delivery Engineer, (617) 250-4649 jlandis_at_akamai.comReceived on 2001-02-08