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

Commit ec629e2f authored by Erik Kline's avatar Erik Kline Committed by Gerrit Code Review
Browse files

Merge "Fix CaptivePortalLoginActivity probes to bypass Private DNS"

parents b686b9cf 848d842a
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);
            }
        };
    }
}