Skip to content

Commit 3741e47

Browse files
neilddmitshur
authored andcommitted
[internal-branch.go1.16-vendor] http2: remove check for read-after-close of request bodies
Aborting a request currently races with writes of the request body, so abortRequestBodyWrite can close the body before writeRequestBody reads from it. Updates golang/go#49076 Change-Id: I5362283f4066611aeecbc48b400d79cfa0b4b284 Reviewed-on: https://go-review.googlesource.com/c/net/+/351972 Trust: Damien Neil <[email protected]> Run-TryBot: Damien Neil <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> Reviewed-on: https://go-review.googlesource.com/c/net/+/356984 Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 2df4c53 commit 3741e47

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

http2/transport_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -4969,7 +4969,10 @@ func (rc *closeChecker) Read(b []byte) (n int, err error) {
49694969
select {
49704970
default:
49714971
case <-rc.closed:
4972-
panic("read from closed body")
4972+
// TODO(dneil): Consider restructuring the request write to avoid reading
4973+
// from the request body after closing it, and check for read-after-close here.
4974+
// Currently, abortRequestBodyWrite races with writeRequestBody.
4975+
return 0, errors.New("read after Body.Close")
49734976
}
49744977
return rc.ReadCloser.Read(b)
49754978
}

0 commit comments

Comments
 (0)