net/url: RequestURI encoded path should not encode '!'
Opened this issue · 17 comments
Deleted user commented
see https://groups.google.com/forum/#!topic/golang-nuts/5er6Ud_V0-U
Deleted user commented
see http://play.golang.org/p/X6LGcNbHzA, it's more obvious. it's affected by all struts2 framework, it's serious.
davecheney commented
Here is a smaller reproduction, http://play.golang.org/p/xPQ61lbUqE The bone of contention is the encoding of !. I am not sure if this is a problem or not.
Deleted user commented
The https://www.shipin7.com/user/userAction%21goRegister.action page is incorrect. https://www.shipin7.com/user/userAction!goRegister.action page is ok. you can compare above in Browser. http.Client.Do(), http.Get() internal encode '!' and send whole Request to server. I think '!' should not encode because of RFC3986
gopherbot commented
In RFC 2396:
reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
"$" | ","
unreserved = alphanum | mark
mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")"
In RFC 3986:
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
https://code.google.com/p/go/source/detail?r=6b46fb967ca4a48caf486f4452c4358251f91aad
The CL above only removes !*\() from unreserved part(the \ may be wrong, it should be
"'"),
but doesn't add []!'()* to the reserved part. So I think it's a bug.gopherbot commented
rsc commented
dsymonds commented
rsc commented
rsc commented
gopherbot commented
This also triggers with the hashbang style single-page web app url fragments: http://play.golang.org/p/-kx5yULrzl u, err := url.Parse("http://foo.bar/#!quux") // http://foo.bar/#%21quux See https://developers.google.com/webmasters/ajax-crawling/ for more.
minux commented
https://golang.org/cl/31400043/ Does anyone know why ! is left out in the first place? was that intentional?
Status changed to Started.
andybalholm commented
Some examples of URLs where parentheses don't work if they're escaped: http://web.signaltiretrader.com/(S(5iexcz551ptpgo45g03mgz45))/Themes/css/ploneColumns.css and the LinkedIn API URLs discussed at https://groups.google.com/forum/#!searchin/golang-nuts/url$20escaping/golang-nuts/Mro8TGrb3y8/eW8QCx_iFYMJ
gopherbot commented
jkbbwr on IRC pointed out that slashes in queries get quoted too: http://play.golang.org/p/EiRhkOT8im Relevant RFC: http://tools.ietf.org/html/rfc3986#section-3.4
gopherbot commented
andybalholm commented
andybalholm commented
Referenced on StackOverflow: http://stackoverflow.com/questions/20847357/golang-http-client-always-escaped-the-url/