Skip to content

Fix consumeChunks: actually strip chunk size-lines and trailing CRLFs#91

Open
joncol wants to merge 1 commit intoHappstack:masterfrom
scrive:fix-dechunker
Open

Fix consumeChunks: actually strip chunk size-lines and trailing CRLFs#91
joncol wants to merge 1 commit intoHappstack:masterfrom
scrive:fix-dechunker

Conversation

@joncol
Copy link
Copy Markdown

@joncol joncol commented May 5, 2026

Previously consumeChunks returned the raw chunked stream unchanged, so any caller using Transfer-Encoding: chunked input got chunk-size hex prefixes embedded in the body. Multipart parsing in particular saw hex digits inside the file content and rejected the upload.

This fixes consumeChunks/consumeChunksImpl to extract just the chunk body bytes (dropping the size-line and trailing CRLF), and to drop the HTTP trailer from the body output (trailers are headers per RFC 2616, not body content). consumeChunks is also exported from Internal.Handler so it can be tested.

@joncol joncol force-pushed the fix-dechunker branch 2 times, most recently from 37e50bc to ec3146d Compare May 5, 2026 12:25
Previously consumeChunks returned the raw chunked stream unchanged, so
any caller using Transfer-Encoding: chunked input got chunk-size hex
prefixes embedded in the body. Multipart parsing in particular saw
hex digits inside the file content and rejected the upload.

This fixes consumeChunks/consumeChunksImpl to extract just the chunk
body bytes (dropping the size-line and trailing CRLF), and to drop
the HTTP trailer from the body output (trailers are headers per
RFC 2616, not body content). consumeChunks is also exported from
Internal.Handler so it can be tested.
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.

1 participant