forked from boostorg/beast
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user