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

Comments

Projects
None yet
5 participants
@GuySirton

GuySirton commented Feb 23, 2017

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

This comment has been minimized.

Show comment
Hide comment
@odeke-em
Member

odeke-em commented Feb 23, 2017

/cc @bradfitz

@bradfitz bradfitz added this to the Go1.9 milestone Feb 23, 2017

@JanBerktold

This comment has been minimized.

Show comment
Hide comment
@JanBerktold

JanBerktold Feb 23, 2017

Contributor

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

I will take care of this.

Contributor

JanBerktold commented Feb 23, 2017

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

I will take care of this.

@gopherbot

This comment has been minimized.

Show comment
Hide comment
@gopherbot

gopherbot commented Feb 23, 2017

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

@gopherbot gopherbot closed this in 51b2213 May 24, 2017

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