From 467f911cea2055ba025cc5825d753fdf6bbc9695 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 10 Mar 2026 08:11:35 +0100 Subject: [PATCH] MINOR: http-ana: Use HTX API to move to a large buffer Use htx_move_to_large_buffer() to move a regular HTX message to a large buffer when we are waiting for a huge payload. --- src/http_ana.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/http_ana.c b/src/http_ana.c index 51d53b3ed..80726e9f6 100644 --- a/src/http_ana.c +++ b/src/http_ana.c @@ -4337,20 +4337,10 @@ enum rule_result http_wait_for_msg_body(struct stream *s, struct channel *chn, } if (channel_htx_full(chn, htx, global.tune.maxrewrite) || sc_waiting_room(chn_prod(chn))) { - struct buffer lbuf; - char *area; + struct buffer lbuf = BUF_NULL; - if (large_buffer == 0 || b_is_large(&chn->buf)) - goto end; /* don't use large buffer or large buffer is full */ - - /* normal buffer is full, allocate a large one - */ - area = pool_alloc(pool_head_large_buffer); - if (!area) - goto end; /* Allocation failure: TODO must be improved to use buffer_wait */ - lbuf = b_make(area, global.tune.bufsize_large, 0, 0); - htx_xfer_blks(htx_from_buf(&lbuf), htx, htx_used_space(htx), HTX_BLK_UNUSED); - htx_to_buf(htx, &chn->buf); + if (large_buffer == 0 || b_is_large(&chn->buf) || !htx_move_to_large_buffer(&lbuf, &chn->buf)) + goto end; /* don't use large buffer or already a large buffer */ b_free(&chn->buf); offer_buffers(s, 1); chn->buf = lbuf;