You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2012/01/19 00:13:55 UTC

git commit: fixing whitelist handling

Updated Branches:
  refs/heads/master 8db5e06c6 -> 64c462c8a


fixing whitelist handling


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/64c462c8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/64c462c8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/64c462c8

Branch: refs/heads/master
Commit: 64c462c8ad6d54d26c15b97ccc115b2cda6dc3aa
Parents: 8db5e06
Author: Anis Kadri <an...@gmail.com>
Authored: Fri Jan 13 17:29:46 2012 -0800
Committer: Anis Kadri <an...@gmail.com>
Committed: Fri Jan 13 17:29:46 2012 -0800

----------------------------------------------------------------------
 framework/src/com/phonegap/DroidGap.java |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/64c462c8/framework/src/com/phonegap/DroidGap.java
----------------------------------------------------------------------
diff --git a/framework/src/com/phonegap/DroidGap.java b/framework/src/com/phonegap/DroidGap.java
index 2eee859..fdf61b7 100755
--- a/framework/src/com/phonegap/DroidGap.java
+++ b/framework/src/com/phonegap/DroidGap.java
@@ -1904,24 +1904,24 @@ public class DroidGap extends PhonegapActivity {
         // Unlimited access to network resources
         if(origin.compareTo("*") == 0) {
             LOG.d(TAG, "Unlimited access to network resources");
-            whiteList.add(Pattern.compile("*"));
+            whiteList.add(Pattern.compile(".*"));
         } else { // specific access
           // check if subdomains should be included
           // TODO: we should not add more domains if * has already been added
           if (subdomains) {
               // XXX making it stupid friendly for people who forget to include protocol/SSL
               if(origin.startsWith("http")) {
-                whiteList.add(Pattern.compile(origin.replaceFirst("https{0,1}://", "^https{0,1}://.*")));
+                whiteList.add(Pattern.compile(origin.replaceFirst("https?://", "^https?://(.*\\.)?")));
               } else {
-                whiteList.add(Pattern.compile("^https{0,1}://.*"+origin));
+                whiteList.add(Pattern.compile("^https?://(.*\\.)?"+origin));
               }
               LOG.d(TAG, "Origin to allow with subdomains: %s", origin);
           } else {
               // XXX making it stupid friendly for people who forget to include protocol/SSL
               if(origin.startsWith("http")) {
-                whiteList.add(Pattern.compile(origin.replaceFirst("https{0,1}://", "^https{0,1}://")));
+                whiteList.add(Pattern.compile(origin.replaceFirst("https?://", "^https?://")));
               } else {
-                whiteList.add(Pattern.compile("^https{0,1}://"+origin));
+                whiteList.add(Pattern.compile("^https?://"+origin));
               }
               LOG.d(TAG, "Origin to allow: %s", origin);
           }