aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES6
-rw-r--r--docs/TODO7
-rw-r--r--lib/hostip.c15
-rw-r--r--lib/hostip.h14
-rw-r--r--lib/url.c16
-rw-r--r--lib/urldata.h1
6 files changed, 42 insertions, 17 deletions
diff --git a/CHANGES b/CHANGES
index 560f1791b..ffbfdcf8d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,12 @@
Changelog
+Daniel S (15 Jan 2008)
+- I made the torture test on test 530 go through. This was actually due to
+ silly code left from when we switched to let the multi handle "hold" the dns
+ cache when using the multi interface... Of course this only triggered when a
+ certain function call returned error at the correct moment.
+
Daniel S (14 Jan 2008)
- Joe Malicki filed bug report #1871269
(http://curl.haxx.se/bug/view.cgi?id=1871269) and we could fix his hang-
diff --git a/docs/TODO b/docs/TODO
index 17aedb620..e5a3df6a3 100644
--- a/docs/TODO
+++ b/docs/TODO
@@ -103,6 +103,7 @@
15.3 size_t
15.4 remove several functions
15.5 remove CURLOPT_FAILONERROR
+ 15.6 remove CURLOPT_DNS_USE_GLOBAL_CACHE
==============================================================================
@@ -563,3 +564,9 @@ to provide the data to send.
Remove support for CURLOPT_FAILONERROR, it has gotten too kludgy and weird
internally. Let the app judge success or not for itself.
+
+15.6 remove CURLOPT_DNS_USE_GLOBAL_CACHE
+
+ Remove support for a global DNS cache. Anything global is silly, and we
+ already offer the share interface for the same functionality but done
+ "right".
diff --git a/lib/hostip.c b/lib/hostip.c
index 55225480c..aa5ec1e00 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -127,14 +127,19 @@ static void freednsentry(void *freethis);
* Curl_global_host_cache_init() initializes and sets up a global DNS cache.
* Global DNS cache is general badness. Do not use. This will be removed in
* a future version. Use the share interface instead!
+ *
+ * Returns 0 on success, 1 on failure.
*/
-void Curl_global_host_cache_init(void)
+int Curl_global_host_cache_init(void)
{
+ int rc = 0;
if(!host_cache_initialized) {
- Curl_hash_init(&hostname_cache, 7, Curl_hash_str, Curl_str_key_compare,
- freednsentry);
- host_cache_initialized = 1;
+ rc = Curl_hash_init(&hostname_cache, 7, Curl_hash_str,
+ Curl_str_key_compare, freednsentry);
+ if(!rc)
+ host_cache_initialized = 1;
}
+ return rc;
}
/*
diff --git a/lib/hostip.h b/lib/hostip.h
index 53093c169..a7e0988a2 100644
--- a/lib/hostip.h
+++ b/lib/hostip.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -125,11 +125,19 @@ struct hostent;
struct SessionHandle;
struct connectdata;
-void Curl_global_host_cache_init(void);
+/*
+ * Curl_global_host_cache_init() initializes and sets up a global DNS cache.
+ * Global DNS cache is general badness. Do not use. This will be removed in
+ * a future version. Use the share interface instead!
+ *
+ * Returns 0 on success, 1 on failure.
+ */
+int Curl_global_host_cache_init(void);
void Curl_global_host_cache_dtor(void);
struct curl_hash *Curl_global_host_cache_get(void);
-#define Curl_global_host_cache_use(__p) ((__p)->set.global_dns_cache)
+#define Curl_global_host_cache_use(__p) \
+ ((__p)->dns.hostcachetype == HCACHE_GLOBAL)
struct Curl_dns_entry {
Curl_addrinfo *addr;
diff --git a/lib/url.c b/lib/url.c
index a5e4565ad..94c363fc2 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -457,11 +457,8 @@ CURLcode Curl_close(struct SessionHandle *data)
return CURLE_OK;
}
- if( ! (data->share && data->share->hostcache) ) {
- if( !Curl_global_host_cache_use(data)) {
- Curl_hash_destroy(data->dns.hostcache);
- }
- }
+ if(data->dns.hostcachetype == HCACHE_PRIVATE)
+ Curl_hash_destroy(data->dns.hostcache);
if(data->state.rangestringalloc)
free(data->state.range);
@@ -782,10 +779,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
case CURLOPT_DNS_USE_GLOBAL_CACHE:
{
long use_cache = va_arg(param, long);
- if(use_cache)
+ if(use_cache) {
Curl_global_host_cache_init();
-
- data->set.global_dns_cache = (bool)(0 != use_cache);
+ data->dns.hostcachetype = HCACHE_GLOBAL;
+ }
+ else
+ /* not global makes it private by default then */
+ data->dns.hostcachetype = HCACHE_PRIVATE;
}
break;
case CURLOPT_SSL_CIPHER_LIST:
diff --git a/lib/urldata.h b/lib/urldata.h
index e9e4fb872..f3ca2f80d 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1443,7 +1443,6 @@ struct UserDefined {
curl_ftpauth ftpsslauth; /* what AUTH XXX to be attempted */
curl_ftpccc ftp_ccc; /* FTP CCC options */
bool no_signal; /* do not use any signal/alarm handler */
- bool global_dns_cache; /* subject for future removal */
bool tcp_nodelay; /* whether to enable TCP_NODELAY or not */
bool ignorecl; /* ignore content length */
bool ftp_skip_ip; /* skip the IP address the FTP server passes on to