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.

Unknown Content-Encoding value and zero-lenght string CURLOPT_ACCEPT_ENCODING

From: Fujii Hironori via curl-library <>
Date: Thu, 28 Oct 2021 16:39:20 +0900


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

If I invoke curl command, it reports no error for the unknown encoding.
> curl -v http://localhost:8888/

However, if I invoke curl commnad with '--compressed' switch, it reports
$ curl -v --compressed http://localhost:8888/
* Trying
* Connected to localhost ( port 8888 (#0)
> GET / HTTP/1.1
> Host: localhost:8888
> User-Agent: curl/7.68.0
> Accept: */*
> Accept-Encoding: deflate, gzip, br
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Encoding: utf8
< Content-Type: text/html
< Expires: Thu, 28 Oct 2021 07:06:19 GMT
< ETag: e54e50d368dc1cf7edcfd55ca1226c7c
< Content-Length: 5736
< Date: Thu, 28 Oct 2021 07:06:14 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
* Unrecognized content encoding type. libcurl understands deflate, gzip, br
content encodings.
* Closing connection 0
curl: (61) Unrecognized content encoding type. libcurl understands deflate,
gzip, br content encodings.

According to <>
'identity' value "is always considered as acceptable, even if omitted."
Why doesn't curl treat the unknown encoding as identity if
I want the zero-length string CURLOPT_ACCEPT_ENCODING to accept both
compressed and non-compressed encodings.

WebKit WinCairo port is using libcurl as the network stack, and it sets
So, it can't load the content. However, Google Chrome and Firefox can load
the invalid encoding.

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");

-- Fujii

Received on 2021-10-28