mirror of
https://github.com/moparisthebest/curl
synced 2025-01-11 22:18:00 -05:00
parent
197d8aaf6d
commit
f389953da0
@ -99,23 +99,23 @@ static const struct testcase tests[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
UNITTEST_START
|
UNITTEST_START
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
int testnum = sizeof(tests) / sizeof(struct testcase);
|
int testnum = sizeof(tests) / sizeof(struct testcase);
|
||||||
|
struct Curl_multi *multi = NULL;
|
||||||
|
struct Curl_easy *easy = NULL;
|
||||||
|
struct curl_slist *list = NULL;
|
||||||
|
|
||||||
for(i = 0; i < testnum; ++i) {
|
for(i = 0; i < testnum; ++i) {
|
||||||
int j;
|
int j;
|
||||||
int addressnum = sizeof(tests[i].address) / sizeof(*tests[i].address);
|
int addressnum = sizeof(tests[i].address) / sizeof(*tests[i].address);
|
||||||
struct Curl_addrinfo *addr;
|
struct Curl_addrinfo *addr;
|
||||||
struct Curl_dns_entry *dns;
|
struct Curl_dns_entry *dns;
|
||||||
struct curl_slist *list;
|
|
||||||
void *entry_id;
|
void *entry_id;
|
||||||
bool problem = false;
|
bool problem = false;
|
||||||
struct Curl_multi *multi;
|
easy = curl_easy_init();
|
||||||
struct Curl_easy *easy = curl_easy_init();
|
if(!easy)
|
||||||
if(!easy) {
|
goto error;
|
||||||
curl_global_cleanup();
|
|
||||||
return CURLE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create a multi handle and add the easy handle to it so that the
|
/* create a multi handle and add the easy handle to it so that the
|
||||||
hostcache is setup */
|
hostcache is setup */
|
||||||
@ -124,16 +124,14 @@ UNITTEST_START
|
|||||||
|
|
||||||
list = curl_slist_append(NULL, tests[i].optval);
|
list = curl_slist_append(NULL, tests[i].optval);
|
||||||
if(!list)
|
if(!list)
|
||||||
goto unit_test_abort;
|
goto error;
|
||||||
curl_easy_setopt(easy, CURLOPT_RESOLVE, list);
|
curl_easy_setopt(easy, CURLOPT_RESOLVE, list);
|
||||||
|
|
||||||
Curl_loadhostpairs(easy);
|
Curl_loadhostpairs(easy);
|
||||||
|
|
||||||
entry_id = (void *)aprintf("%s:%d", tests[i].host, tests[i].port);
|
entry_id = (void *)aprintf("%s:%d", tests[i].host, tests[i].port);
|
||||||
if(!entry_id) {
|
if(!entry_id)
|
||||||
curl_slist_free_all(list);
|
goto error;
|
||||||
goto unit_test_abort;
|
|
||||||
}
|
|
||||||
dns = Curl_hash_pick(easy->dns.hostcache, entry_id, strlen(entry_id) + 1);
|
dns = Curl_hash_pick(easy->dns.hostcache, entry_id, strlen(entry_id) + 1);
|
||||||
free(entry_id);
|
free(entry_id);
|
||||||
entry_id = NULL;
|
entry_id = NULL;
|
||||||
@ -202,12 +200,20 @@ UNITTEST_START
|
|||||||
}
|
}
|
||||||
|
|
||||||
curl_easy_cleanup(easy);
|
curl_easy_cleanup(easy);
|
||||||
|
easy = NULL;
|
||||||
curl_multi_cleanup(multi);
|
curl_multi_cleanup(multi);
|
||||||
|
multi = NULL;
|
||||||
curl_slist_free_all(list);
|
curl_slist_free_all(list);
|
||||||
|
list = NULL;
|
||||||
|
|
||||||
if(problem) {
|
if(problem) {
|
||||||
unitfail++;
|
unitfail++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
error:
|
||||||
|
curl_easy_cleanup(easy);
|
||||||
|
curl_multi_cleanup(multi);
|
||||||
|
curl_slist_free_all(list);
|
||||||
|
}
|
||||||
UNITTEST_STOP
|
UNITTEST_STOP
|
||||||
|
Loading…
Reference in New Issue
Block a user