From 3288fa10b33c7792d7aa205908310bd4bfd17e02 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 8 Jul 2026 17:12:27 +0200 Subject: [PATCH] MINOR: fcgi-app: Stop on last HTX block when getting the payload size In the loop counting all DATA block to be able to add a "Content-length:" header in the FCGI response, we now check flags on the HTX block to know if it is the last one of the message or not. If HTX_BLK_FL_EOM flag is set, it means we can stop. --- src/fcgi-app.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fcgi-app.c b/src/fcgi-app.c index d77ae10ea..79c1f8e57 100644 --- a/src/fcgi-app.c +++ b/src/fcgi-app.c @@ -351,10 +351,10 @@ static int fcgi_flt_http_headers(struct stream *s, struct filter *filter, struct for (blk = htx_get_first_blk(htx); blk; blk = htx_get_next_blk(htx, blk)) { enum htx_blk_type type = htx_get_blk_type(blk); - if (type == HTX_BLK_TLR || type == HTX_BLK_EOT) - break; if (type == HTX_BLK_DATA) len += htx_get_blksz(blk); + if (type == HTX_BLK_TLR || type == HTX_BLK_EOT || (blk->flags & HTX_BLK_FL_EOM)) + break; } end = ultoa_o(len, trash.area, trash.size); if (http_add_header(htx, ist("content-length"), ist2(trash.area, end-trash.area), 0)) { -- 2.47.3