diff options
Diffstat (limited to 'src/network/access/qhttpnetworkreply.cpp')
-rw-r--r-- | src/network/access/qhttpnetworkreply.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp index 2063ca6bd0..172d4dab5b 100644 --- a/src/network/access/qhttpnetworkreply.cpp +++ b/src/network/access/qhttpnetworkreply.cpp @@ -78,6 +78,23 @@ void QHttpNetworkReply::setUrl(const QUrl &url) d->url = url; } +QUrl QHttpNetworkReply::redirectUrl() const +{ + return d_func()->redirectUrl; +} + +void QHttpNetworkReply::setRedirectUrl(const QUrl &url) +{ + Q_D(QHttpNetworkReply); + d->redirectUrl = url; +} + +bool QHttpNetworkReply::isHttpRedirect(int statusCode) +{ + return (statusCode == 301 || statusCode == 302 || statusCode == 303 + || statusCode == 305 || statusCode == 307); +} + qint64 QHttpNetworkReply::contentLength() const { return d_func()->contentLength(); @@ -267,6 +284,11 @@ void QHttpNetworkReply::setSpdyWasUsed(bool spdy) d_func()->spdyUsed = spdy; } +bool QHttpNetworkReply::isRedirecting() const +{ + return d_func()->isRedirecting(); +} + QHttpNetworkConnection* QHttpNetworkReply::connection() { return d_func()->connection; @@ -910,6 +932,14 @@ qint64 QHttpNetworkReplyPrivate::getChunkSize(QAbstractSocket *socket, qint64 *c return bytes; } +bool QHttpNetworkReplyPrivate::isRedirecting() const +{ + // We're in the process of redirecting - if the HTTP status code says so and + // followRedirect is switched on + return (QHttpNetworkReply::isHttpRedirect(statusCode) + && request.isFollowRedirects()); +} + bool QHttpNetworkReplyPrivate::shouldEmitSignals() { // for 401 & 407 don't emit the data signals. Content along with these |