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:
parent
bf91eb6883
commit
f9c0ed49b1
1 changed files with 26 additions and 1 deletions
27
ircd/http.cc
27
ircd/http.cc
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue