• Brad Fitzpatrick's avatar
    net/http: add Response.Uncompressed bool · ca8b6270
    Brad Fitzpatrick authored
    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/22671Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    ca8b6270
dump.go 8.53 KB