Descriptionnet/http: don't send implicit gzip Accept-Encoding on Range requests
The http package by default adds "Accept-Encoding: gzip" to outgoing
requests, unless it's a bad idea, or the user requested otherwise.
Only when the http package adds its own implicit Accept-Encoding header
does the http package also transparently un-gzip the response.
If the user requested part of a document (e.g. bytes 40 to 50), it appears
that Github/Varnish send:
range(gzip(content), 40, 50)
And not:
gzip(range(content, 40, 50))
The RFC 2616 set of replacements (with the purpose of
clarifying ambiguities since 1999) has an RFC about Range
requests (http://tools.ietf.org/html/rfc7233) but does not
mention the interaction with encodings.
Regardless of whether range(gzip(content)) or gzip(range(content)) is
correct, this change prevents the Go package from asking for gzip
in requests if we're also asking for Range, avoiding the issue.
If the user cared, they can do it themselves. But Go transparently
un-gzipping a fragment of gzip is never useful.
Fixes Issue 8923
Patch Set 1 #Patch Set 2 : diff -r c4357074542926768bf0587b8f907aa177a964d7 https://go.googlecode.com/hg/ #Patch Set 3 : diff -r c4357074542926768bf0587b8f907aa177a964d7 https://go.googlecode.com/hg/ #Patch Set 4 : diff -r 3266b7e742ba13bf2207d7e1447155653289629d https://go.googlecode.com/hg/ #
MessagesTotal messages: 5
|