Commit 208d4d22 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

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/33769Reviewed-by: default avatarChris Broadfoot <cbro@golang.org>
parent e5e05627
...@@ -313,8 +313,8 @@ type Request struct { ...@@ -313,8 +313,8 @@ type Request struct {
// For outgoing client requests, the context controls cancelation. // For outgoing client requests, the context controls cancelation.
// //
// For incoming server requests, the context is canceled when the // For incoming server requests, the context is canceled when the
// ServeHTTP method returns. For its associated values, see // client's connection closes, the request is canceled (with HTTP/2),
// ServerContextKey and LocalAddrContextKey. // or when the ServeHTTP method returns.
func (r *Request) Context() context.Context { func (r *Request) Context() context.Context {
if r.ctx != nil { if r.ctx != nil {
return r.ctx return r.ctx
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment