diff options
author | Brad Fitzpatrick <bradfitz@android.com> | 2010-10-10 11:49:43 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-10-10 11:49:43 -0700 |
commit | b3ffd4adccc430f59a9348dd218d23545e4f6c65 (patch) | |
tree | ea4cb3c78069d2f50823ce53b7f37c904c1b1c74 | |
parent | 5a41b3f8aa788f164af495bac6dc2666568f4cb6 (diff) | |
parent | 3ed792d59cda9f9023201d80f5bdc62d4cef3090 (diff) | |
download | frameworks_base-b3ffd4adccc430f59a9348dd218d23545e4f6c65.zip frameworks_base-b3ffd4adccc430f59a9348dd218d23545e4f6c65.tar.gz frameworks_base-b3ffd4adccc430f59a9348dd218d23545e4f6c65.tar.bz2 |
am 3ed792d5: Merge "Don\'t perform DNS lookup in android.net.Proxy.isLocalHost"
Merge commit '3ed792d59cda9f9023201d80f5bdc62d4cef3090' into gingerbread-plus-aosp
* commit '3ed792d59cda9f9023201d80f5bdc62d4cef3090':
Don't perform DNS lookup in android.net.Proxy.isLocalHost
-rw-r--r-- | core/java/android/net/Proxy.java | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/core/java/android/net/Proxy.java b/core/java/android/net/Proxy.java index 22c30a5..c1fa5b4 100644 --- a/core/java/android/net/Proxy.java +++ b/core/java/android/net/Proxy.java @@ -24,9 +24,7 @@ import android.os.SystemProperties; import android.provider.Settings; import android.util.Log; -import java.net.InetAddress; import java.net.URI; -import java.net.UnknownHostException; import junit.framework.Assert; @@ -162,15 +160,15 @@ final public class Proxy { final URI uri = URI.create(url); final String host = uri.getHost(); if (host != null) { - if (host.equalsIgnoreCase("localhost")) { - return true; - } - if (InetAddress.getByName(host).isLoopbackAddress()) { + // TODO: InetAddress.isLoopbackAddress should be used to check + // for localhost. However no public factory methods exist which + // can be used without triggering DNS lookup if host is not localhost. + if (host.equalsIgnoreCase("localhost") || + host.equals("127.0.0.1") || + host.equals("[::1]")) { return true; } } - } catch (UnknownHostException uex) { - // Ignore (INetworkSystem.ipStringToByteArray) } catch (IllegalArgumentException iex) { // Ignore (URI.create) } |