Fix ForwardedHeaderFilter preserves semicolon content
Previously a requestURI that contained ';' would have the value incorrectly stripped out when using ForwardedHeaderFilter. This commit ensures that the ';' is preserved when using ForwardedHeaderFilter. Issue: SPR-15428
This commit is contained in:
parent
f65e1edd58
commit
95099fd709
|
|
@ -74,6 +74,7 @@ public class ForwardedHeaderFilter extends OncePerRequestFilter {
|
|||
public ForwardedHeaderFilter() {
|
||||
this.pathHelper = new UrlPathHelper();
|
||||
this.pathHelper.setUrlDecode(false);
|
||||
this.pathHelper.setRemoveSemicolonContent(false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -171,6 +171,17 @@ public class ForwardedHeaderFilterTests {
|
|||
assertEquals("/", actual.getRequestURI());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestUriPreserveSemicolonContent() throws Exception {
|
||||
this.request.setContextPath("");
|
||||
this.request.setRequestURI("/path;a=b/with/semicolon");
|
||||
HttpServletRequest actual = filterAndGetWrappedRequest();
|
||||
|
||||
assertEquals("", actual.getContextPath());
|
||||
assertEquals("/path;a=b/with/semicolon", actual.getRequestURI());
|
||||
assertEquals("http://localhost/path;a=b/with/semicolon", actual.getRequestURL().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void caseInsensitiveForwardedPrefix() throws Exception {
|
||||
this.request = new MockHttpServletRequest() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue