Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http/httputil: ReverseProxy.Director comments unclear leads to potential race #18456

Closed
mikewiacek opened this issue Dec 28, 2016 · 1 comment

Comments

@mikewiacek
Copy link
Contributor

The godoc comments on net/http/httputil ReverseProxy need to be clarified. The ReverseProxy.Director function can not continue to access the provided http.Request after it returns. The code in ReverseProxy that calls the user supplied Director function will sometimes modify the Header field after Director returns, which can lead to a concurrent read/write on http.Request.Header.

My code hit a sporadic race condition due to this behavior. Director launched a goroutine to do some specialized request logging. This lead to a panic after several thousand requests.

@bradfitz bradfitz changed the title net/http/httputil ReverseProxy Director comments unclear leads to potential race net/http/httputil: ReverseProxy.Director comments unclear leads to potential race Dec 29, 2016
@bradfitz bradfitz added this to the Go1.9 milestone Dec 29, 2016
@gopherbot
Copy link

CL https://golang.org/cl/34720 mentions this issue.

@golang golang locked and limited conversation to collaborators Dec 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants