diff options
author | mhilbrunner <m.hilbrunner@gmail.com> | 2017-12-10 23:18:44 +0100 |
---|---|---|
committer | mhilbrunner <m.hilbrunner@gmail.com> | 2017-12-12 10:56:18 +0100 |
commit | a7abb459c91156e0326018bbd7274c9a425e1087 (patch) | |
tree | 8d0afe2023871230b4dbf2f91d22c2362f58f533 /core/io | |
parent | aa5f5191f0e1d7704bf439bbdf41077ce6a61c66 (diff) |
HTTPClient: Add PATCH method and missing HTTP status codes
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/http_client.cpp | 19 | ||||
-rw-r--r-- | core/io/http_client.h | 15 |
2 files changed, 32 insertions, 2 deletions
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 5097898314..9d89baafb1 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -93,7 +93,8 @@ Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector "DELETE", "OPTIONS", "TRACE", - "CONNECT" + "CONNECT", + "PATCH" }; String request = String(_methods[p_method]) + " " + p_url + " HTTP/1.1\r\n"; @@ -153,7 +154,8 @@ Error HTTPClient::request(Method p_method, const String &p_url, const Vector<Str "DELETE", "OPTIONS", "TRACE", - "CONNECT" + "CONNECT", + "PATCH" }; String request = String(_methods[p_method]) + " " + p_url + " HTTP/1.1\r\n"; @@ -683,6 +685,7 @@ void HTTPClient::_bind_methods() { BIND_ENUM_CONSTANT(METHOD_OPTIONS); BIND_ENUM_CONSTANT(METHOD_TRACE); BIND_ENUM_CONSTANT(METHOD_CONNECT); + BIND_ENUM_CONSTANT(METHOD_PATCH); BIND_ENUM_CONSTANT(METHOD_MAX); BIND_ENUM_CONSTANT(STATUS_DISCONNECTED); @@ -709,6 +712,7 @@ void HTTPClient::_bind_methods() { BIND_ENUM_CONSTANT(RESPONSE_RESET_CONTENT); BIND_ENUM_CONSTANT(RESPONSE_PARTIAL_CONTENT); BIND_ENUM_CONSTANT(RESPONSE_MULTI_STATUS); + BIND_ENUM_CONSTANT(RESPONSE_ALREADY_REPORTED); BIND_ENUM_CONSTANT(RESPONSE_IM_USED); // 3xx redirection @@ -718,7 +722,9 @@ void HTTPClient::_bind_methods() { BIND_ENUM_CONSTANT(RESPONSE_SEE_OTHER); BIND_ENUM_CONSTANT(RESPONSE_NOT_MODIFIED); BIND_ENUM_CONSTANT(RESPONSE_USE_PROXY); + BIND_ENUM_CONSTANT(RESPONSE_SWITCH_PROXY); BIND_ENUM_CONSTANT(RESPONSE_TEMPORARY_REDIRECT); + BIND_ENUM_CONSTANT(RESPONSE_PERMANENT_REDIRECT); // 4xx client error BIND_ENUM_CONSTANT(RESPONSE_BAD_REQUEST); @@ -739,10 +745,16 @@ void HTTPClient::_bind_methods() { BIND_ENUM_CONSTANT(RESPONSE_UNSUPPORTED_MEDIA_TYPE); BIND_ENUM_CONSTANT(RESPONSE_REQUESTED_RANGE_NOT_SATISFIABLE); BIND_ENUM_CONSTANT(RESPONSE_EXPECTATION_FAILED); + BIND_ENUM_CONSTANT(RESPONSE_IM_A_TEAPOT); + BIND_ENUM_CONSTANT(RESPONSE_MISDIRECTED_REQUEST); BIND_ENUM_CONSTANT(RESPONSE_UNPROCESSABLE_ENTITY); BIND_ENUM_CONSTANT(RESPONSE_LOCKED); BIND_ENUM_CONSTANT(RESPONSE_FAILED_DEPENDENCY); BIND_ENUM_CONSTANT(RESPONSE_UPGRADE_REQUIRED); + BIND_ENUM_CONSTANT(RESPONSE_PRECONDITION_REQUIRED); + BIND_ENUM_CONSTANT(RESPONSE_TOO_MANY_REQUESTS); + BIND_ENUM_CONSTANT(RESPONSE_REQUEST_HEADER_FIELDS_TOO_LARGE); + BIND_ENUM_CONSTANT(RESPONSE_UNAVAILABLE_FOR_LEGAL_REASONS); // 5xx server error BIND_ENUM_CONSTANT(RESPONSE_INTERNAL_SERVER_ERROR); @@ -751,6 +763,9 @@ void HTTPClient::_bind_methods() { BIND_ENUM_CONSTANT(RESPONSE_SERVICE_UNAVAILABLE); BIND_ENUM_CONSTANT(RESPONSE_GATEWAY_TIMEOUT); BIND_ENUM_CONSTANT(RESPONSE_HTTP_VERSION_NOT_SUPPORTED); + BIND_ENUM_CONSTANT(RESPONSE_VARIANT_ALSO_NEGOTIATES); BIND_ENUM_CONSTANT(RESPONSE_INSUFFICIENT_STORAGE); + BIND_ENUM_CONSTANT(RESPONSE_LOOP_DETECTED); BIND_ENUM_CONSTANT(RESPONSE_NOT_EXTENDED); + BIND_ENUM_CONSTANT(RESPONSE_NETWORK_AUTH_REQUIRED); } diff --git a/core/io/http_client.h b/core/io/http_client.h index db5dd115bd..2e0a345f1c 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -56,6 +56,7 @@ public: RESPONSE_RESET_CONTENT = 205, RESPONSE_PARTIAL_CONTENT = 206, RESPONSE_MULTI_STATUS = 207, + RESPONSE_ALREADY_REPORTED = 208, RESPONSE_IM_USED = 226, // 3xx redirection @@ -65,7 +66,9 @@ public: RESPONSE_SEE_OTHER = 303, RESPONSE_NOT_MODIFIED = 304, RESPONSE_USE_PROXY = 305, + RESPONSE_SWITCH_PROXY = 306, RESPONSE_TEMPORARY_REDIRECT = 307, + RESPONSE_PERMANENT_REDIRECT = 308, // 4xx client error RESPONSE_BAD_REQUEST = 400, @@ -86,10 +89,16 @@ public: RESPONSE_UNSUPPORTED_MEDIA_TYPE = 415, RESPONSE_REQUESTED_RANGE_NOT_SATISFIABLE = 416, RESPONSE_EXPECTATION_FAILED = 417, + RESPONSE_IM_A_TEAPOT = 418, + RESPONSE_MISDIRECTED_REQUEST = 421, RESPONSE_UNPROCESSABLE_ENTITY = 422, RESPONSE_LOCKED = 423, RESPONSE_FAILED_DEPENDENCY = 424, RESPONSE_UPGRADE_REQUIRED = 426, + RESPONSE_PRECONDITION_REQUIRED = 428, + RESPONSE_TOO_MANY_REQUESTS = 429, + RESPONSE_REQUEST_HEADER_FIELDS_TOO_LARGE = 431, + RESPONSE_UNAVAILABLE_FOR_LEGAL_REASONS = 451, // 5xx server error RESPONSE_INTERNAL_SERVER_ERROR = 500, @@ -98,8 +107,11 @@ public: RESPONSE_SERVICE_UNAVAILABLE = 503, RESPONSE_GATEWAY_TIMEOUT = 504, RESPONSE_HTTP_VERSION_NOT_SUPPORTED = 505, + RESPONSE_VARIANT_ALSO_NEGOTIATES = 506, RESPONSE_INSUFFICIENT_STORAGE = 507, + RESPONSE_LOOP_DETECTED = 508, RESPONSE_NOT_EXTENDED = 510, + RESPONSE_NETWORK_AUTH_REQUIRED = 511, }; @@ -113,10 +125,13 @@ public: METHOD_OPTIONS, METHOD_TRACE, METHOD_CONNECT, + METHOD_PATCH, METHOD_MAX + }; enum Status { + STATUS_DISCONNECTED, STATUS_RESOLVING, //resolving hostname (if passed a hostname) STATUS_CANT_RESOLVE, |