mirror of
https://github.com/matrix-construct/construct
synced 2024-12-01 19:22:53 +01:00
ircd::http: Status code signage consistency.
This commit is contained in:
parent
ba6832b420
commit
bbc1844c61
4 changed files with 10 additions and 9 deletions
|
@ -14,7 +14,7 @@
|
||||||
/// HyperText TransPort: formal grammars & tools
|
/// HyperText TransPort: formal grammars & tools
|
||||||
namespace ircd::http
|
namespace ircd::http
|
||||||
{
|
{
|
||||||
enum code :int;
|
enum code :ushort;
|
||||||
struct error;
|
struct error;
|
||||||
struct line;
|
struct line;
|
||||||
struct query;
|
struct query;
|
||||||
|
@ -40,7 +40,7 @@ namespace ircd::http
|
||||||
// Add more as you go...
|
// Add more as you go...
|
||||||
//
|
//
|
||||||
enum ircd::http::code
|
enum ircd::http::code
|
||||||
:int
|
:ushort
|
||||||
{
|
{
|
||||||
CONTINUE = 100,
|
CONTINUE = 100,
|
||||||
SWITCHING_PROTOCOLS = 101,
|
SWITCHING_PROTOCOLS = 101,
|
||||||
|
|
|
@ -687,11 +687,11 @@ catch(const http::error &e)
|
||||||
{
|
{
|
||||||
if(ircd::debugmode) log::error
|
if(ircd::debugmode) log::error
|
||||||
{
|
{
|
||||||
"socket(%p) local[%s] remote[%s] HTTP %d %s `%s' :%s",
|
"socket(%p) local[%s] remote[%s] HTTP %u %s `%s' :%s",
|
||||||
sock.get(),
|
sock.get(),
|
||||||
string(local(*this)),
|
string(local(*this)),
|
||||||
string(remote(*this)),
|
string(remote(*this)),
|
||||||
int(e.code),
|
uint(e.code),
|
||||||
http::status(e.code),
|
http::status(e.code),
|
||||||
head.uri,
|
head.uri,
|
||||||
e.content
|
e.content
|
||||||
|
|
|
@ -72,7 +72,8 @@ BOOST_FUSION_ADAPT_STRUCT
|
||||||
( decltype(ircd::http::line::request::version), version )
|
( decltype(ircd::http::line::request::version), version )
|
||||||
)
|
)
|
||||||
|
|
||||||
const decltype(ircd::http::reason) ircd::http::reason
|
decltype(ircd::http::reason)
|
||||||
|
ircd::http::reason
|
||||||
{
|
{
|
||||||
{ code::CONTINUE, "Continue" },
|
{ code::CONTINUE, "Continue" },
|
||||||
{ code::SWITCHING_PROTOCOLS, "Switching Protocols" },
|
{ code::SWITCHING_PROTOCOLS, "Switching Protocols" },
|
||||||
|
@ -765,7 +766,7 @@ ircd::http::error::error(const http::code &code,
|
||||||
,headers{std::move(headers)}
|
,headers{std::move(headers)}
|
||||||
,code{code}
|
,code{code}
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "%d %s", int(code), status(code).c_str());
|
snprintf(buf, sizeof(buf), "%u %s", uint(code), status(code).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::http::code
|
ircd::http::code
|
||||||
|
@ -786,7 +787,7 @@ ircd::http::status(const string_view &str)
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::string_view
|
ircd::string_view
|
||||||
ircd::http::status(const enum code &code)
|
ircd::http::status(const http::code &code)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return reason.at(code);
|
return reason.at(code);
|
||||||
|
@ -795,7 +796,7 @@ catch(const std::out_of_range &e)
|
||||||
{
|
{
|
||||||
log::warning
|
log::warning
|
||||||
{
|
{
|
||||||
"No reason string for HTTP status code %d", int(code)
|
"No reason string for HTTP status code %u", uint(code)
|
||||||
};
|
};
|
||||||
|
|
||||||
return ""_sv;
|
return ""_sv;
|
||||||
|
|
|
@ -709,7 +709,7 @@ ircd::resource::response::response(client &client,
|
||||||
client.sock.get(),
|
client.sock.get(),
|
||||||
string(local(client)),
|
string(local(client)),
|
||||||
string(remote(client)),
|
string(remote(client)),
|
||||||
int(code),
|
uint(code),
|
||||||
http::status(code),
|
http::status(code),
|
||||||
request_time,
|
request_time,
|
||||||
content_type,
|
content_type,
|
||||||
|
|
Loading…
Reference in a new issue