Skip to content

Commit 92bbd81

Browse files
committed
Make removal of jsessionid case insensitive
Issue: SPR-10398
1 parent 9c19469 commit 92bbd81

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

spring-web/src/main/java/org/springframework/web/util/UrlPathHelper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ private String removeSemicolonContentInternal(String requestUri) {
457457
}
458458

459459
private String removeJsessionid(String requestUri) {
460-
int startIndex = requestUri.indexOf(";jsessionid=");
460+
int startIndex = requestUri.toLowerCase().indexOf(";jsessionid=");
461461
if (startIndex != -1) {
462462
int endIndex = requestUri.indexOf(';', startIndex + 12);
463463
String start = requestUri.substring(0, startIndex);

spring-web/src/test/java/org/springframework/web/util/UrlPathHelperTests.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616

1717
package org.springframework.web.util;
1818

19-
import static org.junit.Assert.assertEquals;
20-
import static org.junit.Assert.assertNull;
21-
2219
import java.io.UnsupportedEncodingException;
2320

2421
import org.junit.Before;
2522
import org.junit.Ignore;
2623
import org.junit.Test;
2724
import org.springframework.mock.web.test.MockHttpServletRequest;
2825

26+
import static org.junit.Assert.*;
27+
2928
/**
3029
* @author Rob Harrop
3130
* @author Juergen Hoeller
@@ -111,6 +110,11 @@ public void getRequestKeepSemicolonContent() throws UnsupportedEncodingException
111110

112111
request.setRequestURI("/foo;a=b;jsessionid=c0o7fszeb1;c=d");
113112
assertEquals("jsessionid should always be removed", "/foo;a=b;c=d", helper.getRequestUri(request));
113+
114+
// SPR-10398
115+
116+
request.setRequestURI("/foo;a=b;JSESSIONID=c0o7fszeb1;c=d");
117+
assertEquals("JSESSIONID should always be removed", "/foo;a=b;c=d", helper.getRequestUri(request));
114118
}
115119

116120
@Test

0 commit comments

Comments
 (0)