Repository navigation
Conversation
read_proxy_header looped forever when the peer closed the connection before the header's newline arrived: peek returns Ok(0) at EOF, no newline is found, and the zero-length read in the None branch returns Ok(0) too. Treat Ok(0) from peek as UnexpectedEof so the header task logs the error and ends. Fixes bolcom#580 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 6, 2026
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.
Fixes #580.
read_proxy_headerloops forever when the peer closes the connection before the header'snewline arrives:
peekreturnsOk(0)at EOF, no newline is found, and the zero-lengthreadin theNonebranch returnsOk(0)too.peekonly returnsOk(0)at EOF (the buffer is never empty), so this checks for it rightafter the peek and returns
ProxyError::ReadErrorwithio::ErrorKind::UnexpectedEof. Thespawned header task then logs "proxy protocol read error" and ends, like for every other
header error. Behaviour for connections that do send a header is unchanged.
Two tests cover EOF before any byte and EOF after a partial header; both used to hang and now
return the error (they are bounded by a 5 s timeout so a regression fails instead of hanging).