Skip to main content
The 2024 Developer Survey results are live! See the results

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • 33
    This would appear to be a curl bug, because it should trigger its decoding based on the response, not on what it requested (given that it does support gzip). To quote HTTP 1.1: "If no Accept-Encoding field is present in a request, the server MAY assume that the client will accept any content coding." But it does go on to say that servers SHOULD in that case not encode the content, hmm, go figure. Commented Feb 21, 2013 at 16:37
  • actually on my version works --comp --compress --compressed Commented Jun 13, 2016 at 13:14
  • 7
    this also sets the request header: "Accept-Encoding: deflate, gzip" thats great since if the server serves gzip and no gzip, you just need --compressed and not add the accept encoding header yourself
    – mbert
    Commented Feb 27, 2017 at 15:47
  • help my QA with this solution in 1 minute ! thank you ! That said, my application is actually sending gzip response with Content-Encoding: gzip. Browsers and modern tools (e.g. httpie) automatically handles it. I guess curl just need a "hint"
    – Faraway
    Commented Apr 18, 2018 at 23:15
  • 1
    Surprisingly, setting Accept-Encoding: deflate, gzip is not enough - even if the server returns a gzip response with Content-Encoding: gzip, curl won't automatically ungzip it. The --compressed flag is required.
    – rjh
    Commented Jan 8, 2019 at 20:06