1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00

IDN for owner check

This commit is contained in:
M66B 2022-07-08 21:37:07 +02:00
parent 02bd0a3af3
commit 4c3c1b12e4

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));
}