Fix handling of body_what::pause in basic_parser_v1

This commit is contained in:
Vinnie Falco
2016-10-16 19:28:24 -04:00
parent 6832bd57d3
commit 4ded6cff76
4 changed files with 27 additions and 5 deletions

View File

@@ -10,6 +10,7 @@
* Tidy up basic_headers for documentation
* Tidy up documentation
* Add basic_parser_v1::reset
* Fix handling of body_what::pause in basic_parser_v1
API Changes:

View File

@@ -422,7 +422,10 @@ public:
bool
complete() const
{
return s_ == s_restart || s_ == s_closed_complete;
return
s_ == s_restart ||
s_ == s_closed_complete ||
s_ == s_body_pause;
}
/** Write a sequence of buffers to the parser.

View File

@@ -127,7 +127,7 @@ protected:
s_chunk_data_cr,
s_chunk_data_lf,
s_body_what,
s_body_pause,
s_body_identity0,
s_body_identity,
s_body_identity_eof0,

View File

@@ -902,11 +902,29 @@ write(boost::asio::const_buffer const& buffer, error_code& ec)
call_on_headers(ec);
if(ec)
return errc();
s_ = s_body_what;
// fall through
auto const what = call_on_body_what(ec);
if(ec)
return errc();
switch(what)
{
case body_what::normal:
break;
case body_what::upgrade:
upgrade_ = true;
// fall through
case body_what::skip:
flags_ |= parse_flag::skipbody;
break;
case body_what::pause:
++p;
s_ = s_body_pause;
return used();
}
s_ = s_headers_done;
goto redo;
}
case s_body_what:
case s_body_pause:
{
auto const what = call_on_body_what(ec);
if(ec)