Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1057)

Unified Diff: net/proxy/proxy_resolver_winhttp.cc

Issue 1657: This change implements the performance recommendation from: ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_resolver_winhttp.cc
===================================================================
--- net/proxy/proxy_resolver_winhttp.cc (revision 1892)
+++ net/proxy/proxy_resolver_winhttp.cc (working copy)
@@ -90,7 +90,7 @@
// supports DHCP based auto-detection) also appears to have issues.
//
WINHTTP_AUTOPROXY_OPTIONS options = {0};
- options.fAutoLogonIfChallenged = TRUE;
+ options.fAutoLogonIfChallenged = FALSE;
options.dwFlags = WINHTTP_AUTOPROXY_CONFIG_URL;
std::wstring pac_url_wide = ASCIIToWide(pac_url);
options.lpszAutoConfigUrl =
@@ -98,19 +98,35 @@
WINHTTP_PROXY_INFO info = {0};
DCHECK(session_handle_);
- if (!CallWinHttpGetProxyForUrl(
- session_handle_, ASCIIToWide(query_url).c_str(), &options, &info)) {
+
+ // Per http://msdn.microsoft.com/en-us/library/aa383153(VS.85).aspx, it is
+ // necessary to first try resolving with fAutoLogonIfChallenged set to false.
+ // Otherwise, we failover to trying it with a value of true. This way we get
wtc 2008/09/09 19:03:10 Nit: "fail over", two words.
+ // good performance in the case where WinHTTP uses an out-of-proc resolver.
wtc 2008/09/09 19:03:10 Nit: "out-of-process"
+ // This is important for Vista and Win2k3.
+ BOOL ok = CallWinHttpGetProxyForUrl(
+ session_handle_, ASCIIToWide(query_url).c_str(), &options, &info);
+ if (!ok) {
DWORD error = GetLastError();
LOG(ERROR) << "WinHttpGetProxyForUrl failed: " << error;
-
- // If we got here because of RPC timeout during out of process PAC
- // resolution, no further requests on this session are going to work.
- if ((ERROR_WINHTTP_TIMEOUT == error) ||
- (ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR == error)) {
- CloseWinHttpSession();
+ if (ERROR_WINHTTP_LOGIN_FAILURE == error) {
+ options.fAutoLogonIfChallenged = TRUE;
+ ok = CallWinHttpGetProxyForUrl(
+ session_handle_, ASCIIToWide(query_url).c_str(), &options, &info);
+ if (!ok) {
+ error = GetLastError();
+ LOG(ERROR) << "WinHttpGetProxyForUrl failed: " << error;
Nicolas Sylvain 2008/09/09 15:18:12 Can you put this line in the other "if (!ok)" unde
+ }
}
-
- return ERR_FAILED; // TODO(darin): Bug 1189288: translate error code.
+ if(!ok) {
+ // If we got here because of RPC timeout during out of process PAC
+ // resolution, no further requests on this session are going to work.
+ if (ERROR_WINHTTP_TIMEOUT == error ||
+ ERROR_WINHTTP_AUTO_PROXY_SERVICE_ERROR == error) {
+ CloseWinHttpSession();
+ }
+ return ERR_FAILED; // TODO(darin): Bug 1189288: translate error code.
+ }
}
int rv = OK;
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698