felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r1771365 - /felix/trunk/httplite/core/src/main/java/org/apache/felix/httplite/servlet/HttpServletRequestImpl.java
Date Fri, 25 Nov 2016 18:13:02 GMT
Author: bimargulies
Date: Fri Nov 25 18:13:01 2016
New Revision: 1771365

URL: http://svn.apache.org/viewvc?rev=1771365&view=rev
Log:
FELIX-5423: decode parameter values in httplite.

Modified:
    felix/trunk/httplite/core/src/main/java/org/apache/felix/httplite/servlet/HttpServletRequestImpl.java

Modified: felix/trunk/httplite/core/src/main/java/org/apache/felix/httplite/servlet/HttpServletRequestImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/httplite/core/src/main/java/org/apache/felix/httplite/servlet/HttpServletRequestImpl.java?rev=1771365&r1=1771364&r2=1771365&view=diff
==============================================================================
--- felix/trunk/httplite/core/src/main/java/org/apache/felix/httplite/servlet/HttpServletRequestImpl.java
(original)
+++ felix/trunk/httplite/core/src/main/java/org/apache/felix/httplite/servlet/HttpServletRequestImpl.java
Fri Nov 25 18:13:01 2016
@@ -1081,8 +1081,15 @@ public class HttpServletRequestImpl impl
 
             if ( nva.length == 2 )
             {
-                //Deprecated method decode() intentionally used for Java 1.3 compatibility.
-                params.put( URLDecoder.decode( nva[0].trim() ), nva[1].trim() );
+		// Also decode value, not just name.
+		boolean mustDecodeValue = nva[1].indexOf('+') >= 0 || nva[1].indexOf('%') >= 0;
+		//Deprecated method decode() intentionally used for Java 1.3 compatibility.
+                //Tomcat only does this if it sees some evidence of encoding.
+                String val = nva[1].trim();
+                if (mustDecodeValue) {
+                    val = URLDecoder.decode(val);
+                }
+                params.put( URLDecoder.decode( nva[0].trim() ), val );
             }
         }
     }



Mime
View raw message