Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-80983

QNetworkAccessManager::proxyAuthenticationRequired fired multiple times

    XMLWordPrintable

Details

    • Windows

    Description

      1. Use a proxy which requires authentication. Either specify it in global system settings, or in app using Qt API.
      2. Connect to QNetworkAccessManager::proxyAuthenticationRequired and provide user name and password there.
      3. Bug: in some cases Qt fires this signal several times, despite the fact that credentials are always correct.

      I've made some investigation and found that this happens when you set custom QNetworkRequest::UserAgentHeader and trying to access some specific URLs.

      E.g. some cases:

      1. Just: QNetworkRequest request(QUrl("https://rutracker.org/forum/dl.php?t=4005246"));

      Problem is NOT happening. Log is showing:
      onProxyAuthenticationRequired

       

      2. QNetworkRequest request(QUrl("https://rutracker.org/forum/dl.php?t=4005246"));
      request.setHeader(QNetworkRequest::UserAgentHeader, "FDM/6.0.0.0");

      Problem IS happening. Log is showing:
      onProxyAuthenticationRequired
      onProxyAuthenticationRequired
      QNetworkAccessCache::addEntry: overriding active cache entry 'auth:proxy-http://REMOVED@REMOVED:3130#=FDM%20TEST%20Proxy%20Server='
      QNetworkAccessCache::addEntry: overriding active cache entry 'auth:proxy-http://REMOVED@REMOVED:3130'
      QNetworkAccessCache::addEntry: overriding active cache entry 'auth:proxy-http://REMOVED:3130'
      onProxyAuthenticationRequired
      QNetworkAccessCache::addEntry: overriding active cache entry 'auth:proxy-http://REMOVED@REMOVED:3130#=FDM%20TEST%20Proxy%20Server='
      QNetworkAccessCache::addEntry: overriding active cache entry 'auth:proxy-http://REMOVED@REMOVED:3130'
      QNetworkAccessCache::addEntry: overriding active cache entry 'auth:proxy-http://REMOVED:3130'
      onProxyAuthenticationRequired
      QNetworkAccessCache::addEntry: overriding active cache entry 'auth:proxy-http://REMOVED@REMOVED:3130#=FDM%20TEST%20Proxy%20Server='
      QNetworkAccessCache::addEntry: overriding active cache entry 'auth:proxy-http://REMOVED@REMOVED:3130'
      QNetworkAccessCache::addEntry: overriding active cache entry 'auth:proxy-http://REMOVED:3130'

       

      3. QNetworkRequest request(QUrl("https://ya.ru"));
      request.setHeader(QNetworkRequest::UserAgentHeader, "FDM/6.0.0.0");
      Problem is NOT happening. Log is showing:
      onProxyAuthenticationRequired

       

      I've attached a minimal reproducible example.

      Attachments

        Activity

          People

            cnn Qt Core & Network
            alervd Alexander Dyagilev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: