Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1207)

Unified Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 262173002: Reduce method names converted to upper case via uppercaseKnownHTTPMethod() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/method-names-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/xml/XMLHttpRequest.cpp
diff --git a/Source/core/xml/XMLHttpRequest.cpp b/Source/core/xml/XMLHttpRequest.cpp
index 245bbc5f5dfa27af1b7714dc5abf953eda1661ab..88c950d69f39327d0ab5d620483090a1b043698e 100644
--- a/Source/core/xml/XMLHttpRequest.cpp
+++ b/Source/core/xml/XMLHttpRequest.cpp
@@ -488,22 +488,20 @@ bool XMLHttpRequest::isAllowedHTTPMethod(const String& method)
AtomicString XMLHttpRequest::uppercaseKnownHTTPMethod(const AtomicString& method)
{
+ // http://xhr.spec.whatwg.org/#dom-xmlhttprequest-open
+ // If method is a case-insensitive match for `DELETE`, `GET`, `HEAD`, `OPTIONS`, `POST`, or
+ // `PUT`, subtract 0x20 from each byte in the range 0x61 (ASCII a) to 0x7A (ASCII z).
+ //
+ // If it does not match any of the above, it is passed through literally, including in the final
+ // request.
const char* const methods[] = {
- "COPY",
"DELETE",
"GET",
"HEAD",
- "INDEX",
- "LOCK",
- "M-POST",
- "MKCOL",
- "MOVE",
"OPTIONS",
"POST",
- "PROPFIND",
- "PROPPATCH",
- "PUT",
- "UNLOCK" };
+ "PUT"
+ };
for (unsigned i = 0; i < WTF_ARRAY_LENGTH(methods); ++i) {
if (equalIgnoringCase(method, methods[i])) {
// Don't bother allocating a new string if it's already all uppercase.
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/method-names-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698