]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: clarify Request.Context's lifetime
authorBrad Fitzpatrick <bradfitz@golang.org>
Thu, 1 Dec 2016 16:50:00 +0000 (16:50 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 1 Dec 2016 17:42:25 +0000 (17:42 +0000)
Reverts https://golang.org/cl/23672 and tweaks the text to clarify
HTTP/2 request cancelations also cancel the context (not just closing
the TCP conn).

Fixes #18143

Change-Id: I9f838e09b906d455c98f676e5bc5559f8f7ecb17
Reviewed-on: https://go-review.googlesource.com/33769
Reviewed-by: Chris Broadfoot <cbro@golang.org>
src/net/http/request.go

index fd9ea5494eca1dfd0f516d071d2493c2a4818824..7a86322f94c532fbd8e1d69299e866c17cc4e982 100644 (file)
@@ -313,8 +313,8 @@ type Request struct {
 // For outgoing client requests, the context controls cancelation.
 //
 // For incoming server requests, the context is canceled when the
-// ServeHTTP method returns. For its associated values, see
-// ServerContextKey and LocalAddrContextKey.
+// client's connection closes, the request is canceled (with HTTP/2),
+// or when the ServeHTTP method returns.
 func (r *Request) Context() context.Context {
        if r.ctx != nil {
                return r.ctx