Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: components/cronet/android/cronet_url_request_context_adapter.cc

Issue 1318573006: [Cronet] Add support for Proxy Auto Config (PAC) script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/android/cronet_url_request_context_adapter.cc
diff --git a/components/cronet/android/cronet_url_request_context_adapter.cc b/components/cronet/android/cronet_url_request_context_adapter.cc
index c1008498cb223ed398ca15203479bf8005a80ed3..8009eb2a6c2474345770c5b8a0a5d0786d09b3a0 100644
--- a/components/cronet/android/cronet_url_request_context_adapter.cc
+++ b/components/cronet/android/cronet_url_request_context_adapter.cc
@@ -27,6 +27,7 @@
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_server_properties_manager.h"
#include "net/log/write_to_file_net_log_observer.h"
+#include "net/proxy/proxy_config_service_android.h"
#include "net/proxy/proxy_service.h"
#include "net/sdch/sdch_owner.h"
#include "net/url_request/url_request_context.h"
@@ -147,8 +148,14 @@ void CronetURLRequestContextAdapter::InitRequestContextOnMainThread(
jobject jcaller) {
base::android::ScopedJavaGlobalRef<jobject> jcaller_ref;
jcaller_ref.Reset(env, jcaller);
- proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService(
- GetNetworkTaskRunner(), nullptr));
+ net::ProxyConfigServiceAndroid* android_proxy_config_service =
+ static_cast<net::ProxyConfigServiceAndroid*>(
+ net::ProxyService::CreateSystemProxyConfigService(
+ GetNetworkTaskRunner(), nullptr /* Ignored on Android */));
+ // If a PAC URL is present, ignore it and use the address and port of
+ // Android system's local HTTP proxy server. See: crbug.com/432539.
+ android_proxy_config_service->set_exclude_pac_url(true);
+ proxy_config_service_.reset(android_proxy_config_service);
GetNetworkTaskRunner()->PostTask(
FROM_HERE,
base::Bind(&CronetURLRequestContextAdapter::InitializeOnNetworkThread,
@@ -187,7 +194,13 @@ void CronetURLRequestContextAdapter::InitializeOnNetworkThread(
#endif // defined(DATA_REDUCTION_PROXY_SUPPORT)
context_builder.set_network_delegate(network_delegate.Pass());
context_builder.set_net_log(net_log_.get());
- context_builder.set_proxy_config_service(proxy_config_service_.Pass());
+
+ // Android provides a local HTTP proxy server that handles proxying when a PAC
+ // URL is present. Create a proxy service without a resolver and rely on this
+ // local HTTP proxy. See: crbug.com/432539.
+ context_builder.set_proxy_service(
+ net::ProxyService::CreateWithoutProxyResolver(
+ proxy_config_service_.release(), net_log_.get()));
config->ConfigureURLRequestContextBuilder(&context_builder);
// Set up pref file if storage path is specified.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698