diff options
author | Jesse Wilson <jessewilson@google.com> | 2010-12-06 15:23:52 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-12-06 15:23:52 -0800 |
commit | 3dafdc28e38c2720a85d8581b068e09e709ac434 (patch) | |
tree | 0089bce5a15860c91ab373e70773f714d177831d /src | |
parent | f0035c0e7077bc2d7a8aaf6516d96b0d2b1ba22d (diff) | |
parent | e7c14c45c80070fee70451deb8a0a53de66e5a43 (diff) | |
download | external_apache-http-3dafdc28e38c2720a85d8581b068e09e709ac434.zip external_apache-http-3dafdc28e38c2720a85d8581b068e09e709ac434.tar.gz external_apache-http-3dafdc28e38c2720a85d8581b068e09e709ac434.tar.bz2 |
Merge "Use proxies specified by system properties in DefaultHttpClient."
Diffstat (limited to 'src')
-rw-r--r-- | src/org/apache/http/impl/client/DefaultHttpClient.java | 8 | ||||
-rw-r--r-- | src/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java | 14 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/org/apache/http/impl/client/DefaultHttpClient.java b/src/org/apache/http/impl/client/DefaultHttpClient.java index 7dcb2a2..7b3a3fa 100644 --- a/src/org/apache/http/impl/client/DefaultHttpClient.java +++ b/src/org/apache/http/impl/client/DefaultHttpClient.java @@ -61,7 +61,7 @@ import org.apache.http.cookie.CookieSpecRegistry; import org.apache.http.impl.DefaultConnectionReuseStrategy; import org.apache.http.impl.auth.BasicSchemeFactory; import org.apache.http.impl.auth.DigestSchemeFactory; -import org.apache.http.impl.conn.DefaultHttpRoutePlanner; +import org.apache.http.impl.conn.ProxySelectorRoutePlanner; import org.apache.http.impl.conn.SingleClientConnManager; import org.apache.http.impl.cookie.BestMatchSpecFactory; import org.apache.http.impl.cookie.BrowserCompatSpecFactory; @@ -326,8 +326,10 @@ public class DefaultHttpClient extends AbstractHttpClient { @Override protected HttpRoutePlanner createHttpRoutePlanner() { - return new DefaultHttpRoutePlanner - (getConnectionManager().getSchemeRegistry()); + // BEGIN android-changed + // Use the proxy specified by system properties + return new ProxySelectorRoutePlanner(getConnectionManager().getSchemeRegistry(), null); + // END android-changed } diff --git a/src/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java b/src/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java index 136caf4..daa7227 100644 --- a/src/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java +++ b/src/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java @@ -51,6 +51,7 @@ import org.apache.http.conn.scheme.Scheme; import org.apache.http.conn.scheme.SchemeRegistry; import org.apache.http.conn.params.ConnRouteParams; +import org.apache.http.conn.params.ConnRoutePNames; /** @@ -140,7 +141,18 @@ public class ProxySelectorRoutePlanner implements HttpRoutePlanner { final InetAddress local = ConnRouteParams.getLocalAddress(request.getParams()); - final HttpHost proxy = determineProxy(target, request, context); + + // BEGIN android-changed + // If the client or request explicitly specifies a proxy (or no + // proxy), prefer that over the ProxySelector's VM-wide default. + HttpHost proxy = (HttpHost) request.getParams().getParameter(ConnRoutePNames.DEFAULT_PROXY); + if (proxy == null) { + proxy = determineProxy(target, request, context); + } else if (ConnRouteParams.NO_HOST.equals(proxy)) { + // value is explicitly unset + proxy = null; + } + // END android-changed final Scheme schm = this.schemeRegistry.getScheme(target.getSchemeName()); |