net/http: TimeoutHandler should start timer when serving request
TimeoutHandler was starting the Timer when the handler was created, instead of when serving a request. It also was sharing it between multiple requests, which is incorrect, as the requests might start at different times. Store the timeout duration and create the Timer when ServeHTTP is called. Different requests will have different timers. The testing plumbing was simplified to store the channel used to control when timeout happens. It overrides the regular timer. Fixes #14568. Change-Id: I4bd51a83f412396f208682d3ae5e382db5f8dc81 Reviewed-on: https://go-review.googlesource.com/20046Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Showing
Please register or sign in to comment