Changeset 846 for trunk/src/network/kernel/qnetworkproxy_win.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/network/kernel/qnetworkproxy_win.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 52 52 #include <qt_windows.h> 53 53 #include <wininet.h> 54 54 55 55 56 /* … … 100 101 #define WINHTTP_NO_PROXY_NAME NULL 101 102 #define WINHTTP_NO_PROXY_BYPASS NULL 103 104 105 106 102 107 103 108 QT_BEGIN_NAMESPACE … … 274 279 #else 275 280 // load the winhttp.dll library 276 HINSTANCE winhttpHnd = LoadLibrary(L"winhttp");277 if (! winhttpHnd)281 (L"winhttp"); 282 if (!) 278 283 return; // failed to load 279 284 280 ptrWinHttpOpen = (PtrWinHttpOpen) GetProcAddress(winhttpHnd,"WinHttpOpen");281 ptrWinHttpCloseHandle = (PtrWinHttpCloseHandle) GetProcAddress(winhttpHnd,"WinHttpCloseHandle");282 ptrWinHttpGetProxyForUrl = (PtrWinHttpGetProxyForUrl) GetProcAddress(winhttpHnd,"WinHttpGetProxyForUrl");283 ptrWinHttpGetDefaultProxyConfiguration = (PtrWinHttpGetDefaultProxyConfiguration) GetProcAddress(winhttpHnd,"WinHttpGetDefaultProxyConfiguration");284 ptrWinHttpGetIEProxyConfigForCurrentUser = (PtrWinHttpGetIEProxyConfigForCurrentUser) GetProcAddress(winhttpHnd,"WinHttpGetIEProxyConfigForCurrentUser");285 ptrWinHttpOpen = (PtrWinHttpOpen)"WinHttpOpen"); 286 ptrWinHttpCloseHandle = (PtrWinHttpCloseHandle)"WinHttpCloseHandle"); 287 ptrWinHttpGetProxyForUrl = (PtrWinHttpGetProxyForUrl)"WinHttpGetProxyForUrl"); 288 ptrWinHttpGetDefaultProxyConfiguration = (PtrWinHttpGetDefaultProxyConfiguration)"WinHttpGetDefaultProxyConfiguration"); 289 ptrWinHttpGetIEProxyConfigForCurrentUser = (PtrWinHttpGetIEProxyConfigForCurrentUser)"WinHttpGetIEProxyConfigForCurrentUser"); 285 290 286 291 // Try to obtain the Internet Explorer configuration. … … 321 326 isAutoConfig = true; 322 327 memset(&autoProxyOptions, 0, sizeof autoProxyOptions); 323 autoProxyOptions.fAutoLogonIfChallenged = true;328 autoProxyOptions.fAutoLogonIfChallenged = e; 324 329 if (ieProxyConfig.fAutoDetect) { 325 330 autoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT; … … 378 383 url.setScheme(QLatin1String("https")); 379 384 } 380 if (ptrWinHttpGetProxyForUrl(sp->hHttpSession, 381 (LPCWSTR)url.toString().utf16(), 382 &sp->autoProxyOptions, 383 &proxyInfo)) { 385 386 bool getProxySucceeded = ptrWinHttpGetProxyForUrl(sp->hHttpSession, 387 (LPCWSTR)url.toString().utf16(), 388 &sp->autoProxyOptions, 389 &proxyInfo); 390 DWORD getProxyError = GetLastError(); 391 392 if (!getProxySucceeded 393 && (ERROR_WINHTTP_LOGIN_FAILURE == getProxyError)) { 394 // We first tried without AutoLogon, because this might prevent caching the result. 395 // But now we've to enable it (http://msdn.microsoft.com/en-us/library/aa383153%28v=VS.85%29.aspx) 396 sp->autoProxyOptions.fAutoLogonIfChallenged = TRUE; 397 getProxySucceeded = ptrWinHttpGetProxyForUrl(sp->hHttpSession, 398 (LPCWSTR)url.toString().utf16(), 399 &sp->autoProxyOptions, 400 &proxyInfo); 401 getProxyError = GetLastError(); 402 } 403 404 if (getProxySucceeded) { 384 405 // yes, we got a config for this URL 385 406 QString proxyBypass = QString::fromWCharArray(proxyInfo.lpszProxyBypass); … … 396 417 397 418 // GetProxyForUrl failed 419 420 421 422 423 424 425 398 426 return sp->defaultResult; 399 427 }
Note:
See TracChangeset
for help on using the changeset viewer.