mirror of
https://github.com/curl/curl.git
synced 2026-08-03 17:20:29 +03:00
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:
parent
ebc0550110
commit
f73de32d46
9 changed files with 35 additions and 119 deletions
|
|
@ -31,12 +31,8 @@ bool getaddressinfo(struct sockaddr *sa, char *addr, long *port);
|
|||
|
||||
#include "memdebug.h" /* LAST include file */
|
||||
|
||||
static struct Curl_easy *easy;
|
||||
static struct curl_hash *hostcache;
|
||||
|
||||
static void unit_stop(void)
|
||||
{
|
||||
curl_easy_cleanup(easy);
|
||||
curl_global_cleanup();
|
||||
}
|
||||
|
||||
|
|
@ -46,18 +42,6 @@ static CURLcode unit_setup(void)
|
|||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy = curl_easy_init();
|
||||
if(!easy) {
|
||||
curl_global_cleanup();
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
hostcache = Curl_global_host_cache_init();
|
||||
if(!hostcache) {
|
||||
unit_stop();
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +106,7 @@ UNITTEST_START
|
|||
int i;
|
||||
int testnum = sizeof(tests) / sizeof(struct testcase);
|
||||
|
||||
for(i = 0; i < testnum; ++i, curl_easy_reset(easy)) {
|
||||
for(i = 0; i < testnum; ++i) {
|
||||
int j;
|
||||
int addressnum = sizeof(tests[i].address) / sizeof(*tests[i].address);
|
||||
struct Curl_addrinfo *addr;
|
||||
|
|
@ -130,10 +114,17 @@ UNITTEST_START
|
|||
struct curl_slist *list;
|
||||
void *entry_id;
|
||||
bool problem = false;
|
||||
struct Curl_multi *multi;
|
||||
struct Curl_easy *easy = curl_easy_init();
|
||||
if(!easy) {
|
||||
curl_global_cleanup();
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
Curl_hostcache_clean(easy, hostcache);
|
||||
easy->dns.hostcache = hostcache;
|
||||
easy->dns.hostcachetype = HCACHE_GLOBAL;
|
||||
/* create a multi handle and add the easy handle to it so that the
|
||||
hostcache is setup */
|
||||
multi = curl_multi_init();
|
||||
curl_multi_add_handle(multi, easy);
|
||||
|
||||
list = curl_slist_append(NULL, tests[i].optval);
|
||||
if(!list)
|
||||
|
|
@ -214,7 +205,8 @@ UNITTEST_START
|
|||
addr = addr->ai_next;
|
||||
}
|
||||
|
||||
Curl_hostcache_clean(easy, easy->dns.hostcache);
|
||||
curl_easy_cleanup(easy);
|
||||
curl_multi_cleanup(multi);
|
||||
curl_slist_free_all(list);
|
||||
|
||||
if(problem) {
|
||||
|
|
|
|||
|
|
@ -31,12 +31,8 @@ bool getaddressinfo(struct sockaddr *sa, char *addr, long *port);
|
|||
|
||||
#include "memdebug.h" /* LAST include file */
|
||||
|
||||
static struct Curl_easy *easy;
|
||||
static struct curl_hash *hostcache;
|
||||
|
||||
static void unit_stop(void)
|
||||
{
|
||||
curl_easy_cleanup(easy);
|
||||
curl_global_cleanup();
|
||||
}
|
||||
|
||||
|
|
@ -46,18 +42,6 @@ static CURLcode unit_setup(void)
|
|||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
easy = curl_easy_init();
|
||||
if(!easy) {
|
||||
curl_global_cleanup();
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
hostcache = Curl_global_host_cache_init();
|
||||
if(!hostcache) {
|
||||
unit_stop();
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -117,17 +101,15 @@ static const struct testcase tests[] = {
|
|||
};
|
||||
|
||||
UNITTEST_START
|
||||
{
|
||||
int i;
|
||||
int testnum = sizeof(tests) / sizeof(struct testcase);
|
||||
|
||||
/* important: we setup cache outside of the loop
|
||||
and also clean cache after the loop. In contrast,for example,
|
||||
test 1607 sets up and cleans cache on each iteration. */
|
||||
Curl_hostcache_clean(easy, hostcache);
|
||||
easy->dns.hostcache = hostcache;
|
||||
easy->dns.hostcachetype = HCACHE_GLOBAL;
|
||||
|
||||
for(i = 0; i < testnum; ++i, curl_easy_reset(easy)) {
|
||||
for(i = 0; i < testnum; ++i) {
|
||||
int j;
|
||||
int addressnum = sizeof (tests[i].address) / sizeof (*tests[i].address);
|
||||
struct Curl_addrinfo *addr;
|
||||
|
|
@ -135,6 +117,16 @@ UNITTEST_START
|
|||
struct curl_slist *list;
|
||||
void *entry_id;
|
||||
bool problem = false;
|
||||
struct Curl_multi *multi;
|
||||
struct Curl_easy *easy = curl_easy_init();
|
||||
if(!easy) {
|
||||
curl_global_cleanup();
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
/* create a multi handle and add the easy handle to it so that the
|
||||
hostcache is setup */
|
||||
multi = curl_multi_init();
|
||||
curl_multi_add_handle(multi, easy);
|
||||
|
||||
list = curl_slist_append(NULL, tests[i].optval);
|
||||
if(!list)
|
||||
|
|
@ -205,6 +197,9 @@ UNITTEST_START
|
|||
addr = addr->ai_next;
|
||||
}
|
||||
|
||||
curl_easy_cleanup(easy);
|
||||
Curl_hash_destroy(&multi->hostcache);
|
||||
curl_multi_cleanup(multi);
|
||||
curl_slist_free_all(list);
|
||||
|
||||
if(problem) {
|
||||
|
|
@ -212,7 +207,5 @@ UNITTEST_START
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Curl_hostcache_clean(easy, easy->dns.hostcache);
|
||||
|
||||
}
|
||||
UNITTEST_STOP
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue