Refactor chunked parsing (API Change):

* parser now has a callback feature for intercepting chunk headers
  and chunk bodies

* The names for basic_parser derived class callbacks have been
  refactored

* basic_parser offers an additional callback for distinguishing
  chunk body data.

Actions Required:

* Adjust signatures for required members of user-defined
  subclasses of basic_parser

* Use the new basic_parser chunk callbacks for accessing
  chunk extensions and chunk bodies.
This commit is contained in:
Vinnie Falco
2017-07-20 08:15:31 -07:00
parent cc73d883be
commit 4b71aa67e0
27 changed files with 1851 additions and 269 deletions
+18 -10
View File
@@ -166,14 +166,14 @@ public:
boost::asio::mutable_buffers_1;
void
on_request(verb, string_view,
on_request_impl(verb, string_view,
string_view, int, error_code& ec)
{
ec.assign(0, ec.category());
}
void
on_response(int,
on_response_impl(int,
string_view,
int, error_code& ec)
{
@@ -181,42 +181,50 @@ public:
}
void
on_field(field,
on_field_impl(field,
string_view, string_view, error_code& ec)
{
ec.assign(0, ec.category());
}
void
on_header(error_code& ec)
on_header_impl(error_code& ec)
{
ec.assign(0, ec.category());
}
void
on_body(boost::optional<std::uint64_t> const&,
on_body_init_impl(
boost::optional<std::uint64_t> const&,
error_code& ec)
{
ec.assign(0, ec.category());
}
std::size_t
on_data(string_view s, error_code& ec)
on_body_impl(string_view s, error_code& ec)
{
ec.assign(0, ec.category());
return s.size();
}
void
on_chunk(std::uint64_t,
string_view,
error_code& ec)
on_chunk_header_impl(std::uint64_t,
string_view, error_code& ec)
{
ec.assign(0, ec.category());
}
std::size_t
on_chunk_body_impl(std::uint64_t,
string_view s, error_code& ec)
{
ec.assign(0, ec.category());
return s.size();
}
void
on_complete(error_code& ec)
on_finish_impl(error_code& ec)
{
ec.assign(0, ec.category());
}