mirror of
https://github.com/curl/curl.git
synced 2025-09-09 21:52:40 +03:00
urldata: remove 'hostname' from struct Curl_async
It is unnecessary duplicated information, as the host name being resolved is already present in conn->host. Closes #16451
This commit is contained in:
parent
7007f59caa
commit
8ded8e5f3f
|
@ -592,7 +592,7 @@ static void query_completed_cb(void *arg, /* (struct connectdata *) */
|
||||||
res->num_pending--;
|
res->num_pending--;
|
||||||
|
|
||||||
if(CURL_ASYNC_SUCCESS == status) {
|
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) {
|
if(ai) {
|
||||||
compound_results(res, ai);
|
compound_results(res, ai);
|
||||||
}
|
}
|
||||||
|
@ -774,8 +774,6 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
|
||||||
if(!res->hostname)
|
if(!res->hostname)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
data->state.async.hostname = res->hostname;
|
|
||||||
data->state.async.port = port;
|
|
||||||
data->state.async.done = FALSE; /* not done */
|
data->state.async.done = FALSE; /* not done */
|
||||||
data->state.async.dns = NULL; /* clear */
|
data->state.async.dns = NULL; /* clear */
|
||||||
|
|
||||||
|
@ -811,6 +809,7 @@ struct Curl_addrinfo *Curl_resolver_getaddrinfo(struct Curl_easy *data,
|
||||||
service, &hints, addrinfo_cb, data);
|
service, &hints, addrinfo_cb, data);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
(void)port;
|
||||||
|
|
||||||
#ifdef HAVE_CARES_IPV6
|
#ifdef HAVE_CARES_IPV6
|
||||||
if((data->conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) {
|
if((data->conn->ip_version != CURL_IPRESOLVE_V4) && Curl_ipv6works(data)) {
|
||||||
|
|
|
@ -400,7 +400,7 @@ static void destroy_async_data(struct Curl_easy *data)
|
||||||
|
|
||||||
td->init = FALSE;
|
td->init = FALSE;
|
||||||
}
|
}
|
||||||
Curl_safefree(async->hostname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_HTTPSRR_ARES
|
#ifdef USE_HTTPSRR_ARES
|
||||||
|
@ -414,7 +414,7 @@ static CURLcode resolve_httpsrr(struct Curl_easy *data,
|
||||||
memset(&async->thdata.hinfo, 0, sizeof(struct Curl_https_rrinfo));
|
memset(&async->thdata.hinfo, 0, sizeof(struct Curl_https_rrinfo));
|
||||||
async->thdata.hinfo.port = -1;
|
async->thdata.hinfo.port = -1;
|
||||||
ares_query_dnsrec(async->thdata.channel,
|
ares_query_dnsrec(async->thdata.channel,
|
||||||
async->hostname, ARES_CLASS_IN,
|
data->conn->host.name, ARES_CLASS_IN,
|
||||||
ARES_REC_TYPE_HTTPS,
|
ARES_REC_TYPE_HTTPS,
|
||||||
Curl_dnsrec_done_cb, data, NULL);
|
Curl_dnsrec_done_cb, data, NULL);
|
||||||
|
|
||||||
|
@ -436,7 +436,6 @@ static bool init_resolve_thread(struct Curl_easy *data,
|
||||||
int err = ENOMEM;
|
int err = ENOMEM;
|
||||||
struct Curl_async *async = &data->state.async;
|
struct Curl_async *async = &data->state.async;
|
||||||
|
|
||||||
async->port = port;
|
|
||||||
async->done = FALSE;
|
async->done = FALSE;
|
||||||
async->dns = NULL;
|
async->dns = NULL;
|
||||||
td->thread_hnd = curl_thread_t_null;
|
td->thread_hnd = curl_thread_t_null;
|
||||||
|
@ -447,11 +446,6 @@ static bool init_resolve_thread(struct Curl_easy *data,
|
||||||
goto errno_exit;
|
goto errno_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(async->hostname);
|
|
||||||
async->hostname = strdup(hostname);
|
|
||||||
if(!async->hostname)
|
|
||||||
goto err_exit;
|
|
||||||
|
|
||||||
/* The thread will set this TRUE when complete. */
|
/* The thread will set this TRUE when complete. */
|
||||||
td->tsd.done = FALSE;
|
td->tsd.done = FALSE;
|
||||||
|
|
||||||
|
|
|
@ -1181,7 +1181,7 @@ CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
|
||||||
|
|
||||||
if(dohp->probe[DOH_SLOT_IPV4].easy_mid < 0 &&
|
if(dohp->probe[DOH_SLOT_IPV4].easy_mid < 0 &&
|
||||||
dohp->probe[DOH_SLOT_IPV6].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 :
|
return CONN_IS_PROXIED(data->conn) ? CURLE_COULDNT_RESOLVE_PROXY :
|
||||||
CURLE_COULDNT_RESOLVE_HOST;
|
CURLE_COULDNT_RESOLVE_HOST;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,8 +76,8 @@ CURLcode Curl_addrinfo_callback(struct Curl_easy *data,
|
||||||
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
|
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
|
||||||
|
|
||||||
dns = Curl_cache_addr(data, ai,
|
dns = Curl_cache_addr(data, ai,
|
||||||
data->state.async.hostname, 0,
|
data->conn->host.dispname, 0,
|
||||||
data->state.async.port, FALSE);
|
data->conn->localport, FALSE);
|
||||||
if(data->share)
|
if(data->share)
|
||||||
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
|
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
|
||||||
|
|
||||||
|
|
|
@ -1480,7 +1480,7 @@ CURLcode Curl_resolver_error(struct Curl_easy *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
failf(data, "Could not resolve %s: %s", host_or_proxy,
|
failf(data, "Could not resolve %s: %s", host_or_proxy,
|
||||||
data->state.async.hostname);
|
data->conn->host.dispname);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -565,14 +565,12 @@ struct hostname {
|
||||||
#if defined(CURLRES_ASYNCH) || !defined(CURL_DISABLE_DOH)
|
#if defined(CURLRES_ASYNCH) || !defined(CURL_DISABLE_DOH)
|
||||||
#define USE_CURL_ASYNC
|
#define USE_CURL_ASYNC
|
||||||
struct Curl_async {
|
struct Curl_async {
|
||||||
char *hostname;
|
|
||||||
struct Curl_dns_entry *dns;
|
struct Curl_dns_entry *dns;
|
||||||
#ifdef CURLRES_ASYNCH
|
#ifdef CURLRES_ASYNCH
|
||||||
struct thread_data thdata;
|
struct thread_data thdata;
|
||||||
#endif
|
#endif
|
||||||
void *resolver; /* resolver state, if it is used in the URL state -
|
void *resolver; /* resolver state, if it is used in the URL state -
|
||||||
ares_channel e.g. */
|
ares_channel e.g. */
|
||||||
int port;
|
|
||||||
BIT(done); /* set TRUE when the lookup is complete */
|
BIT(done); /* set TRUE when the lookup is complete */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user