• Brad Fitzpatrick's avatar
    http: fix Transport connection re-use race · 243266f6
    Brad Fitzpatrick authored
    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
    243266f6
transport_test.go 8.45 KB