Open mh47838704 opened 4 years ago
Looking at RFC 3986 ^
must always be percent encoded while !
may avoid percent encoding depending on its position in the URL. Section 3.3 indicates that !
need not be escaped. However any character in a path element may be percent escaped, for example https://google.com/a
and https://google.com/%61
are identical.
I agree that the addition of a character that must be escaped into a path element triggering other sub-delims to be percent encoded is surprising, but by my reading of the RFC not wrong.
Can you explain how you found this issue and what problem is it causing for you?
i found this,cause i build a web proxy use go,a url through this proxy,the “!” has been encoded to "21%",but the dest server also a proxy, dest server has a lot of rules to dispatch the request ,one of them is match the char “!”,because the "!" was encoded to "21%" when the request pass through my proxy server, so the dest server can not match correctly
Looking at RFC 3986
^
must always be percent encoded while!
may avoid percent encoding depending on its position in the URL. Section 3.3 indicates that!
need not be escaped. However any character in a path element may be percent escaped, for examplehttps://google.com/a
andhttps://google.com/%61
are identical.I agree that the addition of a character that must be escaped into a path element triggering other sub-delims to be percent encoded is surprising, but by my reading of the RFC not wrong.
Can you explain how you found this issue and what problem is it causing for you?
i found this,cause i build a web proxy use go,a url through this proxy,the “!” has been encoded to "21%",but the dest server also a proxy, dest server has a lot of rules to dispatch the request ,one of them is match the char “!”,because the "!" was encoded to "21%" when the request pass through my proxy server, so the dest server can not match correctly
and i also found the encoded logic is not the same, when path only has char "!" and when the path has any other char that need encode, the output can not keep the same, this is not what i want
/cc @rsc @bradfitz
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
alway Exist
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
for example
What did you see instead?
i found the code int sdk, "validEncoded" method treat the "!" as encoded, but in "escape" define "!" need encoed when mode is “encodePath”, where is judged in method "shouldEscape", logic conflict, so the result is not expected.
and i found other language do not encode "!" "(" ")" , such as python