Skip to content

quic: connect() to endpoints, with a name of their own to verify, or none - #50

Merged
pgit merged 2 commits into
masterfrom
quic-connect-endpoints
Nov 23, 2026
Merged

pgit merged 2 commits into
masterfrom
quic-connect-endpoints

Conversation

@pgit-bot

Copy link
Copy Markdown
Collaborator

What

quic::connect() resolves the host it is given and checks the certificate against that same host, and it always checks. A client that already has its server's address, and knows the server's name separately, can't use that. A DNS resolver is such a client: c-ares knows its servers by address only, and for DNS over QUIC (RFC 9250) the name the certificate is for comes from configuration.

  • New overload quic::connect(executor, std::vector<TcpEndpoint> endpoints, std::string host, Config config). It connects to the first of endpoints that answers and checks the certificate for host: a name, which is also sent as SNI, or an address. An empty host checks the chain only and sends no SNI.
  • quic::Config::tls_verify (default true). Setting it to false turns verification off, for testing. handle_error() then no longer logs the "server certificate: …" warning, because no decision was based on it.
  • connect_to(): both overloads now share it in src/quic/connection.cpp.
  • Docs: a paragraph in the guide. The reference now lists both overloads by signature, because Breathe can't resolve an overloaded name given alone.

The first user is DNS over QUIC in c-ares-async. It currently carries this change as a patch on top of the pinned 3b4b0c5.

Tests

In test/test_quic.cpp, each run Staged and ZeroCopy:

  • WHEN_connecting_to_endpoints_THEN_the_certificate_is_checked_for_the_name_given
  • WHEN_the_name_given_is_not_the_certificates_THEN_connect_fails
  • WHEN_no_name_is_given_THEN_the_chain_is_still_checked
  • WHEN_verification_is_off_THEN_any_certificate_is_taken

Locally, in build/ (ASIO, AWS-LC): all 614 tests pass with gtest-parallel, and the docs target builds. The COROSIO trees were not built locally; the change is in generic code only.

Note

#47 adds tls_keylog_file to quic::Config as well, so whichever of the two is merged second may need a trivial rebase there.

🤖 Generated with Claude Code

pgit and others added 2 commits November 23, 2026 22:20
…none

A client that has the address of its server already, and the server's name apart from it, has no
use for a connect() that resolves the host and checks the certificate against that same host. A DNS
resolver is one: c-ares knows its servers by address only, and DNS over QUIC (RFC 9250) takes the
name the certificate is for from elsewhere. Nor could verification be turned off, for testing.

quic::connect(executor, endpoints, host, config) connects to the first of the endpoints that gets
there, and checks the certificate for host -- a name, sent as SNI, or an address. An empty host
checks the chain only, and sends no SNI. Config::tls_verify turns the check off; the warning about
the server certificate that handle_error() logs is left out then, as nothing was decided by it.
Both overloads are connect_to() underneath.

Tests in test_quic.cpp; the guide has a paragraph, and the reference both overloads by their
signatures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in #47 (tls_keylog_file), which added a field to quic::Config and
ClientConfig in the same places as this branch's tls_verify / verify. Both
are kept, the key log field first, as in client::Config, and
TlsClientContext sets up the key log after the verify mode either way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pgit
pgit merged commit 3d4c47a into master Nov 23, 2026
12 checks passed
@pgit
pgit deleted the quic-connect-endpoints branch November 23, 2026 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants