• Brad Fitzpatrick's avatar
    http: fix two Transport gzip+persist crashes · fa23a700
    Brad Fitzpatrick authored
    There were a couple issues:
    
    -- HEAD requests were attempting to be ungzipped,
       despite having no content.  That was fixed in
       the previous patch version, but ultimately was
       fixed as a result of other refactoring:
    
    -- persist.go's ClientConn "lastbody" field was
       remembering the wrong body, since we were
       mucking with it later. Instead, ditch
       ClientConn's readRes func field and add a new
       method passing it in, so we can use a closure
       and do all our bodyEOFSignal + gunzip stuff
       in one place, simplifying a lot of code and
       not requiring messing with ClientConn's innards.
    
    -- closing the gzip reader didn't consume its
       contents.  if the caller wasn't done reading
       all the response body and ClientConn closed it
       (thinking it'd move past those bytes in the
       TCP stream), it actually wouldn't.  so introduce
       a new wrapper just for gzip reader to have its
       Close method do an ioutil.Discard on its body
       first, before the close.
    
    Fixes #1725
    Fixes #1804
    
    R=rsc, eivind
    CC=golang-dev
    https://golang.org/cl/4523058
    fa23a700
Name
Last commit
Last update
..
cgi Loading commit data...
fcgi Loading commit data...
httptest Loading commit data...
pprof Loading commit data...
spdy Loading commit data...
testdata Loading commit data...
Makefile Loading commit data...
chunked.go Loading commit data...
client.go Loading commit data...
client_test.go Loading commit data...
cookie.go Loading commit data...
cookie_test.go Loading commit data...
dump.go Loading commit data...
export_test.go Loading commit data...
fs.go Loading commit data...
fs_test.go Loading commit data...
header.go Loading commit data...
header_test.go Loading commit data...
lex.go Loading commit data...
lex_test.go Loading commit data...
persist.go Loading commit data...
proxy_test.go Loading commit data...
range_test.go Loading commit data...
readrequest_test.go Loading commit data...
request.go Loading commit data...
request_test.go Loading commit data...
requestwrite_test.go Loading commit data...
response.go Loading commit data...
response_test.go Loading commit data...
responsewrite_test.go Loading commit data...
reverseproxy.go Loading commit data...
reverseproxy_test.go Loading commit data...
serve_test.go Loading commit data...
server.go Loading commit data...
status.go Loading commit data...
transfer.go Loading commit data...
transport.go Loading commit data...
transport_test.go Loading commit data...
triv.go Loading commit data...
url.go Loading commit data...
url_test.go Loading commit data...