From f9c0ed49b1a291c71354d314adf9b59e0ea2ed85 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 19 Mar 2018 14:42:40 -0700 Subject: [PATCH] ircd::http: Improve chunk header parsing device. --- ircd/http.cc | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/ircd/http.cc b/ircd/http.cc index 749bf7409..f830cd6df 100644 --- a/ircd/http.cc +++ b/ircd/http.cc @@ -149,10 +149,16 @@ struct ircd::http::grammar rule chunk_size { - qi::uint_parser{} >> CRLF + qi::uint_parser{} ,"chunk size" }; + rule chunk_extensions + { + ';' >> raw[string] //TODO: extensions + ,"chunk extensions" + }; + rule 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 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 &e) +{ + throw_error(e, true); +} + ircd::http::headers::headers(parse::capstan &pc, const closure &c) :string_view{[&pc, &c]