diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-19 22:17:53 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-19 22:17:53 +0000 |
commit | 51fff29dc2dae1a8be5ea107d2b13205510c4e46 (patch) | |
tree | 56a82f110e5605f9aed8f75b2cf954cc5765ed1a /net/proxy/proxy_resolver_winhttp.cc | |
parent | 4750a86ea19e14d99a6b5fc94cd18d08ced463da (diff) | |
download | chromium_src-51fff29dc2dae1a8be5ea107d2b13205510c4e46.zip chromium_src-51fff29dc2dae1a8be5ea107d2b13205510c4e46.tar.gz chromium_src-51fff29dc2dae1a8be5ea107d2b13205510c4e46.tar.bz2 |
Split ProxyResolver into two interfaces: A. interface for retrieving the system proxy settings (ProxyConfigService) B. interface for resolving the proxy (ProxyResolver)The motivation behind this change is: 1. Simplify sharing the WinHTTP code that fetches IE settings, with the V8 proxy resolver (avoids having platform-specific code in ProxyResolverV8). 2. Restrict objects to one thread. (ProxyService calls the config getter on IO thread, and the proxy resolving on the PAC thread).(ProxyResolver is now only 1 method, but this will grow shortly).
Review URL: http://codereview.chromium.org/15070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7323 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_resolver_winhttp.cc')
-rw-r--r-- | net/proxy/proxy_resolver_winhttp.cc | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/net/proxy/proxy_resolver_winhttp.cc b/net/proxy/proxy_resolver_winhttp.cc index 382914f..d4877ac 100644 --- a/net/proxy/proxy_resolver_winhttp.cc +++ b/net/proxy/proxy_resolver_winhttp.cc @@ -8,7 +8,6 @@ #include <winhttp.h> #include "base/histogram.h" -#include "base/string_tokenizer.h" #include "net/base/net_errors.h" #pragma comment(lib, "winhttp.lib") @@ -35,15 +34,6 @@ static BOOL CallWinHttpGetProxyForUrl(HINTERNET session, LPCWSTR url, return rv; } -static void FreeConfig(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG* config) { - if (config->lpszAutoConfigUrl) - GlobalFree(config->lpszAutoConfigUrl); - if (config->lpszProxy) - GlobalFree(config->lpszProxy); - if (config->lpszProxyBypass) - GlobalFree(config->lpszProxyBypass); -} - static void FreeInfo(WINHTTP_PROXY_INFO* info) { if (info->lpszProxy) GlobalFree(info->lpszProxy); @@ -59,37 +49,6 @@ ProxyResolverWinHttp::~ProxyResolverWinHttp() { CloseWinHttpSession(); } -int ProxyResolverWinHttp::GetProxyConfig(ProxyConfig* config) { - WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config = {0}; - if (!WinHttpGetIEProxyConfigForCurrentUser(&ie_config)) { - LOG(ERROR) << "WinHttpGetIEProxyConfigForCurrentUser failed: " << - GetLastError(); - return ERR_FAILED; // TODO(darin): Bug 1189288: translate error code. - } - - if (ie_config.fAutoDetect) - config->auto_detect = true; - if (ie_config.lpszProxy) - config->proxy_server = WideToASCII(ie_config.lpszProxy); - if (ie_config.lpszProxyBypass) { - std::string proxy_bypass = WideToASCII(ie_config.lpszProxyBypass); - - StringTokenizer proxy_server_bypass_list(proxy_bypass, "; \t\n\r"); - while (proxy_server_bypass_list.GetNext()) { - std::string bypass_url_domain = proxy_server_bypass_list.token(); - if (bypass_url_domain == "<local>") - config->proxy_bypass_local_names = true; - else - config->proxy_bypass.push_back(bypass_url_domain); - } - } - if (ie_config.lpszAutoConfigUrl) - config->pac_url = GURL(ie_config.lpszAutoConfigUrl); - - FreeConfig(&ie_config); - return OK; -} - int ProxyResolverWinHttp::GetProxyForURL(const GURL& query_url, const GURL& pac_url, ProxyInfo* results) { |