Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66d8d2a5 authored by Erik Kline's avatar Erik Kline Committed by android-build-merger
Browse files

Merge "Fix CaptivePortalLoginActivity probes to bypass Private DNS"

am: ec629e2f

Change-Id: Ieca1a7b245f08b71e56deaaea870f6dd6c6844c4
parents cfefe5bf ec629e2f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -320,6 +320,7 @@ public class CaptivePortalLoginActivity extends Activity {
        // TODO: reuse NetworkMonitor facilities for consistent captive portal detection.
        new Thread(new Runnable() {
            public void run() {
                final Network network = ResolvUtil.makeNetworkWithPrivateDnsBypass(mNetwork);
                // Give time for captive portal to open.
                try {
                    Thread.sleep(1000);
@@ -328,7 +329,7 @@ public class CaptivePortalLoginActivity extends Activity {
                HttpURLConnection urlConnection = null;
                int httpResponseCode = 500;
                try {
                    urlConnection = (HttpURLConnection) mNetwork.openConnection(mUrl);
                    urlConnection = (HttpURLConnection) network.openConnection(mUrl);
                    urlConnection.setInstanceFollowRedirects(false);
                    urlConnection.setConnectTimeout(SOCKET_TIMEOUT_MS);
                    urlConnection.setReadTimeout(SOCKET_TIMEOUT_MS);
+9 −0
Original line number Diff line number Diff line
@@ -62,4 +62,13 @@ public class ResolvUtil {
        final long netidForResolv = NETID_USE_LOCAL_NAMESERVERS | (long) network.netId;
        return new Network((int) netidForResolv);
    }

    public static Network makeNetworkWithPrivateDnsBypass(Network network) {
        return new Network(network) {
            @Override
            public InetAddress[] getAllByName(String host) throws UnknownHostException {
                return blockingResolveAllLocally(network, host);
            }
        };
    }
}