curl / Mailing Lists / curl-library / 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: Unknown Content-Encoding value and zero-lenght string CURLOPT_ACCEPT_ENCODING

From: Daniel Stenberg via curl-library <curl-library_at_lists.haxx.se>
Date: Thu, 28 Oct 2021 13:15:20 +0200 (CEST)

On Thu, 28 Oct 2021, Fujii Hironori via curl-library wrote:

> Monaco Editor Samples is using their own HTTP server 'yaserver' which sends
> an invalid 'Content-Encoding: utf8' header.

Shouldn't you then report this as an error against yaserver?

> However, if I invoke curl commnad with '--compressed' switch, it reports
> 'CURLE_BAD_CONTENT_ENCODING' error.

It's not a known encoding to libcurl.

> https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding>
> 'identity' value "is always considered as acceptable, even if omitted."

The better reference for the header is here:
https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.2.2

> Why doesn't curl treat the unknown encoding as identity if
> CURLOPT_ACCEPT_ENCODING is set to ""?

I don't think that's what it says we should do, because that would then also
pass on contents compressed with other algorithm than what curl supports etc.

But I understand what you're asking for. Maybe we should provide a way to tell
libcurl "when no matching encoding is found, pretend it was identity". Of
course that will then risk passing on complete garbage at times.

> Should WinCairo set the CURLOPT_ACCEPT_ENCODING explicitly to the following
> instead of "" ?
>
>> curl_easy_setopt(m_handle, CURLOPT_ACCEPT_ENCODING, "identity, deflate,
> gzip, br");

That list still doesn't include 'utf8'.

-- 
  / daniel.haxx.se
  | Commercial curl support up to 24x7 is available!
  | Private help, bug fixes, support, ports, new features
  | https://curl.se/support.html
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2021-10-28