[PR #12674/e8832aee backport][3.14] Fix ZLibDecompressor dropping data past the first gzip member#12745
Merged
Dreamsorcerer merged 1 commit intoMay 31, 2026
Conversation
(cherry picked from commit e8832ae)
7 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 3.14 #12745 +/- ##
=======================================
Coverage 98.18% 98.18%
=======================================
Files 135 135
Lines 47667 47750 +83
Branches 2558 2563 +5
=======================================
+ Hits 46801 46884 +83
Misses 683 683
Partials 183 183
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Merging this PR will not alter performance
Comparing Footnotes
|
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.
This is a backport of PR #12674 as merged into master (e8832ae).
What do these changes do?
When a response body contains concatenated gzip members (e.g. a server that produces one gzip member per write call, as nginx does under certain configs),
zlib.decompressobjsetseofand stores the remaining bytes inunused_dataafter it finishes the first member.decompress_sync()wasn't checkingunused_dataat all, so every member after the first was silently discarded. The caller got truncated output with no error.The fix applies the same
while eof and unused_dataloop thatZSTDDecompressoralready uses for multi-frame zstd streams. Each iteration creates a fresh decompressor and feeds it the leftover bytes, accumulating output across all members.max_lengthis tracked and honoured across the loop.Also added
unused_datatoZLibDecompressObjProtocolso the attribute is properly typed, and three tests that mirror the existing ZSTD multi-frame test suite.Are there changes in behaviour for the end user?
Yes — responses with concatenated gzip members now decompress fully instead of being silently truncated at the first member boundary.
Related issue number
Fixes #7157
Checklist
make fmthas been run N/A (formatting only)CONTRIBUTORS.txtDrafted with Claude Sonnet 4.6; reviewed by Ashutosh-177.