Skip to content

fix(proxy): stop SOCKS5 optimistic sending deadlock - #310

Merged
seanmonstar merged 3 commits into
hyperium:masterfrom
JPDye:socks5-parse-before-read
Aug 3, 2026
Merged

fix(proxy): stop SOCKS5 optimistic sending deadlock #310
seanmonstar merged 3 commits into
hyperium:masterfrom
JPDye:socks5-parse-before-read

Conversation

@JPDye

@JPDye JPDye commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

When using the "optimistic sending" mode, if all of the servers responses are received in a single read call, read_message() will hang waiting for more bytes that will never arrive. I've not yet found a server that does this, but best to be safe.

Solution is to try to parse from the existing buffer of bytes before trying to read more from the network. We can add an if !buf.is_empty() gate to prevent calling try_from with an empty buffer, but I don't think it's necessary.

First commit adds tests (one of which fails). Second commit makes that test pass.

@seanmonstar
seanmonstar merged commit eaed54f into hyperium:master Aug 3, 2026
18 checks passed
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