summaryrefslogtreecommitdiffstats
path: root/src/org/apache/http/impl
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2010-12-06 15:12:37 -0800
committerJesse Wilson <jessewilson@google.com>2010-12-06 15:23:08 -0800
commite7c14c45c80070fee70451deb8a0a53de66e5a43 (patch)
treef7c8b09e2c5a333bb335ae6270a938b4a8a1a7be /src/org/apache/http/impl
parentbdd331840a37ca37136f6c030ad557750372d53f (diff)
downloadexternal_apache-http-e7c14c45c80070fee70451deb8a0a53de66e5a43.zip
external_apache-http-e7c14c45c80070fee70451deb8a0a53de66e5a43.tar.gz
external_apache-http-e7c14c45c80070fee70451deb8a0a53de66e5a43.tar.bz2
Use proxies specified by system properties in DefaultHttpClient.
Change-Id: Ic05f450a301d5478ff3a8f03af56ac0c0dbe3620 http://b/3254717
Diffstat (limited to 'src/org/apache/http/impl')
-rw-r--r--src/org/apache/http/impl/client/DefaultHttpClient.java8
-rw-r--r--src/org/apache/http/impl/conn/ProxySelectorRoutePlanner.java14
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());