cURL / Mailing Lists / curl-library / Single Mail

curl-library

Global cache possible bug?

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

-----BEGIN PGP SIGNED MESSAGE-----
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) {
        Curl_global_host_cache_init();
      }

      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
this:

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++
(http://www.sourceforge.net/projects/curlpp)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE+GHReb/24YeGNKWQRAoquAJ9TYLtfmgP43Ju4VkkQkdynbSLR7QCfZBeS
/5uI9JMh7PjLknhMr2MzxWk=
=Lnwm
-----END PGP SIGNATURE-----

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-01-05