Title: [132758] trunk
- Revision
- 132758
- Author
- [email protected]
- Date
- 2012-10-28 19:50:52 -0700 (Sun, 28 Oct 2012)
Log Message
Webkit adds a boundary to the Content-Type: text/plain POST header
https://bugs.webkit.org/show_bug.cgi?id=100445
Patch by Kunihiko Sakamoto <[email protected]> on 2012-10-28
Reviewed by Kent Tamura.
Source/WebCore:
Fixed a bug where an empty boundary parameter was added to Content-Type
header when POSTing forms with enctype=text/plain.
Test: http/tests/misc/form-post-textplain.html
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::populateFrameLoadRequest): Add boundary parameter to
Content-Type only when a boundary string is generated.
LayoutTests:
Fixed test failure and added a test case for Content-Type header.
* http/tests/misc/form-post-textplain-expected.txt:
* http/tests/misc/form-post-textplain.html:
* http/tests/misc/resources/form-post-textplain.php:
Added a test case for testing Content-Type POST header.
Also fixed existing test case that attempted to test newline in the input value.
LF in the input value is replaced with CRLF durling the construction of the form data set.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (132757 => 132758)
--- trunk/LayoutTests/ChangeLog 2012-10-29 02:16:27 UTC (rev 132757)
+++ trunk/LayoutTests/ChangeLog 2012-10-29 02:50:52 UTC (rev 132758)
@@ -1,3 +1,19 @@
+2012-10-28 Kunihiko Sakamoto <[email protected]>
+
+ Webkit adds a boundary to the Content-Type: text/plain POST header
+ https://bugs.webkit.org/show_bug.cgi?id=100445
+
+ Reviewed by Kent Tamura.
+
+ Fixed test failure and added a test case for Content-Type header.
+
+ * http/tests/misc/form-post-textplain-expected.txt:
+ * http/tests/misc/form-post-textplain.html:
+ * http/tests/misc/resources/form-post-textplain.php:
+ Added a test case for testing Content-Type POST header.
+ Also fixed existing test case that attempted to test newline in the input value.
+ LF in the input value is replaced with CRLF durling the construction of the form data set.
+
2012-10-28 Kent Tamura <[email protected]>
[Chromium] Test expectation update
Modified: trunk/LayoutTests/http/tests/misc/form-post-textplain-expected.txt (132757 => 132758)
--- trunk/LayoutTests/http/tests/misc/form-post-textplain-expected.txt 2012-10-29 02:16:27 UTC (rev 132757)
+++ trunk/LayoutTests/http/tests/misc/form-post-textplain-expected.txt 2012-10-29 02:50:52 UTC (rev 132758)
@@ -1,3 +1,5 @@
-This is a test for 20795, it makes sure that forms POSTed with a content-type of text/plain actually send data in text/plain
+This is a test for 20795 and 100445, it makes sure that forms POSTed with a content-type of text/plain actually send data in text/plain
-FAILURE: f1=This is field #1 &!@$%\n='<> f2=This is field #2 ""
+SUCCESS: Content-type is text/plain.
+
+SUCCESS
Modified: trunk/LayoutTests/http/tests/misc/form-post-textplain.html (132757 => 132758)
--- trunk/LayoutTests/http/tests/misc/form-post-textplain.html 2012-10-29 02:16:27 UTC (rev 132757)
+++ trunk/LayoutTests/http/tests/misc/form-post-textplain.html 2012-10-29 02:50:52 UTC (rev 132758)
@@ -1,15 +1,16 @@
<html>
<head>
-<title>Regression test for bug 20795</title>
+<title>Regression test for bug 20795 and 100445</title>
</head>
<body>
<p>
-This is a test for https://bugs.webkit.org/show_bug.cgi?id=20795, it makes sure that
+This is a test for https://bugs.webkit.org/show_bug.cgi?id=20795 and
+https://bugs.webkit.org/show_bug.cgi?id=100445, it makes sure that
forms POSTed with a content-type of text/plain actually send data in text/plain
</p>
<form enctype="text/plain" method="post" action="" name="f">
- <input type="hidden" name="f1" value="This is field #1 &!@$%\n='<>">
+ <input type="hidden" name="f1" value="This is field #1 &!@$% ='<>">
<input type="hidden" name="f2" value='This is field #2 ""'>
<input type="submit" value="press me">
</form>
Modified: trunk/LayoutTests/http/tests/misc/resources/form-post-textplain.php (132757 => 132758)
--- trunk/LayoutTests/http/tests/misc/resources/form-post-textplain.php 2012-10-29 02:16:27 UTC (rev 132757)
+++ trunk/LayoutTests/http/tests/misc/resources/form-post-textplain.php 2012-10-29 02:50:52 UTC (rev 132758)
@@ -3,16 +3,25 @@
?>
<html>
<head>
-<title>Regression test for bug 20795</title>
+<title>Regression test for bug 20795 and 100445</title>
</head>
<body>
<p>
-This is a test for 20795, it makes sure that forms POSTed with a content-type of text/plain actually send data in text/plain
+This is a test for 20795 and 100445, it makes sure that forms POSTed with a content-type of text/plain actually send data in text/plain
</p>
<?php
+
+$content_type = $_SERVER["CONTENT_TYPE"];
+
+if ($content_type == "text/plain") {
+ echo "<p>SUCCESS: Content-type is text/plain.</p>";
+} else {
+ echo "<p>FAIL: Content-type should be text/plain, but was '$content_type'</p>";
+}
+
$data = ""
-if($data == "f1=This is field #1 &!@$%\n='<>\r\nf2=This is field #2 \"\"") {
+if($data == "f1=This is field #1 &!@$%\r\n='<>\r\nf2=This is field #2 \"\"") {
echo "<p>SUCCESS</p>";
} else {
echo "<p>FAILURE: $data</p>";
Modified: trunk/Source/WebCore/ChangeLog (132757 => 132758)
--- trunk/Source/WebCore/ChangeLog 2012-10-29 02:16:27 UTC (rev 132757)
+++ trunk/Source/WebCore/ChangeLog 2012-10-29 02:50:52 UTC (rev 132758)
@@ -1,3 +1,19 @@
+2012-10-28 Kunihiko Sakamoto <[email protected]>
+
+ Webkit adds a boundary to the Content-Type: text/plain POST header
+ https://bugs.webkit.org/show_bug.cgi?id=100445
+
+ Reviewed by Kent Tamura.
+
+ Fixed a bug where an empty boundary parameter was added to Content-Type
+ header when POSTing forms with enctype=text/plain.
+
+ Test: http/tests/misc/form-post-textplain.html
+
+ * loader/FormSubmission.cpp:
+ (WebCore::FormSubmission::populateFrameLoadRequest): Add boundary parameter to
+ Content-Type only when a boundary string is generated.
+
2012-10-28 Philip Rogers <[email protected]>
Cache calcMode() value for SVG animations.
Modified: trunk/Source/WebCore/loader/FormSubmission.cpp (132757 => 132758)
--- trunk/Source/WebCore/loader/FormSubmission.cpp 2012-10-29 02:16:27 UTC (rev 132757)
+++ trunk/Source/WebCore/loader/FormSubmission.cpp 2012-10-29 02:50:52 UTC (rev 132758)
@@ -245,9 +245,9 @@
frameRequest.resourceRequest().setHTTPBody(m_formData);
// construct some user headers if necessary
- if (m_contentType.isNull() || m_contentType == "application/x-www-form-urlencoded")
+ if (m_boundary.isEmpty())
frameRequest.resourceRequest().setHTTPContentType(m_contentType);
- else // contentType must be "multipart/form-data"
+ else
frameRequest.resourceRequest().setHTTPContentType(m_contentType + "; boundary=" + m_boundary);
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes