diff --git a/CHANGELOG.md b/CHANGELOG.md index dfad923f..2faf3a31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Version 76: * Use Boost.Config * BodyReader may construct from a non-const message * Add serializer::get +* Add serializer::chunked -------------------------------------------------------------------------------- diff --git a/include/beast/http/impl/serializer.ipp b/include/beast/http/impl/serializer.ipp index 689bd23c..fcafe884 100644 --- a/include/beast/http/impl/serializer.ipp +++ b/include/beast/http/impl/serializer.ipp @@ -87,7 +87,8 @@ next(error_code& ec, Visit&& visit) frdinit(std::integral_constant{}); close_ = ! frd_->keep_alive(); - if(frd_->chunked()) + chunked_ = frd_->chunked(); + if(chunked_) goto go_init_c; s_ = do_init; BEAST_FALLTHROUGH; diff --git a/include/beast/http/serializer.hpp b/include/beast/http/serializer.hpp index 34b0f0ff..4545ef4a 100644 --- a/include/beast/http/serializer.hpp +++ b/include/beast/http/serializer.hpp @@ -385,6 +385,17 @@ public: return s_ == do_complete; } + /** Return `true` if the serializer will apply chunk-encoding. + + This function may only be called if @ref is_header_done + would return `true`. + */ + bool + chunked() + { + return chunked_; + } + /** Return `true` if Connection: close semantic is indicated. Depending on the contents of the message, the end of @@ -392,6 +403,9 @@ public: for the recipient (if any) to receive a complete message, the underlying network connection must be closed when this function returns `true`. + + This function may only be called if @ref is_header_done + would return `true`. */ bool need_close() const