reverseproxy: close connection on proxy protocol error paths" -m "Aft…#7836
Open
Ackberry wants to merge 1 commit into
Open
reverseproxy: close connection on proxy protocol error paths" -m "Aft…#7836Ackberry wants to merge 1 commit into
Ackberry wants to merge 1 commit into
Conversation
…er a successful dial, the four error returns in the ProxyProtocol block of dialContext returned without closing the established connection, leaking the socket. Close conn on each path. Fixes one item from caddyserver#7833." Signed-off-by: Ackberry <akbari@usf.edu>
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.
Assistance Disclosure
AI was used. I used Claude Code to help draft PR message and understand the codebase. I worked as a peer-programmer.
What this does
In
HTTPTransport's customdialContextclosure (modules/caddyhttp/reverseproxy/httptransport.go), the connection is established viadialer.DialContextand then, whenproxy_protocolis configured, several error paths returned without closing the already-open connection, leaking the socket:This closes
connon each of those paths. The dial-failure return (where no connection exists yet) and the success path are unchanged.Addresses the reverse proxy item in #7833. Per the maintainer's suggestion in that issue, the other reported leaks are left for separate PRs by area.
Testing
go build ./...go test -race ./modules/caddyhttp/reverseproxy/passes