You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2016/04/13 21:06:52 UTC

svn commit: r1738994 - in /felix/trunk/http/sslfilter: pom.xml src/main/java/org/apache/felix/http/sslfilter/internal/SslFilterResponse.java src/test/java/org/apache/felix/http/sslfilter/internal/SslFilterResponseTest.java

Author: cziegeler
Date: Wed Apr 13 19:06:52 2016
New Revision: 1738994

URL: http://svn.apache.org/viewvc?rev=1738994&view=rev
Log:
FELIX-5234 : SSL Filter URL Decoding Path Issues

Modified:
    felix/trunk/http/sslfilter/pom.xml
    felix/trunk/http/sslfilter/src/main/java/org/apache/felix/http/sslfilter/internal/SslFilterResponse.java
    felix/trunk/http/sslfilter/src/test/java/org/apache/felix/http/sslfilter/internal/SslFilterResponseTest.java

Modified: felix/trunk/http/sslfilter/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/http/sslfilter/pom.xml?rev=1738994&r1=1738993&r2=1738994&view=diff
==============================================================================
--- felix/trunk/http/sslfilter/pom.xml (original)
+++ felix/trunk/http/sslfilter/pom.xml Wed Apr 13 19:06:52 2016
@@ -110,7 +110,7 @@
         <dependency>
           <groupId>org.eclipse.jetty</groupId>
           <artifactId>jetty-servlet</artifactId>
-          <version>${jetty.version}</version>
+          <version>9.2.15.v20160210</version>
           <scope>test</scope>
         </dependency>
 

Modified: felix/trunk/http/sslfilter/src/main/java/org/apache/felix/http/sslfilter/internal/SslFilterResponse.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/sslfilter/src/main/java/org/apache/felix/http/sslfilter/internal/SslFilterResponse.java?rev=1738994&r1=1738993&r2=1738994&view=diff
==============================================================================
--- felix/trunk/http/sslfilter/src/main/java/org/apache/felix/http/sslfilter/internal/SslFilterResponse.java (original)
+++ felix/trunk/http/sslfilter/src/main/java/org/apache/felix/http/sslfilter/internal/SslFilterResponse.java Wed Apr 13 19:06:52 2016
@@ -193,9 +193,9 @@ class SslFilterResponse extends HttpServ
                 sb.append(':');
                 sb.append(this.clientPort);
             }
-            if ( uri.getPath() != null )
+            if ( uri.getRawPath() != null )
             {
-                sb.append(uri.getPath());
+                sb.append(uri.getRawPath());
             }
             if ( uri.getRawQuery() != null )
             {

Modified: felix/trunk/http/sslfilter/src/test/java/org/apache/felix/http/sslfilter/internal/SslFilterResponseTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/sslfilter/src/test/java/org/apache/felix/http/sslfilter/internal/SslFilterResponseTest.java?rev=1738994&r1=1738993&r2=1738994&view=diff
==============================================================================
--- felix/trunk/http/sslfilter/src/test/java/org/apache/felix/http/sslfilter/internal/SslFilterResponseTest.java (original)
+++ felix/trunk/http/sslfilter/src/test/java/org/apache/felix/http/sslfilter/internal/SslFilterResponseTest.java Wed Apr 13 19:06:52 2016
@@ -210,6 +210,20 @@ public class SslFilterResponseTest
         assertEquals(expectedUrl, sresp.getHeader(SslFilterConstants.HDR_LOCATION));
     }
 
+    @Test
+    public void testPathEncoding() throws Exception
+    {
+        TestHttpServletResponse response = createServletResponse();
+        HttpServletRequest req = createServletRequest(BACKEND_SERVER, PATH);
+
+        SslFilterResponse sresp = new SslFilterResponse(response, req);
+
+        final String setUrl = "http://" + BACKEND_SERVER + "/apps/test/content/%E4%B8%83%E6%9C%88%E5%8F%B7.redirect";
+        sresp.setHeader(SslFilterConstants.HDR_LOCATION, setUrl);
+
+        assertEquals("https://" + BACKEND_SERVER + "/apps/test/content/%E4%B8%83%E6%9C%88%E5%8F%B7.redirect", sresp.getHeader(SslFilterConstants.HDR_LOCATION));
+    }
+
     private HttpServletRequest createServletRequest(String serverName, String requestURL)
     {
         return createServletRequest(serverName, DEFAULT_HTTP_PORT, HTTPS, DEFAULT_HTTPS_PORT, requestURL);