diff options
author | MÃ¥rten Nordheim <marten.nordheim@qt.io> | 2017-10-19 12:22:16 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-10-24 16:43:35 +0000 |
commit | 18f0a45964e62bf3db7b657847902a356fd31f51 (patch) | |
tree | 0ede665d056cfa71d1f866e98a1971ff5a1fa510 /src/network | |
parent | 7e7683cabb8df58097c5bc4638a2e08cf6e6ff71 (diff) |
Fix redirecting all the other methods for HTTP 307 and 308
c4cf90b1f739c47383672de3d66b1d9d5427f5db made POST requests be
redirected properly, but this wasn't enough and should have included
every method/verb.
Change-Id: I37b12dc9fdffcbf2aadbd2360d4fc2584c024939
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index fa49c8e05b..c1a9f628a0 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1110,16 +1110,14 @@ QNetworkAccessManager::Operation QNetworkReplyHttpImplPrivate::getRedirectOperat // HTTP status code can be used to decide if we can redirect with a GET // operation or not. See http://www.ietf.org/rfc/rfc2616.txt [Sec 10.3] for // more details - Q_UNUSED(httpStatus); + + // We MUST keep using the verb that was used originally when being redirected with 307 or 308. + if (httpStatus == 307 || httpStatus == 308) + return currentOp; switch (currentOp) { case QNetworkAccessManager::HeadOperation: return QNetworkAccessManager::HeadOperation; - case QNetworkAccessManager::PostOperation: - // We MUST keep using POST when being redirected with 307 or 308. - if (statusCode == 307 || statusCode == 308) - return QNetworkAccessManager::PostOperation; - break; default: break; } |