• Brad Fitzpatrick's avatar
    http2: make Transport close unneeded connections after h1->h2 upgrade · a8e212f3
    Brad Fitzpatrick authored
    If a user starts two HTTP requests when no http2 connection is
    available, both end up creating new TCP connections, since the
    server's protocol (h1 or h2) isn't yet known. Once it turns out that
    the server supports h2, one of the connections is useless. Previously
    we kept upgrading both TLS connections to h2 (SETTINGS frame exchange,
    etc).  Now the unnecessary connections are closed instead, before the
    h2 preface/SETTINGS.
    
    Tests in the standard library (where it's easier to test), in the
    commit which updates h2_bundle.go with this change.
    
    Updates golang/go#13957
    
    Change-Id: I5af177e6ea755d572b551cc0b0de9da865ef4ae7
    Reviewed-on: https://go-review.googlesource.com/18675Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    a8e212f3
client_conn_pool.go 5.42 KB