Repository navigation
Flag cap-cut deflate bodies, bound encoding layers, add max_body_size to BatchConfig - #114
Merged
Merged
Conversation
… to BatchConfig A deflate body cut short by max_body_size read as cleanly decoded, since neither deflate flavor has a trailer the decoder checks. A body whose read stopped at the cap is now flagged either way. The number of Content-Encoding layers came straight from the header, so a response could make the client run thousands of near full-size decode passes. At most three are undone now, and anything past that is flagged. BatchConfig had no max_body_size, so every batch response was stuck at the 10MB default even though the README lists it. It is now a constructor kwarg like the others. Fixes #90 Fixes #93 Fixes #94
en0f
approved these changes
Oct 5, 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 #90, #93 and #94. All three are about how
max_body_sizeand decoding bound what a response can cost.max_body_sizecame back withdecode_error = None, because neither deflate flavor has a trailer the decoder checks. A body whose read stopped at the cap is now flagged "body hit the max_body cap mid-stream", whatever the decoder thought.Content-Encodinglayers came straight from the header, so a few KB of header could cost seconds of CPU on one response. At most three are undone now. Past that, what came off so far is returned anddecode_errorsays decoding stopped at the limit. The README mentions the limit.BatchConfignow takesmax_body_sizeas a keyword argument, as the README already said it did. It's added at the end, so positional calls are unchanged.New tests: Python tests for both deflate flavors hitting the cap and for
max_body_sizein a batch, and a Rust unit test for the layer limit.