diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2017-10-09 14:57:46 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2017-10-17 18:50:14 +0000 |
commit | c4cf90b1f739c47383672de3d66b1d9d5427f5db (patch) | |
tree | 6dbbfb0138043672bf3689ccb1e6bca4e0965ab2 /src/network/access/qnetworkreplyhttpimpl.cpp | |
parent | 8a39384e907e830c907f73009f498c486b22bd20 (diff) |
Fix redirecting POST for HTTP 307 and 308
All POST requests that were redirected would previously turn into GET
requests. This does not follow the standard for HTTP codes 307 and 308.
Task-number: QTBUG-63142
Change-Id: Ibd25a9566066e589670a9bc34e5dc5111f8139d5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network/access/qnetworkreplyhttpimpl.cpp')
-rw-r--r-- | src/network/access/qnetworkreplyhttpimpl.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 9756b43108..89d552f431 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1115,10 +1115,15 @@ QNetworkAccessManager::Operation QNetworkReplyHttpImplPrivate::getRedirectOperat 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; } - // For now, we're always returning GET for anything other than HEAD + // Use GET for everything else. return QNetworkAccessManager::GetOperation; } |