]> Cypherpunks repositories - gostls13.git/commit
net/http: add Response.Uncompressed bool
authorBrad Fitzpatrick <bradfitz@golang.org>
Sat, 16 Apr 2016 16:35:32 +0000 (09:35 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sun, 1 May 2016 06:29:57 +0000 (06:29 +0000)
commitca8b6270724026fb7697e9f9510d1e6865ed7045
tree49bb0ba6d9c5043829d576af5efeef772bd168ca
parenta9cf0b1e1e2a66db547fcabb7188465e4ac54700
net/http: add Response.Uncompressed bool

The Transport's automatic gzip uncompression lost information in the
process (the compressed Content-Length, if known). Normally that's
okay, but it's not okay for reverse proxies which have to be able to
generate a valid HTTP response from the Transport's provided
*Response.

Reverse proxies should normally be disabling compression anyway and
just piping the compressed pipes though and not wasting CPU cycles
decompressing them. So also document that on the new Uncompressed
field.

Then, using the new field, fix Response.Write to not inject a bogus
"Connection: close" header when it doesn't see a transfer encoding or
content-length.

Updates #15366 (the http2 side remains, once this is submitted)

Change-Id: I476f40aa14cfa7aa7b3bf99021bebba4639f9640
Reviewed-on: https://go-review.googlesource.com/22671
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/net/http/clientserver_test.go
src/net/http/httputil/dump.go
src/net/http/response.go
src/net/http/response_test.go
src/net/http/transport.go