fix(client): Handle multiple layers of compression#657
Open
elliotcourant wants to merge 2 commits intodakrone:3.xfrom
Open
fix(client): Handle multiple layers of compression#657elliotcourant wants to merge 2 commits intodakrone:3.xfrom
elliotcourant wants to merge 2 commits intodakrone:3.xfrom
Conversation
If a server responds with a `Content-Encoding` of something like `deflate, gzip`, clj-http would not be able to handle the response as the response body has been compressed using zlib and then compressed again using gzip. This patch adds a recursive wrapper to the decompression handling that allows for multiple layers of compression to be unwrapped when receiving responses like this. The content encoding header is split by commas, then in reverse order is decompressed layer by layer until the final body is produced which is then returned to the caller.
Contributor
Author
|
@dakrone I'm happy to try to fix the CI/CD here too if you want, but it looks like its a caching/github actions issue and not something you might want me tampering with. Happy to take a swing at it though if you'd like. |
elliotcourant
commented
Oct 15, 2025
Comment on lines
398
to
400
| (assoc resp | ||
| :orig-content-encoding | ||
| (get-in resp [:headers "content-encoding"]))) |
Contributor
Author
There was a problem hiding this comment.
This might not be necessary since I've essentially lifted this into the decompression-response function at the start of the loop?
Owner
|
I’m currently out of the country but will look in early November when I’m back!
…On Wed, Oct 15, 2025, at 11:14 PM, Elliot Courant wrote:
***@***.**** commented on this pull request.
In src/clj_http/client.clj
<#657 (comment)>:
>
This *might* not be necessary since I've essentially lifted this into
the decompression-response function at the start of the loop?
—
Reply to this email directly, view it on GitHub
<#657 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEU5HN6RWZ775LLZTQE733X22LFAVCNFSM6AAAAACJJSW656VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTGNBSGMYTCNZRGA>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Contributor
Author
|
Thank you, no rush! |
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.
If a server responds with a
Content-Encodingof something likedeflate, gzip, clj-http would not be able to handle the response as the response body has been compressed using zlib and then compressed again using gzip.This patch adds a recursive wrapper to the decompression handling that allows for multiple layers of compression to be unwrapped when receiving responses like this.
The content encoding header is split by commas, then in reverse order is decompressed layer by layer until the final body is produced which is then returned to the caller.