Author: scottbw
Date: Mon Jan 30 10:19:45 2012
New Revision: 1237591

URL: http://svn.apache.org/viewvc?rev=1237591&view=rev
Log:
Where no port is specified in a request, use default port (80 for http, 443 for 
https) when comparing against an access policy.

Modified:
    incubator/wookie/trunk/src/org/apache/wookie/proxy/Policy.java

Modified: incubator/wookie/trunk/src/org/apache/wookie/proxy/Policy.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/proxy/Policy.java?rev=1237591&r1=1237590&r2=1237591&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/proxy/Policy.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/proxy/Policy.java Mon Jan 30 
10:19:45 2012
@@ -151,11 +151,18 @@ public class Policy {
 
     //
     // Check ports match
-    // Note that where the Policy has no port specified, we treat
-    // this as being "any port"
     //
     int requestedPort = uri.getPort();
-    if (requestedPort == -1) requestedPort = 80;
+    //
+    // If there is no specified port in the request, substitute with default 
port
+    // based on the scheme
+    //
+    if (requestedPort == -1 && uri.getScheme().equals("http")) requestedPort = 
80;
+    if (requestedPort == -1 && uri.getScheme().equals("https")) requestedPort 
= 443;
+    //
+    // Note that where the Policy has no port specified, we treat
+    // this as being "any port" otherwise the ports must match
+    //
     if( match.getPort() != -1 && requestedPort !=  match.getPort()) return 0;
 
 


Reply via email to