cURL / Mailing Lists / curl-library / Single Mail


Global cache possible bug?

From: Jean-Philippe Barrette-LaPierre <>
Date: Sun, 5 Jan 2003 13:07:23 -0500

Hash: SHA1

I was reading some code concerning the glabal cache and I saw something that
maybe lead to a little bug.

When we set CURLOPT_DNS_CACHE_TIMEOUT to a handle it do that:
      int use_cache = va_arg(param, int);
      if (use_cache) {

      data->set.global_dns_cache = use_cache;

and we use global_dns cache only in Curl_global_host_cache_use, this function
is only used just before calling Curl_perform ( for multi_perform it's
different but I think this bug will be here too ) and the code look like

if (!data->hostcache) {
    if (Curl_global_host_cache_use(data)) {
      data->hostcache = Curl_global_host_cache_get();
    else {
      data->hostcache = Curl_hash_alloc(7, Curl_freednsinfo);

it seem okay but In the case of the first time we called perform without the
CURLOPT_DNS_CACHE_TIMEOUT, and we set after the perform the
CURLOPT_DNS_CACHE_TIMEOUT option, It seem that at the beginning of the
perform function the handle will allready have a hostcahe, so it will not set
the global cache and it will not use it in future perform operation.

Am I right?

- --
Jean-Philippe Barrette-LaPierre
Maintener of curlpp: When TRYING(but still in good way) to get the best of C++
Version: GnuPG v1.0.7 (GNU/Linux)


This email is sponsored by:ThinkGeek
Welcome to geek heaven.
Received on 2003-01-05