mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::http: Better handling of unrecognized HTTP status code to reason string.
This commit is contained in:
parent
24fdfdd9fe
commit
cf112ec26e
1 changed files with 10 additions and 0 deletions
10
ircd/http.cc
10
ircd/http.cc
|
@ -888,6 +888,16 @@ ircd::http::status(const string_view &str)
|
|||
|
||||
ircd::string_view
|
||||
ircd::http::status(const enum code &code)
|
||||
try
|
||||
{
|
||||
return reason.at(code);
|
||||
}
|
||||
catch(const std::out_of_range &e)
|
||||
{
|
||||
log::warning
|
||||
{
|
||||
"No reason string for HTTP status code %d", int(code)
|
||||
};
|
||||
|
||||
return ""_sv;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue