]> Cypherpunks repositories - gostls13.git/commitdiff
net/http: document how Hijack and Request.Context interact
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 29 May 2018 19:45:34 +0000 (19:45 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 29 May 2018 20:35:07 +0000 (20:35 +0000)
Fixes #22347

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

index 119a015a53d1dc3756288bf2538baa4644fd6b76..7c4325027cf2d4ea1777fe67af287b99dd551b9f 100644 (file)
@@ -316,7 +316,8 @@ type Request struct {
 //
 // For incoming server requests, the context is canceled when the
 // client's connection closes, the request is canceled (with HTTP/2),
-// or when the ServeHTTP method returns.
+// the ServeHTTP method returns, or if the Hijack method is
+// called on the ResponseWriter.
 func (r *Request) Context() context.Context {
        if r.ctx != nil {
                return r.ctx
index ac5cadd8d0a5419f09af7c760fb3401f1566627b..2d3486dc66083a5296e643466abc0b9db42cd885 100644 (file)
@@ -187,8 +187,8 @@ type Hijacker interface {
        // The returned bufio.Reader may contain unprocessed buffered
        // data from the client.
        //
-       // After a call to Hijack, the original Request.Body must
-       // not be used.
+       // After a call to Hijack, the original Request.Body must not
+       // be used, and the Request.Context will be canceled.
        Hijack() (net.Conn, *bufio.ReadWriter, error)
 }