OSDN Git Service

Use getBoundURL for network validation.
authorLorenzo Colitti <lorenzo@google.com>
Thu, 17 Jul 2014 16:57:34 +0000 (01:57 +0900)
committerLorenzo Colitti <lorenzo@google.com>
Tue, 29 Jul 2014 04:36:10 +0000 (13:36 +0900)
Disable for now, until we're more confident that it doesn't choke
on strange captive portals.

Change-Id: Ic8e66a379d32c915c949df70ca0d38535cd5dbe0

services/core/java/com/android/server/connectivity/NetworkMonitor.java

index 5260185..e1c102a 100644 (file)
@@ -617,8 +617,11 @@ public class NetworkMonitor extends StateMachine {
         int httpResponseCode = 599;
         try {
             URL url = new URL(urlString);
+            // TODO: check that standard HttpURLConnection doesn't choke on
+            // cruel and unusual captive portals, and then replace the
+            // hand-rolled HTTP code in the else branch with this code.
             if (false) {
-                // TODO: Need to add URLConnection.setNetwork() before we can enable.
+                url = mNetworkAgentInfo.network.getBoundURL(url);
                 urlConnection = (HttpURLConnection) url.openConnection();
                 urlConnection.setInstanceFollowRedirects(false);
                 urlConnection.setConnectTimeout(SOCKET_TIMEOUT_MS);