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

net/http: HTTP transport automatic unzipping appears to not properly work if Content-Encoding reply header isn't lowercase gzip #19248

Closed
GuySirton opened this issue Feb 23, 2017 · 3 comments
Labels
FrozenDueToAge help wanted Suggested Issues that may be good for new contributors looking for work to do.
Milestone

Comments

@GuySirton
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.7.3

What operating system and processor architecture are you using (go env)?

linux; amd64

What did you do?

Used a Go application binary that uses an HTTP client to retrieve data from an in-house/custom HTTP server. Examined network traffic.
The Go application specifies: "Accept-Encoding: gzip"
The server replies with "Content-Encoding: GZIP" and a gzipped reply (note the uppercase).

What did you expect to see?

Expected the Go application to unzip the data.

What did you see instead?

It appears the data didn't get unzipped and the application logic failed as a result of that. When the in-house server was modified to reply with a lowecase "gzip" the Go application unzipped the stream and the application logic worked.

The root cause may be this:
https://golang.org/src/net/http/transport.go?h=DisableCompression#L1582
if rc.addedGzip && resp.Header.Get("Content-Encoding") == "gzip" {

RFC2616 section 3.5 specifies: "All content-coding values are case-insensitive." so it seems that the client is not fully compliant?

@odeke-em
Copy link
Member

/cc @bradfitz

@bradfitz bradfitz added this to the Go1.9 milestone Feb 23, 2017
@bradfitz bradfitz added help wanted Suggested Issues that may be good for new contributors looking for work to do. labels Feb 23, 2017
@JanBerktold
Copy link
Contributor

Unless I am missing something, this should be quite easy to fix.

I will take care of this.

@gopherbot
Copy link

CL https://golang.org/cl/37431 mentions this issue.

@golang golang locked and limited conversation to collaborators May 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted Suggested Issues that may be good for new contributors looking for work to do.
Projects
None yet
Development

No branches or pull requests

5 participants