2 // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com)
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // Official repository: https://github.com/boostorg/beast
10 #ifndef BOOST_BEAST_HTTP_STATUS_HPP
11 #define BOOST_BEAST_HTTP_STATUS_HPP
13 #include <boost/beast/core/detail/config.hpp>
14 #include <boost/beast/core/string.hpp>
21 enum class status : unsigned
23 /** An unknown status-code.
25 This value indicates that the value for the status code
26 is not in the list of commonly recognized status codes.
27 Callers interested in the exactly value should use the
28 interface which provides the raw integer.
34 /** Switching Protocols
36 This status indicates that a request to switch to a new
37 protocol was accepted and applied by the server. A successful
38 response to a WebSocket Upgrade HTTP request will have this
41 switching_protocols = 101,
48 non_authoritative_information = 203,
51 partial_content = 206,
53 already_reported = 208,
56 multiple_choices = 300,
57 moved_permanently = 301,
62 temporary_redirect = 307,
63 permanent_redirect = 308,
67 payment_required = 402,
70 method_not_allowed = 405,
72 proxy_authentication_required = 407,
73 request_timeout = 408,
76 length_required = 411,
77 precondition_failed = 412,
78 payload_too_large = 413,
80 unsupported_media_type = 415,
81 range_not_satisfiable = 416,
82 expectation_failed = 417,
83 misdirected_request = 421,
84 unprocessable_entity = 422,
86 failed_dependency = 424,
87 upgrade_required = 426,
88 precondition_required = 428,
89 too_many_requests = 429,
90 request_header_fields_too_large = 431,
91 connection_closed_without_response = 444,
92 unavailable_for_legal_reasons = 451,
93 client_closed_request = 499,
95 internal_server_error = 500,
96 not_implemented = 501,
98 service_unavailable = 503,
99 gateway_timeout = 504,
100 http_version_not_supported = 505,
101 variant_also_negotiates = 506,
102 insufficient_storage = 507,
105 network_authentication_required = 511,
106 network_connect_timeout_error = 599
109 /** Represents the class of a status-code.
111 enum class status_class : unsigned
113 /// Unknown status-class
116 /// The request was received, continuing processing.
119 /// The request was successfully received, understood, and accepted.
122 /// Further action needs to be taken in order to complete the request.
125 /// The request contains bad syntax or cannot be fulfilled.
128 /// The server failed to fulfill an apparently valid request.
132 /** Converts the integer to a known status-code.
134 If the integer does not match a known status code,
135 @ref status::unknown is returned.
139 int_to_status(unsigned v);
141 /** Convert an integer to a status_class.
143 @param v The integer representing a status code.
145 @return The status class. If the integer does not match
146 a known status class, @ref status_class::unknown is returned.
150 to_status_class(unsigned v);
152 /** Convert a status_code to a status_class.
154 @param v The status code to convert.
156 @return The status class.
160 to_status_class(status v);
162 /** Returns the obsolete reason-phrase text for a status code.
164 @param v The status code to use.
168 obsolete_reason(status v);
170 /// Outputs the standard reason phrase of a status code to a stream.
173 operator<<(std::ostream&, status);
179 #ifdef BOOST_BEAST_HEADER_ONLY
180 #include <boost/beast/http/impl/status.ipp>