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

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
@MoSal
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@jay

jay Feb 8, 2018

Member

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,
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

content_encoding: Add "none" alias to "identity"
 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

This comment has been minimized.

Show comment
Hide comment
@MoSal

MoSal Feb 8, 2018

Contributor

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'
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@bagder

bagder Feb 8, 2018

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@mkauf

mkauf Feb 8, 2018

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@jay

jay Feb 9, 2018

Member

Ok just landed. Thanks guys

Member

jay commented Feb 9, 2018

Ok just landed. Thanks guys

@curl curl 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.