Repository navigation
Conversation
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
There was a problem hiding this comment.
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
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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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