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 <lars.knoll@nokia.com>
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
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;