From ce2771c71c6679a020ae66ac6602e04621a66a8f Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 4 Apr 2017 13:58:24 +0200 Subject: [PATCH] QNetworkRequest - do not set ManualRedirectPolicy If QNAM's general policy is 'Manual' and QNetworkRequest has neither policy set not FollowRedirectAttribute - do NOT set this 'Manual' policy - its implicitly implied. This fixes previously unnoticed auto test failure (was blacklisted) and also makes QNetworkRequest::operator == work correctly. Change-Id: If17c9af4baf8a470659f82d1a40488078ea8ede0 Reviewed-by: Edward Welbourne Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkaccessmanager.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 0a6270d417..018586f9dc 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -1280,11 +1280,9 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera Q_D(QNetworkAccessManager); QNetworkRequest req(originalReq); - if (req.attribute(QNetworkRequest::RedirectPolicyAttribute).isNull() + if (redirectPolicy() != QNetworkRequest::ManualRedirectPolicy + && req.attribute(QNetworkRequest::RedirectPolicyAttribute).isNull() && req.attribute(QNetworkRequest::FollowRedirectsAttribute).isNull()) { - // We only apply the general manager's policy if: - // - RedirectPolicyAttribute is not set already on request and - // - no FollowRedirectsAttribute is set. req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, redirectPolicy()); }