Skip to content

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

@GuySirton

Description

@GuySirton

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeSuggestedIssues that may be good for new contributors looking for work to do.help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions