From 39121ceca6945b62fdea24de1cb5102c6631417b Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 17 Mar 2026 08:03:07 +0100 Subject: [PATCH] MEDIUM: tree-wide: Rely on htx_xfer() instead of htx_xfer_blks() htx_xfer() function replaced htx_xfer_blks(). So let's use it. --- src/applet.c | 4 ++-- src/http_client.c | 13 +++---------- src/mux_h2.c | 4 +--- src/qmux_http.c | 2 +- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/applet.c b/src/applet.c index 4246da3e4..8f11535d6 100644 --- a/src/applet.c +++ b/src/applet.c @@ -511,7 +511,7 @@ size_t appctx_htx_rcv_buf(struct appctx *appctx, struct buffer *buf, size_t coun goto out; } - htx_xfer_blks(buf_htx, appctx_htx, count, HTX_BLK_UNUSED); + htx_xfer(buf_htx, appctx_htx, count, HTX_XFER_DEFAULT); buf_htx->flags |= (appctx_htx->flags & (HTX_FL_PARSING_ERROR|HTX_FL_PROCESSING_ERROR)); if (htx_is_empty(appctx_htx)) { buf_htx->flags |= (appctx_htx->flags & HTX_FL_EOM); @@ -608,7 +608,7 @@ size_t appctx_htx_snd_buf(struct appctx *appctx, struct buffer *buf, size_t coun goto end; } - htx_xfer_blks(appctx_htx, buf_htx, count, HTX_BLK_UNUSED); + htx_xfer(appctx_htx, buf_htx, count, HTX_XFER_DEFAULT); if (htx_is_empty(buf_htx)) { appctx_htx->flags |= (buf_htx->flags & HTX_FL_EOM); } diff --git a/src/http_client.c b/src/http_client.c index 762fc0946..410d384c3 100644 --- a/src/http_client.c +++ b/src/http_client.c @@ -604,10 +604,7 @@ void httpclient_applet_io_handler(struct appctx *appctx) htx_to_buf(htx, outbuf); b_xfer(outbuf, &hc->req.buf, b_data(&hc->req.buf)); } else { - struct htx_ret ret; - - ret = htx_xfer_blks(htx, hc_htx, htx_used_space(hc_htx), HTX_BLK_UNUSED); - if (!ret.ret) { + if (!htx_xfer(htx, hc_htx, htx_used_space(hc_htx), HTX_XFER_DEFAULT)) { applet_have_more_data(appctx); goto out; } @@ -711,7 +708,6 @@ void httpclient_applet_io_handler(struct appctx *appctx) if (hc->options & HTTPCLIENT_O_RES_HTX) { /* HTX mode transfers the header to the hc buffer */ struct htx *hc_htx; - struct htx_ret ret; if (!b_alloc(&hc->res.buf, DB_MUX_TX)) { applet_wont_consume(appctx); @@ -720,8 +716,7 @@ void httpclient_applet_io_handler(struct appctx *appctx) hc_htx = htxbuf(&hc->res.buf); /* xfer the headers */ - ret = htx_xfer_blks(hc_htx, htx, htx_used_space(htx), HTX_BLK_EOH); - if (!ret.ret) { + if (!htx_xfer(hc_htx, htx, htx_used_space(htx), HTX_XFER_HDRS_ONLY)) { applet_need_more_data(appctx); goto out; } @@ -811,12 +806,10 @@ void httpclient_applet_io_handler(struct appctx *appctx) if (hc->options & HTTPCLIENT_O_RES_HTX) { /* HTX mode transfers the header to the hc buffer */ struct htx *hc_htx; - struct htx_ret ret; hc_htx = htxbuf(&hc->res.buf); - ret = htx_xfer_blks(hc_htx, htx, htx_used_space(htx), HTX_BLK_UNUSED); - if (!ret.ret) + if (!htx_xfer(hc_htx, htx, htx_used_space(htx), HTX_XFER_DEFAULT)) applet_wont_consume(appctx); else applet_fl_clr(appctx, APPCTX_FL_INBLK_FULL); diff --git a/src/mux_h2.c b/src/mux_h2.c index edd4ec507..692cf6071 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -7866,7 +7866,6 @@ static size_t h2_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count, in struct htx *h2s_htx = NULL; struct htx *buf_htx = NULL; struct buffer *rxbuf = NULL; - struct htx_ret htxret; size_t ret = 0; uint prev_h2c_flags = h2c->flags; unsigned long long prev_body_len = h2s->body_len; @@ -7901,8 +7900,7 @@ static size_t h2_rcv_buf(struct stconn *sc, struct buffer *buf, size_t count, in goto end; } - htxret = htx_xfer_blks(buf_htx, h2s_htx, count, HTX_BLK_UNUSED); - count -= htxret.ret; + count -= htx_xfer(buf_htx, h2s_htx, count, HTX_XFER_DEFAULT); if (h2s_htx->flags & HTX_FL_PARSING_ERROR) { buf_htx->flags |= HTX_FL_PARSING_ERROR; diff --git a/src/qmux_http.c b/src/qmux_http.c index d67ed4b93..a752b8f33 100644 --- a/src/qmux_http.c +++ b/src/qmux_http.c @@ -44,7 +44,7 @@ size_t qcs_http_rcv_buf(struct qcs *qcs, struct buffer *buf, size_t count, goto end; } - htx_xfer_blks(cs_htx, qcs_htx, count, HTX_BLK_UNUSED); + htx_xfer(cs_htx, qcs_htx, count, HTX_XFER_DEFAULT); BUG_ON(qcs_htx->flags & HTX_FL_PARSING_ERROR); /* Copy EOM from src to dst buffer if all data copied. */ -- 2.47.3