From d815de8c26ccee33713e37a0fec2982755dcfe1f Mon Sep 17 00:00:00 2001 From: Mandeep Sandhu Date: Mon, 17 Mar 2014 19:21:25 +0530 Subject: QNetworkAccessManager: Support HTTP redirection This commit adds support for following HTTP redirect responses on a per request basis. This behavior is disabled by default. It can be switched on by setting the QNetworkRequest::FollowRedirectAttribute to true. 2 new error codes have been added to QNetworkReply: * TooManyRedirectsError: Set when the number of redirects exceed a given value set by the user (defaults to 50 if not set) * UnsecureRedirectError: Set when we are redirecting from a 'https' to 'http' protocol. Test cases for the following scenarios: * Single HTTP redirect using local test server * Changing max-redirects * Testing all redirect related error scenarios The next commit will extend this feature at a QNAM level. Task-number: QTBUG-8232 Change-Id: If9e28ad12bad08bcdc5bc511b1cd59dc9d8150f0 Reviewed-by: Allan Sandfeld Jensen --- src/network/access/qhttpthreaddelegate_p.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/network/access/qhttpthreaddelegate_p.h') diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h index ff919b11c5..4889bcd1f1 100644 --- a/src/network/access/qhttpthreaddelegate_p.h +++ b/src/network/access/qhttpthreaddelegate_p.h @@ -139,6 +139,8 @@ signals: void downloadData(QByteArray); void error(QNetworkReply::NetworkError, const QString); void downloadFinished(); + void redirected(const QUrl &url, int httpStatus, int maxRedirectsRemainig); + public slots: // This are called via QueuedConnection from user thread void startRequest(); -- cgit v1.2.3