summaryrefslogtreecommitdiffstats
path: root/src/network/access/qhttpnetworkrequest_p.h
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2016-12-28 15:27:57 +0100
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2017-01-17 18:51:32 +0000
commitcebf1fea4a6802b8999469f647f52171e87d02b6 (patch)
treeca858bb7eb3b482d1e555c285b08c0e627497256 /src/network/access/qhttpnetworkrequest_p.h
parent27e27966bf01b4c42343100a49b1dd6b014025fe (diff)
Add redirects policy to QNetworkAccessManager
This patch makes it possible to enable/disable redirects on QNAM level (before it was per-request only). This policy would be applied to all subsequent requests* created by QNAM. The policies we support at the moment: a. Manual - that's what we always had - it's up to a user to handle redirects. b. NoLessSafeRedirectsPolicy - we allow http->http, http->https and https->https redirects, but no protocol 'downgrade' (no https->http redirects). c. SameOriginPolicy - we check that protocol/host/port are the same. Updated tst_qnetworkreply. *We previously were enabling redirect for each request, by setting FollowRedirectsAttribute on QNetworkRequest object. For backward compatibility this attribute has a higher priority (if set) than QNAM's policy (and it will work as NoLessSafeRedirectsPolicy). [ChangeLog][QtNetwork] Added redirects policy to QNAM Task-number: QTPM-239 Task-number: QTPM-237 Change-Id: I493d1728254b71b61b5504937e8e01dca5953527 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/access/qhttpnetworkrequest_p.h')
-rw-r--r--src/network/access/qhttpnetworkrequest_p.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h
index d1abb76e28..3900e9080e 100644
--- a/src/network/access/qhttpnetworkrequest_p.h
+++ b/src/network/access/qhttpnetworkrequest_p.h
@@ -55,6 +55,7 @@
#ifndef QT_NO_HTTP
#include <private/qhttpnetworkheader_p.h>
+#include <QtNetwork/qnetworkrequest.h>
#include <qmetatype.h>
QT_BEGIN_NAMESPACE
@@ -130,7 +131,8 @@ public:
void setPreConnect(bool preConnect);
bool isFollowRedirects() const;
- void setFollowRedirects(bool followRedirect);
+ void setRedirectsPolicy(QNetworkRequest::RedirectsPolicy policy);
+ QNetworkRequest::RedirectsPolicy redirectsPolicy() const;
int redirectCount() const;
void setRedirectCount(int count);
@@ -173,8 +175,8 @@ public:
bool withCredentials;
bool ssl;
bool preConnect;
- bool followRedirect;
int redirectCount;
+ QNetworkRequest::RedirectsPolicy redirectsPolicy;
};