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.
compressed to a generated curl command so that curl decompresses the response body.
Curl is, without a doubt, one of the most powerful command-line tools for testing and debugging websites. It allows you to customise your HTTP request in any way you desire. To test if a website is performing Gzip compression, you can of course use curl.
It means the client can accept a response which has been compressed using the DEFLATE algorithm.
Accept-encoding header is an HTTP header which must be included on every origin server response. Its main job is to inform the browsers if the client can handle the compressed version of the website. The warning can appear when you don't use the Vary: Accept-Encoding in your header on a server or CDN.
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.
curl --compressed http://example.com
requests gzipped-compressed data and uncompresses it before writing to disk.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With