Soup HTTP backend does not send Content-Length in certain cases
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Apr 2012 12:59:35 +0000 (12:59 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Apr 2012 12:59:35 +0000 (12:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=82036

Patch by Dominik Röttsches <dominik.rottsches@linux.intel.com> on 2012-04-03
Reviewed by Gustavo Noronha Silva.

Source/WebCore:

Telling soup explicitly when to send content-length header
in POST & PUT cases in order to align with e.g. Chromium and FF.

No new tests, already covered by *methods*.html in
http/tests/xmlhttprequest/.

* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::startHTTPRequest): Special handling for POST & PUT.

LayoutTests:

Rebaselining and unskipping relevant tests for EFL.
Rebaselining POST and PUT cases for GTK.

* platform/efl/Skipped:
* platform/efl/http/tests/xmlhttprequest/methods-async-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/methods-async-expected.txt.
* platform/efl/http/tests/xmlhttprequest/methods-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/methods-expected.txt.
* platform/efl/http/tests/xmlhttprequest/workers/methods-async-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/methods-async-expected.txt.
* platform/efl/http/tests/xmlhttprequest/workers/methods-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/methods-expected.txt.
* platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt.
* platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt.
* platform/gtk/http/tests/xmlhttprequest/methods-async-expected.txt:
* platform/gtk/http/tests/xmlhttprequest/methods-expected.txt:
* platform/gtk/http/tests/xmlhttprequest/workers/methods-async-expected.txt:
* platform/gtk/http/tests/xmlhttprequest/workers/methods-expected.txt:
* platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt:
* platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113019 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/efl/Skipped
LayoutTests/platform/efl/http/tests/xmlhttprequest/methods-async-expected.txt [new file with mode: 0644]
LayoutTests/platform/efl/http/tests/xmlhttprequest/methods-expected.txt [new file with mode: 0644]
LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/methods-async-expected.txt [new file with mode: 0644]
LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/methods-expected.txt [new file with mode: 0644]
LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt [new file with mode: 0644]
LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt [new file with mode: 0644]
LayoutTests/platform/gtk/http/tests/xmlhttprequest/methods-async-expected.txt
LayoutTests/platform/gtk/http/tests/xmlhttprequest/methods-expected.txt
LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/methods-async-expected.txt
LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/methods-expected.txt
LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt
LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

index f172ea2..d67afd5 100644 (file)
@@ -1,3 +1,27 @@
+2012-04-03  Dominik Röttsches  <dominik.rottsches@linux.intel.com>
+
+        Soup HTTP backend does not send Content-Length in certain cases
+        https://bugs.webkit.org/show_bug.cgi?id=82036
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Rebaselining and unskipping relevant tests for EFL.
+        Rebaselining POST and PUT cases for GTK.
+
+        * platform/efl/Skipped:
+        * platform/efl/http/tests/xmlhttprequest/methods-async-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/methods-async-expected.txt.
+        * platform/efl/http/tests/xmlhttprequest/methods-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/methods-expected.txt.
+        * platform/efl/http/tests/xmlhttprequest/workers/methods-async-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/methods-async-expected.txt.
+        * platform/efl/http/tests/xmlhttprequest/workers/methods-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/methods-expected.txt.
+        * platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt.
+        * platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt: Copied from LayoutTests/platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt.
+        * platform/gtk/http/tests/xmlhttprequest/methods-async-expected.txt:
+        * platform/gtk/http/tests/xmlhttprequest/methods-expected.txt:
+        * platform/gtk/http/tests/xmlhttprequest/workers/methods-async-expected.txt:
+        * platform/gtk/http/tests/xmlhttprequest/workers/methods-expected.txt:
+        * platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt:
+        * platform/gtk/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt:
+
 2012-04-03  Christophe Dumez  <christophe.dumez@intel.com>
 
         [EFL] LayoutTestController needs implementation of setDefersLoading
index 6d425e8..0d85d7f 100644 (file)
@@ -2520,8 +2520,6 @@ http/tests/xmlhttprequest/cross-origin-cookie-storage.html
 http/tests/xmlhttprequest/cross-origin-no-authorization.html
 http/tests/xmlhttprequest/failed-auth.html
 http/tests/xmlhttprequest/logout.html
-http/tests/xmlhttprequest/methods.html
-http/tests/xmlhttprequest/methods-async.html
 http/tests/xmlhttprequest/origin-whitelisting-all.html
 http/tests/xmlhttprequest/origin-whitelisting-exact-match.html
 http/tests/xmlhttprequest/origin-whitelisting-ip-addresses.html
@@ -2529,10 +2527,6 @@ http/tests/xmlhttprequest/origin-whitelisting-removal.html
 http/tests/xmlhttprequest/origin-whitelisting-subdomains.html
 http/tests/xmlhttprequest/remember-bad-password.html
 http/tests/xmlhttprequest/redirect-cross-origin-tripmine.html
-http/tests/xmlhttprequest/workers/shared-worker-methods.html
-http/tests/xmlhttprequest/workers/methods.html
-http/tests/xmlhttprequest/workers/methods-async.html
-http/tests/xmlhttprequest/workers/shared-worker-methods-async.html
 http/tests/xmlviewer/extensions-api.html
 
 # These test cases don't have expected result yet.
diff --git a/LayoutTests/platform/efl/http/tests/xmlhttprequest/methods-async-expected.txt b/LayoutTests/platform/efl/http/tests/xmlhttprequest/methods-async-expected.txt
new file mode 100644 (file)
index 0000000..8a0ceb4
--- /dev/null
@@ -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: null
+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(0 bytes), Content-Type: application/xml
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(3 bytes), Content-Type: application/xml
+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(null bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(null bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
diff --git a/LayoutTests/platform/efl/http/tests/xmlhttprequest/methods-expected.txt b/LayoutTests/platform/efl/http/tests/xmlhttprequest/methods-expected.txt
new file mode 100644 (file)
index 0000000..8a0ceb4
--- /dev/null
@@ -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: null
+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(0 bytes), Content-Type: application/xml
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(3 bytes), Content-Type: application/xml
+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(null bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(null bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
diff --git a/LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/methods-async-expected.txt b/LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/methods-async-expected.txt
new file mode 100644 (file)
index 0000000..f6bb933
--- /dev/null
@@ -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: null
+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(0 bytes), Content-Type: application/xml
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(3 bytes), Content-Type: application/xml
+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(null bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(null bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
+DONE
diff --git a/LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/methods-expected.txt b/LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/methods-expected.txt
new file mode 100644 (file)
index 0000000..f6bb933
--- /dev/null
@@ -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: null
+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(0 bytes), Content-Type: application/xml
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(3 bytes), Content-Type: application/xml
+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(null bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(null bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
+DONE
diff --git a/LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt b/LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-async-expected.txt
new file mode 100644 (file)
index 0000000..634827a
--- /dev/null
@@ -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: null
+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(0 bytes), Content-Type: application/xml
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(3 bytes), Content-Type: application/xml
+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(null bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(null bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
+DONE
diff --git a/LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt b/LayoutTests/platform/efl/http/tests/xmlhttprequest/workers/shared-worker-methods-expected.txt
new file mode 100644 (file)
index 0000000..634827a
--- /dev/null
@@ -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: null
+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(0 bytes), Content-Type: application/xml
+DELETE(null): DELETE(null bytes), Content-Type: null
+DELETE("123"): DELETE(3 bytes), Content-Type: application/xml
+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(null bytes), Content-Type: null
+WKFOOBAR("123"): WKFOOBAR(3 bytes), Content-Type: application/xml
+SEARCH(""): SEARCH(0 bytes), Content-Type: application/xml
+SEARCH(null): SEARCH(null bytes), Content-Type: null
+SEARCH("123"): SEARCH(3 bytes), Content-Type: application/xml
+DONE
index e05b0be..8a0ceb4 100644 (file)
@@ -4,10 +4,10 @@ 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(null bytes), Content-Type: null
+POST(null): POST(0 bytes), Content-Type: null
 POST("123"): POST(3 bytes), Content-Type: application/xml
 PUT(""): PUT(0 bytes), Content-Type: application/xml
-PUT(null): PUT(null bytes), Content-Type: null
+PUT(null): PUT(0 bytes), Content-Type: null
 PUT("123"): PUT(3 bytes), Content-Type: application/xml
 DELETE(""): DELETE(0 bytes), Content-Type: application/xml
 DELETE(null): DELETE(null bytes), Content-Type: null
index e05b0be..8a0ceb4 100644 (file)
@@ -4,10 +4,10 @@ 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(null bytes), Content-Type: null
+POST(null): POST(0 bytes), Content-Type: null
 POST("123"): POST(3 bytes), Content-Type: application/xml
 PUT(""): PUT(0 bytes), Content-Type: application/xml
-PUT(null): PUT(null bytes), Content-Type: null
+PUT(null): PUT(0 bytes), Content-Type: null
 PUT("123"): PUT(3 bytes), Content-Type: application/xml
 DELETE(""): DELETE(0 bytes), Content-Type: application/xml
 DELETE(null): DELETE(null bytes), Content-Type: null
index 008e324..f6bb933 100644 (file)
@@ -4,10 +4,10 @@ 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(null bytes), Content-Type: null
+POST(null): POST(0 bytes), Content-Type: null
 POST("123"): POST(3 bytes), Content-Type: application/xml
 PUT(""): PUT(0 bytes), Content-Type: application/xml
-PUT(null): PUT(null bytes), Content-Type: null
+PUT(null): PUT(0 bytes), Content-Type: null
 PUT("123"): PUT(3 bytes), Content-Type: application/xml
 DELETE(""): DELETE(0 bytes), Content-Type: application/xml
 DELETE(null): DELETE(null bytes), Content-Type: null
index 008e324..f6bb933 100644 (file)
@@ -4,10 +4,10 @@ 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(null bytes), Content-Type: null
+POST(null): POST(0 bytes), Content-Type: null
 POST("123"): POST(3 bytes), Content-Type: application/xml
 PUT(""): PUT(0 bytes), Content-Type: application/xml
-PUT(null): PUT(null bytes), Content-Type: null
+PUT(null): PUT(0 bytes), Content-Type: null
 PUT("123"): PUT(3 bytes), Content-Type: application/xml
 DELETE(""): DELETE(0 bytes), Content-Type: application/xml
 DELETE(null): DELETE(null bytes), Content-Type: null
index ec52cf8..634827a 100644 (file)
@@ -4,10 +4,10 @@ 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(null bytes), Content-Type: null
+POST(null): POST(0 bytes), Content-Type: null
 POST("123"): POST(3 bytes), Content-Type: application/xml
 PUT(""): PUT(0 bytes), Content-Type: application/xml
-PUT(null): PUT(null bytes), Content-Type: null
+PUT(null): PUT(0 bytes), Content-Type: null
 PUT("123"): PUT(3 bytes), Content-Type: application/xml
 DELETE(""): DELETE(0 bytes), Content-Type: application/xml
 DELETE(null): DELETE(null bytes), Content-Type: null
index ec52cf8..634827a 100644 (file)
@@ -4,10 +4,10 @@ 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(null bytes), Content-Type: null
+POST(null): POST(0 bytes), Content-Type: null
 POST("123"): POST(3 bytes), Content-Type: application/xml
 PUT(""): PUT(0 bytes), Content-Type: application/xml
-PUT(null): PUT(null bytes), Content-Type: null
+PUT(null): PUT(0 bytes), Content-Type: null
 PUT("123"): PUT(3 bytes), Content-Type: application/xml
 DELETE(""): DELETE(0 bytes), Content-Type: application/xml
 DELETE(null): DELETE(null bytes), Content-Type: null
index b76915e..33477dc 100644 (file)
@@ -1,3 +1,19 @@
+2012-04-03  Dominik Röttsches  <dominik.rottsches@linux.intel.com>
+
+        Soup HTTP backend does not send Content-Length in certain cases
+        https://bugs.webkit.org/show_bug.cgi?id=82036
+
+        Reviewed by Gustavo Noronha Silva.
+
+        Telling soup explicitly when to send content-length header
+        in POST & PUT cases in order to align with e.g. Chromium and FF.
+
+        No new tests, already covered by *methods*.html in
+        http/tests/xmlhttprequest/.
+
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::startHTTPRequest): Special handling for POST & PUT.
+
 2012-04-03  Eric Seidel  <eric@webkit.org>
 
         Simplify CSSStyleSelector constructor through the use of a helper function
index afeeed3..3d11af4 100644 (file)
@@ -496,6 +496,15 @@ static bool startHTTPRequest(ResourceHandle* handle)
     if (!soup_message_headers_get_one(soupMessage->request_headers, "Accept"))
         soup_message_headers_append(soupMessage->request_headers, "Accept", "*/*");
 
+    // In the case of XHR .send() and .send("") explicitly tell libsoup
+    // to send a zero content-lenght header for consistency
+    // with other backends (e.g. Chromium's) and other UA implementations like FF.
+    // It's done in the backend here instead of in XHR code since in XHR CORS checking
+    // prevents us from this kind of late header manipulation.
+    if ((request.httpMethod() == "POST" || request.httpMethod() == "PUT")
+        && (!request.httpBody() || request.httpBody()->isEmpty()))
+        soup_message_headers_set_content_length(soupMessage->request_headers, 0);
+
     // Send the request only if it's not been explicitly deferred.
     if (!d->m_defersLoading) {
         d->m_cancellable = adoptGRef(g_cancellable_new());