summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Wilson <jessewilson@google.com>2010-12-06 15:26:13 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2010-12-06 15:26:13 -0800
commit645db2f0647b88f06059eb29a7c7455feda3e119 (patch)
tree0089bce5a15860c91ab373e70773f714d177831d
parentc9a8b4e3604e8512bd028025f1a849a8b21fe951 (diff)
parent3dafdc28e38c2720a85d8581b068e09e709ac434 (diff)
downloadexternal_apache-http-645db2f0647b88f06059eb29a7c7455feda3e119.zip
external_apache-http-645db2f0647b88f06059eb29a7c7455feda3e119.tar.gz
external_apache-http-645db2f0647b88f06059eb29a7c7455feda3e119.tar.bz2
am 3dafdc28: Merge "Use proxies specified by system properties in DefaultHttpClient."
* commit '3dafdc28e38c2720a85d8581b068e09e709ac434': Use proxies specified by system properties in DefaultHttpClient.
-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());