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
							
								
									96bfe7d197
								
							
						
					
					
						commit
						e92e65f8c3
					
				| 
						 | 
				
			
			@ -74,6 +74,7 @@ public class ForwardedHeaderFilter extends OncePerRequestFilter {
 | 
			
		|||
	public ForwardedHeaderFilter() {
 | 
			
		||||
		this.pathHelper = new UrlPathHelper();
 | 
			
		||||
		this.pathHelper.setUrlDecode(false);
 | 
			
		||||
		this.pathHelper.setRemoveSemicolonContent(false);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -169,6 +169,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