curl-library
Re: can't get curl dns cache to work
Date: Thu, 04 Apr 2002 22:23:22 +1000
Thanks Daniel,
I've been testing the libcurl cache and found the following (I'm using PERL)
-
the default timeout definately is 60 seconds.
the libcurl cache timeout definately does work, but not under certain
circumstances.
eg.. If I repeatedly request 'domain.com' once every 7 seconds and kill the
dns during the process, after 60 seconds the requests will fail (as
expected). However, if I change the page request interval from 7 to 5
seconds, the cache never times out. Originally I was requesting the same
page once every second and the cache would never time out, I changed it to
once every 7 seconds and the timeout started to work. I simply used the
'sleep' command.
As long as the page request intervals were greater than 6 seconds, the cache
timeout would work fine. CURLOPT_DNS_CACHE_TIMEOUT now started to work also.
However, changing the timeout to anything under 20seconds started to give
unreliable results. The values 0 and -1 also worked respectively, however
only if I followed the 7 second rule.
These 7 seconds probably only apply to the environment in which I am
currently working in, however if you repeatedly request a page with no
interval using PERL you should see that the cache never times out.
I have not tested this on multiple domain requests as yet, only the one page
so far.
Very strange.
Thanks.
Regards,
Phillip Stevens
>
>
> > I'm having trouble manipulating the curl dns cache. The cache seems to
>be
> > turned on by default, however it doesn't seem to be timing out by
>default.
> > If I indefinitely request a web page via a perl script and then I kill
>the
> > dns server during the process, the perl script will continue to retrieve
> > the page indefinitely (does not fail after 60 seconds). I let the script
> > run for several minutes, it was still retrieving the page successfully.
> >
> > Neither CURLOPT_DNS_CACHE_TIMEOUT or CURLOPT_DNS_USE_GLOBAL_CACHE seems
>to
> > have any effect. If I change the timeout to 10 seconds nothing changes.
>The
> > cache doesn't time out. I must be doing something wrong.
>
>This sounds as if there's a bug in there or something.
>
>The code to study is the Curl_resolv() function in lib/hostip.c. I'll have
>a
>go myself "soon" if no one else does it.
>
>--
> Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
>
>
>
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
Received on 2002-04-04