curl / Mailing Lists / curl-users / Single Mail

curl-users

Re: Content-encoding compressed output

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 16 May 2018 13:47:34 +0200 (CEST)

On Wed, 16 May 2018, Piotr Wójcik wrote:

> According to this discussion: https://github.com/curl/curl/issues/2422 , curl
> will *sometimes* print a compressed file instead of what servers serve, and
> user can do nothing about that. I see it a bug, as this makes curl
> unreliable.
> Why is it like this? What about some flag to print uncompressed output?

On the contrary, I'd say it is in fact making curl reliable. I'll elaborate:

curl shows you what it gets from the server. If that contents is compressed,
and you didn't tell curl to uncompress it, it will "show" you the compressed
content. It will reliably show you exactly what the server sent in its
response. That has always been one of the fundamental behaviors of curl: you
get what you ask for.

You can ask curl to uncompress received data "automatically" with the
--compressed option.

Browsers will (of course) uncompress such responses automatically and show the
uncompressed contents. But they serve a slightly different purpose and thus
work differently in cases like this.

-- 
  / daniel.haxx.se

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2018-05-16