* truncated. Nothing more will come, so it is an
* error. Otherwise, the end of the message would be
* held forever.
+ *
+ * But the error is only reported once all forwarded
+ * data were sent, because they would be lost
+ * otherwise. Until then, we wait to be called again
+ * when the output is drained.
*/
if (!blk && ((st->flags & DECOMP_STATE_EOM_SEEN) || htx_msg_ended(htx)) &&
!st->decomp_ctx->drain_len &&
- !(st->decomp_ctx->flags & DECOMP_CTX_FL_DONE))
+ !(st->decomp_ctx->flags & DECOMP_CTX_FL_DONE) &&
+ !total && !co_data(chn))
goto error;
ret = decomp_stream_blk_drain(s, f, chn, NULL, NULL, 0);