Commit 0e4ee0c9 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

net/http: fix timer leak in Transport when using ResponseHeaderTimeout

Fixes #9104

Change-Id: Ide5ac70215d73278e6910f5b9c7687ad7734c0be
Reviewed-on: https://go-review.googlesource.com/1530Reviewed-by: 's avatarDavid Symonds <dsymonds@golang.org>
parent d160d1bc
......@@ -1087,7 +1087,9 @@ WaitResponse:
break WaitResponse
}
if d := pc.t.ResponseHeaderTimeout; d > 0 {
respHeaderTimer = time.After(d)
timer := time.NewTimer(d)
defer timer.Stop() // prevent leaks
respHeaderTimer = timer.C
}
case <-pconnDeadCh:
// The persist connection is dead. This shouldn't
......
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