Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.4.1
-
None
-
8
-
7822b89ae (dev), 786c9f0b0 (6.5)
-
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.