mirror of
https://github.com/matrix-construct/construct
synced 2024-11-26 00:32:35 +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
|
||||
namespace ircd::http
|
||||
{
|
||||
enum code :int;
|
||||
enum code :ushort;
|
||||
struct error;
|
||||
struct line;
|
||||
struct query;
|
||||
|
@ -40,7 +40,7 @@ namespace ircd::http
|
|||
// Add more as you go...
|
||||
//
|
||||
enum ircd::http::code
|
||||
:int
|
||||
:ushort
|
||||
{
|
||||
CONTINUE = 100,
|
||||
SWITCHING_PROTOCOLS = 101,
|
||||
|
|
|
@ -687,11 +687,11 @@ catch(const http::error &e)
|
|||
{
|
||||
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(),
|
||||
string(local(*this)),
|
||||
string(remote(*this)),
|
||||
int(e.code),
|
||||
uint(e.code),
|
||||
http::status(e.code),
|
||||
head.uri,
|
||||
e.content
|
||||
|
|
|
@ -72,7 +72,8 @@ BOOST_FUSION_ADAPT_STRUCT
|
|||
( 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::SWITCHING_PROTOCOLS, "Switching Protocols" },
|
||||
|
@ -765,7 +766,7 @@ ircd::http::error::error(const http::code &code,
|
|||
,headers{std::move(headers)}
|
||||
,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
|
||||
|
@ -786,7 +787,7 @@ ircd::http::status(const string_view &str)
|
|||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::http::status(const enum code &code)
|
||||
ircd::http::status(const http::code &code)
|
||||
try
|
||||
{
|
||||
return reason.at(code);
|
||||
|
@ -795,7 +796,7 @@ catch(const std::out_of_range &e)
|
|||
{
|
||||
log::warning
|
||||
{
|
||||
"No reason string for HTTP status code %d", int(code)
|
||||
"No reason string for HTTP status code %u", uint(code)
|
||||
};
|
||||
|
||||
return ""_sv;
|
||||
|
|
|
@ -709,7 +709,7 @@ ircd::resource::response::response(client &client,
|
|||
client.sock.get(),
|
||||
string(local(client)),
|
||||
string(remote(client)),
|
||||
int(code),
|
||||
uint(code),
|
||||
http::status(code),
|
||||
request_time,
|
||||
content_type,
|
||||
|
|
Loading…
Reference in a new issue