cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: DNS caching ?

From: Anindya Sinha <as_vxml_at_yahoo.com>
Date: Wed, 28 Sep 2005 16:54:47 -0700 (PDT)

Thanks for the information. I have one more
clarification.
Since the cache entry is added after lookup (and
before successful fetch), what happens if the fetch
fails ? Is the entry removed so that subsequent fetch
requests do not use the "failed" IP address ?

Thanks
Anindya

--- Daniel Stenberg <daniel-curl_at_haxx.se> wrote:

> On Tue, 27 Sep 2005, Anindya Sinha wrote:
>
> > Just wanted to check if libcurl supports DNS
> caching on an existing curl
> > handle.
>
> That's exactly the kind of DNS caching libcurl
> supports!
>
> > If I create a curl handle (via curl_easy_init ())
> and use it to fetch from
> > say, host.webserver.com. Say this has 2 DNS
> entries ip1 and ip2. I know curl
> > does a DNS lookup and selects one of the 2 ip
> addresses and tries to fetch
> > the content; if it fails, it tries the next ip
> address and so on till all ip
> > addresses are tried.
>
> Yes, but the whole name resolve chunk is kept in the
> DNS cache. Including all
> the IP addresses.
>
> > If the content is fetched successfully, does it
> cache this entry on that
> > curl handle ?
>
> It caches the DNS resolve after a successful lookup.
> The transfer mail fail
> later on, but the entry may be cached anyway.
>
> > if I were to request libcurl to fetch another
> document (after 1st
> > successful fetch) from the same
> host.webserver.com, does it use the ip
> > address it used before for the 1st fetch?
>
> First it will attempt to re-use the previous
> connection.
>
> Failing that, it will re-use the previously resolved
> address(es). In the same
> order as before even (which has been debated before
> and should be fixed so
> that the order is modified on repeated uses to
> better work with hosts
> resolving to multiple IPs).
>
> I hope this answers your questions. Ask more if not!
>
> --
> Commercial curl and libcurl Technical Support:
> http://haxx.se/curl.html
>

                
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
Received on 2005-09-29