aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSterling Hughes <sterling@bumblebury.com>2003-01-06 06:17:15 +0000
committerSterling Hughes <sterling@bumblebury.com>2003-01-06 06:17:15 +0000
commitcfb32da198dd3917082d40de6d0ad88b431002fb (patch)
treed11be02a7eb37205497fcc172ed096ec085d6b82
parent9b4f92130f74a4efe08c119d7dd41f10a011eb1c (diff)
fix bug (?) :-)
previously, if you called curl_easy_perform and then set the global dns cache, the global cache wouldn't be used. I don't see this really happening in practice, but this code allows you to do it.
-rw-r--r--lib/easy.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/easy.c b/lib/easy.c
index a068604b4..145db5af1 100644
--- a/lib/easy.c
+++ b/lib/easy.c
@@ -233,15 +233,17 @@ CURLcode curl_easy_perform(CURL *curl)
{
struct SessionHandle *data = (struct SessionHandle *)curl;
- 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);
+ if (Curl_global_host_cache_use(data) && data->hostcache != Curl_global_host_cache_get()) {
+ if (data->hostcache) {
+ Curl_hash_destroy(data->hostcache);
}
+ data->hostcache = Curl_global_host_cache_get();
}
+ if (!data->hostcache) {
+ data->hostcache = Curl_hash_alloc(7, Curl_freednsinfo);
+ }
+
return Curl_perform(data);
}