From d194635a5e7d2262da5d616609b30ed58f6063fa Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Mon, 7 Dec 2020 12:02:24 -0800 Subject: [PATCH] ircd::server: Fix dynamic chunked encoding buffers not reused, affecting large transfers. --- ircd/server.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ircd/server.cc b/ircd/server.cc index 217106392..309abd1c7 100644 --- a/ircd/server.cc +++ b/ircd/server.cc @@ -4041,11 +4041,17 @@ ircd::server::tag::read_chunk_dynamic_content(const const_buffer &buffer, if(req.in.progress && !done) req.in.progress(buffer, const_buffer{chunk, state.chunk_read}); - if(state.chunk_read == state.chunk_length) + const bool content_completed + { + state.chunk_read == state.chunk_length + }; + + if(content_completed) chunk_dynamic_content_completed(*this, done); assert(state.chunk_read <= state.chunk_length); - if(likely(state.chunk_read != state.chunk_length)) + assert(!content_completed || state.chunk_read == state.chunk_length); + if(likely(!content_completed)) return {}; assert(state.chunk_read <= state.content_read);