• Tom Bergan's avatar
    http2: fix flake in net/http's TestCloseIdleConnections_h2 · 894f8ed5
    Tom Bergan authored
    That test makes a request with no body and receives a response with no
    body. The client will receive a HEADERS frame with END_STREAM. The test
    assumes that the stream is closed immediately on receipt of that HEADERS
    frame, i.e., before RoundTrip returns.
    
    This assumption was broken by https://golang.org/cl/70510, which made
    stream closure asynchronous w.r.t. RoundTrip.
    
    To fix TestCloseIdleConnections_h2 while preserving the intent of CL
    70510, we break processHeaders into two cases:
    
    1. The request has a body. In this case, END_STREAM puts the stream in a
       half-closed-remote state, which means the connection is not
       necessarily idle when RoundTrip returns (since the request body is
       still being uploaded). In this case, we preserve the behavior from CL
       70510.
    
    2. The request does not have a body. In this case, END_STREAM puts the
       stream in a closed state and we must close the stream before
       returning from RoundTrip.
    
    The following command passes when this CL is merged into net/http:
    go test -count=100000 -run=TestCloseIdleConnections_h2 net/http
    
    Updates golang/go#22413
    
    Change-Id: Iff2a0685a636ad51bff380e86a42b0d0eea984e5
    Reviewed-on: https://go-review.googlesource.com/80139
    Run-TryBot: Tom Bergan <tombergan@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    894f8ed5
Name
Last commit
Last update
bpf Loading commit data...
context Loading commit data...
dict Loading commit data...
dns/dnsmessage Loading commit data...
html Loading commit data...
http/httpproxy Loading commit data...
http2 Loading commit data...
icmp Loading commit data...
idna Loading commit data...
internal Loading commit data...
ipv4 Loading commit data...
ipv6 Loading commit data...
lex/httplex Loading commit data...
lif Loading commit data...
nettest Loading commit data...
netutil Loading commit data...
proxy Loading commit data...
publicsuffix Loading commit data...
route Loading commit data...
trace Loading commit data...
webdav Loading commit data...
websocket Loading commit data...
xsrftoken Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
codereview.cfg Loading commit data...