mirror of
https://github.com/golang/go
synced 2024-11-18 08:54:45 -07:00
net/http/httputil: fix race in DumpRequestOut
Fixes #3892. Swapping the order of the writers inside the MultiWriter ensures the request will be written to buf before http.ReadRequest completes. The fencedBuffer is not required to make the test pass on any machine that I have access too, but as the buf is shared across goroutines, I think it is necessary for correctness. R=bradfitz, fullung, franciscossouza CC=golang-dev https://golang.org/cl/6483061
This commit is contained in:
parent
d199c34cf0
commit
f8d4bb884f
@ -89,7 +89,7 @@ func DumpRequestOut(req *http.Request, body bool) ([]byte, error) {
|
||||
|
||||
t := &http.Transport{
|
||||
Dial: func(net, addr string) (net.Conn, error) {
|
||||
return &dumpConn{io.MultiWriter(pw, &buf), dr}, nil
|
||||
return &dumpConn{io.MultiWriter(&buf, pw), dr}, nil
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user