Commit 39888635 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: document how Hijack and Request.Context interact

Fixes #22347

Change-Id: If86aa5d54cfd7a7c32d630fb2bf4f47e057dbfb2
Reviewed-on: https://go-review.googlesource.com/115039Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 47901815
...@@ -316,7 +316,8 @@ type Request struct { ...@@ -316,7 +316,8 @@ type Request struct {
// //
// For incoming server requests, the context is canceled when the // For incoming server requests, the context is canceled when the
// client's connection closes, the request is canceled (with HTTP/2), // 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 { func (r *Request) Context() context.Context {
if r.ctx != nil { if r.ctx != nil {
return r.ctx return r.ctx
......
...@@ -187,8 +187,8 @@ type Hijacker interface { ...@@ -187,8 +187,8 @@ type Hijacker interface {
// The returned bufio.Reader may contain unprocessed buffered // The returned bufio.Reader may contain unprocessed buffered
// data from the client. // data from the client.
// //
// After a call to Hijack, the original Request.Body must // After a call to Hijack, the original Request.Body must not
// not be used. // be used, and the Request.Context will be canceled.
Hijack() (net.Conn, *bufio.ReadWriter, error) Hijack() (net.Conn, *bufio.ReadWriter, error)
} }
......
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