-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: NewRequest modifies path #8767
Labels
Milestone
Comments
Thanks for the report. Diagnosis: http.NewRequest parses the URL, which unescapes the :, /, and + in the path -- see http://play.golang.org/p/HNK6Qa4RfH. curl, browsers, etc. send the original path. cloudfront doesn't treat the unescaped and the escaped paths the same, which looks like a violation of the RFC. On the other hand, it seems like the http client shouldn't modify the path provided to it. Brad? Labels changed: added repo-main. Owner changed to @bradfitz. |
This is the dozenth bug in the same theme. It's been like this for ages. The http client ultimately uses net/url.Parse which unescapes the path. The workaround has been documented at http://golang.org/pkg/net/url/#URL but not on url.Parse, nor on http.Get and friends. Perhaps we need a new url.ParseRaw or something which is documented to guarantee to round-trip (String->Parse->String), parsing into the url.Opaque field as needed to preserve the guarantee. Then we can adjust net/http to use url.ParseRaw instead. Assigning to Russ for his opinion, and he can assign back to me to implement if desired. Owner changed to @rsc. |
Update: I added an example at https://golang.org/cl/171620043 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by stuart.carnie:
The text was updated successfully, but these errors were encountered: