From ade5adaab82607593cf17d84fefc330c9fd2a3e0 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 4 Apr 2012 15:45:22 +0100 Subject: [PATCH] Set ConnectInBackground based on request Set the QNetworkSession attribute to match the QNetworkRequest that triggered it. Currently if there are a mix of normal and background requests queued and background connections are not allowed by policy: - background requests at the head of the queue should fail - first foreground request should successfully start a connection - remaining requests succeed regardless of background attribute Change-Id: If0e3ec0b8a5096e3d7cd6df85884c6f53172d233 Reviewed-by: Lars Knoll Reviewed-by: Martin Petersson --- src/network/access/qnetworkreplyimpl.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index c65d790..9fdc29a 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -105,8 +105,11 @@ void QNetworkReplyImplPrivate::_q_startOperation() QObject::connect(session, SIGNAL(error(QNetworkSession::SessionError)), q, SLOT(_q_networkSessionFailed())); - if (!session->isOpen()) + if (!session->isOpen()) { + session->setSessionProperty(QStringLiteral("ConnectInBackground"), + backend->request().attribute(QNetworkRequest::BackgroundRequestAttribute, QVariant::fromValue(false))); session->open(); + } } else { qWarning("Backend is waiting for QNetworkSession to connect, but there is none!"); state = Working; -- 2.7.4