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

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


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

commit a72847f8adda9692c7688454407c36b7a12b2448
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 ff9ba95..881d513 100644
--- a/java/org/apache/catalina/core/ApplicationContext.java
+++ b/java/org/apache/catalina/core/ApplicationContext.java
@@ -446,7 +446,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 d5e1fcb..a0d27ca 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