Skip compression for partial content responses - #277
Conversation
|
I just ran into this issue myself, I'm glad to see this potential fix. |
kilisamemarisaaa
left a comment
There was a problem hiding this comment.
Verified independently at 2418be3 on Windows with Node 24: npm test passed (57 passing, 1 pending) and npm run lint passed. The 206 regression test preserves Content-Range and Content-Length while suppressing Content-Encoding; the early status check also prevents the existing compression path from removing the range response's length. I found no blocking issue.
2418be3 to
63d9224
Compare
UlisesGascon
left a comment
There was a problem hiding this comment.
Thanks @vibhor-aggr! I rebased the changes, added some changes (docs and tests) and I think we can ship this in next minor release as it is 👍
|
Is there any reason to prefer skipping compression instead of ignoring the
Since by default RFC 9110 allows both ignoring the
Here's a small comparison of other server software:
|
7f83fdb to
151f63e
Compare
Fixes #185.
This skips response compression when the response status is
206 Partial Content. Compressing a partial response can leaveContent-Rangedescribing the original unencoded bytes while the payload has been transformed, which makes the response metadata inconsistent.Verification:
./node_modules/.bin/mocha --check-leaks --reporter spec --grep 'partial content responses'npm testnpm run lintgit diff --check