Share code to determine a forbidden method
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Oct 2017 22:40:35 +0000 (22:40 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Oct 2017 22:40:35 +0000 (22:40 +0000)
commit8d155da429c833066196f417848ee1d6b3e048f6
tree48a896be98fa6e190c676d328a1fe2dbf695cbed
parent8e84092e59ebba4a056557abb465b8dcfa33fa46
Share code to determine a forbidden method
https://bugs.webkit.org/show_bug.cgi?id=177833

Reviewed by Andy Estes.

Currently we duplicate code in XMLHttpRequest and FetchRequest to determine if a method is
forbidden. We should add a common helper function and update both classes to make use of it.

No functionality changed. So, no new tests.

* Modules/fetch/FetchRequest.cpp:
(WebCore::setMethod): Modified to use WebCore::isForbiddenMethod().
* platform/network/HTTPParsers.cpp:
(WebCore::isForbiddenMethod): Added.
* platform/network/HTTPParsers.h:
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::open): Modified to use WebCore::isForbiddenMethod().
(WebCore::XMLHttpRequest::isAllowedHTTPMethod): Deleted.
* xml/XMLHttpRequest.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchRequest.cpp
Source/WebCore/platform/network/HTTPParsers.cpp
Source/WebCore/platform/network/HTTPParsers.h
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h