Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/network/kernel/qnetworkproxy_win.cpp

    r651 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    5252#include <qt_windows.h>
    5353#include <wininet.h>
     54
    5455
    5556/*
     
    100101#define WINHTTP_NO_PROXY_NAME     NULL
    101102#define WINHTTP_NO_PROXY_BYPASS   NULL
     103
     104
     105
     106
    102107
    103108QT_BEGIN_NAMESPACE
     
    274279#else
    275280    // load the winhttp.dll library
    276     HINSTANCE winhttpHnd = LoadLibrary(L"winhttp");
    277     if (!winhttpHnd)
     281    (L"winhttp");
     282    if (!)
    278283        return;                 // failed to load
    279284
    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");
    285290
    286291    // Try to obtain the Internet Explorer configuration.
     
    321326        isAutoConfig = true;
    322327        memset(&autoProxyOptions, 0, sizeof autoProxyOptions);
    323         autoProxyOptions.fAutoLogonIfChallenged = true;
     328        autoProxyOptions.fAutoLogonIfChallenged = e;
    324329        if (ieProxyConfig.fAutoDetect) {
    325330            autoProxyOptions.dwFlags = WINHTTP_AUTOPROXY_AUTO_DETECT;
     
    378383            url.setScheme(QLatin1String("https"));
    379384        }
    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) {
    384405            // yes, we got a config for this URL
    385406            QString proxyBypass = QString::fromWCharArray(proxyInfo.lpszProxyBypass);
     
    396417
    397418        // GetProxyForUrl failed
     419
     420
     421
     422
     423
     424
     425
    398426        return sp->defaultResult;
    399427    }
Note: See TracChangeset for help on using the changeset viewer.