• Brad Fitzpatrick's avatar
    net/http: fix TimeoutHandler data races; hold lock longer · e38fa916
    Brad Fitzpatrick authored
    The existing lock needed to be held longer. If a timeout occured
    while writing (but after the guarded timeout check), the writes
    would clobber a future connection's buffer.
    
    Also remove a harmless warning by making Write also set the
    flag that headers were sent (implicitly), so we don't try to
    write headers later (a no-op + warning) on timeout after we've
    started writing.
    
    Fixes #8414
    Fixes #8209
    
    LGTM=ruiu, adg
    R=adg, ruiu
    CC=golang-codereviews
    https://golang.org/cl/123610043
    e38fa916
serve_test.go 77.3 KB