curl-library
Re: Asynch DNS
Date: Mon, 17 Mar 2003 16:50:44 -0500
Hi,
It's actually a little funny that this whole thread of asynch DNS came
up today. Coincidentally, I was just tracking down some odd cases in how
I was using curl. I do my own DNS lookups and rewrite the url as explained
by codemastr:
> > I looked through the docs, I didn't see anything that allowed me to handle
> > a DNS lookup, so what I thought of was, if I pass a URL in the form of say
> > http://127.0.0.1/file.html will libcurl still attempt any kind of DNS
> > lookup?
to which Daniel Stenberg responded:
> Nope. But you need to make sure to pass in a Host: header that is fine in
> case you intend to play HTTP.
The only catch with this plan is that you cannot then allow FOLLOWLOCATION.
For example, http://cnn.com/ is redirected to http://www.cnn.com/. If I do:
curl --location --max-redirs 2 -D - --header 'Host: cnn.com' 'http://64.236.24.4/'
It will redirect itself continually (until the max is reached, of course),
because the new request will be identical: the same IP and the same host
field. This is with 7.10.3 on a redhat 7.2 linux box. I would have
expected (or at least I hoped) that the location would override the
host header field, instead of preserving it.
Is this a bug? It seems like buggy behaviour to me, but it could also
be the intended behaviour. If you don't think it's a bug, it might be
a good idea to add a note or two to the documentation saying that adding
Host header fields and using FOLLOWLOCATION are potentially incompatible.
Cheers,
Chris.
-- Christopher R. Palmer palmer_at_vivisimo.com Chief Technology Officer www.vivisimo.com Vivisimo, Inc. 412-422-2499 ------------------------------------------------------- This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031enReceived on 2003-03-18