aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/curl/lib/hostip.c
diff options
context:
space:
mode:
authorAlexander Smirnov <alex@ydb.tech>2024-10-16 12:11:24 +0000
committerAlexander Smirnov <alex@ydb.tech>2024-10-16 12:11:24 +0000
commit40811e93f3fdf9342a9295369994012420fac548 (patch)
treea8d85e094a9c21e10aa250f537c101fc2016a049 /contrib/libs/curl/lib/hostip.c
parent30ebe5357bb143648c6be4d151ecd4944af81ada (diff)
parent28a0c4a9f297064538a018c512cd9bbd00a1a35d (diff)
downloadydb-40811e93f3fdf9342a9295369994012420fac548.tar.gz
Merge branch 'rightlib' into mergelibs-241016-1210
Diffstat (limited to 'contrib/libs/curl/lib/hostip.c')
-rw-r--r--contrib/libs/curl/lib/hostip.c215
1 files changed, 96 insertions, 119 deletions
diff --git a/contrib/libs/curl/lib/hostip.c b/contrib/libs/curl/lib/hostip.c
index 18dea56923..813ea33c2d 100644
--- a/contrib/libs/curl/lib/hostip.c
+++ b/contrib/libs/curl/lib/hostip.c
@@ -84,8 +84,8 @@
* source file are these:
*
* CURLRES_IPV6 - this host has getaddrinfo() and family, and thus we use
- * that. The host may not be able to resolve IPv6, but we do not really have to
- * take that into account. Hosts that are not IPv6-enabled have CURLRES_IPV4
+ * that. The host may not be able to resolve IPv6, but we don't really have to
+ * take that into account. Hosts that aren't IPv6-enabled have CURLRES_IPV4
* defined.
*
* CURLRES_ARES - is defined if libcurl is built to use c-ares for
@@ -115,7 +115,7 @@
* CURLRES_* defines based on the config*.h and curl_setup.h defines.
*/
-static void hostcache_unlink_entry(void *entry);
+static void freednsentry(void *freethis);
#ifndef CURL_DISABLE_VERBOSE_STRINGS
static void show_resolve_info(struct Curl_easy *data,
@@ -144,7 +144,7 @@ void Curl_printable_address(const struct Curl_addrinfo *ai, char *buf,
(void)Curl_inet_ntop(ai->ai_family, (const void *)ipaddr4, buf, bufsize);
break;
}
-#ifdef USE_IPV6
+#ifdef ENABLE_IPV6
case AF_INET6: {
const struct sockaddr_in6 *sa6 = (const void *)ai->ai_addr;
const struct in6_addr *ipaddr6 = &sa6->sin6_addr;
@@ -167,18 +167,23 @@ create_hostcache_id(const char *name,
int port, char *ptr, size_t buflen)
{
size_t len = nlen ? nlen : strlen(name);
+ size_t olen = 0;
DEBUGASSERT(buflen >= MAX_HOSTCACHE_LEN);
if(len > (buflen - 7))
len = buflen - 7;
/* store and lower case the name */
- Curl_strntolower(ptr, name, len);
- return msnprintf(&ptr[len], 7, ":%u", port) + len;
+ while(len--) {
+ *ptr++ = Curl_raw_tolower(*name++);
+ olen++;
+ }
+ olen += msnprintf(ptr, 7, ":%u", port);
+ return olen;
}
struct hostcache_prune_data {
time_t now;
time_t oldest; /* oldest time in cache not pruned. */
- int max_age_sec;
+ int cache_timeout;
};
/*
@@ -189,16 +194,16 @@ struct hostcache_prune_data {
* cache.
*/
static int
-hostcache_entry_is_stale(void *datap, void *hc)
+hostcache_timestamp_remove(void *datap, void *hc)
{
struct hostcache_prune_data *prune =
(struct hostcache_prune_data *) datap;
- struct Curl_dns_entry *dns = (struct Curl_dns_entry *) hc;
+ struct Curl_dns_entry *c = (struct Curl_dns_entry *) hc;
- if(dns->timestamp) {
+ if(c->timestamp) {
/* age in seconds */
- time_t age = prune->now - dns->timestamp;
- if(age >= prune->max_age_sec)
+ time_t age = prune->now - c->timestamp;
+ if(age >= prune->cache_timeout)
return TRUE;
if(age > prune->oldest)
prune->oldest = age;
@@ -216,13 +221,13 @@ hostcache_prune(struct Curl_hash *hostcache, int cache_timeout,
{
struct hostcache_prune_data user;
- user.max_age_sec = cache_timeout;
+ user.cache_timeout = cache_timeout;
user.now = now;
user.oldest = 0;
Curl_hash_clean_with_criterium(hostcache,
(void *) &user,
- hostcache_entry_is_stale);
+ hostcache_timestamp_remove);
return user.oldest;
}
@@ -238,13 +243,13 @@ void Curl_hostcache_prune(struct Curl_easy *data)
int timeout = data->set.dns_cache_timeout;
if(!data->dns.hostcache)
- /* NULL hostcache means we cannot do it */
+ /* NULL hostcache means we can't do it */
return;
if(data->share)
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
- now = time(NULL);
+ time(&now);
do {
/* Remove outdated and unused entries from the hostcache */
@@ -257,8 +262,7 @@ void Curl_hostcache_prune(struct Curl_easy *data)
/* if the cache size is still too big, use the oldest age as new
prune limit */
- } while(timeout &&
- (Curl_hash_count(data->dns.hostcache) > MAX_DNS_CACHE_SIZE));
+ } while(timeout && (data->dns.hostcache->size > MAX_DNS_CACHE_SIZE));
if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
@@ -284,14 +288,14 @@ static struct Curl_dns_entry *fetch_addr(struct Curl_easy *data,
size_t entry_len = create_hostcache_id(hostname, 0, port,
entry_id, sizeof(entry_id));
- /* See if it is already in our dns cache */
+ /* See if its already in our dns cache */
dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1);
/* No entry found in cache, check if we might have a wildcard entry */
if(!dns && data->state.wildcard_resolve) {
entry_len = create_hostcache_id("*", 1, port, entry_id, sizeof(entry_id));
- /* See if it is already in our dns cache */
+ /* See if it's already in our dns cache */
dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1);
}
@@ -299,11 +303,11 @@ static struct Curl_dns_entry *fetch_addr(struct Curl_easy *data,
/* See whether the returned entry is stale. Done before we release lock */
struct hostcache_prune_data user;
- user.now = time(NULL);
- user.max_age_sec = data->set.dns_cache_timeout;
+ time(&user.now);
+ user.cache_timeout = data->set.dns_cache_timeout;
user.oldest = 0;
- if(hostcache_entry_is_stale(&user, dns)) {
+ if(hostcache_timestamp_remove(&user, dns)) {
infof(data, "Hostname in DNS cache was stale, zapped");
dns = NULL; /* the memory deallocation is being handled by the hash */
Curl_hash_delete(data->dns.hostcache, entry_id, entry_len + 1);
@@ -330,7 +334,7 @@ static struct Curl_dns_entry *fetch_addr(struct Curl_easy *data,
}
if(!found) {
- infof(data, "Hostname in DNS cache does not have needed family, zapped");
+ infof(data, "Hostname in DNS cache doesn't have needed family, zapped");
dns = NULL; /* the memory deallocation is being handled by the hash */
Curl_hash_delete(data->dns.hostcache, entry_id, entry_len + 1);
}
@@ -349,8 +353,8 @@ static struct Curl_dns_entry *fetch_addr(struct Curl_easy *data,
*
* Returns the Curl_dns_entry entry pointer or NULL if not in the cache.
*
- * The returned data *MUST* be "released" with Curl_resolv_unlink() after
- * use, or we will leak memory!
+ * The returned data *MUST* be "unlocked" with Curl_resolv_unlock() after
+ * use, or we'll leak memory!
*/
struct Curl_dns_entry *
Curl_fetch_addr(struct Curl_easy *data,
@@ -365,7 +369,7 @@ Curl_fetch_addr(struct Curl_easy *data,
dns = fetch_addr(data, hostname, port);
if(dns)
- dns->refcount++; /* we use it! */
+ dns->inuse++; /* we use it! */
if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
@@ -429,8 +433,8 @@ UNITTEST CURLcode Curl_shuffle_addr(struct Curl_easy *data,
if(Curl_rand(data, (unsigned char *)rnd, rnd_size) == CURLE_OK) {
struct Curl_addrinfo *swap_tmp;
for(i = num_addrs - 1; i > 0; i--) {
- swap_tmp = nodes[rnd[i] % (unsigned int)(i + 1)];
- nodes[rnd[i] % (unsigned int)(i + 1)] = nodes[i];
+ swap_tmp = nodes[rnd[i] % (i + 1)];
+ nodes[rnd[i] % (i + 1)] = nodes[i];
nodes[i] = swap_tmp;
}
@@ -469,8 +473,7 @@ Curl_cache_addr(struct Curl_easy *data,
struct Curl_addrinfo *addr,
const char *hostname,
size_t hostlen, /* length or zero */
- int port,
- bool permanent)
+ int port)
{
char entry_id[MAX_HOSTCACHE_LEN];
size_t entry_len;
@@ -498,15 +501,11 @@ Curl_cache_addr(struct Curl_easy *data,
entry_len = create_hostcache_id(hostname, hostlen, port,
entry_id, sizeof(entry_id));
- dns->refcount = 1; /* the cache has the first reference */
+ dns->inuse = 1; /* the cache has the first reference */
dns->addr = addr; /* this is the address(es) */
- if(permanent)
- dns->timestamp = 0; /* an entry that never goes stale */
- else {
- dns->timestamp = time(NULL);
- if(dns->timestamp == 0)
- dns->timestamp = 1;
- }
+ time(&dns->timestamp);
+ if(dns->timestamp == 0)
+ dns->timestamp = 1; /* zero indicates permanent CURLOPT_RESOLVE entry */
dns->hostport = port;
if(hostlen)
memcpy(dns->hostname, hostname, hostlen);
@@ -520,11 +519,11 @@ Curl_cache_addr(struct Curl_easy *data,
}
dns = dns2;
- dns->refcount++; /* mark entry as in-use */
+ dns->inuse++; /* mark entry as in-use */
return dns;
}
-#ifdef USE_IPV6
+#ifdef ENABLE_IPV6
/* return a static IPv6 ::1 for the name */
static struct Curl_addrinfo *get_localhost6(int port, const char *name)
{
@@ -542,8 +541,8 @@ static struct Curl_addrinfo *get_localhost6(int port, const char *name)
sa6.sin6_port = htons(port16);
sa6.sin6_flowinfo = 0;
sa6.sin6_scope_id = 0;
-
- (void)Curl_inet_pton(AF_INET6, "::1", ipv6);
+ if(Curl_inet_pton(AF_INET6, "::1", ipv6) < 1)
+ return NULL;
memcpy(&sa6.sin6_addr, ipv6, sizeof(ipv6));
ca->ai_flags = 0;
@@ -601,14 +600,14 @@ static struct Curl_addrinfo *get_localhost(int port, const char *name)
return ca6;
}
-#ifdef USE_IPV6
+#ifdef ENABLE_IPV6
/*
* Curl_ipv6works() returns TRUE if IPv6 seems to work.
*/
bool Curl_ipv6works(struct Curl_easy *data)
{
if(data) {
- /* the nature of most system is that IPv6 status does not come and go
+ /* the nature of most system is that IPv6 status doesn't come and go
during a program's lifetime so we only probe the first time and then we
have the info kept for fast reuse */
DEBUGASSERT(data);
@@ -624,7 +623,7 @@ bool Curl_ipv6works(struct Curl_easy *data)
/* probe to see if we have a working IPv6 stack */
curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0);
if(s == CURL_SOCKET_BAD)
- /* an IPv6 address was requested but we cannot get/use one */
+ /* an IPv6 address was requested but we can't get/use one */
ipv6_works = 0;
else {
ipv6_works = 1;
@@ -633,7 +632,7 @@ bool Curl_ipv6works(struct Curl_easy *data)
return (ipv6_works>0)?TRUE:FALSE;
}
}
-#endif /* USE_IPV6 */
+#endif /* ENABLE_IPV6 */
/*
* Curl_host_is_ipnum() returns TRUE if the given string is a numerical IPv4
@@ -642,11 +641,11 @@ bool Curl_ipv6works(struct Curl_easy *data)
bool Curl_host_is_ipnum(const char *hostname)
{
struct in_addr in;
-#ifdef USE_IPV6
+#ifdef ENABLE_IPV6
struct in6_addr in6;
#endif
if(Curl_inet_pton(AF_INET, hostname, &in) > 0
-#ifdef USE_IPV6
+#ifdef ENABLE_IPV6
|| Curl_inet_pton(AF_INET6, hostname, &in6) > 0
#endif
)
@@ -668,12 +667,12 @@ static bool tailmatch(const char *full, const char *part)
/*
* Curl_resolv() is the main name resolve function within libcurl. It resolves
* a name and returns a pointer to the entry in the 'entry' argument (if one
- * is provided). This function might return immediately if we are using asynch
+ * is provided). This function might return immediately if we're using asynch
* resolves. See the return codes.
*
* The cache entry we return will get its 'inuse' counter increased when this
- * function is used. You MUST call Curl_resolv_unlink() later (when you are
- * done using this struct) to decrease the reference counter again.
+ * function is used. You MUST call Curl_resolv_unlock() later (when you're
+ * done using this struct) to decrease the counter again.
*
* Return codes:
*
@@ -714,7 +713,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
if(dns) {
infof(data, "Hostname %s was found in DNS cache", hostname);
- dns->refcount++; /* we use it! */
+ dns->inuse++; /* we use it! */
rc = CURLRESOLV_RESOLVED;
}
@@ -742,7 +741,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
Curl_set_in_callback(data, true);
st = data->set.resolver_start(
#ifdef USE_CURL_ASYNC
- data->state.async.resolver,
+ conn->resolve_async.resolver,
#else
NULL,
#endif
@@ -755,24 +754,18 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
#ifndef USE_RESOLVE_ON_IPS
/* First check if this is an IPv4 address string */
- if(Curl_inet_pton(AF_INET, hostname, &in) > 0) {
+ if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
/* This is a dotted IP address 123.123.123.123-style */
addr = Curl_ip2addr(AF_INET, &in, hostname, port);
- if(!addr)
- return CURLRESOLV_ERROR;
- }
-#ifdef USE_IPV6
- else {
+#ifdef ENABLE_IPV6
+ if(!addr) {
struct in6_addr in6;
/* check if this is an IPv6 address string */
- if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0) {
+ if(Curl_inet_pton(AF_INET6, hostname, &in6) > 0)
/* This is an IPv6 address literal */
addr = Curl_ip2addr(AF_INET6, &in6, hostname, port);
- if(!addr)
- return CURLRESOLV_ERROR;
- }
}
-#endif /* USE_IPV6 */
+#endif /* ENABLE_IPV6 */
#else /* if USE_RESOLVE_ON_IPS */
#ifndef CURL_DISABLE_DOH
@@ -780,7 +773,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
if(Curl_inet_pton(AF_INET, hostname, &in) > 0)
/* This is a dotted IP address 123.123.123.123-style */
ipnum = TRUE;
-#ifdef USE_IPV6
+#ifdef ENABLE_IPV6
else {
struct in6_addr in6;
/* check if this is an IPv6 address string */
@@ -788,7 +781,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
/* This is an IPv6 address literal */
ipnum = TRUE;
}
-#endif /* USE_IPV6 */
+#endif /* ENABLE_IPV6 */
#endif /* CURL_DISABLE_DOH */
#endif /* !USE_RESOLVE_ON_IPS */
@@ -819,7 +812,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
if(respwait) {
/* the response to our resolve call will come asynchronously at
a later time, good or bad */
- /* First, check that we have not received the info by now */
+ /* First, check that we haven't received the info by now */
result = Curl_resolv_check(data, &dns);
if(result) /* error detected */
return CURLRESOLV_ERROR;
@@ -834,7 +827,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
/* we got a response, store it in the cache */
- dns = Curl_cache_addr(data, addr, hostname, 0, port, FALSE);
+ dns = Curl_cache_addr(data, addr, hostname, 0, port);
if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
@@ -857,7 +850,7 @@ enum resolve_t Curl_resolv(struct Curl_easy *data,
#ifdef USE_ALARM_TIMEOUT
/*
* This signal handler jumps back into the main libcurl code and continues
- * execution. This effectively causes the remainder of the application to run
+ * execution. This effectively causes the remainder of the application to run
* within a signal handler which is nonportable and could lead to problems.
*/
CURL_NORETURN static
@@ -870,12 +863,12 @@ void alarmfunc(int sig)
/*
* Curl_resolv_timeout() is the same as Curl_resolv() but specifies a
- * timeout. This function might return immediately if we are using asynch
+ * timeout. This function might return immediately if we're using asynch
* resolves. See the return codes.
*
* The cache entry we return will get its 'inuse' counter increased when this
- * function is used. You MUST call Curl_resolv_unlink() later (when you are
- * done using this struct) to decrease the reference counter again.
+ * function is used. You MUST call Curl_resolv_unlock() later (when you're
+ * done using this struct) to decrease the counter again.
*
* If built with a synchronous resolver and use of signals is not
* disabled by the application, then a nonzero timeout will cause a
@@ -940,7 +933,7 @@ enum resolve_t Curl_resolv_timeout(struct Curl_easy *data,
will generate a signal and we will siglongjmp() from that here.
This technique has problems (see alarmfunc).
This should be the last thing we do before calling Curl_resolv(),
- as otherwise we would have to worry about variables that get modified
+ as otherwise we'd have to worry about variables that get modified
before we invoke Curl_resolv() (and thus use "volatile"). */
curl_simple_lock_lock(&curl_jmpenv_lock);
@@ -961,7 +954,7 @@ enum resolve_t Curl_resolv_timeout(struct Curl_easy *data,
keep_copysig = TRUE; /* yes, we have a copy */
sigact.sa_handler = alarmfunc;
#ifdef SA_RESTART
- /* HP-UX does not have SA_RESTART but defaults to that behavior! */
+ /* HPUX doesn't have SA_RESTART but defaults to that behavior! */
sigact.sa_flags &= ~SA_RESTART;
#endif
/* now set the new struct */
@@ -1028,7 +1021,7 @@ clean_up:
((alarm_set >= 0x80000000) && (prev_alarm < 0x80000000)) ) {
/* if the alarm time-left reached zero or turned "negative" (counted
with unsigned values), we should fire off a SIGALRM here, but we
- will not, and zero would be to switch it off so we never set it to
+ won't, and zero would be to switch it off so we never set it to
less than 1! */
alarm(1);
rc = CURLRESOLV_TIMEDOUT;
@@ -1043,20 +1036,18 @@ clean_up:
}
/*
- * Curl_resolv_unlink() releases a reference to the given cached DNS entry.
- * When the reference count reaches 0, the entry is destroyed. It is important
- * that only one unlink is made for each Curl_resolv() call.
+ * Curl_resolv_unlock() unlocks the given cached DNS entry. When this has been
+ * made, the struct may be destroyed due to pruning. It is important that only
+ * one unlock is made for each Curl_resolv() call.
*
* May be called with 'data' == NULL for global cache.
*/
-void Curl_resolv_unlink(struct Curl_easy *data, struct Curl_dns_entry **pdns)
+void Curl_resolv_unlock(struct Curl_easy *data, struct Curl_dns_entry *dns)
{
- struct Curl_dns_entry *dns = *pdns;
- *pdns = NULL;
if(data && data->share)
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
- hostcache_unlink_entry(dns);
+ freednsentry(dns);
if(data && data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
@@ -1065,31 +1056,14 @@ void Curl_resolv_unlink(struct Curl_easy *data, struct Curl_dns_entry **pdns)
/*
* File-internal: release cache dns entry reference, free if inuse drops to 0
*/
-static void hostcache_unlink_entry(void *entry)
+static void freednsentry(void *freethis)
{
- struct Curl_dns_entry *dns = (struct Curl_dns_entry *) entry;
- DEBUGASSERT(dns && (dns->refcount>0));
+ struct Curl_dns_entry *dns = (struct Curl_dns_entry *) freethis;
+ DEBUGASSERT(dns && (dns->inuse>0));
- dns->refcount--;
- if(dns->refcount == 0) {
+ dns->inuse--;
+ if(dns->inuse == 0) {
Curl_freeaddrinfo(dns->addr);
-#ifdef USE_HTTPSRR
- if(dns->hinfo) {
- if(dns->hinfo->target)
- free(dns->hinfo->target);
- if(dns->hinfo->alpns)
- free(dns->hinfo->alpns);
- if(dns->hinfo->ipv4hints)
- free(dns->hinfo->ipv4hints);
- if(dns->hinfo->echconfiglist)
- free(dns->hinfo->echconfiglist);
- if(dns->hinfo->ipv6hints)
- free(dns->hinfo->ipv6hints);
- if(dns->hinfo->val)
- free(dns->hinfo->val);
- free(dns->hinfo);
- }
-#endif
free(dns);
}
}
@@ -1097,10 +1071,10 @@ static void hostcache_unlink_entry(void *entry)
/*
* Curl_init_dnscache() inits a new DNS cache.
*/
-void Curl_init_dnscache(struct Curl_hash *hash, size_t size)
+void Curl_init_dnscache(struct Curl_hash *hash, int size)
{
Curl_hash_init(hash, size, Curl_hash_str, Curl_str_key_compare,
- hostcache_unlink_entry);
+ freednsentry);
}
/*
@@ -1158,7 +1132,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
if(data->share)
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
- /* delete entry, ignore if it did not exist */
+ /* delete entry, ignore if it didn't exist */
Curl_hash_delete(data->dns.hostcache, entry_id, entry_len + 1);
if(data->share)
@@ -1230,7 +1204,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
memcpy(address, addr_begin, alen);
address[alen] = '\0';
-#ifndef USE_IPV6
+#ifndef ENABLE_IPV6
if(strchr(address, ':')) {
infof(data, "Ignoring resolve address '%s', missing IPv6 support.",
address);
@@ -1272,7 +1246,7 @@ err:
if(data->share)
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
- /* See if it is already in our dns cache */
+ /* See if it's already in our dns cache */
dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len + 1);
if(dns) {
@@ -1293,11 +1267,13 @@ err:
}
/* put this new host in the cache */
- dns = Curl_cache_addr(data, head, host_begin, hlen, port, permanent);
+ dns = Curl_cache_addr(data, head, host_begin, hlen, port);
if(dns) {
+ if(permanent)
+ dns->timestamp = 0; /* mark as permanent */
/* release the returned reference; the cache itself will keep the
* entry alive: */
- dns->refcount--;
+ dns->inuse--;
}
if(data->share)
@@ -1368,7 +1344,7 @@ static void show_resolve_info(struct Curl_easy *data,
if(!result)
result = Curl_dyn_add(d, buf);
if(result) {
- infof(data, "too many IP, cannot show");
+ infof(data, "too many IP, can't show");
goto fail;
}
}
@@ -1439,9 +1415,9 @@ CURLcode Curl_once_resolved(struct Curl_easy *data, bool *protocol_done)
struct connectdata *conn = data->conn;
#ifdef USE_CURL_ASYNC
- if(data->state.async.dns) {
- conn->dns_entry = data->state.async.dns;
- data->state.async.dns = NULL;
+ if(conn->resolve_async.dns) {
+ conn->dns_entry = conn->resolve_async.dns;
+ conn->resolve_async.dns = NULL;
}
#endif
@@ -1449,7 +1425,8 @@ CURLcode Curl_once_resolved(struct Curl_easy *data, bool *protocol_done)
if(result) {
Curl_detach_connection(data);
- Curl_cpool_disconnect(data, conn, TRUE);
+ Curl_conncache_remove_conn(data, conn, TRUE);
+ Curl_disconnect(data, conn, TRUE);
}
return result;
}
@@ -1462,11 +1439,11 @@ CURLcode Curl_once_resolved(struct Curl_easy *data, bool *protocol_done)
#ifdef USE_CURL_ASYNC
CURLcode Curl_resolver_error(struct Curl_easy *data)
{
+ struct connectdata *conn = data->conn;
const char *host_or_proxy;
CURLcode result;
#ifndef CURL_DISABLE_PROXY
- struct connectdata *conn = data->conn;
if(conn->bits.httpproxy) {
host_or_proxy = "proxy";
result = CURLE_COULDNT_RESOLVE_PROXY;
@@ -1479,7 +1456,7 @@ CURLcode Curl_resolver_error(struct Curl_easy *data)
}
failf(data, "Could not resolve %s: %s", host_or_proxy,
- data->state.async.hostname);
+ conn->resolve_async.hostname);
return result;
}