mirror of
https://github.com/golang/go
synced 2024-11-23 22:30:05 -07:00
bb54a855a9
The StripPrefix wrapper strips a prefix string from the request's URL.Path field, but doesn't touch the RawPath field. This leads to the confusing situation when StripPrefix handles a request with URL.RawPath populated (due to some escaped characters in the request path) and the wrapped request's RawPath contains the prefix but Path does not. This change modifies StripPrefix to strip the prefix from both Path and RawPath. If there are escaped characters in the prefix part of the request URL the stripped handler serves a 404 instead of invoking the underlying handler with a mismatched Path/RawPath pair. This is a backward incompatible change for a very small minority of requests; I would be surprised if anyone is depending on this behavior, but it is possible. If that's the case, we could make a more conservative change where the RawPath is trimmed if possible, but when the prefix contains escaped characters then we don't 404 but rather send through the invalid Path/RawPath pair as before. Fixes #24366 Change-Id: I7030b8c183a3dfce307bc0272bba9a18df4cfe08 Reviewed-on: https://go-review.googlesource.com/c/go/+/233637 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> |
||
---|---|---|
.. | ||
articles | ||
codewalk | ||
gopher | ||
play | ||
progs | ||
asm.html | ||
cmd.html | ||
contribute.html | ||
debugging_with_gdb.html | ||
diagnostics.html | ||
editors.html | ||
effective_go.html | ||
gccgo_contribute.html | ||
gccgo_install.html | ||
go1.1.html | ||
go1.2.html | ||
go1.3.html | ||
go1.4.html | ||
go1.5.html | ||
go1.6.html | ||
go1.7.html | ||
go1.8.html | ||
go1.9.html | ||
go1.10.html | ||
go1.11.html | ||
go1.12.html | ||
go1.13.html | ||
go1.14.html | ||
go1.15.html | ||
go1.16.html | ||
go1.html | ||
go1compat.html | ||
go_faq.html | ||
go_mem.html | ||
go_spec.html | ||
go-logo-black.png | ||
go-logo-blue.png | ||
go-logo-white.png | ||
help.html | ||
ie.css | ||
install-source.html | ||
install.html | ||
share.png | ||
tos.html |