diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2010-02-15 13:19:47 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2010-02-16 10:59:11 (GMT) |
commit | 934b824fbb7a313789de32356664db81dc8576da (patch) | |
tree | cd8879613788a3f4876bf0150d62203530f209f5 /src/network/access/qnetworkaccesshttpbackend.cpp | |
parent | e5534b9ba700fa2b25fa63e181e2c5f82469875d (diff) | |
download | Qt-934b824fbb7a313789de32356664db81dc8576da.zip Qt-934b824fbb7a313789de32356664db81dc8576da.tar.gz Qt-934b824fbb7a313789de32356664db81dc8576da.tar.bz2 |
QNetworkAccessManager: add method to send custom requests
This method was added to support e.g. HTTP OPTIONS (needed by Webkit);
rather than adding one method for each of those exotic verbs, there is
now a generic version for all.
Reviewed-by: Markus Goetz
Reviewed-by: Andreas Kling
Task-number: QTBUG-8206
Diffstat (limited to 'src/network/access/qnetworkaccesshttpbackend.cpp')
-rw-r--r-- | src/network/access/qnetworkaccesshttpbackend.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 8e02723..c8f4e5b 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -213,6 +213,7 @@ QNetworkAccessHttpBackendFactory::create(QNetworkAccessManager::Operation op, case QNetworkAccessManager::HeadOperation: case QNetworkAccessManager::PutOperation: case QNetworkAccessManager::DeleteOperation: + case QNetworkAccessManager::CustomOperation: break; default: @@ -526,6 +527,14 @@ void QNetworkAccessHttpBackend::postRequest() httpRequest.setOperation(QHttpNetworkRequest::Delete); break; + case QNetworkAccessManager::CustomOperation: + invalidateCache(); // for safety reasons, we don't know what the operation does + httpRequest.setOperation(QHttpNetworkRequest::Custom); + httpRequest.setUploadByteDevice(createUploadByteDevice()); + httpRequest.setCustomVerb(request().attribute( + QNetworkRequest::CustomVerbAttribute).toByteArray()); + break; + default: break; // can't happen } |