cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: DNS caching - a documentation/implementation mismatch?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 9 Feb 2006 12:53:02 +0100 (CET)

On Thu, 9 Feb 2006, Shmulik Regev wrote:

> The libcurl documentation says that setting CURLOPT_DNS_CACHE_TIMEOUT to
> zero disables caching completely. However my experience (and debugging)
> shows that this is not entirely accurate (version 7.15.1) at least not when
> the multi interface is used with a persistent connection cache. In
> Curl_resolv, the hostcache is checked (hostip.c:400) for the existence of an
> entry, and on hostip.c:444 an entry is added to the cache after a successful
> resolve. The timestamp is not checked until Curl_disconnect is called which
> in turn prunes the cache (url.c:1486) .
>
> Maybe it is just me, but after reading the documentation I expected no DNS
> caching once CURLOPT_DNS_CACHE_TIMEOUT is set to zero. Or maybe it is an
> implementation bug? Anyway I suggest that something will be changed either
> the documentation or the implementation.

Right. The DNS caching worked slightly different at the time that wording was
added to the manual and it (the manual) has remained like that even though the
code has been altered slightly since.

The truth is that even when you "disable" the DNS cache like this, the entry
that gets resolved will exist in the cache during the lifetime of the actual
request. This way we can always point to existing cache entries when we want
DNS info within libcurl. I made it so for simplicity.

I'll welcome a patch for the docs if you can think of a way to translate this
into manual-friendly phrasing.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-02-09