Skip to content

DoH with HTTPS, fix response handling - #22372

Closed
icing wants to merge 4 commits into
curl:masterfrom
icing:doh-https-rr-ech
Closed

DoH with HTTPS, fix response handling#22372
icing wants to merge 4 commits into
curl:masterfrom
icing:doh-https-rr-ech

Conversation

@icing

@icing icing commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fix handling of DoH response that only asks for HTTPS records.

Add test 2117 for checking that a HTTPS-RR resolve is processed, even though the actual answer is invalid.

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.

Pull request overview

Fixes DoH resolution handling when the query set includes HTTPS records (including the HTTPS-only case), and adds coverage for processing an HTTPS-RR resolve even when the actual answer is invalid. The PR also refactors tracing by introducing a dedicated DoH trace feature and updating related trace output and documentation.

Changes:

  • Add test 2117 to validate HTTPS-RR processing behavior with DoH under ECH/HTTPSRR-enabled configurations.
  • Adjust DoH result handling and tracing to better support non-address queries and HTTPS-RR decode flow.
  • Introduce a new Curl_trc_feat_doh trace feature and document curl_global_trace’s doh option.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/data/test2117 Adds a new DoH + HTTPS-RR focused regression test (with ECH) validating processing of HTTPS RR resolves.
tests/data/Makefile.am Registers the new test2117 in the test suite list.
lib/httpsrr.c Updates HTTPS RR trace message prefixes/wording.
lib/doh.c Refines DoH probe/consume logic for HTTPS-RR cases and adjusts verbosity/tracing behavior.
lib/curl_trc.h Declares the new DoH trace feature (guarded by !CURL_DISABLE_DOH).
lib/curl_trc.c Defines/registers the new DoH trace feature in the trace feature table.
docs/libcurl/curl_global_trace.md Documents doh tracing, but currently ends up with duplicate/conflicting doh sections.
Comments suppressed due to low confidence (2)

lib/doh.c:371

  • The DoH probe's CURLOPT_VERBOSE is now only enabled when Curl_trc_feat_doh is verbose. Because curl_global_trace("doh") is currently aliased to dns in Curl_trc_opt(), this condition will remain false in practice and the probe handle loses verbose output compared to dns tracing. Consider accepting either doh or dns verbosity here (or fix the option parsing).
  if(data->set.err && data->set.err != stderr)
    ERROR_CHECK_SETOPT(CURLOPT_STDERR, data->set.err);
  if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_doh))
    ERROR_CHECK_SETOPT(CURLOPT_VERBOSE, 1L);

lib/doh.c:1255

  • doh_show() output is now gated solely on Curl_trc_feat_doh. Given curl_global_trace("doh") is currently parsed as an alias for dns, this prevents the detailed DoH response dump from showing up under DNS tracing. Either make doh independently enableable, or also respect dns verbosity for this debug output.

        if(Curl_trc_ft_is_verbose(data, &Curl_trc_feat_doh)) {
          CURL_TRC_DNS(data, "hostname: %s", dohp->host);
          doh_show(data, &de);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/doh.c Outdated
Comment thread lib/doh.c
Comment thread lib/curl_trc.c
Comment thread docs/libcurl/curl_global_trace.md
icing added 4 commits July 24, 2026 10:41
Fix handling of DoH response that only asks for HTTPS records.

Add test 2117 for checking that a HTTPS-RR resolve is processed,
even though the actual answer is invalid.
- reverse handling of `data->sub_xfer_done` to be called from
  the `sub` transfer. This allows better management of 1-n
  relationships. In DoH, a transfer can be the master of an
  arbitrary number of DoH requests.
- clarify tracing of doh/dns features
@icing
icing force-pushed the doh-https-rr-ech branch from be15baf to 6fc8026 Compare July 24, 2026 09:16
@icing
icing requested a review from bagder July 24, 2026 09:35
@bagder bagder closed this in a954d87 Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants