0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 18:22:50 +01:00

ircd::http: Minor cleanup: move the code enum.

This commit is contained in:
Jason Volk 2018-05-20 17:37:50 -07:00
parent 1103eb7fa8
commit 5da82c7e93

View file

@ -36,56 +36,6 @@ namespace ircd::http
const_buffer writechunk(const mutable_buffer &, const uint32_t &size); const_buffer writechunk(const mutable_buffer &, const uint32_t &size);
} }
//
// Add more as you go...
//
enum ircd::http::code
:ushort
{
CONTINUE = 100,
SWITCHING_PROTOCOLS = 101,
OK = 200,
CREATED = 201,
ACCEPTED = 202,
NON_AUTHORITATIVE_INFORMATION = 203,
NO_CONTENT = 204,
PARTIAL_CONTENT = 206,
MULTIPLE_CHOICES = 300,
MOVED_PERMANENTLY = 301,
FOUND = 302,
SEE_OTHER = 303,
NOT_MODIFIED = 304,
TEMPORARY_REDIRECT = 305,
PERMANENT_REDIRECT = 306,
BAD_REQUEST = 400,
UNAUTHORIZED = 401,
FORBIDDEN = 403,
NOT_FOUND = 404,
METHOD_NOT_ALLOWED = 405,
NOT_ACCEPTABLE = 406,
REQUEST_TIMEOUT = 408,
CONFLICT = 409,
LENGTH_REQUIRED = 411,
PAYLOAD_TOO_LARGE = 413,
REQUEST_URI_TOO_LONG = 414,
UNSUPPORTED_MEDIA_TYPE = 415,
EXPECTATION_FAILED = 417,
IM_A_TEAPOT = 418,
UNPROCESSABLE_ENTITY = 422,
TOO_MANY_REQUESTS = 429,
REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
INTERNAL_SERVER_ERROR = 500,
NOT_IMPLEMENTED = 501,
BAD_GATEWAY = 502,
SERVICE_UNAVAILABLE = 503,
HTTP_VERSION_NOT_SUPPORTED = 505,
INSUFFICIENT_STORAGE = 507,
};
/// Root exception for HTTP. /// Root exception for HTTP.
struct ircd::http::error struct ircd::http::error
:ircd::error :ircd::error
@ -273,7 +223,7 @@ struct ircd::http::response
// compose a response into buffer // compose a response into buffer
response(window_buffer &, response(window_buffer &,
const code & = code::OK, const code &,
const size_t &content_length = 0, const size_t &content_length = 0,
const string_view &content_type = {}, const string_view &content_type = {},
const string_view &headers = {}, const string_view &headers = {},
@ -308,6 +258,56 @@ struct ircd::http::response::chunk
chunk() = default; chunk() = default;
}; };
//
// Add more as you go...
//
enum ircd::http::code
:ushort
{
CONTINUE = 100,
SWITCHING_PROTOCOLS = 101,
OK = 200,
CREATED = 201,
ACCEPTED = 202,
NON_AUTHORITATIVE_INFORMATION = 203,
NO_CONTENT = 204,
PARTIAL_CONTENT = 206,
MULTIPLE_CHOICES = 300,
MOVED_PERMANENTLY = 301,
FOUND = 302,
SEE_OTHER = 303,
NOT_MODIFIED = 304,
TEMPORARY_REDIRECT = 305,
PERMANENT_REDIRECT = 306,
BAD_REQUEST = 400,
UNAUTHORIZED = 401,
FORBIDDEN = 403,
NOT_FOUND = 404,
METHOD_NOT_ALLOWED = 405,
NOT_ACCEPTABLE = 406,
REQUEST_TIMEOUT = 408,
CONFLICT = 409,
LENGTH_REQUIRED = 411,
PAYLOAD_TOO_LARGE = 413,
REQUEST_URI_TOO_LONG = 414,
UNSUPPORTED_MEDIA_TYPE = 415,
EXPECTATION_FAILED = 417,
IM_A_TEAPOT = 418,
UNPROCESSABLE_ENTITY = 422,
TOO_MANY_REQUESTS = 429,
REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
INTERNAL_SERVER_ERROR = 500,
NOT_IMPLEMENTED = 501,
BAD_GATEWAY = 502,
SERVICE_UNAVAILABLE = 503,
HTTP_VERSION_NOT_SUPPORTED = 505,
INSUFFICIENT_STORAGE = 507,
};
template<class T> template<class T>
T T
ircd::http::query::string::get(const string_view &key, ircd::http::query::string::get(const string_view &key,