Title: [231427] releases/WebKitGTK/webkit-2.20
Revision
231427
Author
[email protected]
Date
2018-05-07 02:29:35 -0700 (Mon, 07 May 2018)

Log Message

Merge r230963 - REGRESSION(r221839): Fix requests with FormData containing empty files
https://bugs.webkit.org/show_bug.cgi?id=184490
<rdar://problem/39385169>

Patch by Tadeu Zagallo <[email protected]> on 2018-04-24
Reviewed by Geoffrey Garen.

Source/WebCore:

We should not append the blob to the FormData when it is a file but has no path. It broke
the submission since the request was failing to read the file in FormDataStreamCFNet.h:156

Test: http/tests/local/formdata/send-form-data-with-empty-file.html

* platform/network/FormData.cpp:
(WebCore::FormData::appendMultiPartFileValue):

LayoutTests:

Verify that the final boundary is present in the request body when submitting FormData containing an empty file.

* http/tests/local/formdata/send-form-data-with-empty-file-expected.txt: Added.
* http/tests/local/formdata/send-form-data-with-empty-file.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog (231426 => 231427)


--- releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog	2018-05-07 09:18:09 UTC (rev 231426)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/ChangeLog	2018-05-07 09:29:35 UTC (rev 231427)
@@ -1,3 +1,16 @@
+2018-04-24  Tadeu Zagallo  <[email protected]>
+
+        REGRESSION(r221839): Fix requests with FormData containing empty files
+        https://bugs.webkit.org/show_bug.cgi?id=184490
+        <rdar://problem/39385169>
+
+        Reviewed by Geoffrey Garen.
+
+        Verify that the final boundary is present in the request body when submitting FormData containing an empty file.
+
+        * http/tests/local/formdata/send-form-data-with-empty-file-expected.txt: Added.
+        * http/tests/local/formdata/send-form-data-with-empty-file.html: Added.
+
 2018-04-23  Antti Koivisto  <[email protected]>
 
         REGRESSION (r220112): reCAPTCHA images render off screen on Twitch.tv app Log In or Sign Up

Added: releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file-expected.txt (0 => 231427)


--- releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file-expected.txt	2018-05-07 09:29:35 UTC (rev 231427)
@@ -0,0 +1,10 @@
+Test that we correctly send forms with empty files
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS lines[0] + "--" is lines[lines.length - 1]
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file.html (0 => 231427)


--- releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-2.20/LayoutTests/http/tests/local/formdata/send-form-data-with-empty-file.html	2018-05-07 09:29:35 UTC (rev 231427)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<form action="" method="post" enctype="multipart/form-data">
+  <input name="file" type="file">
+</form>
+<script src=""
+<script>
+
+description("Test that we correctly send forms with empty files");
+
+window.jsTestIsAsync = true;
+
+const form = document.forms[0];
+const request = new XMLHttpRequest();
+request.open("POST", form.action);
+request._onload_ = function() {
+    lines = request.responseText.trim().split('\r\n');
+    shouldBe('lines[0] + "--"', 'lines[lines.length - 1]');
+    finishJSTest();
+}
+request.send(new FormData(form));
+</script>
+<script src=""
+</body>
+</html>
+

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog (231426 => 231427)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-05-07 09:18:09 UTC (rev 231426)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/ChangeLog	2018-05-07 09:29:35 UTC (rev 231427)
@@ -1,3 +1,19 @@
+2018-04-24  Tadeu Zagallo  <[email protected]>
+
+        REGRESSION(r221839): Fix requests with FormData containing empty files
+        https://bugs.webkit.org/show_bug.cgi?id=184490
+        <rdar://problem/39385169>
+
+        Reviewed by Geoffrey Garen.
+
+        We should not append the blob to the FormData when it is a file but has no path. It broke
+        the submission since the request was failing to read the file in FormDataStreamCFNet.h:156
+
+        Test: http/tests/local/formdata/send-form-data-with-empty-file.html
+
+        * platform/network/FormData.cpp:
+        (WebCore::FormData::appendMultiPartFileValue):
+
 2018-04-24  Zan Dobersek  <[email protected]>
 
         [CoordGraphics] Avoid painting backing stores for zero-opacity layers

Modified: releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/network/FormData.cpp (231426 => 231427)


--- releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/network/FormData.cpp	2018-05-07 09:18:09 UTC (rev 231426)
+++ releases/WebKitGTK/webkit-2.20/Source/WebCore/platform/network/FormData.cpp	2018-05-07 09:29:35 UTC (rev 231427)
@@ -223,7 +223,7 @@
 
     if (!file.path().isEmpty())
         appendFile(file.path(), shouldGenerateFile);
-    else
+    else if (file.size())
         appendBlob(file.url());
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to