1
0
mirror of https://github.com/golang/go synced 2024-10-01 18:28:32 -06:00

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

Fixes #9104

Change-Id: Ide5ac70215d73278e6910f5b9c7687ad7734c0be
Reviewed-on: https://go-review.googlesource.com/1530
Reviewed-by: David Symonds <dsymonds@golang.org>
This commit is contained in:
Brad Fitzpatrick 2014-12-13 18:19:05 +11:00
parent d160d1bc87
commit 0e4ee0c9bf

View File

@ -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