You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What did you expect to see?
I expected HTTP handler to get a request with URL equivalent to URL in original request, i.e. /a%2F%2Fb. Per https://tools.ietf.org/html/rfc3986#section-2.2/a/b and even /a//b are NOT EQUIVALENT to /a%2F%2Fb
This happens because http.ServeMux uses URL.Path, which already contains wrong data /a//b, does some normalization on that and issues a redirect to /a/b, so user handler is never invoked during the initial request, only after this redirect.
I suggest one of these ways to fix this:
Make net/url percent-decode only unreserved characters, making it compliant with RFC3986
Use EscapedPath() in http.ServeMux, so it will see the data before net/url spoiled it
Both options (and probably any other) break API in one way or another.
Yes, I saw the response on #8248 that this is documented behavior, but it directly contradicts relevant Internet standard, so it's worth to be changed.