-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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/url: issue with encoding spaces #4013
Labels
Comments
Is that actually specified somewhere? net/url assumes a query parameter to follow application/x-www-form-urlencoded rules instead of RFC's. RFC1738 defines + as an allowed character but doesn't specify it to be a space, even though it is commonly regarded as such. RFC3986 seems to recommend %20 for spaces. net/url makes a special case out of the space, even though url.go refers to RFC3986. If I recall correctly the + sign is used when a browser submits a form to an url, for legacy reasons(?) when using mime-type 'application/x-www-form-urlencoded'. This is, however, not part of an RFC? So both forms are in use and both appear to be syntactically correct (even though using the + sign is older but more readable), so when encoding one just has to choose. See also: http://en.wikipedia.org/wiki/Percent-encoding#The_application.2Fx-www-form-urlencoded_type |
It seems that the query portion can be escaped as "%20" or "+" and the path portion can only be escaped as "%20". I was using this function to generate paths and because "+" did not become spaces, according the browser, there was an unintended consequence. It seems to me it would be better to have it encode to "%20" as they work for both cases. |
mrmiroslav
pushed a commit
to mrmiroslav/amazing
that referenced
this issue
May 6, 2015
AWS Signature V2 used in Product Advertising API (API Version 2013-08-01) is using %20 for space encoding within signature, where is golang uses +. This produces a signature mismatch when amazon verifies signature. References: http://docs.aws.amazon.com/AWSECommerceService/latest/DG/RESTSyntax.html golang/go#4013
API for proper percent-encoding would be still nice to have. |
mikioh
changed the title
net/url issue with encoding spaces
net/url: issue with encoding spaces
Jun 13, 2015
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by [email protected]:
The text was updated successfully, but these errors were encountered: