8201815: Use Mozilla Public Suffix List

Reviewed-by: michaelm, erikj, ihse
This commit is contained in:
Weijun Wang 2018-06-26 18:55:48 +08:00
parent 19f5116cd9
commit 60ff77bd97
13 changed files with 13920 additions and 928 deletions

View file

@ -675,9 +675,21 @@ public final class SocketPermission extends Permission
private transient String cdomain, hdomain;
/**
* previously we allowed domain names to be specified in IDN ACE form
* Need to check for that and convert to Unicode
*/
private static String checkForIDN(String name) {
if (name.startsWith("xn--") || name.contains(".xn--")) {
return IDN.toUnicode(name);
} else {
return name;
}
}
private boolean match(String cname, String hname) {
String a = cname.toLowerCase();
String b = hname.toLowerCase();
String a = checkForIDN(cname.toLowerCase());
String b = checkForIDN(hname.toLowerCase());
if (a.startsWith(b) &&
((a.length() == b.length()) || (a.charAt(b.length()) == '.'))) {
return true;