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

ircd::http: Improve chunk header parsing device.

This commit is contained in:
Jason Volk 2018-03-19 14:42:40 -07:00
parent bf91eb6883
commit f9c0ed49b1

View file

@ -149,10 +149,16 @@ struct ircd::http::grammar
rule<size_t> chunk_size
{
qi::uint_parser<size_t, 16, 1, 8>{} >> CRLF
qi::uint_parser<size_t, 16, 1, 8>{}
,"chunk size"
};
rule<string_view> chunk_extensions
{
';' >> raw[string] //TODO: extensions
,"chunk extensions"
};
rule<http::query> query
{
query_key >> -(equal >> query_val)
@ -393,6 +399,25 @@ ircd::http::response::head::head(parse::capstan &pc,
{
}
ircd::http::response::chunk::chunk(parse::capstan &pc)
try
:line{pc}
{
static const parser::rule<size_t> grammar
{
parser.chunk_size >> -parser.chunk_extensions
,"chunk head"
};
const char *start(line::begin());
const auto res(qi::parse(start, line::end(), eps > grammar, this->size));
assert(res == true);
}
catch(const qi::expectation_failure<const char *> &e)
{
throw_error(e, true);
}
ircd::http::headers::headers(parse::capstan &pc,
const closure &c)
:string_view{[&pc, &c]