Is there any way to get curl to decompress a response without sending the Accept headers in the request?

CurlGzip

Curl Problem Overview


Is there any way to get curl to decompress a response without sending the Accept-encoding headers in the request?

I'm trying to debug an issue where the order of the Accept-encoding headers may be relevant, but I also need to know what the response is. If I just send -H 'Accept-encoding: gzip and the server gzips the response, curl won't decompress it.

Curl Solutions


Solution 1 - Curl

Probably the easiest thing to do is just use gunzip to do it:

curl -sH 'Accept-encoding: gzip' http://example.com/ | gunzip -

Or there's also --compressed, which curl will decompress (I believe) since it knows the response is compressed. But, not sure if that meets your needs.

Solution 2 - Curl

curl --compressed http://example.com requests gzipped-compressed data and uncompresses it before writing to disk.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJun-Dai Bates-KobashigawaView Question on Stackoverflow
Solution 1 - CurlFatalErrorView Answer on Stackoverflow
Solution 2 - CurlthakisView Answer on Stackoverflow