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
net/http/httputil: handle escaped paths in SingleHostReverseProxy
When forwarding a request, a SingleHostReverseProxy appends the
request's path to the target URL's path. However, if certain path
elements are encoded, (such as %2F for slash in either the request or
target path), simply joining the URL.Path elements is not sufficient,
since the field holds the *decoded* path.
Since 87a605, the RawPath field was added which holds a decoding hint for the URL.
When joining URL paths, this decoding hint needs to be taken into consideration.
As an example, if the target URL.Path is /a/b, and URL.RawPath is /a%2Fb,
joining the path with /c should result in /a/b/c URL.Path, and /a%2Fb/c
in RawPath.
The added joinURLPath function combines the two URL's Paths,
while taking into account escaping, and replaces the previously used
singleJoiningSlash in NewSingleHostReverseProxy.
Fixes#35908
0 commit comments