• Brad Fitzpatrick's avatar
    net/http: reuse client connections earlier when Content-Length is set · 01e3b4fc
    Brad Fitzpatrick authored
    Set EOF on the final Read of a body with a Content-Length, which
    will cause clients to recycle their connection immediately upon
    the final Read, rather than waiting for another Read or Close
    (neither of which might come).  This happens often when client
    code is simply something like:
    
      err := json.NewDecoder(resp.Body).Decode(&dest)
      ...
    
    Then there's usually no subsequent Read. Even if the client
    calls Close (which they should): in Go 1.1, the body was
    slurped to EOF, but in Go 1.2, that was then treated as a
    Close-before-EOF and the underlying connection was closed.
    But that's assuming the user even calls Close. Many don't.
    Reading to EOF also causes a connection be reused. Now the EOF
    arrives earlier.
    
    This CL only addresses the Content-Length case. A future CL
    will address the chunked case.
    
    LGTM=adg
    R=adg
    CC=golang-codereviews
    https://golang.org/cl/49570044
    01e3b4fc
Name
Last commit
Last update
..
cmd Loading commit data...
lib9 Loading commit data...
libbio Loading commit data...
liblink Loading commit data...
libmach Loading commit data...
pkg Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...
sudo.bash Loading commit data...