]> Cypherpunks repositories - gostls13.git/commit
net/http: fix data race when sharing request body between client and server
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 7 Jan 2014 18:40:56 +0000 (10:40 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 7 Jan 2014 18:40:56 +0000 (10:40 -0800)
commitaffab3f3128558dd808247f01abfee4b2bfee712
treed510e7fde474fe267cfbacfe4c2da9666f157f51
parent39a396d2ba470e24316be700db76aafbec963156
net/http: fix data race when sharing request body between client and server

A server Handler (e.g. a proxy) can receive a Request, and
then turn around and give a copy of that Request.Body out to
the Transport. So then two goroutines own that Request.Body
(the server and the http client), and both think they can
close it on failure.  Therefore, all incoming server requests
bodies (always *http.body from transfer.go) need to be
thread-safe.

Fixes #6995

R=golang-codereviews, r
CC=golang-codereviews
https://golang.org/cl/46570043
src/pkg/net/http/response_test.go
src/pkg/net/http/serve_test.go
src/pkg/net/http/transfer.go
src/pkg/net/http/transfer_test.go