diff --git a/CHANGELOG.md b/CHANGELOG.md index afd31bd0..c0524ebf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Add is_Reader trait * Tidy up basic_headers for documentation * Tidy up documentation +* Add basic_parser_v1::reset API Changes: diff --git a/include/beast/http/basic_parser_v1.hpp b/include/beast/http/basic_parser_v1.hpp index 2174f34b..0b056d7d 100644 --- a/include/beast/http/basic_parser_v1.hpp +++ b/include/beast/http/basic_parser_v1.hpp @@ -467,6 +467,15 @@ public: void write_eof(error_code& ec); +protected: + /** Reset the parsing state. + + The state of the parser is reset to expect the beginning of + a new request or response. The old state is discarded. + */ + void + reset(); + private: Derived& impl() @@ -486,14 +495,6 @@ private: s_ = s_res_start; } - void - reset() - { - h_left_ = h_max_; - b_left_ = b_max_; - reset(std::integral_constant{}); - } - void init(std::true_type) { diff --git a/include/beast/http/impl/basic_parser_v1.ipp b/include/beast/http/impl/basic_parser_v1.ipp index c2c98e8f..4793fe75 100644 --- a/include/beast/http/impl/basic_parser_v1.ipp +++ b/include/beast/http/impl/basic_parser_v1.ipp @@ -1175,6 +1175,16 @@ write_eof(error_code& ec) } } +template +void +basic_parser_v1:: +reset() +{ + h_left_ = h_max_; + b_left_ = b_max_; + reset(std::integral_constant{}); +} + template bool basic_parser_v1::