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 <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Timur Pocheptsov 2017-04-04 13:58:24 +02:00
parent 1b2234c4e7
commit ce2771c71c

View File

@ -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());
}