• Caio Marcelo de Oliveira Filho's avatar
    net/http: TimeoutHandler should start timer when serving request · bd68b8ab
    Caio Marcelo de Oliveira Filho authored
    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: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    bd68b8ab
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...