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 <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit c69a5611ae3c7e4e7049f5b472e253cfdbd70aea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mårten Nordheim 2023-04-28 16:56:40 +02:00 committed by Qt Cherry-pick Bot
parent 7e063b92bf
commit 7eb8a71c94

View File

@ -154,6 +154,9 @@ QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manage
d->sslConfiguration.reset(new QSslConfiguration(request.sslConfiguration())); d->sslConfiguration.reset(new QSslConfiguration(request.sslConfiguration()));
#endif #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? // FIXME Later maybe set to Unbuffered, especially if it is zerocopy or from cache?
QIODevice::open(QIODevice::ReadOnly); QIODevice::open(QIODevice::ReadOnly);
@ -870,9 +873,6 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
q, SLOT(onRedirected(QUrl,int,int)), q, SLOT(onRedirected(QUrl,int,int)),
Qt::QueuedConnection); Qt::QueuedConnection);
QObject::connect(q, SIGNAL(redirectAllowed()), q, SLOT(followRedirect()),
Qt::QueuedConnection);
#ifndef QT_NO_SSL #ifndef QT_NO_SSL
QObject::connect(delegate, SIGNAL(sslConfigurationChanged(QSslConfiguration)), QObject::connect(delegate, SIGNAL(sslConfigurationChanged(QSslConfiguration)),
q, SLOT(replySslConfigurationChanged(QSslConfiguration)), q, SLOT(replySslConfigurationChanged(QSslConfiguration)),