-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: Request.WithContext should deep copy all pointer/map fields #23544
Comments
Related to #20068, which added URL deep-copying. |
Probably, but this is also getting a little sad in terms of copies/allocs. It might be time for a new Unfortunately the name |
Alternatively we could export the context. There's nothing special about it compared to the other mutable parts IMO. Then add |
It was an explicit decision to make it unexported, so people don't shoot themselves in the foot. Russ described the problem in the original bug(s). |
I'm probably alone here: I am strongly opposed to turning I also think https://golang.org/cl/41308 was a mistake. The CL description says "server.ServeHTTP mutates the request's URL", but net/http's server does not mutate |
ping @bradfitz @tombergan for decision |
Punting to Go 1.12. But I think we do probably want to add a Clone and a new Context-accepting NewRequest. And maybe revert CL 41308. But maybe this is all moot if we end up making a new http client interface. (#23707). |
I am checking in here to remind myself to be involved with the decision to rollback CL 41308 which I authored but also to be involved in this conversation, for Go1.12 |
Punting to Go 1.13. |
Change https://golang.org/cl/174324 mentions this issue: |
@bradfitz I just came across
I wanted to ask if Is |
WithContext works there. |
Right now WithContext deep-copies URL only. At minimum, it should also deep-copy Headers for the same reason. For some reason the code distinguishes URL because it is "not a map", but maps are also pointer types.
The text was updated successfully, but these errors were encountered: