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 {
//
// 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
......
......@@ -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)
}
......
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