]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.6] net/http: TimeoutHandler should start timer when serving request
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Mon, 29 Feb 2016 15:06:57 +0000 (12:06 -0300)
committerAndrew Gerrand <adg@golang.org>
Tue, 19 Apr 2016 23:07:19 +0000 (23:07 +0000)
commitf709adadf162ba7ded49f349485fc5cb078db0b0
treef951fa23a00f7d77adef407ecbef2ace4e92886a
parent14ebc59f6a4c28c7bf27ce47717ce9ced4441eea
[release-branch.go1.6] 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/20046
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-on: https://go-review.googlesource.com/22274
Reviewed-by: Andrew Gerrand <adg@golang.org>
Run-TryBot: Andrew Gerrand <adg@golang.org>
src/net/http/export_test.go
src/net/http/serve_test.go
src/net/http/server.go