• Brad Fitzpatrick's avatar
    net/http: close TCP connection on Response.Body.Close · ce834155
    Brad Fitzpatrick authored
    Previously the HTTP client's (*Response).Body.Close would try
    to keep reading until EOF, hoping to reuse the keep-alive HTTP
    connection, but the EOF might never come, or it might take a
    long time. Now we immediately close the TCP connection if we
    haven't seen EOF.
    
    This shifts the burden onto clients to read their whole response
    bodies if they want the advantage of reusing TCP connections.
    
    In the future maybe we could decide on heuristics to read some
    number of bytes for some max amount of time before forcefully
    closing, but I'd rather not for now.
    
    Statistically, touching this code makes things regress, so I
    wouldn't be surprised if this introduces new bugs, but all the
    tests pass, and I think the code is simpler now too. Maybe.
    
    Please test your HTTP client code before Go 1.1.
    
    Fixes #3672
    
    R=golang-dev, adg
    CC=golang-dev
    https://golang.org/cl/7419050
    ce834155
Name
Last commit
Last update
..
cmd Loading commit data...
lib9 Loading commit data...
libbio 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...