0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-28 19:58:53 +02:00

ircd::http: Simplify line ctor; move eoi into grammar.

This commit is contained in:
Jason Volk 2022-06-22 15:00:38 -07:00
parent e70d26b23e
commit 01c2c55054

View file

@ -765,7 +765,7 @@ namespace ircd::http::parser
decltype(ircd::http::parser::parse_header) decltype(ircd::http::parser::parse_header)
ircd::http::parser::parse_header ircd::http::parser::parse_header
{ {
expect[header] eoi | expect[header]
,"header" ,"header"
}; };
@ -786,9 +786,6 @@ ircd::http::parser::parse_response
ircd::http::header::header(const line &line) ircd::http::header::header(const line &line)
try try
{ {
if(line.empty())
return;
const char const char
*start(line.data()), *start(line.data()),
*const stop(line.data() + line.size()); *const stop(line.data() + line.size());
@ -881,9 +878,8 @@ ircd::http::line::terminator
}; };
ircd::http::line::line(parse::capstan &pc) ircd::http::line::line(parse::capstan &pc)
:string_view{[&pc]
{ {
string_view ret; auto &ret(static_cast<string_view &>(*this));
pc([&ret](const char *&start, const char *const &stop) pc([&ret](const char *&start, const char *const &stop)
{ {
if(start == stop) if(start == stop)
@ -897,10 +893,6 @@ ircd::http::line::line(parse::capstan &pc)
assert(ok); assert(ok);
return ok; return ok;
}); });
return ret;
}()}
{
} }
// //