Skip to content

Commit

Permalink
http2: read request in TestTransportBodyLargerThanXXX
Browse files Browse the repository at this point in the history
Otherwise the server can stop the connection before
clientStream.writeRequestBody has a chance to see if there is any more
data beyond the specified content length.

Tested by adding time.Sleep(time.Millisecond) to chunkReader.Read,
which caused the test to reliably fail before this change,
and reliably pass afterward.

Fixes golang/go#34616

Change-Id: I119bdf01bf916b2ded2c5d293655cba2596c0166
Reviewed-on: https://go-review.googlesource.com/c/net/+/234523
Run-TryBot: Ian Lance Taylor <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
  • Loading branch information
ianlancetaylor committed May 20, 2020
1 parent d87ec0c commit 59133d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http2/transport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4516,7 +4516,7 @@ func TestTransportBodyLargerThanSpecifiedContentLength_len2(t *testing.T) {

func testTransportBodyLargerThanSpecifiedContentLength(t *testing.T, body *chunkReader, contentLen int64) {
st := newServerTester(t, func(w http.ResponseWriter, r *http.Request) {
// Nothing.
r.Body.Read(make([]byte, 6))
}, optOnlyServer)
defer st.Close()

Expand Down

0 comments on commit 59133d7

Please sign in to comment.