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

Commit 11ae28f3 authored by Hugo Benichi's avatar Hugo Benichi
Browse files

Change network validation probe default configs

This patch changes the default configuration values for captive
portal detection.

Now by default:
  - the HTTPS probe tries to connect to www.google.com/generate_204
    instead of connectivitycheck.gstatic.com/generate_204
  - the fallback probe is used and tries to connect to
    google.com/gen_204
  - the request header User-Agent field is set to appears similar to
    a Chrome request.

Bug: 29367974
Change-Id: Ic965e2693e154e96bf0f7e4c1b9a2f704b9c3452
parent 92eb22fd
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -82,13 +82,16 @@ public class NetworkMonitor extends StateMachine {
    private static final String TAG = NetworkMonitor.class.getSimpleName();
    private static final boolean DBG = false;

    // Default urls for captive portal detection probes
    private static final String DEFAULT_HTTPS_URL     =
            "https://connectivitycheck.gstatic.com/generate_204";
    // Default configuration values for captive portal detection probes.
    // TODO: append a random length parameter to the default HTTPS url.
    // TODO: randomize browser version ids in the default User-Agent String.
    private static final String DEFAULT_HTTPS_URL     = "https://www.google.com/generate_204";
    private static final String DEFAULT_HTTP_URL      =
            "http://connectivitycheck.gstatic.com/generate_204";
    private static final String DEFAULT_FALLBACK_URL  = null;
    private static final String DEFAULT_USER_AGENT    = null;
    private static final String DEFAULT_FALLBACK_URL  = "http://www.google.com/gen_204";
    private static final String DEFAULT_USER_AGENT    = "Mozilla/5.0 (X11; Linux x86_64) "
                                                      + "AppleWebKit/537.36 (KHTML, like Gecko) "
                                                      + "Chrome/52.0.2743.82 Safari/537.36";

    private static final int SOCKET_TIMEOUT_MS = 10000;
    private static final int PROBE_TIMEOUT_MS  = 3000;