-
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