mirror of https://github.com/golang/go.git
net/http: fix vet warning of leaked context in error paths
Updates #16230 Change-Id: Ie38f85419c41c00108f8843960280428a39789b5 Reviewed-on: https://go-review.googlesource.com/24850 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
54b499e3f1
commit
54ffdf364f
|
|
@ -775,9 +775,6 @@ func (c *conn) readRequest(ctx context.Context) (w *response, err error) {
|
|||
return nil, badRequestError("unsupported protocol version")
|
||||
}
|
||||
|
||||
ctx, cancelCtx := context.WithCancel(ctx)
|
||||
req.ctx = ctx
|
||||
|
||||
c.lastMethod = req.Method
|
||||
c.r.setInfiniteReadLimit()
|
||||
|
||||
|
|
@ -804,6 +801,8 @@ func (c *conn) readRequest(ctx context.Context) (w *response, err error) {
|
|||
}
|
||||
delete(req.Header, "Host")
|
||||
|
||||
ctx, cancelCtx := context.WithCancel(ctx)
|
||||
req.ctx = ctx
|
||||
req.RemoteAddr = c.remoteAddr
|
||||
req.TLS = c.tlsState
|
||||
if body, ok := req.Body.(*body); ok {
|
||||
|
|
|
|||
Loading…
Reference in New Issue