The Fix
pip install urllib3==1.25
Based on closed urllib3/urllib3 issue #593 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -418,6 +418,29 @@ def test_mock_transfer_encoding_chunked(self):
i += 1
+ def test_mock_gzipped_transfer_encoding_chunked_decoded(self):
+ """Show that we can decode the gizpped and chunked body."""
+ def stream():
Option A — Upgrade to fixed release\npip install urllib3==1.25\nWhen NOT to use: Do not use this fix if the response does not use both gzip and chunked encoding.\n\n
Why This Fix Works in Production
- Trigger: Responses with chunked gzipped content were not decompressed, leading to incorrect data being processed.
- Mechanism: Addresses a regression in the handling of chunked and gzipped responses in the Response.stream() method, ensuring that the decode_content parameter is respected.
- Why the fix works: Addresses a regression in the handling of chunked and gzipped responses in the Response.stream() method, ensuring that the decode_content parameter is respected. (first fixed release: 1.25).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- Production symptom (often without a traceback): Responses with chunked gzipped content were not decompressed, leading to incorrect data being processed.
Proof / Evidence
- GitHub issue: #593
- Fix PR: https://github.com/urllib3/urllib3/pull/595
- First fixed release: 1.25
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.74
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Originally kennethreitz/requests#2561. It seems that if you hit an endpoint that sets both Content-Encoding: gzip and Transfer-Encoding: chunked, and then use Response.stream() with decode_content=True, we don't decompress the content. That”
Failure Signature (Search String)
- Responses with chunked gzipped content were not decompressed, leading to incorrect data being processed.
Copy-friendly signature
Failure Signature
-----------------
Responses with chunked gzipped content were not decompressed, leading to incorrect data being processed.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Responses with chunked gzipped content were not decompressed, leading to incorrect data being processed.
What Broke
Responses with chunked gzipped content were not decompressed, leading to incorrect data being processed.
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install urllib3==1.25
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/urllib3/urllib3/pull/595
First fixed release: 1.25
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if the response does not use both gzip and chunked encoding.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
- Upgrade behind a canary and run integration tests against the canary before 100% rollout.
Version Compatibility Table
| Version | Status |
|---|---|
| 1.25 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.