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

Side by Side 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, 7 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/method-names-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org>
4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org>
5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved.
6 * Copyright (C) 2012 Intel Corporation 6 * Copyright (C) 2012 Intel Corporation
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 481
482 bool XMLHttpRequest::isAllowedHTTPMethod(const String& method) 482 bool XMLHttpRequest::isAllowedHTTPMethod(const String& method)
483 { 483 {
484 return !equalIgnoringCase(method, "TRACE") 484 return !equalIgnoringCase(method, "TRACE")
485 && !equalIgnoringCase(method, "TRACK") 485 && !equalIgnoringCase(method, "TRACK")
486 && !equalIgnoringCase(method, "CONNECT"); 486 && !equalIgnoringCase(method, "CONNECT");
487 } 487 }
488 488
489 AtomicString XMLHttpRequest::uppercaseKnownHTTPMethod(const AtomicString& method ) 489 AtomicString XMLHttpRequest::uppercaseKnownHTTPMethod(const AtomicString& method )
490 { 490 {
491 // http://xhr.spec.whatwg.org/#dom-xmlhttprequest-open
492 // If method is a case-insensitive match for `DELETE`, `GET`, `HEAD`, `OPTIO NS`, `POST`, or
493 // `PUT`, subtract 0x20 from each byte in the range 0x61 (ASCII a) to 0x7A ( ASCII z).
494 //
495 // If it does not match any of the above, it is passed through literally, in cluding in the final
496 // request.
491 const char* const methods[] = { 497 const char* const methods[] = {
492 "COPY",
493 "DELETE", 498 "DELETE",
494 "GET", 499 "GET",
495 "HEAD", 500 "HEAD",
496 "INDEX",
497 "LOCK",
498 "M-POST",
499 "MKCOL",
500 "MOVE",
501 "OPTIONS", 501 "OPTIONS",
502 "POST", 502 "POST",
503 "PROPFIND", 503 "PUT"
504 "PROPPATCH", 504 };
505 "PUT",
506 "UNLOCK" };
507 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(methods); ++i) { 505 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(methods); ++i) {
508 if (equalIgnoringCase(method, methods[i])) { 506 if (equalIgnoringCase(method, methods[i])) {
509 // Don't bother allocating a new string if it's already all uppercas e. 507 // Don't bother allocating a new string if it's already all uppercas e.
510 if (method == methods[i]) 508 if (method == methods[i])
511 return method; 509 return method;
512 return methods[i]; 510 return methods[i];
513 } 511 }
514 } 512 }
515 return method; 513 return method;
516 } 514 }
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 } 1412 }
1415 1413
1416 void XMLHttpRequest::trace(Visitor* visitor) 1414 void XMLHttpRequest::trace(Visitor* visitor)
1417 { 1415 {
1418 visitor->trace(m_responseBlob); 1416 visitor->trace(m_responseBlob);
1419 visitor->trace(m_responseStream); 1417 visitor->trace(m_responseStream);
1420 visitor->trace(m_progressEventThrottle); 1418 visitor->trace(m_progressEventThrottle);
1421 } 1419 }
1422 1420
1423 } // namespace WebCore 1421 } // namespace WebCore
OLDNEW
« 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