Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
6.5.2
-
13c4e11c4 (dev), 44e53b3ed (6.6), 3e1cf8b0a (6.5), 545d6e52d (tqtc/lts-6.2)
Description
Please see the code below. Multiple requests of QNetworkAccessManager together to a single URL, where the first two are stopped, but the last one never completes. If you call abort the final one does complete. but there is a workaground , if setting the property of QNetworkRequest object like setAttribute(QNetworkRequest::Http2AllowedAttribute, false); then it works fine.
#include <QCoreApplication> #include <QNetworkAccessManager> #include <QNetworkReply> #include <QTimer> namespace { void watch(QNetworkReply *reply, const QString &name) { QObject::connect(reply, &QNetworkReply::finished, [=]() { qInfo() << name << ": finished"; }); QObject::connect(reply, &QNetworkReply::destroyed, [=]() { qInfo() << name << ": destroyed"; }); } void abort(QNetworkReply *reply) { //reply->abort(); // if you do this it works //reply->close(); // if you do this it still does not work reply->deleteLater(); } } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QNetworkAccessManager manager; QTimer::singleShot(1, [&]() { { auto reply = manager.get(QNetworkRequest(QUrl("https://www.google.com/"))); watch(reply, "dud1"); abort(reply); } { auto reply = manager.get(QNetworkRequest(QUrl("https://www.google.com/"))); watch(reply, "dud2"); abort(reply); } { auto reply = manager.get(QNetworkRequest(QUrl("https://www.google.com/"))); watch(reply, "real"); } }); return a.exec(); }