-
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: Brad Fitzpatrick <bradfitz@golang.org>
894f8ed5