You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/10/16 08:33:10 UTC
svn commit: r1708910 - in /tomcat/trunk:
java/org/apache/catalina/core/ApplicationPushBuilder.java
test/org/apache/catalina/core/TestApplicationPushBuilder.java
Author: markt
Date: Fri Oct 16 06:33:09 2015
New Revision: 1708910
URL: http://svn.apache.org/viewvc?rev=1708910&view=rev
Log:
Servlet 4.0
Use the correct character encoding (the one used for the original URI) to decode the push path.
Modified:
tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java
tomcat/trunk/test/org/apache/catalina/core/TestApplicationPushBuilder.java
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java?rev=1708910&r1=1708909&r2=1708910&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationPushBuilder.java Fri Oct 16 06:33:09 2015
@@ -364,7 +364,8 @@ public class ApplicationPushBuilder impl
// Undecoded path - just %nn encoded
pushTarget.requestURI().setString(pushPath);
- pushTarget.decodedURI().setString(decode(pushPath, baseRequest.getCharacterEncoding()));
+ pushTarget.decodedURI().setString(decode(pushPath,
+ catalinaRequest.getConnector().getURIEncodingLower()));
// Query string
if (pushQueryString == null && queryString != null) {
@@ -398,7 +399,7 @@ public class ApplicationPushBuilder impl
}
- // Package private so it can be tested
+ // Package private so it can be tested. charsetName must be in lower case.
static String decode(String input, String charsetName) {
int start = input.indexOf('%');
int end = 0;
@@ -410,7 +411,7 @@ public class ApplicationPushBuilder impl
Charset charset;
try {
- charset = B2CConverter.getCharset(charsetName);
+ charset = B2CConverter.getCharsetLower(charsetName);
} catch (UnsupportedEncodingException uee) {
// Impossible since original request would have triggered an error
// before reaching here
Modified: tomcat/trunk/test/org/apache/catalina/core/TestApplicationPushBuilder.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestApplicationPushBuilder.java?rev=1708910&r1=1708909&r2=1708910&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/core/TestApplicationPushBuilder.java (original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestApplicationPushBuilder.java Fri Oct 16 06:33:09 2015
@@ -23,27 +23,27 @@ public class TestApplicationPushBuilder
@Test
public void test01() {
- doTest("foo", "UTF-8", "foo");
+ doTest("foo", "utf-8", "foo");
}
@Test
public void test02() {
- doTest("/foo", "UTF-8", "/foo");
+ doTest("/foo", "utf-8", "/foo");
}
@Test
public void test03() {
- doTest("%20foo", "UTF-8", " foo");
+ doTest("%20foo", "utf-8", " foo");
}
@Test
public void test04() {
- doTest("fo%20o", "UTF-8", "fo o");
+ doTest("fo%20o", "utf-8", "fo o");
}
@Test
public void test05() {
- doTest("foo%20", "UTF-8", "foo ");
+ doTest("foo%20", "utf-8", "foo ");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org