forked from boostorg/beast
Update status code list to conform with IANA registry
https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml Resolves #2729
This commit is contained in:
committed by
Mohammad Nejati
parent
dc8798c917
commit
25105e476a
@@ -26,6 +26,7 @@ int_to_status(unsigned v)
|
||||
case status::continue_:
|
||||
case status::switching_protocols:
|
||||
case status::processing:
|
||||
case status::early_hints:
|
||||
BOOST_FALLTHROUGH;
|
||||
|
||||
// 2xx
|
||||
@@ -75,13 +76,12 @@ int_to_status(unsigned v)
|
||||
case status::unprocessable_entity:
|
||||
case status::locked:
|
||||
case status::failed_dependency:
|
||||
case status::too_early:
|
||||
case status::upgrade_required:
|
||||
case status::precondition_required:
|
||||
case status::too_many_requests:
|
||||
case status::request_header_fields_too_large:
|
||||
case status::connection_closed_without_response:
|
||||
case status::unavailable_for_legal_reasons:
|
||||
case status::client_closed_request:
|
||||
BOOST_FALLTHROUGH;
|
||||
|
||||
// 5xx
|
||||
@@ -96,7 +96,6 @@ int_to_status(unsigned v)
|
||||
case status::loop_detected:
|
||||
case status::not_extended:
|
||||
case status::network_authentication_required:
|
||||
case status::network_connect_timeout_error:
|
||||
return static_cast<status>(v);
|
||||
|
||||
default:
|
||||
@@ -136,6 +135,7 @@ obsolete_reason(status v)
|
||||
case status::continue_: return "Continue";
|
||||
case status::switching_protocols: return "Switching Protocols";
|
||||
case status::processing: return "Processing";
|
||||
case status::early_hints: return "Early Hints";
|
||||
|
||||
// 2xx
|
||||
case status::ok: return "OK";
|
||||
@@ -182,13 +182,12 @@ obsolete_reason(status v)
|
||||
case status::unprocessable_entity: return "Unprocessable Entity";
|
||||
case status::locked: return "Locked";
|
||||
case status::failed_dependency: return "Failed Dependency";
|
||||
case status::too_early: return "Too Early";
|
||||
case status::upgrade_required: return "Upgrade Required";
|
||||
case status::precondition_required: return "Precondition Required";
|
||||
case status::too_many_requests: return "Too Many Requests";
|
||||
case status::request_header_fields_too_large: return "Request Header Fields Too Large";
|
||||
case status::connection_closed_without_response: return "Connection Closed Without Response";
|
||||
case status::unavailable_for_legal_reasons: return "Unavailable For Legal Reasons";
|
||||
case status::client_closed_request: return "Client Closed Request";
|
||||
// 5xx
|
||||
case status::internal_server_error: return "Internal Server Error";
|
||||
case status::not_implemented: return "Not Implemented";
|
||||
@@ -201,7 +200,6 @@ obsolete_reason(status v)
|
||||
case status::loop_detected: return "Loop Detected";
|
||||
case status::not_extended: return "Not Extended";
|
||||
case status::network_authentication_required: return "Network Authentication Required";
|
||||
case status::network_connect_timeout_error: return "Network Connect Timeout Error";
|
||||
|
||||
default:
|
||||
break;
|
||||
|
@@ -39,8 +39,8 @@ enum class status : unsigned
|
||||
code.
|
||||
*/
|
||||
switching_protocols = 101,
|
||||
|
||||
processing = 102,
|
||||
early_hints = 103,
|
||||
|
||||
ok = 200,
|
||||
created = 201,
|
||||
@@ -84,13 +84,12 @@ enum class status : unsigned
|
||||
unprocessable_entity = 422,
|
||||
locked = 423,
|
||||
failed_dependency = 424,
|
||||
too_early = 425,
|
||||
upgrade_required = 426,
|
||||
precondition_required = 428,
|
||||
too_many_requests = 429,
|
||||
request_header_fields_too_large = 431,
|
||||
connection_closed_without_response = 444,
|
||||
unavailable_for_legal_reasons = 451,
|
||||
client_closed_request = 499,
|
||||
|
||||
internal_server_error = 500,
|
||||
not_implemented = 501,
|
||||
@@ -102,8 +101,7 @@ enum class status : unsigned
|
||||
insufficient_storage = 507,
|
||||
loop_detected = 508,
|
||||
not_extended = 510,
|
||||
network_authentication_required = 511,
|
||||
network_connect_timeout_error = 599
|
||||
network_authentication_required = 511
|
||||
};
|
||||
|
||||
/** Represents the class of a status-code.
|
||||
|
@@ -32,6 +32,7 @@ public:
|
||||
check(status::continue_ ,100, status_class::informational);
|
||||
check(status::switching_protocols ,101, status_class::informational);
|
||||
check(status::processing ,102, status_class::informational);
|
||||
check(status::early_hints ,103, status_class::informational);
|
||||
|
||||
check(status::ok ,200, status_class::successful);
|
||||
check(status::created ,201, status_class::successful);
|
||||
@@ -75,13 +76,12 @@ public:
|
||||
check(status::unprocessable_entity ,422, status_class::client_error);
|
||||
check(status::locked ,423, status_class::client_error);
|
||||
check(status::failed_dependency ,424, status_class::client_error);
|
||||
check(status::too_early ,425, status_class::client_error);
|
||||
check(status::upgrade_required ,426, status_class::client_error);
|
||||
check(status::precondition_required ,428, status_class::client_error);
|
||||
check(status::too_many_requests ,429, status_class::client_error);
|
||||
check(status::request_header_fields_too_large ,431, status_class::client_error);
|
||||
check(status::connection_closed_without_response ,444, status_class::client_error);
|
||||
check(status::unavailable_for_legal_reasons ,451, status_class::client_error);
|
||||
check(status::client_closed_request ,499, status_class::client_error);
|
||||
|
||||
check(status::internal_server_error ,500, status_class::server_error);
|
||||
check(status::not_implemented ,501, status_class::server_error);
|
||||
@@ -94,7 +94,6 @@ public:
|
||||
check(status::loop_detected ,508, status_class::server_error);
|
||||
check(status::not_extended ,510, status_class::server_error);
|
||||
check(status::network_authentication_required ,511, status_class::server_error);
|
||||
check(status::network_connect_timeout_error ,599, status_class::server_error);
|
||||
|
||||
BEAST_EXPECT(to_status_class(1) == status_class::unknown);
|
||||
BEAST_EXPECT(to_status_class(status::unknown) == status_class::unknown);
|
||||
@@ -107,6 +106,7 @@ public:
|
||||
good(status::continue_);
|
||||
good(status::switching_protocols);
|
||||
good(status::processing);
|
||||
good(status::early_hints);
|
||||
good(status::ok);
|
||||
good(status::created);
|
||||
good(status::accepted);
|
||||
@@ -147,6 +147,7 @@ public:
|
||||
good(status::unprocessable_entity);
|
||||
good(status::locked);
|
||||
good(status::failed_dependency);
|
||||
good(status::too_early);
|
||||
good(status::upgrade_required);
|
||||
good(status::precondition_required);
|
||||
good(status::too_many_requests);
|
||||
|
Reference in New Issue
Block a user