This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
     new cccb520  Be explicit that UTF-8 is used for encoded dispatcher paths
cccb520 is described below

commit cccb520b2bb4f4f22f66071118349681544d95d2
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Mar 16 15:21:35 2020 +0000

    Be explicit that UTF-8 is used for encoded dispatcher paths
    
    Be consistent with AsyncContext and getRequestDispatcher()
---
 java/org/apache/catalina/core/ApplicationContext.java | 2 +-
 webapps/docs/config/context.xml                       | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/java/org/apache/catalina/core/ApplicationContext.java 
b/java/org/apache/catalina/core/ApplicationContext.java
index 3561324..d44ef02 100644
--- a/java/org/apache/catalina/core/ApplicationContext.java
+++ b/java/org/apache/catalina/core/ApplicationContext.java
@@ -429,7 +429,7 @@ public class ApplicationContext implements ServletContext {
 
         if (getContext().getDispatchersUseEncodedPaths()) {
             // Decode
-            String decodedUri = UDecoder.URLDecode(normalizedUri);
+            String decodedUri = UDecoder.URLDecode(normalizedUri, 
StandardCharsets.UTF_8);
 
             // Security check to catch attempts to encode /../ sequences
             normalizedUri = RequestUtil.normalize(decodedUri);
diff --git a/webapps/docs/config/context.xml b/webapps/docs/config/context.xml
index 767aefe..873ff75 100644
--- a/webapps/docs/config/context.xml
+++ b/webapps/docs/config/context.xml
@@ -374,7 +374,8 @@
         ares expected to be encoded. This affects both how Tomcat handles calls
         to obtain a request dispatcher as well as how Tomcat generates paths
         used to obtain request dispatchers internally. If not specified, the
-        default value of <code>true</code> is used.</p>
+        default value of <code>true</code> is used. When encoding/decoding 
paths
+        for a request dispatcher, UTF-8 is always used.</p>
       </attribute>
 
       <attribute name="failCtxIfServletStartFails" required="false">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to