res->num_pending--;
if(CURL_ASYNC_SUCCESS == status) {
- struct Curl_addrinfo *ai = Curl_he2ai(hostent, data->state.async.port);
+ struct Curl_addrinfo *ai = Curl_he2ai(hostent, data->conn->localport);
if(ai) {
compound_results(res, ai);
}
if(!res->hostname)
return NULL;
- data->state.async.hostname = res->hostname;
- data->state.async.port = port;
data->state.async.done = FALSE; /* not done */
data->state.async.dns = NULL; /* clear */
service, &hints, addrinfo_cb, data);
}
#else
+ (void)port;
#ifdef HAVE_CARES_IPV6
if((data->conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) {
td->init = FALSE;
}
- Curl_safefree(async->hostname);
+
}
#ifdef USE_HTTPSRR_ARES
memset(&async->thdata.hinfo, 0, sizeof(struct Curl_https_rrinfo));
async->thdata.hinfo.port = -1;
ares_query_dnsrec(async->thdata.channel,
- async->hostname, ARES_CLASS_IN,
+ data->conn->host.name, ARES_CLASS_IN,
ARES_REC_TYPE_HTTPS,
Curl_dnsrec_done_cb, data, NULL);
int err = ENOMEM;
struct Curl_async *async = &data->state.async;
- async->port = port;
async->done = FALSE;
async->dns = NULL;
td->thread_hnd = curl_thread_t_null;
goto errno_exit;
}
- free(async->hostname);
- async->hostname = strdup(hostname);
- if(!async->hostname)
- goto err_exit;
-
/* The thread will set this TRUE when complete. */
td->tsd.done = FALSE;
if(dohp->probe[DOH_SLOT_IPV4].easy_mid < 0 &&
dohp->probe[DOH_SLOT_IPV6].easy_mid < 0) {
- failf(data, "Could not DoH-resolve: %s", data->state.async.hostname);
+ failf(data, "Could not DoH-resolve: %s", dohp->host);
return CONN_IS_PROXIED(data->conn) ? CURLE_COULDNT_RESOLVE_PROXY :
CURLE_COULDNT_RESOLVE_HOST;
}
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
dns = Curl_cache_addr(data, ai,
- data->state.async.hostname, 0,
- data->state.async.port, FALSE);
+ data->conn->host.dispname, 0,
+ data->conn->localport, FALSE);
if(data->share)
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
}
failf(data, "Could not resolve %s: %s", host_or_proxy,
- data->state.async.hostname);
+ data->conn->host.dispname);
return result;
}
#if defined(CURLRES_ASYNCH) || !defined(CURL_DISABLE_DOH)
#define USE_CURL_ASYNC
struct Curl_async {
- char *hostname;
struct Curl_dns_entry *dns;
#ifdef CURLRES_ASYNCH
struct thread_data thdata;
#endif
void *resolver; /* resolver state, if it is used in the URL state -
ares_channel e.g. */
- int port;
BIT(done); /* set TRUE when the lookup is complete */
};