Conversation
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.
1. What does this change do, exactly?
CONNECT currently sends and flushes
200 OKbefore dialing the target. If the dial then fails, the response status is already committed and the client receives a closed tunnel instead of the connection error. Direct dial failures also fall through to403 Forbidden, even when an address passed the ACL.The first commit sends
200only after a successful dial and flushes it before waiting for target data. Refused connections return502, timeouts return504, and ACL denials remain403. Padding negotiation remains available on error responses.The second commit carries the request context through DNS lookup and dialing, so cancellation reaches context-aware operations. Connections returned after cancellation are closed. The context remains valid after an upstream proxy dial returns, preserving the lifetime of an established HTTP/2 tunnel.
This intentionally removes the server's optimistic success response. Clients that wait for the CONNECT response now wait for target connection establishment. Address selection and dial timeout settings are unchanged.
Validation with Go 1.22.2:
go build ./...,go test -count=1 ./..., andgo test -race -count=1 ./...pass. The full race suite ran in an isolated network namespace to keep its fixed fixture ports separate from concurrent tests.2. Please link to the relevant issues.
The repository's issue tracker is disabled. CONNECT semantics: RFC 9110, Section 9.3.6.
3. Which documentation changes (if any) need to be made because of this PR?
None; the CONNECT response-order comment is updated with the implementation.
4. Checklist