1
0
mirror of https://github.com/golang/go synced 2024-11-20 03:04:40 -07:00
go/src
Brad Fitzpatrick ce8341554c net/http: close TCP connection on Response.Body.Close
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
2013-03-05 18:47:27 -08:00
..
cmd vet: check for useless assignments. 2013-03-06 09:55:04 +11:00
lib9 all: clean up C function prototypes 2013-02-26 09:51:33 -08:00
libbio
libmach libmach: many pe handling fixes 2013-03-01 14:49:23 +11:00
pkg net/http: close TCP connection on Response.Body.Close 2013-03-05 18:47:27 -08:00
all.bash
all.bat
all.rc build: do not set GOBIN on Plan 9 2013-02-26 09:25:46 -08:00
clean.bash
clean.bat
clean.rc
make.bash build: clang support 2013-02-15 13:37:43 -08:00
make.bat
Make.dist
make.rc build: do not set GOBIN on Plan 9 2013-02-26 09:25:46 -08:00
race.bash src: add race.bash 2013-01-28 21:05:25 +11:00
race.bat src: add race.bat 2013-02-03 00:49:37 +08:00
run.bash runtime/cgo: fix arm build, re-enable test 2013-03-01 16:24:23 -05:00
run.bat build: disable cgo on windows 2013-03-01 11:55:00 -05:00
run.rc build: do not set GOBIN on Plan 9 2013-02-26 09:25:46 -08:00
sudo.bash