curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Applying decompression by default when content-encoding header is set

From: Marcus Hoffmann via curl-users <>
Date: Fri, 18 Jun 2021 00:57:52 +0200

On 18.06.21 00:11, Dan Fandrich via curl-users wrote:
> On Thu, Jun 17, 2021 at 09:56:47PM +0200, Marcus Hoffmann via curl-users wrote:
>> today I interacted with an API that applied gzip encoding by default to
>> responses, which after reading
>> I think is valid
>> behaviour.
>> I was surprised that curl didn't decompress the response automatically
>> without adding the `--compressed` flag.
>> That was easy enough to find in the man page, but is there any reason for
>> curl not acting upon the `content-encoding` header automatically?
> Enabling it automatically probably would have been a good default at the start,
> but the current behaviour has been that way for over 10 years so changing it
> now likely means breaking all kinds of scripts. You can always enable it by
> default in your .curlrc file.

Ah, mh, that's unfortunate :D.

curl already detects when it's printing to a terminal (and then refuses
to print binary output). Any chance at making auto-decompression
dependent on that as well? I guess that has a far lesser chance of
breaking anyones scripts.
The downside here is that it might cause confusion when things magically
work on the command line, but refuse to do the same in a script... I
guess you can't really win here.

Received on 2021-06-18