OSDN Git Service

Fix captive portal detection on IPv6 networks.
authorLorenzo Colitti <lorenzo@google.com>
Tue, 8 Oct 2013 01:41:25 +0000 (10:41 +0900)
committerLorenzo Colitti <lorenzo@google.com>
Tue, 8 Oct 2013 05:15:14 +0000 (14:15 +0900)
commit143a2cf4134f94efb258f42928a1fb8b76606da8
tree3f7b7b74ff47493dda8d246c029b423c690d7e48
parentbe5ba9a255e258e03925bb651e5563625ddf6d59
Fix captive portal detection on IPv6 networks.

Currently the captive portal check URL is generated by
concatenating scheme, "://", IP address, and port. This breaks
for IPv6 because IPv6 addresses in URLs must be enclosed in
square brackets (e.g., http://2001:db8::1/generate_204 is
invalid; should he http://[2001:db8::1]/generate_204 instead).
The resulting MalformedURLException causes isMobileOk to report
that there is no captive portal, even if there is one.

Fortunately the three-arg URL constructor already knows how to
construct URLs with IPv6 addresses. Use that instead of
generating the URL ourselves.

Bug: 10801896
Change-Id: I02605ef62f493a34f25bb405ef02b111543a76fd
services/java/com/android/server/ConnectivityService.java