0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

ircd::http: Remove gratuitous error constructor; fix 505 response content.

This commit is contained in:
Jason Volk 2019-03-23 03:12:28 -07:00
parent 54f7ddb6bd
commit 94ed73a60e
2 changed files with 5 additions and 17 deletions

View file

@ -52,7 +52,6 @@ struct ircd::http::error
error() = default;
error(const http::code &, std::string content = {}, std::string headers = {});
error(const http::code &, std::string content, const vector_view<const header> &);
template<size_t BUFSIZE, class... args> error(const http::code &, const string_view &fmt, args&&...);
};
/// Represents a single \r\n delimited line used in HTTP.
@ -364,17 +363,3 @@ const
{
return lex_cast<T>(at(key, idx));
}
template<size_t BUFSIZE,
class... args>
ircd::http::error::error(const http::code &code,
const string_view &fmt,
args&&... a)
:http::error
{
code, fmt::snstringf
{
BUFSIZE, fmt, std::forward<args>(a)...
}
}
{}

View file

@ -287,8 +287,11 @@ ircd::http::request::head::head(parse::capstan &pc,
if(this->version != "HTTP/1.1")
throw error
{
HTTP_VERSION_NOT_SUPPORTED, "Sorry, I don't speak '%s' only HTTP/1.1 here."_sv,
string_view{this->version}
HTTP_VERSION_NOT_SUPPORTED, fmt::snstringf
{
128, "Sorry, I don't speak '%s' only HTTP/1.1 here.",
this->version
}
};
return http::headers{pc, [this, &c](const auto &h)