[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
ap at apple.com
ap at apple.com
Wed Dec 22 12:53:33 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit bdf3116e52a2bf1a6e6b3769cb6941f1b1d20eb2
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Sep 1 02:47:19 2010 +0000
2010-08-31 Alexey Proskuryakov <ap at apple.com>
Reviewed by Adam Barth.
https://bugs.webkit.org/show_bug.cgi?id=40947
<rdar://problem/8124723> REGRESSION (r57544): XMLHttpRequest POSTed multipart/form-data
wrongfully gets a charset appended
* http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers-expected.txt:
* http/tests/xmlhttprequest/request-encoding2.html:
Updated tests that has wrong expectations.
* http/tests/xmlhttprequest/post-with-boundary-expected.txt: Added.
* http/tests/xmlhttprequest/post-with-boundary.html: Added.
Added a new test, sending a valid multipart form with boundary.
2010-08-31 Alexey Proskuryakov <ap at apple.com>
Reviewed by Adam Barth.
https://bugs.webkit.org/show_bug.cgi?id=40947
<rdar://problem/8124723> REGRESSION (r57544): XMLHttpRequest POSTed multipart/form-data
wrongfully gets a charset appended
Test: http/tests/xmlhttprequest/post-with-boundary.html
* xml/XMLHttpRequest.cpp:
(WebCore::replaceCharsetInMediaType): Changed to only set charset if it was already present,
and never append.
(WebCore::XMLHttpRequest::send): Updated for replaceCharsetInMediaType renaming.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66568 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b2c5228..8a7fa03 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2010-08-31 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Adam Barth.
+
+ https://bugs.webkit.org/show_bug.cgi?id=40947
+ <rdar://problem/8124723> REGRESSION (r57544): XMLHttpRequest POSTed multipart/form-data
+ wrongfully gets a charset appended
+
+ * http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers-expected.txt:
+ * http/tests/xmlhttprequest/request-encoding2.html:
+ Updated tests that has wrong expectations.
+
+ * http/tests/xmlhttprequest/post-with-boundary-expected.txt: Added.
+ * http/tests/xmlhttprequest/post-with-boundary.html: Added.
+ Added a new test, sending a valid multipart form with boundary.
+
2010-08-31 Darin Adler <darin at apple.com>
Fix gtk bot.
diff --git a/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers-expected.txt b/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers-expected.txt
index 8af388e..2f7e2bd 100644
--- a/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers-expected.txt
+++ b/LayoutTests/http/tests/xmlhttprequest/access-control-basic-whitelist-request-headers-expected.txt
@@ -1,6 +1,6 @@
Accept: *
Accept-Language: ru
Content-Language: ru
-Content-Type: text/plain; charset=UTF-8
+Content-Type: text/plain
diff --git a/LayoutTests/http/tests/xmlhttprequest/post-with-boundary-expected.txt b/LayoutTests/http/tests/xmlhttprequest/post-with-boundary-expected.txt
new file mode 100644
index 0000000..44d96b9
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/post-with-boundary-expected.txt
@@ -0,0 +1,5 @@
+Test for bug 40947: REGRESSION (r57544): XMLHttpRequest POSTed multipart/form-data wrongfully gets a charset appended.
+
+There should be no charset added, and most importantly, it shouldn't be appended to the end.
+
+PASS
diff --git a/LayoutTests/http/tests/xmlhttprequest/post-with-boundary.html b/LayoutTests/http/tests/xmlhttprequest/post-with-boundary.html
new file mode 100644
index 0000000..41048a9
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/post-with-boundary.html
@@ -0,0 +1,29 @@
+<body>
+<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=40947">bug 40947</a>:
+REGRESSION (r57544): XMLHttpRequest POSTed multipart/form-data wrongfully gets a charset appended.</p>
+<p>There should be no charset added, and most importantly, it shouldn't be appended to the end.</p>
+<script>
+if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+var boundary = "----MISFormBoundaryMTCcH1pthhYPYEpV";
+var contentType = "multipart/form-data; boundary=" + boundary;
+var body = '';
+body += '--' + boundary + '\r\n' + 'Content-Disposition: form-data; name="';
+body += "data";
+body += '"\r\n\r\n';
+body += "foobar";
+body += '\r\n'
+body += '--' + boundary + '--';
+
+var r = new XMLHttpRequest;
+r.open("POST", "print-content-type.cgi", false);
+r.setRequestHeader("Content-Type", contentType);
+r.send(body);
+var result = r.responseText.replace(/[\r\n]/g, "");
+
+if (result == contentType)
+ document.write("PASS");
+else
+ document.write("FAIL, Content-Type has been modified. Expected '" + contentType + "', got '" + result + "'.");
+</script>
diff --git a/LayoutTests/http/tests/xmlhttprequest/request-encoding2.html b/LayoutTests/http/tests/xmlhttprequest/request-encoding2.html
index 408bbe5..d17db26 100644
--- a/LayoutTests/http/tests/xmlhttprequest/request-encoding2.html
+++ b/LayoutTests/http/tests/xmlhttprequest/request-encoding2.html
@@ -33,7 +33,7 @@ XMLHttpRequest should force to send content-type as charset equals UTF-8.</p>
req.send("");
document.getElementById("result2").firstChild.data = "Test2 (setRequestHeader was called without a charset):";
- if (req.responseText == "application/xml; charset=UTF-8\n")
+ if (req.responseText == "application/xml\n")
document.getElementById("result2").firstChild.data += " SUCCESS";
else
document.getElementById("result2").firstChild.data += " FAILURE: '" + req.responseText + "'";
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c928346..df2d83d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-08-31 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Adam Barth.
+
+ https://bugs.webkit.org/show_bug.cgi?id=40947
+ <rdar://problem/8124723> REGRESSION (r57544): XMLHttpRequest POSTed multipart/form-data
+ wrongfully gets a charset appended
+
+ Test: http/tests/xmlhttprequest/post-with-boundary.html
+
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::replaceCharsetInMediaType): Changed to only set charset if it was already present,
+ and never append.
+ (WebCore::XMLHttpRequest::send): Updated for replaceCharsetInMediaType renaming.
+
2010-08-31 Daniel Cheng <dcheng at chromium.org>
Reviewed by Tony Chang.
diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp
index b58e3aa..9f93e1a 100644
--- a/WebCore/xml/XMLHttpRequest.cpp
+++ b/WebCore/xml/XMLHttpRequest.cpp
@@ -131,26 +131,22 @@ static bool isSetCookieHeader(const AtomicString& name)
return equalIgnoringCase(name, "set-cookie") || equalIgnoringCase(name, "set-cookie2");
}
-static void setCharsetInMediaType(String& mediaType, const String& charsetValue)
+static void replaceCharsetInMediaType(String& mediaType, const String& charsetValue)
{
unsigned int pos = 0, len = 0;
findCharsetInMediaType(mediaType, pos, len);
if (!len) {
- // When no charset found, append new charset.
- mediaType.stripWhiteSpace();
- if (mediaType[mediaType.length() - 1] != ';')
- mediaType.append(";");
- mediaType.append(" charset=");
- mediaType.append(charsetValue);
- } else {
- // Found at least one existing charset, replace all occurrences with new charset.
- while (len) {
- mediaType.replace(pos, len, charsetValue);
- unsigned int start = pos + charsetValue.length();
- findCharsetInMediaType(mediaType, pos, len, start);
- }
+ // When no charset found, do nothing.
+ return;
+ }
+
+ // Found at least one existing charset, replace all occurrences with new charset.
+ while (len) {
+ mediaType.replace(pos, len, charsetValue);
+ unsigned int start = pos + charsetValue.length();
+ findCharsetInMediaType(mediaType, pos, len, start);
}
}
@@ -502,7 +498,7 @@ void XMLHttpRequest::send(const String& body, ExceptionCode& ec)
#endif
setRequestHeaderInternal("Content-Type", "application/xml");
} else {
- setCharsetInMediaType(contentType, "UTF-8");
+ replaceCharsetInMediaType(contentType, "UTF-8");
m_requestHeaders.set("Content-Type", contentType);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list