]> Cypherpunks repositories - gostls13.git/commit
net/http: fix TimeoutHandler data races; hold lock longer
authorBrad Fitzpatrick <bradfitz@golang.org>
Wed, 20 Aug 2014 01:45:05 +0000 (18:45 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 20 Aug 2014 01:45:05 +0000 (18:45 -0700)
commite38fa9164894b2610a41b335a56e3b6494a3cef6
treeccceef2bb43ee1e7a16654dd1a4a2828b140afda
parent339a24da6611487308b497a2ba7506c5451c637f
net/http: fix TimeoutHandler data races; hold lock longer

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
src/pkg/net/http/serve_test.go
src/pkg/net/http/server.go