From 7eb8a71c94baf6aabcb5a48f04aacfa9b7f7b1f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Fri, 28 Apr 2023 16:56:40 +0200 Subject: [PATCH] QNAM: Fix double-connect for manual redirect handling The other signal connections are broken because we create a new delegate. But 'q' is still the same, so we should not connect to it a second time. Just connect it in the constructor instead. Fixes: QDS-9687 Change-Id: Id47492c2e734087281a3d3488649471814fd981d Reviewed-by: Timur Pocheptsov Reviewed-by: Qt CI Bot Reviewed-by: Fabian Kosmale (cherry picked from commit c69a5611ae3c7e4e7049f5b472e253cfdbd70aea) Reviewed-by: Qt Cherry-pick Bot --- src/network/access/qnetworkreplyhttpimpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 54e70fdcf3f..9efdcc9a3e0 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -154,6 +154,9 @@ QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manage d->sslConfiguration.reset(new QSslConfiguration(request.sslConfiguration())); #endif + QObjectPrivate::connect(this, &QNetworkReplyHttpImpl::redirectAllowed, d, + &QNetworkReplyHttpImplPrivate::followRedirect, Qt::QueuedConnection); + // FIXME Later maybe set to Unbuffered, especially if it is zerocopy or from cache? QIODevice::open(QIODevice::ReadOnly); @@ -870,9 +873,6 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq q, SLOT(onRedirected(QUrl,int,int)), Qt::QueuedConnection); - QObject::connect(q, SIGNAL(redirectAllowed()), q, SLOT(followRedirect()), - Qt::QueuedConnection); - #ifndef QT_NO_SSL QObject::connect(delegate, SIGNAL(sslConfigurationChanged(QSslConfiguration)), q, SLOT(replySslConfigurationChanged(QSslConfiguration)),