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.
Fixes golang/go#48555.
Change-Id: I5362283f4066611aeecbc48b400d79cfa0b4b284
Reviewed-on: https://go-review.googlesource.com/c/net/+/351972
Trust: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/http2/transport_test.go b/http2/transport_test.go
index ab31640..f1d5761 100644
--- a/http2/transport_test.go
+++ b/http2/transport_test.go
@@ -4969,7 +4969,10 @@
select {
default:
case <-rc.closed:
- panic("read from closed body")
+ // TODO(dneil): Consider restructuring the request write to avoid reading
+ // from the request body after closing it, and check for read-after-close here.
+ // Currently, abortRequestBodyWrite races with writeRequestBody.
+ return 0, errors.New("read after Body.Close")
}
return rc.ReadCloser.Read(b)
}