From: Brad Fitzpatrick Date: Thu, 1 Dec 2016 16:50:00 +0000 (+0000) Subject: net/http: clarify Request.Context's lifetime X-Git-Tag: go1.8beta2~126 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=208d4d222786f3e51749a6b50e4f3fd8f8d9777f;p=gostls13.git net/http: clarify Request.Context's lifetime 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 --- diff --git a/src/net/http/request.go b/src/net/http/request.go index fd9ea5494e..7a86322f94 100644 --- a/src/net/http/request.go +++ b/src/net/http/request.go @@ -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