diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 17:29:05 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-17 17:29:05 +0000 |
commit | cfbcab964ac927102ce49c20ea1c4e1bcd667a04 (patch) | |
tree | ff34b602cae9072e4bd5b43f75d73abb91ba142b /chrome/browser/net | |
parent | 0179f39b00af02a9abde26f5003f213e25a4444a (diff) | |
download | chromium_src-cfbcab964ac927102ce49c20ea1c4e1bcd667a04.zip chromium_src-cfbcab964ac927102ce49c20ea1c4e1bcd667a04.tar.gz chromium_src-cfbcab964ac927102ce49c20ea1c4e1bcd667a04.tar.bz2 |
Adds support for the DHCP portion of the WPAD (proxy auto-discovery) protocol.
This is Windows-only for now, and is disabled by default. Start
Chrome with the flag --enable-dhcp-wpad to enable the feature. See
discussion in comment on DhcpProxyScriptFetcherFactory for why this
needs to be done in a per-platform way rather than cross-platform.
The code is factored so that adding other platform implementations
will be straight forward.
Most of the implementation is stand-alone and extends the
ScriptProxyFetcher class hierarchy (and makes its interface slightly
more generic). The integration point into existing code is in
InitProxyResolver, which previously handled fallback from DNS
auto-detect to custom PAC URL and now does fallback from DHCP to DNS
to custom PAC URL.
BUG=18575
TEST=net_unittests has good coverage for the new and changed code, but
manual tests on a network with a PAC URL configured in DHCP are also
needed.
Review URL: http://codereview.chromium.org/6831025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net')
-rw-r--r-- | chrome/browser/net/connection_tester.cc | 8 | ||||
-rw-r--r-- | chrome/browser/net/proxy_service_factory.cc | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc index 84d45d9..3aa578e 100644 --- a/chrome/browser/net/connection_tester.cc +++ b/chrome/browser/net/connection_tester.cc @@ -26,6 +26,7 @@ #include "net/http/http_auth_handler_factory.h" #include "net/http/http_cache.h" #include "net/http/http_network_session.h" +#include "net/proxy/dhcp_proxy_script_fetcher_factory.h" #include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_script_fetcher_impl.h" #include "net/proxy/proxy_service.h" @@ -182,10 +183,17 @@ class ExperimentURLRequestContext : public net::URLRequestContext { return net::ERR_NOT_IMPLEMENTED; } + net::DhcpProxyScriptFetcherFactory dhcp_factory; + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableDhcpWpad)) { + dhcp_factory.set_enabled(true); + } + proxy_service->reset(net::ProxyService::CreateUsingV8ProxyResolver( config_service.release(), 0u, new net::ProxyScriptFetcherImpl(proxy_request_context_), + dhcp_factory.Create(proxy_request_context_), host_resolver(), NULL, NULL)); diff --git a/chrome/browser/net/proxy_service_factory.cc b/chrome/browser/net/proxy_service_factory.cc index ba1cb9a..cf97923 100644 --- a/chrome/browser/net/proxy_service_factory.cc +++ b/chrome/browser/net/proxy_service_factory.cc @@ -12,6 +12,7 @@ #include "chrome/common/chrome_switches.h" #include "content/browser/browser_thread.h" #include "net/base/net_log.h" +#include "net/proxy/dhcp_proxy_script_fetcher_factory.h" #include "net/proxy/proxy_config_service.h" #include "net/proxy/proxy_script_fetcher_impl.h" #include "net/proxy/proxy_service.h" @@ -84,10 +85,16 @@ net::ProxyService* ProxyServiceFactory::CreateProxyService( net::ProxyService* proxy_service; if (use_v8) { + net::DhcpProxyScriptFetcherFactory dhcp_factory; + if (command_line.HasSwitch(switches::kEnableDhcpWpad)) { + dhcp_factory.set_enabled(true); + } + proxy_service = net::ProxyService::CreateUsingV8ProxyResolver( proxy_config_service, num_pac_threads, new net::ProxyScriptFetcherImpl(context), + dhcp_factory.Create(context), context->host_resolver(), net_log, context->network_delegate()); |