Fixes: https://bugs.webkit.org/show_bug.cgi?id=22971
Fix regression caused by the HTMLFormElement refactorization.
File form elements without a name have to be included in multipart/form-data
submission. Cover this behaviour with a new test case.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@39445
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-12-22 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Fixes: https://bugs.webkit.org/show_bug.cgi?id=22971
+
+ Fix regression caused by the HTMLFormElement refactorization.
+ File form elements without a name have to be included in multipart/form-data
+ submission. Cover this behaviour with a new test case.
+
+ * http/tests/misc/empty-file-formdata-expected.txt: Added.
+ * http/tests/misc/empty-file-formdata.html: Added.
+ * http/tests/misc/resources/check-unnamed-file-included-in-formdata.php: Added.
+
2008-12-22 David Kilzer <ddkilzer@apple.com>
Bug 11850: Webarchive fails to save images referenced in CSS
--- /dev/null
+This tests verifies that files without a name are included in the multipart form data:
+
+Test passed.
--- /dev/null
+<html>
+<head>
+<script>
+function test()
+{
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+ }
+
+ document.forms[0].submit();
+}
+
+window.onload = test;
+</script>
+</head>
+<body>
+<form enctype="multipart/form-data" method="POST" action="resources/check-unnamed-file-included-in-formdata.php">
+<input name="data" type="file"></input>
+</form>
+</body>
+</html>
--- /dev/null
+<?php
+header("Content-Type: text/html; charset=UTF-8");
+?>
+<html>
+<head>
+<script>
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+</script>
+</head>
+<body>
+<h1>This tests verifies that files without a name are included in the multipart form data:</h1>
+<pre>
+<?php
+if (isset($_FILES['data'])) {
+ print "Test passed.";
+} else {
+ print "Test failed.";
+}
+?>
+</pre>
+</body>
+</html>
+2008-12-22 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Fixes: https://bugs.webkit.org/show_bug.cgi?id=22971
+
+ Fix regression caused by the HTMLFormElement refactorization.
+ File form elements without a name have to be included in multipart/form-data
+ submission. Cover this behaviour with a new test case.
+
+ Test: http/tests/misc/empty-file-formdata.html
+
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::createFormData):
+ * wml/WMLTagNames.in:
+
2008-12-22 David Kilzer <ddkilzer@apple.com>
<rdar://problem/6438298> Bump schema version for app cache
}
}
- if (!fileName.isEmpty()) {
- m_formDataBuilder.addFilenameToMultiPartHeader(header, encoding, fileName);
+ // We have to include the filename=".." part in the header, even if the filename is empty
+ // Covered by LayoutTests/http/tests/misc/empty-file-formdata.html
+ m_formDataBuilder.addFilenameToMultiPartHeader(header, encoding, fileName);
+ if (!fileName.isEmpty()) {
// FIXME: The MIMETypeRegistry function's name makes it sound like it takes a path,
// not just a basename. But filename is not the path. But note that it's not safe to
// just use path instead since in the generated-file case it will not reflect the