]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: document how Hijack and Request.Context interact, take two
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 15 Jun 2018 20:10:47 +0000 (20:10 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 15 Jun 2018 21:18:10 +0000 (21:18 +0000)
Second try. The previous version (CL 115039 in git rev 3988863) wasn't
accurate.

Fixes #22347

Change-Id: I473165f308c730f50b14ba787cb215f7cb9ea364
Reviewed-on: https://go-review.googlesource.com/119235
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/net/http/request.go
src/net/http/server.go

index ea2d51fee599f07dacf6f3c192764e7b26da4980..390f3cc063f0f1d8f81e74d8d29af58852195d9d 100644 (file)
@@ -321,8 +321,7 @@ type Request struct {
 //
 // For incoming server requests, the context is canceled when the
 // client's connection closes, the request is canceled (with HTTP/2),
-// the ServeHTTP method returns, or if the Hijack method is
-// called on the ResponseWriter.
+// or when the ServeHTTP method returns.
 func (r *Request) Context() context.Context {
        if r.ctx != nil {
                return r.ctx
index d54b745cd21d19a4714ba6f75d26548484cb1d3c..e8903c5346005ecaa4c210e4634a84183f4f1082 100644 (file)
@@ -190,7 +190,9 @@ type Hijacker interface {
        // data from the client.
        //
        // After a call to Hijack, the original Request.Body must not
-       // be used, and the Request.Context will be canceled.
+       // be used. The original Request's Context remains valid and
+       // is not canceled until the Request's ServeHTTP method
+       // returns.
        Hijack() (net.Conn, *bufio.ReadWriter, error)
 }