CURLOPT_DNS_USE_GLOBAL_CACHE: remove

Remove the code too. The functionality has been disabled in code since
7.62.0. Setting this option will from now on simply be ignored and have
no function.

Closes #3654
This commit is contained in:
Daniel Stenberg 2019-03-07 15:39:43 +01:00
parent ebc0550110
commit f73de32d46
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
9 changed files with 35 additions and 119 deletions

View file

@ -265,7 +265,6 @@ void curl_global_cleanup(void)
if(--initialized)
return;
Curl_global_host_cache_dtor();
Curl_ssl_cleanup();
Curl_resolver_global_cleanup();

View file

@ -114,42 +114,8 @@
* CURLRES_* defines based on the config*.h and curl_setup.h defines.
*/
/* These two symbols are for the global DNS cache */
static struct curl_hash hostname_cache;
static int host_cache_initialized;
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 a struct curl_hash pointer on success, NULL on failure.
*/
struct curl_hash *Curl_global_host_cache_init(void)
{
int rc = 0;
if(!host_cache_initialized) {
rc = Curl_hash_init(&hostname_cache, 7, Curl_hash_str,
Curl_str_key_compare, freednsentry);
if(!rc)
host_cache_initialized = 1;
}
return rc?NULL:&hostname_cache;
}
/*
* Destroy and cleanup the global DNS cache
*/
void Curl_global_host_cache_dtor(void)
{
if(host_cache_initialized) {
Curl_hash_destroy(&hostname_cache);
host_cache_initialized = 0;
}
}
/*
* Return # of addresses in a Curl_addrinfo struct
*/

View file

@ -402,19 +402,9 @@ CURLMcode curl_multi_add_handle(struct Curl_multi *multi,
/* set the easy handle */
multistate(data, CURLM_STATE_INIT);
if((data->set.global_dns_cache) &&
(data->dns.hostcachetype != HCACHE_GLOBAL)) {
/* global dns cache was requested but still isn't */
struct curl_hash *global = Curl_global_host_cache_init();
if(global) {
/* only do this if the global cache init works */
data->dns.hostcache = global;
data->dns.hostcachetype = HCACHE_GLOBAL;
}
}
/* for multi interface connections, we share DNS cache automatically if the
easy handle's one is currently not set. */
else if(!data->dns.hostcache ||
if(!data->dns.hostcache ||
(data->dns.hostcachetype == HCACHE_NONE)) {
data->dns.hostcache = &multi->hostcache;
data->dns.hostcachetype = HCACHE_MULTI;

View file

@ -128,11 +128,7 @@ static CURLcode vsetopt(struct Curl_easy *data, CURLoption option,
data->set.dns_cache_timeout = arg;
break;
case CURLOPT_DNS_USE_GLOBAL_CACHE:
#if 0 /* deprecated */
/* remember we want this enabled */
arg = va_arg(param, long);
data->set.global_dns_cache = (0 != arg) ? TRUE : FALSE;
#endif
/* deprecated */
break;
case CURLOPT_SSL_CIPHER_LIST:
/* set a list of cipher we want to use in the SSL connection */

View file

@ -1691,7 +1691,6 @@ struct UserDefined {
bit ftp_use_pret:1; /* if PRET is to be used before PASV or not */
bit no_signal:1; /* do not use any signal/alarm handler */
bit global_dns_cache:1; /* subject for future removal */
bit tcp_nodelay:1; /* whether to enable TCP_NODELAY or not */
bit ignorecl:1; /* ignore content length */
bit ftp_skip_ip:1; /* skip the IP address the FTP server passes on to
@ -1732,7 +1731,6 @@ struct Names {
struct curl_hash *hostcache;
enum {
HCACHE_NONE, /* not pointing to anything */
HCACHE_GLOBAL, /* points to the (shrug) global one */
HCACHE_MULTI, /* points to a shared one in the multi handle */
HCACHE_SHARED /* points to a shared one in a shared object */
} hostcachetype;