File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -778,7 +778,14 @@ prepare() ->
778778 {
779779 BOOST_ASSERT (
780780 h_.md .payload == payload::to_eof);
781- n = clamp (body_limit_remain () + 1 , n);
781+ // No more messages can be pipelined, so
782+ // limit the output buffer to the remaining
783+ // body limit plus one byte to detect
784+ // exhaustion.
785+ std::uint64_t r = body_limit_remain ();
786+ if (r != std::uint64_t (-1 ))
787+ r += 1 ;
788+ n = clamp (r, n);
782789 }
783790
784791 nprepare_ = n;
@@ -803,7 +810,14 @@ prepare() ->
803810 {
804811 BOOST_ASSERT (
805812 h_.md .payload == payload::to_eof);
806- n = clamp (body_limit_remain () + 1 , n);
813+ // No more messages can be pipelined, so
814+ // limit the output buffer to the remaining
815+ // body limit plus one byte to detect
816+ // exhaustion.
817+ std::uint64_t r = body_limit_remain ();
818+ if (r != std::uint64_t (-1 ))
819+ r += 1 ;
820+ n = clamp (r, n);
807821 n = clamp (n, eb_->max_size () - eb_->size ());
808822 // fill capacity first to avoid an allocation
809823 std::size_t avail =
You can’t perform that action at this time.
0 commit comments