summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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());