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

HTTP/2 request does not finish until closed by remote host

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.2.9, 6.5.1, 6.6.0
    • 6.4.1
    • Network: HTTP
    • None
    • 8
    • 7822b89ae (dev), 786c9f0b0 (6.5), 6fb561ab8 (tqtc/lts-6.2)
    • Foundation Sprint 77, Foundation Sprint 78, Foundations Sprint 79

    Description

      If I query a particular server using HTTP/2, all the data gets read, but the finished() signal is not emitted. If I disable HTTP/2, then things work fine.

      Example code to reproduce the issue:

      #include <QCoreApplication>
      #include <QNetworkAccessManager>
      #include <QNetworkReply>
      
      int main(int argc, char *argv[])
      {
        QCoreApplication a(argc, argv);
      
        //QUrl url("https://www.google.com/");  // this works
        QUrl url("https://api.dataforsyningen.dk/orto_foraar_DAF?SERVICE=WMS&REQUEST=GetCapabilities");  // does not work
        QNetworkAccessManager manager;
        QNetworkRequest request(url);
        request.setAttribute(QNetworkRequest::Http2AllowedAttribute, true);  // works fine if http2 is not allowed
        QNetworkReply *reply(manager.get(request));
        QObject::connect(reply, &QNetworkReply::downloadProgress, [reply](qint64 received, qint64 total) {
            qDebug() << "download progress " << received << total;
          });
        QObject::connect(reply, &QNetworkReply::finished, &a, &QCoreApplication::quit);
        a.exec();
        qDebug() << "done. " << reply->error() << " / " << reply->errorString();
        return 0;
      }
      

      When I run this with HTTP/2 enabled:

       

      download progress 47141 -1
         [and after ~5 minutes wait:]
      qt.network.http2: stream 1 finished with error: "Connection closed"
      download progress 47141 47141
      done. QNetworkReply::RemoteHostClosedError / "Connection closed"

       

      When I run this with HTTP/2 disabled:

       

      download progress 47141 -1
      download progress 47141 47141
      done. QNetworkReply::NoError / "Unknown error"

       

      The same behavior with Qt 6.4.1 and 5.15.2, but Qt >= 6.0 has HTTP/2 enabled by default, so the bug appears even without any attributes set.

      Attachments

        For Gerrit Dashboard: QTBUG-111417
        # Subject Branch Project Status CR V

        Activity

          People

            manordheim Mårten Nordheim
            martin_dobias Martin Dobias
            Vladimir Minenko Vladimir Minenko
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: