Fix consumeChunks: actually strip chunk size-lines and trailing CRLFs#2
Fix consumeChunks: actually strip chunk size-lines and trailing CRLFs#2
Conversation
|
If this is approved, I'll get the latest upstream changes and probably drop the 2 commits that are not committed upstream — this fork hasn't been used in a while. |
|
Maybe put some comments of the PR into the code so it's clearer to look at in the future, otherwise looks alright. Before merging please force reset the master in this repo to upstream's master and after when you have a moment, make a PR upstream. |
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.
|
@arybczak, I assume I don't need to care about the GHC 9.14 errors on CI? |
I added some comments to the code.
Fork has been re-set, and PR rebased on top of latest I've created an upstream PR here: Happstack#91 |
Previously
consumeChunksreturned the raw chunked stream unchanged, so any caller usingTransfer-Encoding: chunkedinput 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/consumeChunksImplto 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.