| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 session_handle_, ASCIIToWide(query_url.spec()).c_str(), &options, &info); | 69 session_handle_, ASCIIToWide(query_url.spec()).c_str(), &options, &info); |
| 70 if (!ok) { | 70 if (!ok) { |
| 71 if (ERROR_WINHTTP_LOGIN_FAILURE == GetLastError()) { | 71 if (ERROR_WINHTTP_LOGIN_FAILURE == GetLastError()) { |
| 72 options.fAutoLogonIfChallenged = TRUE; | 72 options.fAutoLogonIfChallenged = TRUE; |
| 73 ok = WinHttpGetProxyForUrl( | 73 ok = WinHttpGetProxyForUrl( |
| 74 session_handle_, ASCIIToWide(query_url.spec()).c_str(), | 74 session_handle_, ASCIIToWide(query_url.spec()).c_str(), |
| 75 &options, &info); | 75 &options, &info); |
| 76 } | 76 } |
| 77 if (!ok) { | 77 if (!ok) { |
| 78 DWORD error = GetLastError(); | 78 DWORD error = GetLastError(); |
| 79 LOG(ERROR) << "WinHttpGetProxyForUrl failed: " << error; | |
| 80 // If we got here because of RPC timeout during out of process PAC | 79 // If we got here because of RPC timeout during out of process PAC |
| 81 // resolution, no further requests on this session are going to work. | 80 // resolution, no further requests on this session are going to work. |
| 82 if (ERROR_WINHTTP_TIMEOUT == error || | 81 if (ERROR_WINHTTP_TIMEOUT == error || |
| 83 ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR == error) { | 82 ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR == error) { |
| 84 CloseWinHttpSession(); | 83 CloseWinHttpSession(); |
| 85 } | 84 } |
| 86 return ERR_FAILED; // TODO(darin): Bug 1189288: translate error code. | 85 return ERR_FAILED; // TODO(darin): Bug 1189288: translate error code. |
| 87 } | 86 } |
| 88 } | 87 } |
| 89 | 88 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 169 } |
| 171 | 170 |
| 172 void ProxyResolverWinHttp::CloseWinHttpSession() { | 171 void ProxyResolverWinHttp::CloseWinHttpSession() { |
| 173 if (session_handle_) { | 172 if (session_handle_) { |
| 174 WinHttpCloseHandle(session_handle_); | 173 WinHttpCloseHandle(session_handle_); |
| 175 session_handle_ = NULL; | 174 session_handle_ = NULL; |
| 176 } | 175 } |
| 177 } | 176 } |
| 178 | 177 |
| 179 } // namespace net | 178 } // namespace net |
| OLD | NEW |