From 69f3a36bcb94b6e69f0248ac749833483326edf9 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Thu, 23 Apr 2026 14:43:11 +0200 Subject: [PATCH] doh: remove conn->bits.doh Since we have a new struct instance for each async operation now and async operation may happen in parallel, remove the connection bit indicating doh is in progress. Closes #21422 --- lib/doh.c | 7 +++---- lib/hostip.c | 6 ++---- lib/urldata.h | 3 --- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/doh.c b/lib/doh.c index 1e5e614be1..4621ccf8d8 100644 --- a/lib/doh.c +++ b/lib/doh.c @@ -457,14 +457,14 @@ CURLcode Curl_doh(struct Curl_easy *data, { CURLcode result = CURLE_OK; struct doh_probes *dohp = NULL; - struct connectdata *conn = data->conn; size_t i; - DEBUGASSERT(conn); DEBUGASSERT(!async->doh); DEBUGASSERT(async->hostname[0]); - if(async->doh) + if(async->doh) { + DEBUGASSERT(0); /* should not happen */ Curl_doh_cleanup(data, async); + } /* start clean, consider allocating this struct on demand */ async->doh = dohp = curlx_calloc(1, sizeof(struct doh_probes)); @@ -476,7 +476,6 @@ CURLcode Curl_doh(struct Curl_easy *data, curlx_dyn_init(&dohp->probe_resp[i].body, DYN_DOH_RESPONSE); } - conn->bits.doh = TRUE; dohp->host = async->hostname; dohp->port = async->port; /* We are making sub easy handles and want to be called back when diff --git a/lib/hostip.c b/lib/hostip.c index 0d1095e33b..48942d4bda 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -424,7 +424,7 @@ static CURLcode hostip_resolv_take_result(struct Curl_easy *data, return CURLE_FAILED_INIT; #ifndef CURL_DISABLE_DOH - if(data->conn->bits.doh) + if(async->doh) result = Curl_doh_take_result(data, async, pdns); else #endif @@ -670,9 +670,7 @@ static CURLcode hostip_resolv(struct Curl_easy *data, *presolv_id = 0; *pdns = NULL; -#ifndef CURL_DISABLE_DOH - data->conn->bits.doh = FALSE; /* default is not */ -#else +#ifdef CURL_DISABLE_DOH (void)allowDOH; #endif diff --git a/lib/urldata.h b/lib/urldata.h index f83c006e72..214fbeddcb 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -295,9 +295,6 @@ struct ConnectBits { BIT(multiplex); /* connection is multiplexed */ BIT(tcp_fastopen); /* use TCP Fast Open */ BIT(tls_enable_alpn); /* TLS ALPN extension? */ -#ifndef CURL_DISABLE_DOH - BIT(doh); -#endif #ifdef USE_UNIX_SOCKETS BIT(abstract_unix_socket); #endif