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

ProxyConnectionRefusedError is not available via QNetworkReply::error()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.12.6
    • Network: HTTP
    • None

    Description

      Steps to reproduce:

      1. Call QNetworkAccessManager.setProxy() to configure HTTP proxy with some valid IP but non-listening port;
      2. Create a QHttpRequest to some valid URL;
      3. Call QNetworkAccessManager::get() with request from step 2;
      4. On reply returned on step 3, connect to finished() signal;
      5. When QNetworkReply::finished() is emitted, check the value return by error() and errorString()

      Expected behavior:
      QNetworkReply::error() == QNetworkReply::ProxyConnectionRefusedError
      QNetworkReply::errorString() == "Proxy connection refused"

      Actual behavior:
      QNetworkReply::error() == QNetworkReply::UnknownNetworkError
      QNetworkReply::errorString() == "Proxy connection refused"

      Same behavior is observed with the QNetworkReply::error() signal parameter being UnknownNetworkError. Since this error code is non-specific, and error string is localizable and non-constant, there is no easy way to detect this (very common) proxy-related error.

      Proposed fix:
      In source file qhttpnetworkconnectionchannel.cpp, line 1049, add the following code:

      case QAbstractSocket::ProxyConnectionRefusedError:
          errorCode = QNetworkReply::ProxyConnectionRefusedError;
          break;
      

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            cnn Qt Core & Network
            denis.gz Denis Zavorotnyy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes