Repository navigation
quic: connect() to endpoints, with a name of their own to verify, or none - #50
Merged
Merged
Conversation
…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>
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.
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.quic::connect(executor, std::vector<TcpEndpoint> endpoints, std::string host, Config config). It connects to the first ofendpointsthat answers and checks the certificate forhost: a name, which is also sent as SNI, or an address. An emptyhostchecks the chain only and sends no SNI.quic::Config::tls_verify(defaulttrue). Setting it tofalseturns 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 insrc/quic/connection.cpp.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_givenWHEN_the_name_given_is_not_the_certificates_THEN_connect_failsWHEN_no_name_is_given_THEN_the_chain_is_still_checkedWHEN_verification_is_off_THEN_any_certificate_is_takenLocally, in
build/(ASIO, AWS-LC): all 614 tests pass withgtest-parallel, and thedocstarget builds. The COROSIO trees were not built locally; the change is in generic code only.Note
#47 adds
tls_keylog_filetoquic::Configas well, so whichever of the two is merged second may need a trivial rebase there.🤖 Generated with Claude Code