felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1744764 - in /felix/trunk/http/sslfilter/src: main/java/org/apache/felix/http/sslfilter/internal/SslFilterRequest.java test/java/org/apache/felix/http/sslfilter/internal/SslFilterRequestTest.java
Date Fri, 20 May 2016 16:09:13 GMT
Author: cziegeler
Date: Fri May 20 16:09:13 2016
New Revision: 1744764

URL: http://svn.apache.org/viewvc?rev=1744764&view=rev
Log:
SLING-5259 : SslFilterRequest always returns -1 when X-Forwarded-Port header is not present.
Apply patch from Bryan Stopp

Modified:
    felix/trunk/http/sslfilter/src/main/java/org/apache/felix/http/sslfilter/internal/SslFilterRequest.java
    felix/trunk/http/sslfilter/src/test/java/org/apache/felix/http/sslfilter/internal/SslFilterRequestTest.java

Modified: felix/trunk/http/sslfilter/src/main/java/org/apache/felix/http/sslfilter/internal/SslFilterRequest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/sslfilter/src/main/java/org/apache/felix/http/sslfilter/internal/SslFilterRequest.java?rev=1744764&r1=1744763&r2=1744764&view=diff
==============================================================================
--- felix/trunk/http/sslfilter/src/main/java/org/apache/felix/http/sslfilter/internal/SslFilterRequest.java
(original)
+++ felix/trunk/http/sslfilter/src/main/java/org/apache/felix/http/sslfilter/internal/SslFilterRequest.java
Fri May 20 16:09:13 2016
@@ -114,7 +114,7 @@ class SslFilterRequest extends HttpServl
         catch (Exception e)
         {
             // Use default port for the used protocol...
-            port = -1;
+            port = getRequest().getServerPort();
         }
         return port;
     }    

Modified: felix/trunk/http/sslfilter/src/test/java/org/apache/felix/http/sslfilter/internal/SslFilterRequestTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/sslfilter/src/test/java/org/apache/felix/http/sslfilter/internal/SslFilterRequestTest.java?rev=1744764&r1=1744763&r2=1744764&view=diff
==============================================================================
--- felix/trunk/http/sslfilter/src/test/java/org/apache/felix/http/sslfilter/internal/SslFilterRequestTest.java
(original)
+++ felix/trunk/http/sslfilter/src/test/java/org/apache/felix/http/sslfilter/internal/SslFilterRequestTest.java
Fri May 20 16:09:13 2016
@@ -90,15 +90,19 @@ public class SslFilterRequestTest
         SslFilterRequest sreq = new SslFilterRequest(req, null);
         
         when(req.getHeader(HDR_X_FORWARDED_PORT)).thenReturn(null);        
+        when(req.getServerPort()).thenReturn(-1);
         assertEquals(-1, sreq.getServerPort());
         
         when(req.getHeader(HDR_X_FORWARDED_PORT)).thenReturn("");        
+        when(req.getServerPort()).thenReturn(-1);
         assertEquals(-1, sreq.getServerPort());
         
         when(req.getHeader(HDR_X_FORWARDED_PORT)).thenReturn("WRONG");        
+        when(req.getServerPort()).thenReturn(-1);
         assertEquals(-1, sreq.getServerPort());
         
         when(req.getHeader(HDR_X_FORWARDED_PORT)).thenReturn("W1");        
+        when(req.getServerPort()).thenReturn(-1);
         assertEquals(-1, sreq.getServerPort());
         
         when(req.getHeader(HDR_X_FORWARDED_PORT)).thenReturn("443");        



Mime
View raw message