diff --git a/include/ircd/http.h b/include/ircd/http.h index ab5d98ea1..3257b9683 100644 --- a/include/ircd/http.h +++ b/include/ircd/http.h @@ -24,8 +24,8 @@ namespace ircd::http struct request; struct response; - string_view status(const enum code &); - enum code status(const string_view &); + string_view status(const code &); + code status(const string_view &); void writeline(window_buffer &); void writeline(window_buffer &, const window_buffer::closure &); @@ -87,12 +87,12 @@ enum ircd::http::code struct ircd::http::error :ircd::error { - enum code code; std::string content; std::string headers; + http::code code; - error(const enum code &, std::string content = {}, std::string headers = {}); - error(const enum code &, std::string content, const vector_view &); + error(const http::code &, std::string content = {}, std::string headers = {}); + error(const http::code &, std::string content, const vector_view &); }; /// Represents a single \r\n delimited line used in HTTP. diff --git a/ircd/http.cc b/ircd/http.cc index e84504b9d..cff7dd2c2 100644 --- a/ircd/http.cc +++ b/ircd/http.cc @@ -853,23 +853,23 @@ ircd::http::throw_error(const qi::expectation_failure &e) }; } -ircd::http::error::error(const enum code &code, +ircd::http::error::error(const http::code &code, std::string content, const vector_view &headers) -:error +:http::error { code, std::move(content), strung(headers) } { } -ircd::http::error::error(const enum code &code, +ircd::http::error::error(const http::code &code, std::string content, std::string headers) :ircd::error{generate_skip} -,code{code} ,content{std::move(content)} ,headers{std::move(headers)} +,code{code} { snprintf(buf, sizeof(buf), "%d %s", int(code), status(code).c_str()); }