basic_parser::content_length is stable (API Change):

fix #1375

* The value returned from `basic_parser::content_length`
  no longer changes as the body of the message is received.

Actions Required:

* Call `basic_parser::content_length_remaining` instead
  of `basic_parser::content_length`.
This commit is contained in:
Vinnie Falco
2019-03-29 15:02:05 -07:00
parent 18bf9b4037
commit 51db4d491a
4 changed files with 34 additions and 0 deletions
@@ -48,6 +48,17 @@ template<bool isRequest>
boost::optional<std::uint64_t>
basic_parser<isRequest>::
content_length() const
{
BOOST_ASSERT(is_header_done());
if(! (f_ & flagContentLength))
return boost::none;
return len0_;
}
template<bool isRequest>
boost::optional<std::uint64_t>
basic_parser<isRequest>::
content_length_remaining() const
{
BOOST_ASSERT(is_header_done());
if(! (f_ & flagContentLength))
@@ -461,6 +472,7 @@ finish_header(error_code& ec, std::true_type)
else
{
len_ = 0;
len0_ = 0;
state_ = state::complete;
}
@@ -796,6 +808,7 @@ do_field(field f,
ec = {};
len_ = v;
len0_ = v;
f_ |= flagContentLength;
return;
}