52 return this->code == other.
code;
56 return !(*
this == other);
117 #define CODE(name) static const StatusCode name 231 case 302:
return FOUND;
248 case 410:
return GONE;
286 #define DEF_CODE(name, shortInfo, code, msg) \ 293 const StatusCode StatusCode::name{shortInfo, code, msg}; 298 DEF_CODE(
PROCESSING,
"Processing", 102,
"The server has accepted the request but has not yet completed it");
299 DEF_CODE(
EARLY_HINTS,
"Early Hints", 103,
"The server is likely to send a final response with the header fields included in the informational response");
306 DEF_CODE(
NO_CONTENT,
"No Content", 204,
"Request fulfilled, no entity-body returned");
307 DEF_CODE(
RESET_CONTENT,
"Reset Content", 205,
"Request fulfilled, user agent should reset the document view");
311 DEF_CODE(
IM_USED,
"IM Used", 226,
"The server has fulfilled a GET request for the resource, and the response is a representation of the result of one or more instance-manipulation applied to the current instance");
314 DEF_CODE(
MULTIPLE_CHOICES,
"Multiple Choices", 300,
"The requested resource corresponds to any one of a set of representations");
316 DEF_CODE(
FOUND,
"Found", 302,
"The requested resource has been delivered but resides temporarily under a different URI");
317 DEF_CODE(
SEE_OTHER,
"See Other", 303,
"The requested resource can be found under a different URI");
319 DEF_CODE(
USE_PROXY,
"Use Proxy", 305,
"The requested resource must be accessed through the given proxy");
325 DEF_CODE(
BAD_REQUEST,
"Bad Request", 400,
"Request could not be understood due to malformed syntax");
328 DEF_CODE(
FORBIDDEN,
"Forbidden", 403,
"Request understood but the server refuses to fulfill it");
329 DEF_CODE(
NOT_FOUND,
"Not Found", 404,
"The requested resource has not been found");
331 DEF_CODE(
NOT_ACCEPTABLE,
"Not Acceptable", 406,
"Responses would not be acceptable according to accept headers in the request");
333 DEF_CODE(
REQUEST_TIMEOUT,
"Request Timeout", 408,
"Client did not produce a request within the time the server was prepared to wait");
334 DEF_CODE(
CONFLICT,
"Conflict", 409,
"Request could not be completed due to a conflict with the current state of the resource");
335 DEF_CODE(
GONE,
"Gone", 410,
"The requested resource is no longer available");
337 DEF_CODE(
PRECONDITION_FAILED,
"Precondition Failed", 412,
"Precondition given in one or more request-header fields evaluated to false");
344 DEF_CODE(
MISDIRECTED_REQUEST,
"Misdirected Request", 421,
"Request was directed at a server that is not able to produce a response");
345 DEF_CODE(
UNPROCESSABLE_ENTITY,
"Unprocessable Entity", 422,
"The server understands the content type and the syntax is correct but was unable to process the contained instructions");
346 DEF_CODE(
LOCKED,
"Locked", 423,
"The requested resource is locked");
347 DEF_CODE(
FAILED_DEPENDENCY,
"Failed Dependency", 424,
"The server could not process the requested action because it depends on an action that failed");
348 DEF_CODE(
TOO_EARLY,
"Too Early", 425,
"The server is unwilling to risk processing a request that might be replayed");
349 DEF_CODE(
UPGRADE_REQUIRED,
"Upgrade Required", 426,
"The server refuses to perform the request using the current protocol but might if the client upgrades to a different protocol");
350 DEF_CODE(
PRECONDITION_REQUIRED,
"Precondition Required", 428,
"The server requires the request to be conditional (missing If-Match header)");
357 DEF_CODE(
NOT_IMPLEMENTED,
"Not Implemented", 501,
"The server does not support the functionality required to fulfill the request");
358 DEF_CODE(
BAD_GATEWAY,
"Bad Gateway", 502,
"The server, acting as a gateway/proxy, received an invalid response from the upstream server it accessed in attempting to fulfill the request");
359 DEF_CODE(
SERVICE_UNAVAILABLE,
"Service Unavailable", 503,
"The server is currently unable to handle the request due to a temporary overloading or maintenance");
360 DEF_CODE(
GATEWAY_TIMEOUT,
"Gateway Timeout", 504,
"The server, acting as a gateway/proxy, did not receive a timely response from the upstream server it accessed in attempting to fulfill the request");
361 DEF_CODE(
HTTP_VERSION_NOT_SUPPORTED,
"HTTP Version Not Supported", 505,
"The server does not support, or refuses to support, the HTTP protocol version that was used in the request");
362 DEF_CODE(
VARIANT_ALSO_NEGOTIATES,
"Variant Also Negotiates", 506,
"The chosen variant resource is configured to engage in transparent content negotiation and is therefore not a proper end point in the negotiation process");
363 DEF_CODE(
INSUFFICIENT_STORAGE,
"Insufficient Storage", 507,
"The server was unable to process the request because it could not store the representation needed to successfully complete the request");
364 DEF_CODE(
LOOP_DETECTED,
"Loop Detected", 508,
"The server terminated an operation because it encountered an infinite loop while processing a request");
366 DEF_CODE(
NOT_EXTENDED,
"Not Extended", 510,
"The policy for accessing the resource has not been met in the request");
374 static const std::string
STATUS, SEP, CF, SPECS;
376 return STATUS + std::to_string(status.
status())
377 + SEP + status.
name()
378 + CF + std::to_string(status.
version()) + SPECS;
static const StatusCode NETWORK_AUTHENTICATION_REQUIRED
static const StatusCode CREATED
static const StatusCode GATEWAY_TIMEOUT
static const StatusCode NON_AUTHORITATIVE_INFORMATION
static const StatusCode REQUESTED_RANGE_NOT_SATISFIABLE
constexpr name_type name() const
static const StatusCode PRECONDITION_REQUIRED
static const StatusCode UNSUPPORTED_MEDIA_TYPE
static const StatusCode HTTP_VERSION_NOT_SUPPORTED
constexpr bool operator==(const StatusCode &other) const
static const StatusCode PERMANENT_REDIRECT
static const StatusCode IM_USED
static const StatusCode SEE_OTHER
const version_type & vers
constexpr bool isOk() const
Determine whether or not this status code indicates that the requests was fulfilled.
static const StatusCode PAYMENT_REQUIRED
static const StatusCode INSUFFICIENT_STORAGE
A pseudo enum class that describes the version of the HTTP Protocol.
Global namespace of the SCL.
constexpr bool isInformational() const
Determine whether or not this status code is informational.
constexpr status_type status() const
#define DEF_CODE(name, shortInfo, code, msg)
static const StatusCode SERVICE_UNAVAILABLE
static const StatusCode OK
static const StatusCode MULTI_STATUS
static const StatusCode REQUEST_HEADER_FIELDS_TOO_LARGE
static const StatusCode NOT_FOUND
static const StatusCode BANDWIDTH_LIMIT_EXCEEDED
static const StatusCode INTERNAL_SERVER_ERROR
static const StatusCode REQUEST_TIMEOUT
static const Version V1_1
static const StatusCode PRECONDITION_FAILED
static const StatusCode UNPROCESSABLE_ENTITY
static const StatusCode FORBIDDEN
static const StatusCode PROCESSING
static const StatusCode FAILED_DEPENDENCY
static const StatusCode PARTIAL_CONTENT
static const StatusCode UPGRADE_REQUIRED
static const StatusCode TEMPORARY_REDIRECT
static const StatusCode TOO_EARLY
static const StatusCode VARIANT_ALSO_NEGOTIATES
static const StatusCode MULTIPLE_CHOICES
static const StatusCode NOT_MODIFIED
static const StatusCode LENGTH_REQUIRED
static const StatusCode PROXY_AUTHENTICATION_REQUIRED
static const StatusCode MOVED_PERMANENTLY
static const StatusCode UNAUTHORIZED
constexpr bool isSuccessful() const
Determine whether or not this status code is for a successful request.
A class that allows the use of optional types (might be there)
static const StatusCode METHOD_NOT_ALLOWED
constexpr version_type version() const
constexpr None none
A constant global variable of type None.
static const StatusCode EARLY_HINTS
static const StatusCode NOT_ACCEPTABLE
constexpr bool isRedirect() const
Determine whether or not this status code is one of a redirection.
static const StatusCode UNAVAILABLE_FOR_LEGAL_REASONS
constexpr bool isServerError() const
Determine whether or not this status code is one of a server error.
static const StatusCode LOOP_DETECTED
static const StatusCode GONE
static const StatusCode NOT_IMPLEMENTED
static const StatusCode REQUEST_URI_TOO_LONG
static const StatusCode SWITCHING_PROTOCOLS
constexpr bool operator!=(const StatusCode &other) const
static const StatusCode REQUEST_ENTITY_TOO_LARGE
static const StatusCode FOUND
static scl::utils::Optional< StatusCode > fromCode(const status_type &status)
Get an optional StatusCode from the status code.
static const StatusCode BAD_REQUEST
std::string operator()(const scl::http::StatusCode &status)
static const StatusCode EXPECTATION_FAILED
static const std::string STATUS
static const StatusCode TOO_MANY_REQUESTS
constexpr bool isClientError() const
Determine whether or not this status code is one of a client error.
static const StatusCode ACCEPTED
unsigned int uint
Unsigned integer.
static const StatusCode BAD_GATEWAY
static const StatusCode MISDIRECTED_REQUEST
const name_type shortInfo
scl::alias::uint status_type
constexpr StatusCode(name_type name, status_type status, message_type message, const version_type &version=Version::V1_1)
static const StatusCode TEAPOT
constexpr message_type message() const
const char * message_type
static const StatusCode USE_PROXY
static const StatusCode LOCKED
static const StatusCode RESET_CONTENT
static const StatusCode NO_CONTENT
static const StatusCode ALREADY_REPORTED
static const StatusCode NOT_EXTENDED
static const StatusCode CONTINUE
static const StatusCode CONFLICT