mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-cordova-android
This commit is contained in:
commit
1dfe7e59a7
@ -1930,24 +1930,24 @@ public class DroidGap extends PhonegapActivity {
|
|||||||
// Unlimited access to network resources
|
// Unlimited access to network resources
|
||||||
if(origin.compareTo("*") == 0) {
|
if(origin.compareTo("*") == 0) {
|
||||||
LOG.d(TAG, "Unlimited access to network resources");
|
LOG.d(TAG, "Unlimited access to network resources");
|
||||||
whiteList.add(Pattern.compile("*"));
|
whiteList.add(Pattern.compile(".*"));
|
||||||
} else { // specific access
|
} else { // specific access
|
||||||
// check if subdomains should be included
|
// check if subdomains should be included
|
||||||
// TODO: we should not add more domains if * has already been added
|
// TODO: we should not add more domains if * has already been added
|
||||||
if (subdomains) {
|
if (subdomains) {
|
||||||
// XXX making it stupid friendly for people who forget to include protocol/SSL
|
// XXX making it stupid friendly for people who forget to include protocol/SSL
|
||||||
if(origin.startsWith("http")) {
|
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 {
|
} 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);
|
LOG.d(TAG, "Origin to allow with subdomains: %s", origin);
|
||||||
} else {
|
} else {
|
||||||
// XXX making it stupid friendly for people who forget to include protocol/SSL
|
// XXX making it stupid friendly for people who forget to include protocol/SSL
|
||||||
if(origin.startsWith("http")) {
|
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 {
|
} else {
|
||||||
whiteList.add(Pattern.compile("^https{0,1}://"+origin));
|
whiteList.add(Pattern.compile("^https?://"+origin));
|
||||||
}
|
}
|
||||||
LOG.d(TAG, "Origin to allow: %s", origin);
|
LOG.d(TAG, "Origin to allow: %s", origin);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user