summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-17 19:53:00 +0000
committerjoi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-17 19:53:00 +0000
commit7258defe34a4482e53ed23d2e04bb8d4fe7b4002 (patch)
tree57606849c4e643f9c08337d431227276ebb6dadd /chrome
parent7ae3de9741146e4f429123e4980733be4c52e66d (diff)
downloadchromium_src-7258defe34a4482e53ed23d2e04bb8d4fe7b4002.zip
chromium_src-7258defe34a4482e53ed23d2e04bb8d4fe7b4002.tar.gz
chromium_src-7258defe34a4482e53ed23d2e04bb8d4fe7b4002.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. Original commit r85646. Reverted (test failures on some release bots) r85648. Will reland with fix. Review URL: http://codereview.chromium.org/6831025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85661 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/net/connection_tester.cc8
-rw-r--r--chrome/browser/net/proxy_service_factory.cc7
-rw-r--r--chrome/chrome_dll.gypi15
-rw-r--r--chrome/common/chrome_switches.cc5
-rw-r--r--chrome/common/chrome_switches.h1
5 files changed, 29 insertions, 7 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());
diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi
index a861546..7d89653 100644
--- a/chrome/chrome_dll.gypi
+++ b/chrome/chrome_dll.gypi
@@ -23,19 +23,20 @@
'VCLinkerTool': {
'BaseAddress': '0x01c30000',
'DelayLoadDLLs': [
+ 'comdlg32.dll',
'crypt32.dll',
'cryptui.dll',
- 'winhttp.dll',
- 'wininet.dll',
- 'wsock32.dll',
- 'ws2_32.dll',
- 'winspool.drv',
- 'comdlg32.dll',
+ 'dhcpcsvc.dll',
'imagehlp.dll',
- 'urlmon.dll',
'imm32.dll',
'iphlpapi.dll',
'setupapi.dll',
+ 'urlmon.dll',
+ 'winhttp.dll',
+ 'wininet.dll',
+ 'winspool.drv',
+ 'ws2_32.dll',
+ 'wsock32.dll',
],
# Set /SUBSYSTEM:WINDOWS for chrome.dll (for consistency).
'SubSystem': '2',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 1f58615..4afe3a8 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -402,6 +402,11 @@ const char kEnableConnectBackupJobs[] = "enable-connect-backup-jobs";
// Enables web developers to create apps for Chrome without using crx packages.
const char kEnableCrxlessWebApps[] = "enable-crxless-web-apps";
+// Enables retrieval of PAC URLs from DHCP as per the WPAD standard. Note
+// that this feature is not supported on all platforms, and using the flag
+// is a no-op on such platforms.
+const char kEnableDhcpWpad[] = "enable-dhcp-wpad";
+
// Enable DNS side checking of certificates. Still experimental, should only
// be used by developers at the current time.
const char kEnableDNSCertProvenanceChecking[] =
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index c4876d7..aa4cb99 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -122,6 +122,7 @@ extern const char kEnableCompactNavigation[];
extern const char kEnableCompositeToTexture[];
extern const char kEnableConnectBackupJobs[];
extern const char kEnableCrxlessWebApps[];
+extern const char kEnableDhcpWpad[];
extern const char kEnableDNSCertProvenanceChecking[];
extern const char kEnableDNSSECCerts[];
extern const char kEnableExperimentalAppManifests[];