2 // Copyright (c) 2016-2017 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.
33 switching_protocols = 101,
39 non_authoritative_information = 203,
42 partial_content = 206,
44 already_reported = 208,
47 multiple_choices = 300,
48 moved_permanently = 301,
53 temporary_redirect = 307,
54 permanent_redirect = 308,
58 payment_required = 402,
61 method_not_allowed = 405,
63 proxy_authentication_required = 407,
64 request_timeout = 408,
67 length_required = 411,
68 precondition_failed = 412,
69 payload_too_large = 413,
71 unsupported_media_type = 415,
72 range_not_satisfiable = 416,
73 expectation_failed = 417,
74 misdirected_request = 421,
75 unprocessable_entity = 422,
77 failed_dependency = 424,
78 upgrade_required = 426,
79 precondition_required = 428,
80 too_many_requests = 429,
81 request_header_fields_too_large = 431,
82 connection_closed_without_response = 444,
83 unavailable_for_legal_reasons = 451,
84 client_closed_request = 499,
86 internal_server_error = 500,
87 not_implemented = 501,
89 service_unavailable = 503,
90 gateway_timeout = 504,
91 http_version_not_supported = 505,
92 variant_also_negotiates = 506,
93 insufficient_storage = 507,
96 network_authentication_required = 511,
97 network_connect_timeout_error = 599
100 /** Represents the class of a status-code.
102 enum class status_class : unsigned
104 /// Unknown status-class
107 /// The request was received, continuing processing.
110 /// The request was successfully received, understood, and accepted.
113 /// Further action needs to be taken in order to complete the request.
116 /// The request contains bad syntax or cannot be fulfilled.
119 /// The server failed to fulfill an apparently valid request.
123 /** Converts the integer to a known status-code.
125 If the integer does not match a known status code,
126 @ref status::unknown is returned.
129 int_to_status(unsigned v);
131 /** Convert an integer to a status_class.
133 @param v The integer representing a status code.
135 @return The status class. If the integer does not match
136 a known status class, @ref status_class::unknown is returned.
139 to_status_class(unsigned v);
141 /** Convert a status_code to a status_class.
143 @param v The status code to convert.
145 @return The status class.
148 to_status_class(status v);
150 /** Returns the obsolete reason-phrase text for a status code.
152 @param v The status code to use.
155 obsolete_reason(status v);
157 /// Outputs the standard reason phrase of a status code to a stream.
159 operator<<(std::ostream&, status);
165 #include <boost/beast/http/impl/status.ipp>