Fix SOCKS5 dynamic forwarding of fragmented and pipelined requests - #912
Open
mucinoab wants to merge 1 commit into
Open
Fix SOCKS5 dynamic forwarding of fragmented and pipelined requests#912mucinoab wants to merge 1 commit into
mucinoab wants to merge 1 commit into
Conversation
The SOCKS5 proxy used for dynamic port forwarding parsed each read as a complete message, throwing a buffer underflow when the greeting or the CONNECT request arrived split across several reads. It also reused the CONNECT request buffer as the reply, echoing request bytes (and any application data pipelined after the request) back to the client instead of forwarding them. Rewrite Socks5 as a state machine with a retained buffer: parse only once a message is complete and queue bytes received before the channel opens, forwarding them once it is up. The state is synchronized because channel open and write futures complete on other threads.
mucinoab
force-pushed
the
socks5-fragmentation
branch
from
August 18, 2026 16:44
a7cb206 to
d9a8c39
Compare
Author
|
@tomaswolf could you please trigger a pipeline run again. Thank you. |
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.
The SOCKS5 proxy used for dynamic port forwarding parsed each read as a complete message, throwing a buffer underflow when the greeting or the CONNECT request arrived split across several reads. It also reused the CONNECT request buffer as the reply, echoing request bytes (and any application data pipelined after the request) back to the client instead of forwarding them.
Rewrite Socks5 as a state machine with a retained buffer: parse only once a message is complete and queue bytes received before the channel opens, forwarding them once it is up.
The state is synchronized because channel open and write futures complete on other threads.
Fixes #911