Skip to content

domain_fronter: drain chunked response trailers#22

Merged
therealaleph merged 1 commit into
therealaleph:mainfrom
freeinternet865:fix/chunked-response-trailers
Apr 22, 2026
Merged

domain_fronter: drain chunked response trailers#22
therealaleph merged 1 commit into
therealaleph:mainfrom
freeinternet865:fix/chunked-response-trailers

Conversation

@freeinternet865
Copy link
Copy Markdown
Contributor

Consume the final CRLF and any trailer lines after a zero-length chunk before returning a pooled upstream connection.

Without this, leftover bytes from a chunked response could remain on the socket and corrupt the next response read on the reused connection.

Add a regression test that reads a chunked response with a trailer and then successfully parses a second response from the same stream.


Edited and written by GPT.

Consume the final CRLF and any trailer lines after a zero-length
chunk before returning a pooled upstream connection.

Without this, leftover bytes from a chunked response could remain on
the socket and corrupt the next response read on the reused connection.

Add a regression test that reads a chunked response with a trailer and
then successfully parses a second response from the same stream.
Copy link
Copy Markdown
Owner

@therealaleph therealaleph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Properly drains final CRLF and trailers so a pooled connection is safe to reuse. Clean refactor via read_crlf_line helper, regression test exercises trailer + second response on the same stream. Tests pass locally.

@therealaleph therealaleph merged commit 1880d26 into therealaleph:main Apr 22, 2026
@freeinternet865 freeinternet865 deleted the fix/chunked-response-trailers branch April 23, 2026 07:38
therealaleph pushed a commit that referenced this pull request Apr 25, 2026
Consume the final CRLF and any trailer lines after a zero-length
chunk before returning a pooled upstream connection.

Without this, leftover bytes from a chunked response could remain on
the socket and corrupt the next response read on the reused connection.

Add a regression test that reads a chunked response with a trailer and
then successfully parses a second response from the same stream.

Co-authored-by: freeinternet865 <free@internet865.com>
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