aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/request.go
diff options
context:
space:
mode:
authorRoss Light <ross@zombiezen.com>2020-08-27 13:08:29 -0700
committerRuss Cox <rsc@golang.org>2020-10-16 16:52:13 +0000
commitdfee3332e66bd3f3afd76615767d2cd9b1905b26 (patch)
treefb7a6089b31875a62093ed3ff102f86e254bd25d /src/net/http/request.go
parentc06a699fb69e17274905bc8d9942de4a4ab8b31b (diff)
downloadgo-dfee3332e66bd3f3afd76615767d2cd9b1905b26.tar.gz
go-dfee3332e66bd3f3afd76615767d2cd9b1905b26.zip
net/http: document concurrency expectations for Request.Body
This is primarily aimed at client requests where the user can supply their own io.ReadCloser, but also clarifies server request behavior. A server request body can be one of: - *body - *http2RequestBody - *expectContinueReader - *maxBytesReader Of those, *expectContinueReader did not meet these expectations, so this change also removes the data race. Change-Id: Id4f1ae573d938347b1123a7b612b271aabb045a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/251087 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/net/http/request.go')
-rw-r--r--src/net/http/request.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/net/http/request.go b/src/net/http/request.go
index 54ec1c5593..183606d0ff 100644
--- a/src/net/http/request.go
+++ b/src/net/http/request.go
@@ -175,6 +175,10 @@ type Request struct {
// but will return EOF immediately when no body is present.
// The Server will close the request body. The ServeHTTP
// Handler does not need to.
+ //
+ // Body must allow Read to be called concurrently with Close.
+ // In particular, calling Close should unblock a Read waiting
+ // for input.
Body io.ReadCloser
// GetBody defines an optional func to return a new copy of