summaryrefslogtreecommitdiff
path: root/lib/doh.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-01-20 10:15:43 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-01-22 08:25:09 +0100
commit8335c6417ea21bdfc340f0cb8cab5dbc97b10a2e (patch)
tree3f2651a3e000016fdef00707917e0e8e394b5dbe /lib/doh.c
parentd3a3bdb5ef867e270f4be205f36024ad1e48beb3 (diff)
downloadcurl-8335c6417ea21bdfc340f0cb8cab5dbc97b10a2e.tar.gz
hostip: remove conn->data from resolver functions
This also moves the 'async' struct from the connectdata struct into the Curl_easy struct, which seems like a better home for it. Closes #6497
Diffstat (limited to 'lib/doh.c')
-rw-r--r--lib/doh.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/doh.c b/lib/doh.c
index 608f3d94c..004244c8d 100644
--- a/lib/doh.c
+++ b/lib/doh.c
@@ -379,21 +379,21 @@ static CURLcode dohprobe(struct Curl_easy *data,
* 'Curl_addrinfo *' with the address information.
*/
-struct Curl_addrinfo *Curl_doh(struct connectdata *conn,
+struct Curl_addrinfo *Curl_doh(struct Curl_easy *data,
const char *hostname,
int port,
int *waitp)
{
- struct Curl_easy *data = conn->data;
CURLcode result = CURLE_OK;
int slot;
struct dohdata *dohp;
+ struct connectdata *conn = data->conn;
*waitp = TRUE; /* this never returns synchronously */
- (void)conn;
(void)hostname;
(void)port;
DEBUGASSERT(!data->req.doh);
+ DEBUGASSERT(conn);
/* start clean, consider allocating this struct on demand */
dohp = data->req.doh = calloc(sizeof(struct dohdata), 1);
@@ -911,11 +911,10 @@ UNITTEST void de_cleanup(struct dohentry *d)
}
}
-CURLcode Curl_doh_is_resolved(struct connectdata *conn,
+CURLcode Curl_doh_is_resolved(struct Curl_easy *data,
struct Curl_dns_entry **dnsp)
{
CURLcode result;
- struct Curl_easy *data = conn->data;
struct dohdata *dohp = data->req.doh;
*dnsp = NULL; /* defaults to no response */
if(!dohp)
@@ -923,8 +922,8 @@ CURLcode Curl_doh_is_resolved(struct connectdata *conn,
if(!dohp->probe[DOH_PROBE_SLOT_IPADDR_V4].easy &&
!dohp->probe[DOH_PROBE_SLOT_IPADDR_V6].easy) {
- failf(data, "Could not DOH-resolve: %s", conn->async.hostname);
- return conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY:
+ failf(data, "Could not DOH-resolve: %s", data->state.async.hostname);
+ return data->conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY:
CURLE_COULDNT_RESOLVE_HOST;
}
else if(!dohp->pending) {
@@ -984,7 +983,7 @@ CURLcode Curl_doh_is_resolved(struct connectdata *conn,
Curl_freeaddrinfo(ai);
}
else {
- conn->async.dns = dns;
+ data->state.async.dns = dns;
*dnsp = dns;
result = CURLE_OK; /* address resolution OK */
}