• Brad Fitzpatrick's avatar
    net/http: make Transport use new connection if over HTTP/2 concurrency limit · 7a622740
    Brad Fitzpatrick authored
    The Go HTTP/1 client will make as many new TCP connections as the user requests.
    
    The HTTP/2 client tried to have that behavior, but the policy of
    whether a connection is re-usable didn't take into account the extra 1
    stream counting against SETTINGS_MAX_CONCURRENT_STREAMS so in practice
    users were getting errors.
    
    For example, if the server's advertised max concurrent streams is 100
    and 200 concurrrent Go HTTP requests ask for a connection at once, all
    200 will think they can reuse that TCP connection, but then 100 will
    fail later when the number of concurrent streams exceeds 100.
    
    Instead, recognize the "no cached connections" error value in the
    shouldRetryRequest method, so those 100 will retry a new connection.
    
    This is the conservative fix for Go 1.7 so users don't get errors, and
    to match the HTTP/1 behavior. Issues #13957 and #13774 are the more
    involved bugs for Go 1.8.
    
    Updates #16582
    Updates #13957
    
    Change-Id: I1f15a7ce60c07a4baebca87675836d6fe03993e8
    Reviewed-on: https://go-review.googlesource.com/25580
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    Reviewed-by: 's avatarChris Broadfoot <cbro@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    7a622740
Name
Last commit
Last update
..
cgi Loading commit data...
cookiejar Loading commit data...
fcgi Loading commit data...
httptest Loading commit data...
httptrace Loading commit data...
httputil Loading commit data...
internal Loading commit data...
pprof Loading commit data...
testdata Loading commit data...
client.go Loading commit data...
client_test.go Loading commit data...
clientserver_test.go Loading commit data...
cookie.go Loading commit data...
cookie_test.go Loading commit data...
doc.go Loading commit data...
example_test.go Loading commit data...
export_test.go Loading commit data...
filetransport.go Loading commit data...
filetransport_test.go Loading commit data...
fs.go Loading commit data...
fs_test.go Loading commit data...
h2_bundle.go Loading commit data...
header.go Loading commit data...
header_test.go Loading commit data...
http.go Loading commit data...
http_test.go Loading commit data...
jar.go Loading commit data...
main_test.go Loading commit data...
method.go Loading commit data...
npn_test.go Loading commit data...
proxy_test.go Loading commit data...
race.go Loading commit data...
range_test.go Loading commit data...
readrequest_test.go Loading commit data...
request.go Loading commit data...
request_test.go Loading commit data...
requestwrite_test.go Loading commit data...
response.go Loading commit data...
response_test.go Loading commit data...
responsewrite_test.go Loading commit data...
serve_test.go Loading commit data...
server.go Loading commit data...
sniff.go Loading commit data...
sniff_test.go Loading commit data...
status.go Loading commit data...
transfer.go Loading commit data...
transfer_test.go Loading commit data...
transport.go Loading commit data...
transport_internal_test.go Loading commit data...
transport_test.go Loading commit data...
triv.go Loading commit data...