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

Side by Side Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 347653003: XMLHttpRequest must build a request using the given method as-is for non-standard types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Write async tests Created 6 years, 6 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
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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 492
493 bool XMLHttpRequest::isAllowedHTTPMethod(const String& method) 493 bool XMLHttpRequest::isAllowedHTTPMethod(const String& method)
494 { 494 {
495 return !equalIgnoringCase(method, "TRACE") 495 return !equalIgnoringCase(method, "TRACE")
496 && !equalIgnoringCase(method, "TRACK") 496 && !equalIgnoringCase(method, "TRACK")
497 && !equalIgnoringCase(method, "CONNECT"); 497 && !equalIgnoringCase(method, "CONNECT");
498 } 498 }
499 499
500 AtomicString XMLHttpRequest::uppercaseKnownHTTPMethod(const AtomicString& method ) 500 AtomicString XMLHttpRequest::uppercaseKnownHTTPMethod(const AtomicString& method )
501 { 501 {
502 // Valid methods per step-5 of http://xhr.spec.whatwg.org/#the-open()-method .
502 const char* const methods[] = { 503 const char* const methods[] = {
503 "COPY",
504 "DELETE", 504 "DELETE",
505 "GET", 505 "GET",
506 "HEAD", 506 "HEAD",
507 "INDEX",
508 "LOCK",
509 "M-POST",
510 "MKCOL",
511 "MOVE",
512 "OPTIONS", 507 "OPTIONS",
513 "POST", 508 "POST",
514 "PROPFIND", 509 "PUT" };
515 "PROPPATCH", 510
516 "PUT",
517 "UNLOCK" };
518 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(methods); ++i) { 511 for (unsigned i = 0; i < WTF_ARRAY_LENGTH(methods); ++i) {
519 if (equalIgnoringCase(method, methods[i])) { 512 if (equalIgnoringCase(method, methods[i])) {
520 // Don't bother allocating a new string if it's already all uppercas e. 513 // Don't bother allocating a new string if it's already all uppercas e.
521 if (method == methods[i]) 514 if (method == methods[i])
522 return method; 515 return method;
523 return methods[i]; 516 return methods[i];
524 } 517 }
525 } 518 }
526 return method; 519 return method;
527 } 520 }
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 { 1458 {
1466 visitor->trace(m_responseBlob); 1459 visitor->trace(m_responseBlob);
1467 visitor->trace(m_responseStream); 1460 visitor->trace(m_responseStream);
1468 visitor->trace(m_responseDocument); 1461 visitor->trace(m_responseDocument);
1469 visitor->trace(m_progressEventThrottle); 1462 visitor->trace(m_progressEventThrottle);
1470 visitor->trace(m_upload); 1463 visitor->trace(m_upload);
1471 XMLHttpRequestEventTarget::trace(visitor); 1464 XMLHttpRequestEventTarget::trace(visitor);
1472 } 1465 }
1473 1466
1474 } // namespace WebCore 1467 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698