IDN for owner check

This commit is contained in:
M66B 2022-07-08 21:37:07 +02:00
parent 02bd0a3af3
commit 4c3c1b12e4
1 changed files with 6 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import androidx.core.net.MailTo;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.IDN;
import java.net.InetAddress;
import java.net.URL;
import java.net.UnknownHostException;
@ -57,6 +58,11 @@ public class IPInfo {
String host = uri.getHost();
if (host == null)
throw new UnknownHostException();
try {
host = IDN.toASCII(host, IDN.ALLOW_UNASSIGNED);
} catch (Throwable ex) {
Log.i(ex);
}
InetAddress address = InetAddress.getByName(host);
return new Pair<>(address, getOrganization(address, context));
}