Skip to content

vdns: announce resolver start before the HTTPS RR query is sent - #23037

Closed
bagder wants to merge 3 commits into
masterfrom
bagder/https-rr-start
Closed

bagder wants to merge 3 commits into
masterfrom
bagder/https-rr-start

Conversation

@bagder

@bagder bagder commented Sep 22, 2026

Copy link
Copy Markdown
Member

In the mixed threaded-resolver + c-ares configuration, Curl_async_getaddrinfo() called async_rr_start() - which initializes the c-ares channel and immediately dispatches the HTTPS RR query with ares_query_dnsrec() - before calling Curl_resolv_announce_start(). This let the HTTPS RR query reach the wire before the application-installed CURLOPT_RESOLVER_START_FUNCTION callback got a chance to configure the channel or veto the resolve, unlike the regular A/AAAA queries and the pure c-ares backend, which both already announce before querying.

Split the c-ares channel setup (async_rr_init) from submitting the query (async_rr_start), and only submit it after
Curl_resolv_announce_start() has returned success, so a non-zero return from the callback prevents the query from ever being sent.

Reported-by: Joshua Rogers

In the mixed threaded-resolver + c-ares configuration,
Curl_async_getaddrinfo() called async_rr_start() - which initializes
the c-ares channel and immediately dispatches the HTTPS RR query with
ares_query_dnsrec() - before calling Curl_resolv_announce_start(). This
let the HTTPS RR query reach the wire before the application-installed
CURLOPT_RESOLVER_START_FUNCTION callback got a chance to configure the
channel or veto the resolve, unlike the regular A/AAAA queries and the
pure c-ares backend, which both already announce before querying.

Split the c-ares channel setup (async_rr_init) from submitting the
query (async_rr_start), and only submit it after
Curl_resolv_announce_start() has returned success, so a non-zero
return from the callback prevents the query from ever being sent.

Reported-by: Joshua Rogers
@bagder bagder added the name lookup DNS and related tech label Sep 22, 2026
@github-actions github-actions Bot added the tests label Sep 22, 2026
@bagder
bagder requested a balanced review from Copilot September 22, 2026 09:49
@bagder
bagder marked this pull request as ready for review September 22, 2026 09:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The regression test assumes an unrelated connection result that can vary with local services.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Moves HTTPS RR submission after the resolver-start callback, allowing configuration or veto before network activity.

Changes:

  • Splits c-ares channel initialization from query submission.
  • Adds regression coverage for callback veto behavior.
  • Clarifies callback invocation documentation.
File Description
lib/​vdns/​asyn-thrdd.c Reorders HTTPS RR query startup.
tests/​libtest/​lib464.c Adds resolver veto regression test.
tests/​libtest/​Makefile.inc Registers the libtest.
tests/​data/​test464 Defines test requirements and metadata.
tests/​data/​Makefile.am Registers test 464.
docs/​libcurl/​opts/​CURLOPT_RESOLVER_START_FUNCTION.md Documents multiple callback invocations.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/libtest/lib464.c
Comment thread tests/data/test464 Outdated
bagder and others added 2 commits September 22, 2026 13:44
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The ordering fix is correct, focused, documented, and covered by an appropriate regression test.

Review effort: Balanced
Findings: None

Resolved since last review (2)

@bagder bagder closed this in f71efc7 Sep 22, 2026
@bagder
bagder deleted the bagder/https-rr-start branch September 22, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

name lookup DNS and related tech tests

Development

Successfully merging this pull request may close these issues.

3 participants