]> Cypherpunks repositories - gostls13.git/commit
http: fix Transport connection re-use race
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 5 Apr 2011 02:22:47 +0000 (19:22 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 5 Apr 2011 02:22:47 +0000 (19:22 -0700)
commit243266f62e2af7167236f99bb0aa376d3c21246b
tree6a87a70a2fe2f7cef989d12f460c054f6091b9f5
parentf3ad899a2d50a0d6daaf69bc4b2ce69ee6b85334
http: fix Transport connection re-use race

A connection shouldn't be made available
for re-use until its body has been consumed.

(except in the case of pipelining, which isn't
implemented yet)

This CL fixes some issues seen with heavy load
against Amazon S3.

Subtle implementation detail: to prevent a race
with the client requesting a new connection
before previous one is returned, we actually
have to call putIdleConnection _before_ we
return from the final Read/Close call on the
http.Response.Body.

R=rsc, adg
CC=golang-dev
https://golang.org/cl/4351048
src/pkg/http/transport.go
src/pkg/http/transport_test.go