net/http: HTTP transport automatic unzipping appears to not properly work if Content-Encoding reply header isn't lowercase gzip #19248
Labels
FrozenDueToAge
help wanted
Suggested
Issues that may be good for new contributors looking for work to do.
Milestone
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?
The text was updated successfully, but these errors were encountered: