Diff
Modified: trunk/LayoutTests/ChangeLog (88611 => 88612)
--- trunk/LayoutTests/ChangeLog 2011-06-12 06:01:25 UTC (rev 88611)
+++ trunk/LayoutTests/ChangeLog 2011-06-12 11:51:45 UTC (rev 88612)
@@ -1,3 +1,33 @@
+2011-06-12 Robert Hogan <[email protected]>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Fix methods.html and methods-lower-case.html
+ https://bugs.webkit.org/show_bug.cgi?id=62221
+
+ Our expectations for the unskipped tests have the following differences from the mac
+ platform:
+ - POST requests with no data get a default Content-Type of 'application/octet-stream' in
+ Qt 4.8 and 'application/x-www-form-urlencoded' in Qt 4.7.3.
+ This is Qt-defined behaviour in QNetworkAccessManager (see QHttpNetworkRequestPrivate::header
+ in qhttpnetworkrequest.cpp)
+ - DELETE and HEAD requests get their ContentType and ContentLength headers (if present) removed
+ by QNetworkReplyHandler. QtWebKit does not send data for either of these request types.
+
+ * platform/qt-4.8/http/tests/xmlhttprequest/methods-expected.txt: Added.
+ * platform/qt-4.8/http/tests/xmlhttprequest/workers/methods-async-expected.txt: Added.
+ * platform/qt-4.8/http/tests/xmlhttprequest/workers/methods-expected.txt: Added.
+ * platform/qt-4.8/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt: Added.
+ * platform/qt/Skipped: Unskip: http/tests/xmlhttprequest/methods.html
+ http/tests/xmlhttprequest/methods-lower-case.html
+ http/tests/xmlhttprequest/workers/methods-async.html
+ http/tests/xmlhttprequest/workers/methods.html
+ http/tests/xmlhttprequest/workers/shared-worker-methods-async.html
+ * platform/qt/http/tests/xmlhttprequest/methods-expected.txt: Added.
+ * platform/qt/http/tests/xmlhttprequest/workers/methods-async-expected.txt: Added.
+ * platform/qt/http/tests/xmlhttprequest/workers/methods-expected.txt: Added.
+ * platform/qt/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt: Added.
+
2011-06-11 Ryosuke Niwa <[email protected]>
Chromium rebaseline after r85560.
Modified: trunk/LayoutTests/platform/qt/Skipped (88611 => 88612)
--- trunk/LayoutTests/platform/qt/Skipped 2011-06-12 06:01:25 UTC (rev 88611)
+++ trunk/LayoutTests/platform/qt/Skipped 2011-06-12 11:51:45 UTC (rev 88612)
@@ -367,12 +367,7 @@
http/tests/xmlhttprequest/cache-override.html
http/tests/xmlhttprequest/cross-origin-authorization.html
http/tests/xmlhttprequest/cross-origin-no-authorization.html
-http/tests/xmlhttprequest/methods-lower-case.html
-http/tests/xmlhttprequest/methods.html
http/tests/xmlhttprequest/redirect-cross-origin-tripmine.html
-http/tests/xmlhttprequest/workers/methods-async.html
-http/tests/xmlhttprequest/workers/methods.html
-http/tests/xmlhttprequest/workers/shared-worker-methods-async.html
# =========================================================================== #
# Failing inserting tests. #
Added: trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/methods-expected.txt (0 => 88612)
--- trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/methods-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/methods-expected.txt 2011-06-12 11:51:45 UTC (rev 88612)
@@ -0,0 +1,23 @@
+Tests for bug 3812 - GET and POST should not be the only HTTP methods implemented in XMLHttpRequest.
+
+GET(""): GET(null bytes), Content-Type: null
+GET(null): GET(null bytes), Content-Type: null
+GET("123"): GET(null bytes), Content-Type: null
+POST(""): POST(0 bytes), Content-Type: application/xml
+POST(null): POST(0 bytes), Content-Type: application/x-www-form-urlencoded
+POST("123"): POST(3 bytes), Content-Type: application/xml
+PUT(""): PUT(0 bytes), Content-Type: application/xml
+PUT(null): PUT(0 bytes), Content-Type: null
+PUT("123"): PUT(3 bytes), Content-Type: application/xml
+DELETE(""): DELETE(null bytes), Content-Type: null
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(null bytes), Content-Type: null
+HEAD(""): HEAD(null bytes), Content-Type: null
+HEAD(null): HEAD(null bytes), Content-Type: null
+HEAD("123"): HEAD(null bytes), Content-Type: null
+WKFOOBAR(""): WKFOOBAR(0 bytes), Content-Type: application/xml
+WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(0 bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
Property changes on: trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/methods-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/methods-async-expected.txt (0 => 88612)
--- trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/methods-async-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/methods-async-expected.txt 2011-06-12 11:51:45 UTC (rev 88612)
@@ -0,0 +1,24 @@
+GET and POST should not be the only HTTP methods implemented in XMLHttpRequest for Workers.
+
+GET(""): GET(null bytes), Content-Type: null
+GET(null): GET(null bytes), Content-Type: null
+GET("123"): GET(null bytes), Content-Type: null
+POST(""): POST(0 bytes), Content-Type: application/xml
+POST(null): POST(0 bytes), Content-Type: application/x-www-form-urlencoded
+POST("123"): POST(3 bytes), Content-Type: application/xml
+PUT(""): PUT(0 bytes), Content-Type: application/xml
+PUT(null): PUT(0 bytes), Content-Type: null
+PUT("123"): PUT(3 bytes), Content-Type: application/xml
+DELETE(""): DELETE(null bytes), Content-Type: null
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(null bytes), Content-Type: null
+HEAD(""): HEAD(null bytes), Content-Type: null
+HEAD(null): HEAD(null bytes), Content-Type: null
+HEAD("123"): HEAD(null bytes), Content-Type: null
+WKFOOBAR(""): WKFOOBAR(0 bytes), Content-Type: application/xml
+WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(0 bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
+DONE
Property changes on: trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/methods-async-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/methods-expected.txt (0 => 88612)
--- trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/methods-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/methods-expected.txt 2011-06-12 11:51:45 UTC (rev 88612)
@@ -0,0 +1,24 @@
+GET and POST should not be the only HTTP methods implemented in XMLHttpRequest for Workers.
+
+GET(""): GET(null bytes), Content-Type: null
+GET(null): GET(null bytes), Content-Type: null
+GET("123"): GET(null bytes), Content-Type: null
+POST(""): POST(0 bytes), Content-Type: application/xml
+POST(null): POST(0 bytes), Content-Type: application/x-www-form-urlencoded
+POST("123"): POST(3 bytes), Content-Type: application/xml
+PUT(""): PUT(0 bytes), Content-Type: application/xml
+PUT(null): PUT(0 bytes), Content-Type: null
+PUT("123"): PUT(3 bytes), Content-Type: application/xml
+DELETE(""): DELETE(null bytes), Content-Type: null
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(null bytes), Content-Type: null
+HEAD(""): HEAD(null bytes), Content-Type: null
+HEAD(null): HEAD(null bytes), Content-Type: null
+HEAD("123"): HEAD(null bytes), Content-Type: null
+WKFOOBAR(""): WKFOOBAR(0 bytes), Content-Type: application/xml
+WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(0 bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
+DONE
Property changes on: trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/methods-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt (0 => 88612)
--- trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt 2011-06-12 11:51:45 UTC (rev 88612)
@@ -0,0 +1,24 @@
+GET and POST should not be the only HTTP methods implemented in XMLHttpRequest for SharedWorkers.
+
+GET(""): GET(null bytes), Content-Type: null
+GET(null): GET(null bytes), Content-Type: null
+GET("123"): GET(null bytes), Content-Type: null
+POST(""): POST(0 bytes), Content-Type: application/xml
+POST(null): POST(0 bytes), Content-Type: application/x-www-form-urlencoded
+POST("123"): POST(3 bytes), Content-Type: application/xml
+PUT(""): PUT(0 bytes), Content-Type: application/xml
+PUT(null): PUT(0 bytes), Content-Type: null
+PUT("123"): PUT(3 bytes), Content-Type: application/xml
+DELETE(""): DELETE(null bytes), Content-Type: null
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(null bytes), Content-Type: null
+HEAD(""): HEAD(null bytes), Content-Type: null
+HEAD(null): HEAD(null bytes), Content-Type: null
+HEAD("123"): HEAD(null bytes), Content-Type: null
+WKFOOBAR(""): WKFOOBAR(0 bytes), Content-Type: application/xml
+WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(0 bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
+DONE
Property changes on: trunk/LayoutTests/platform/qt/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/methods-expected.txt (0 => 88612)
--- trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/methods-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/methods-expected.txt 2011-06-12 11:51:45 UTC (rev 88612)
@@ -0,0 +1,23 @@
+Tests for bug 3812 - GET and POST should not be the only HTTP methods implemented in XMLHttpRequest.
+
+GET(""): GET(null bytes), Content-Type: null
+GET(null): GET(null bytes), Content-Type: null
+GET("123"): GET(null bytes), Content-Type: null
+POST(""): POST(0 bytes), Content-Type: application/xml
+POST(null): POST(0 bytes), Content-Type: application/octet-stream
+POST("123"): POST(3 bytes), Content-Type: application/xml
+PUT(""): PUT(0 bytes), Content-Type: application/xml
+PUT(null): PUT(0 bytes), Content-Type: null
+PUT("123"): PUT(3 bytes), Content-Type: application/xml
+DELETE(""): DELETE(null bytes), Content-Type: null
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(null bytes), Content-Type: null
+HEAD(""): HEAD(null bytes), Content-Type: null
+HEAD(null): HEAD(null bytes), Content-Type: null
+HEAD("123"): HEAD(null bytes), Content-Type: null
+WKFOOBAR(""): WKFOOBAR(0 bytes), Content-Type: application/xml
+WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(0 bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
Property changes on: trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/methods-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/methods-async-expected.txt (0 => 88612)
--- trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/methods-async-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/methods-async-expected.txt 2011-06-12 11:51:45 UTC (rev 88612)
@@ -0,0 +1,24 @@
+GET and POST should not be the only HTTP methods implemented in XMLHttpRequest for Workers.
+
+GET(""): GET(null bytes), Content-Type: null
+GET(null): GET(null bytes), Content-Type: null
+GET("123"): GET(null bytes), Content-Type: null
+POST(""): POST(0 bytes), Content-Type: application/xml
+POST(null): POST(0 bytes), Content-Type: application/octet-stream
+POST("123"): POST(3 bytes), Content-Type: application/xml
+PUT(""): PUT(0 bytes), Content-Type: application/xml
+PUT(null): PUT(0 bytes), Content-Type: null
+PUT("123"): PUT(3 bytes), Content-Type: application/xml
+DELETE(""): DELETE(null bytes), Content-Type: null
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(null bytes), Content-Type: null
+HEAD(""): HEAD(null bytes), Content-Type: null
+HEAD(null): HEAD(null bytes), Content-Type: null
+HEAD("123"): HEAD(null bytes), Content-Type: null
+WKFOOBAR(""): WKFOOBAR(0 bytes), Content-Type: application/xml
+WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(0 bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
+DONE
Property changes on: trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/methods-async-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/methods-expected.txt (0 => 88612)
--- trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/methods-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/methods-expected.txt 2011-06-12 11:51:45 UTC (rev 88612)
@@ -0,0 +1,24 @@
+GET and POST should not be the only HTTP methods implemented in XMLHttpRequest for Workers.
+
+GET(""): GET(null bytes), Content-Type: null
+GET(null): GET(null bytes), Content-Type: null
+GET("123"): GET(null bytes), Content-Type: null
+POST(""): POST(0 bytes), Content-Type: application/xml
+POST(null): POST(0 bytes), Content-Type: application/octet-stream
+POST("123"): POST(3 bytes), Content-Type: application/xml
+PUT(""): PUT(0 bytes), Content-Type: application/xml
+PUT(null): PUT(0 bytes), Content-Type: null
+PUT("123"): PUT(3 bytes), Content-Type: application/xml
+DELETE(""): DELETE(null bytes), Content-Type: null
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(null bytes), Content-Type: null
+HEAD(""): HEAD(null bytes), Content-Type: null
+HEAD(null): HEAD(null bytes), Content-Type: null
+HEAD("123"): HEAD(null bytes), Content-Type: null
+WKFOOBAR(""): WKFOOBAR(0 bytes), Content-Type: application/xml
+WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(0 bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
+DONE
Property changes on: trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/methods-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt (0 => 88612)
--- trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt 2011-06-12 11:51:45 UTC (rev 88612)
@@ -0,0 +1,24 @@
+GET and POST should not be the only HTTP methods implemented in XMLHttpRequest for SharedWorkers.
+
+GET(""): GET(null bytes), Content-Type: null
+GET(null): GET(null bytes), Content-Type: null
+GET("123"): GET(null bytes), Content-Type: null
+POST(""): POST(0 bytes), Content-Type: application/xml
+POST(null): POST(0 bytes), Content-Type: application/octet-stream
+POST("123"): POST(3 bytes), Content-Type: application/xml
+PUT(""): PUT(0 bytes), Content-Type: application/xml
+PUT(null): PUT(0 bytes), Content-Type: null
+PUT("123"): PUT(3 bytes), Content-Type: application/xml
+DELETE(""): DELETE(null bytes), Content-Type: null
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(null bytes), Content-Type: null
+HEAD(""): HEAD(null bytes), Content-Type: null
+HEAD(null): HEAD(null bytes), Content-Type: null
+HEAD("123"): HEAD(null bytes), Content-Type: null
+WKFOOBAR(""): WKFOOBAR(0 bytes), Content-Type: application/xml
+WKFOOBAR(null): WKFOOBAR(0 bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(0 bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
+DONE
Property changes on: trunk/LayoutTests/platform/qt-4.8/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (88611 => 88612)
--- trunk/Source/WebCore/ChangeLog 2011-06-12 06:01:25 UTC (rev 88611)
+++ trunk/Source/WebCore/ChangeLog 2011-06-12 11:51:45 UTC (rev 88612)
@@ -1,3 +1,19 @@
+2011-06-12 Robert Hogan <[email protected]>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] Fix methods.html and methods-lower-case.html
+ https://bugs.webkit.org/show_bug.cgi?id=62221
+
+ * platform/network/qt/QNetworkReplyHandler.cpp:
+ (WebCore::QNetworkReplyHandler::clearContentsHeaders): Refactor code from sendNetworkRequest
+ (WebCore::QNetworkReplyHandler::getIODevice): ditto
+ (WebCore::QNetworkReplyHandler::sendNetworkRequest):
+ - Remove ContentType and ContentLength headers from GET, DELETE and HEAD requests since
+ we do not send data with any of these requests.
+ - If a custom HTTP operation contains data, send it.
+ * platform/network/qt/QNetworkReplyHandler.h:
+
2011-06-11 Michael Saboff <[email protected]>
Reviewed by James Robinson.
Modified: trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp (88611 => 88612)
--- trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp 2011-06-12 06:01:25 UTC (rev 88611)
+++ trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp 2011-06-12 11:51:45 UTC (rev 88612)
@@ -598,6 +598,24 @@
client->didSendData(m_resourceHandle, bytesSent, bytesTotal);
}
+void QNetworkReplyHandler::clearContentHeaders()
+{
+ // Clearing Content-length and Content-type of the requests that do not have contents.
+ // This is necessary to ensure POST requests redirected to GETs do not leak metadata
+ // about the POST content to the site they've been redirected to.
+ m_request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant());
+ m_request.setHeader(QNetworkRequest::ContentLengthHeader, QVariant());
+}
+
+FormDataIODevice* QNetworkReplyHandler::getIODevice(const ResourceRequest& request)
+{
+ FormDataIODevice* device = new FormDataIODevice(request.httpBody());
+ // We may be uploading files so prevent QNR from buffering data.
+ m_request.setHeader(QNetworkRequest::ContentLengthHeader, device->getFormDataSize());
+ m_request.setAttribute(QNetworkRequest::DoNotBufferUploadDataAttribute, QVariant(true));
+ return device;
+}
+
QNetworkReply* QNetworkReplyHandler::sendNetworkRequest(QNetworkAccessManager* manager, const ResourceRequest& request)
{
if (m_loadType == SynchronousLoad)
@@ -615,40 +633,35 @@
&& (!url.toLocalFile().isEmpty() || url.scheme() == QLatin1String("data")))
m_method = QNetworkAccessManager::GetOperation;
- if (m_method != QNetworkAccessManager::PostOperation && m_method != QNetworkAccessManager::PutOperation) {
- // clearing Contents-length and Contents-type of the requests that do not have contents.
- m_request.setHeader(QNetworkRequest::ContentTypeHeader, QVariant());
- m_request.setHeader(QNetworkRequest::ContentLengthHeader, QVariant());
- }
-
switch (m_method) {
case QNetworkAccessManager::GetOperation:
+ clearContentHeaders();
return manager->get(m_request);
case QNetworkAccessManager::PostOperation: {
- FormDataIODevice* postDevice = new FormDataIODevice(request.httpBody());
- // We may be uploading files so prevent QNR from buffering data
- m_request.setHeader(QNetworkRequest::ContentLengthHeader, postDevice->getFormDataSize());
- m_request.setAttribute(QNetworkRequest::DoNotBufferUploadDataAttribute, QVariant(true));
+ FormDataIODevice* postDevice = getIODevice(request);
QNetworkReply* result = manager->post(m_request, postDevice);
postDevice->setParent(result);
return result;
}
case QNetworkAccessManager::HeadOperation:
+ clearContentHeaders();
return manager->head(m_request);
case QNetworkAccessManager::PutOperation: {
- FormDataIODevice* putDevice = new FormDataIODevice(request.httpBody());
- // We may be uploading files so prevent QNR from buffering data
- m_request.setHeader(QNetworkRequest::ContentLengthHeader, putDevice->getFormDataSize());
- m_request.setAttribute(QNetworkRequest::DoNotBufferUploadDataAttribute, QVariant(true));
+ FormDataIODevice* putDevice = getIODevice(request);
QNetworkReply* result = manager->put(m_request, putDevice);
putDevice->setParent(result);
return result;
}
case QNetworkAccessManager::DeleteOperation: {
+ clearContentHeaders();
return manager->deleteResource(m_request);
}
- case QNetworkAccessManager::CustomOperation:
- return manager->sendCustomRequest(m_request, m_resourceHandle->firstRequest().httpMethod().latin1().data());
+ case QNetworkAccessManager::CustomOperation: {
+ FormDataIODevice* customDevice = getIODevice(request);
+ QNetworkReply* result = manager->sendCustomRequest(m_request, m_resourceHandle->firstRequest().httpMethod().latin1().data(), customDevice);
+ customDevice->setParent(result);
+ return result;
+ }
case QNetworkAccessManager::UnknownOperation:
ASSERT_NOT_REACHED();
return 0;
Modified: trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h (88611 => 88612)
--- trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h 2011-06-12 06:01:25 UTC (rev 88611)
+++ trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h 2011-06-12 11:51:45 UTC (rev 88612)
@@ -35,6 +35,7 @@
namespace WebCore {
+class FormDataIODevice;
class ResourceHandle;
class ResourceRequest;
class ResourceResponse;
@@ -140,6 +141,8 @@
void redirect(ResourceResponse&, const QUrl&);
bool wasAborted() const { return !m_resourceHandle; }
QNetworkReply* sendNetworkRequest(QNetworkAccessManager*, const ResourceRequest&);
+ FormDataIODevice* getIODevice(const ResourceRequest&);
+ void clearContentHeaders();
OwnPtr<QNetworkReplyWrapper> m_replyWrapper;
ResourceHandle* m_resourceHandle;