| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/proxy/proxy_resolver_winhttp.h" | 5 #include "net/proxy/proxy_resolver_winhttp.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <winhttp.h> | 8 #include <winhttp.h> |
| 9 | 9 |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 // If we have been given an empty PAC url, then use auto-detection. | 86 // If we have been given an empty PAC url, then use auto-detection. |
| 87 // | 87 // |
| 88 // NOTE: We just use DNS-based auto-detection here like Firefox. We do this | 88 // NOTE: We just use DNS-based auto-detection here like Firefox. We do this |
| 89 // to avoid WinHTTP's auto-detection code, which while more featureful (it | 89 // to avoid WinHTTP's auto-detection code, which while more featureful (it |
| 90 // supports DHCP based auto-detection) also appears to have issues. | 90 // supports DHCP based auto-detection) also appears to have issues. |
| 91 // | 91 // |
| 92 WINHTTP_AUTOPROXY_OPTIONS options = {0}; | 92 WINHTTP_AUTOPROXY_OPTIONS options = {0}; |
| 93 options.fAutoLogonIfChallenged = TRUE; | 93 options.fAutoLogonIfChallenged = TRUE; |
| 94 options.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL; | 94 options.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL; |
| 95 std::wstring pac_url_wide = ASCIIToWide(pac_url); |
| 95 options.lpszAutoConfigUrl = | 96 options.lpszAutoConfigUrl = |
| 96 pac_url.empty() ? L"http://wpad/wpad.dat" : ASCIIToWide(pac_url).c_str(); | 97 pac_url_wide.empty() ? L"http://wpad/wpad.dat" : pac_url_wide.c_str(); |
| 97 | 98 |
| 98 WINHTTP_PROXY_INFO info = {0}; | 99 WINHTTP_PROXY_INFO info = {0}; |
| 99 DCHECK(session_handle_); | 100 DCHECK(session_handle_); |
| 100 if (!CallWinHttpGetProxyForUrl( | 101 if (!CallWinHttpGetProxyForUrl( |
| 101 session_handle_, ASCIIToWide(query_url).c_str(), &options, &info)) { | 102 session_handle_, ASCIIToWide(query_url).c_str(), &options, &info)) { |
| 102 DWORD error = GetLastError(); | 103 DWORD error = GetLastError(); |
| 103 LOG(ERROR) << "WinHttpGetProxyForUrl failed: " << error; | 104 LOG(ERROR) << "WinHttpGetProxyForUrl failed: " << error; |
| 104 | 105 |
| 105 // If we got here because of RPC timeout during out of process PAC | 106 // If we got here because of RPC timeout during out of process PAC |
| 106 // resolution, no further requests on this session are going to work. | 107 // resolution, no further requests on this session are going to work. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 153 |
| 153 void ProxyResolverWinHttp::CloseWinHttpSession() { | 154 void ProxyResolverWinHttp::CloseWinHttpSession() { |
| 154 if (session_handle_) { | 155 if (session_handle_) { |
| 155 WinHttpCloseHandle(session_handle_); | 156 WinHttpCloseHandle(session_handle_); |
| 156 session_handle_ = NULL; | 157 session_handle_ = NULL; |
| 157 } | 158 } |
| 158 } | 159 } |
| 159 | 160 |
| 160 } // namespace net | 161 } // namespace net |
| 161 | 162 |
| OLD | NEW |