Fix ForwardedHeaderFilter getRequestURL()
Previously ForwardedHeaderFilter would return the same StringBuffer for every invocation. This meant that users that modified the StringBuffer changed the state of the HttpServletRequest. This commit ensures that a new StringBuffer is always returned for ForwardedHeaderFilter. Issue: SPR-15423
This commit is contained in:
@@ -204,6 +204,16 @@ public class ForwardedHeaderFilterTests {
|
||||
HttpServletRequest actual = filterAndGetWrappedRequest();
|
||||
assertEquals("http://localhost/prefix/mvc-showcase", actual.getRequestURL().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void requestURLNewStringBuffer() throws Exception {
|
||||
this.request.addHeader(X_FORWARDED_PREFIX, "/prefix/");
|
||||
this.request.setRequestURI("/mvc-showcase");
|
||||
|
||||
HttpServletRequest actual = filterAndGetWrappedRequest();
|
||||
actual.getRequestURL().append("?key=value");
|
||||
assertEquals("http://localhost/prefix/mvc-showcase", actual.getRequestURL().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void contextPathWithForwardedPrefix() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user