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

QNetworkReply::RemoteHostClosedError error when using Secure Channel library (configure option -schannel)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.3.2, 6.5.0
    • Network: SSL
    • None
    • Windows

    Description

      QNetworkReply::RemoteHostClosedError error when using Secure Channel library (configure option -schannel)

      Good afternoon.

      There is Qt built from source code on Windows. The -schannel option was specified during configuration to use the Secure Channel library.

      There is a simple template project created in Qt Creator. When I try to execute a Get request for the url "https://xn-59-6kcaajcv2chul5czct4k.xn-p1ai" (which is the punycode encoded form of the original "https://цветочнаялавка59.рф") using QNetworkAccessManager, I get a QNetworkReply::RemoteHostClosedError in the QNetworkReply::errorOccurred signal processing slot.

      At the same time, when using OpenSSL as an SSL backend, there is no error and the data arrives correctly, the slot for processing the error signal is not called (tested on Windows 11 and Linux Ubuntu 20.04).

      The following is the source code for reproducing the bug:

      // main.cpp
      
      #include <QCoreApplication>
      #include <QNetworkAccessManager>
      #include <QNetworkReply>
      #include <QNetworkRequest>
      #include <QDebug>
      #include <QUrl>
      #include <QObject>int main(int argc, char *argv[])
      {
          QCoreApplication a(argc, argv);    
          // QNetworkRequest request(QUrl("https://цветочнаялавка59.рф"));
          QNetworkRequest request(QUrl("https://xn--59-6kcaajcv2chul5czct4k.xn--p1ai"));    
          
          QNetworkAccessManager manager;
          auto reply = manager.get(request);    
      
          QObject::connect(reply, &QNetworkReply::errorOccurred, [](QNetworkReply::NetworkError code) {
              qDebug() << "QNetworkReply::errorOccurred()" << code;
          });    
      
          QObject::connect(reply, &QNetworkReply::finished, [reply] {
              qDebug() << "QNetworkReply::finished, Status code:" << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute);
              qApp->quit();
          });    
      
          QObject::connect(reply, &QNetworkReply::sslErrors, [reply] (const QList<QSslError> &errors) {
              qDebug() << "QNetworkReply::sslErrors";        
              
              // It does not help
              // reply->ignoreSslErrors();
          });    
      
          return a.exec();
      }
        

      With this code I get the output:

      QNetworkReply::errorOccurred() QNetworkReply::RemoteHostClosedError
      QNetworkReply::finished, Status code: QVariant(Invalid)
      

      Attachments

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

        Activity

          People

            manordheim Mårten Nordheim
            rumgot rumgot
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes