Fixes #22347
Change-Id: If86aa5d54cfd7a7c32d630fb2bf4f47e057dbfb2
Reviewed-on: https://go-review.googlesource.com/115039
Reviewed-by: Ian Lance Taylor <iant@golang.org>
//
// 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
// 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)
}