tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1763372 - /tomcat/trunk/java/org/apache/catalina/webresources/war/Handler.java
Date Wed, 05 Oct 2016 09:30:09 GMT
Author: markt
Date: Wed Oct  5 09:30:09 2016
New Revision: 1763372

URL: http://svn.apache.org/viewvc?rev=1763372&view=rev
Log:
Add a work-around for poorly constructed "war:..." URLs obtained from the security policy
file.

Modified:
    tomcat/trunk/java/org/apache/catalina/webresources/war/Handler.java

Modified: tomcat/trunk/java/org/apache/catalina/webresources/war/Handler.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/webresources/war/Handler.java?rev=1763372&r1=1763371&r2=1763372&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/webresources/war/Handler.java (original)
+++ tomcat/trunk/java/org/apache/catalina/webresources/war/Handler.java Wed Oct  5 09:30:09
2016
@@ -27,4 +27,20 @@ public class Handler extends URLStreamHa
     protected URLConnection openConnection(URL u) throws IOException {
         return new WarURLConnection(u);
     }
+
+    @Override
+    protected void setURL(URL u, String protocol, String host, int port, String authority,
String userInfo, String path,
+            String query, String ref) {
+        if (path.startsWith("file:") && !path.startsWith("file:/")) {
+            // Work around a problem with the URLs in the security policy file.
+            // On Windows, the use of ${catalina.[home|base]} in the policy file
+            // results in codebase URLs of the form file:C:/... when they should
+            // be file:/C:/...
+            // For file: and jar: URLs, the JRE compensates for this. It does not
+            // compensate for this for war:file:... URLs. Therefore, we do that
+            // here
+            path = "file:/" + path.substring(5);
+        }
+        super.setURL(u, protocol, host, port, authority, userInfo, path, query, ref);
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message