Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

content_encoding: Skip checking support for "none" encoding #2298

Closed
wants to merge 1 commit into from

Conversation

MoSal
Copy link
Contributor

@MoSal MoSal commented Feb 8, 2018

Some servers return a "content-encoding" header with a "none" value.

libcurl does not recognise "none" as a special value, which can cause
unrecognised content encoding type errors.

This patch fixes that issue.

@jay
Copy link
Member

jay commented Feb 8, 2018

https://www.iana.org/assignments/http-parameters/http-parameters.xhtml#content-coding

What servers return Content-Encoding: none? It appears to be non-standard. We could add it as an alias for identity I guess.

diff --git a/lib/content_encoding.c b/lib/content_encoding.c
index 46bef0c..2b2188b 100644
--- a/lib/content_encoding.c
+++ b/lib/content_encoding.c
@@ -726,7 +726,7 @@ static void identity_close_writer(struct connectdata *conn,

 static const content_encoding identity_encoding = {
   "identity",
-  NULL,
+  "none",
   identity_init_writer,
   identity_unencode_write,
   identity_close_writer,

@jay jay added the HTTP label Feb 8, 2018
 Some servers return a "content-encoding" header with a non-standard
 "none" value.

 Add "none" as an alias to "identity" as a work-around, to avoid
 unrecognised content encoding type errors.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
@MoSal
Copy link
Contributor Author

MoSal commented Feb 8, 2018

What servers return Content-Encoding: none?

Forums using ElkArte is the use-case I found in the wild.

For example:

curl --compressed -O  'https://www.elkarte.net/community/index.php?action=dlattach;topic=4652.0;attach=4971'

@bagder
Copy link
Member

bagder commented Feb 8, 2018

I googled for "Content-Encoding: none" and that was a sad experience. Lots of hits since many years back.

It seems this header (value) has been proposed and advocated as a solution to a problem where "identity" was recognized but got the wrong treatment. Usually for PHP solutions, which the elkarte.net server mentioned above also uses (running on nginx).

So, I'm mildly positive to recognizing this as an identity alias.

@mkauf
Copy link
Contributor

mkauf commented Feb 8, 2018

I have found this: getgrav/grav#548 (comment)

So Content-Encoding: none is a hack to prevent Apache's mod_deflate from compressing the response. I don't know how widespread this hack is.

@jay jay closed this in f886cbf Feb 9, 2018
@jay
Copy link
Member

jay commented Feb 9, 2018

Ok just landed. Thanks guys

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging this pull request may close these issues.

None yet

4 participants