cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Global cache possible bug?

From: Jean-Philippe Barrette-LaPierre <jpb_at_rrette.com>
Date: Mon, 6 Jan 2003 12:13:40 -0500

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Le Monday 06 January 2003 01:18, Sterling Hughes a écrit :
> I fixed what I thought you meant, check the commit to see if I was right.
> (you mentioned a different option at the end).
>
> -Sterling
>
> > -----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
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf

your fix is okay, my mistake: copy and paste... what a shame for me.
:)

- --
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+GblIb/24YeGNKWQRAktHAJ9RE8pF9m8pso5ntqPTwykkbgPn1gCfSgvh
M6aFcfcixiBWXFFnJpZ/NNo=
=XLpF
-----END PGP SIGNATURE-----

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