Add basic_parser_v1::reset

This commit is contained in:
Vinnie Falco
2016-10-16 18:52:32 -04:00
parent 83556937f6
commit 6832bd57d3
3 changed files with 20 additions and 8 deletions

View File

@@ -9,6 +9,7 @@
* Add is_Reader trait
* Tidy up basic_headers for documentation
* Tidy up documentation
* Add basic_parser_v1::reset
API Changes:

View File

@@ -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<bool, isRequest>{});
}
void
init(std::true_type)
{

View File

@@ -1175,6 +1175,16 @@ write_eof(error_code& ec)
}
}
template<bool isRequest, class Derived>
void
basic_parser_v1<isRequest, Derived>::
reset()
{
h_left_ = h_max_;
b_left_ = b_max_;
reset(std::integral_constant<bool, isRequest>{});
}
template<bool isRequest, class Derived>
bool
basic_parser_v1<isRequest, Derived>::