]> git.kaiwu.me - haproxy.git/commitdiff
MEDIUM: tree-wide: Rely on htx_xfer() instead of htx_xfer_blks()
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 17 Mar 2026 07:03:07 +0000 (08:03 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 23 Mar 2026 13:02:43 +0000 (14:02 +0100)
htx_xfer() function replaced htx_xfer_blks(). So let's use it.

src/applet.c
src/http_client.c
src/mux_h2.c
src/qmux_http.c

index 4246da3e48a3a8ec06c3e3917aa0e9c835e81d54..8f11535d6aec9a38c4e0f4bf63b6811c1198251b 100644 (file)
@@ -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);
        }
index 762fc094680179213b02c6dbe7b7d6b8c4d0cd8d..410d384c31f557aaefac4bf726d422c3e062734a 100644 (file)
@@ -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);
index edd4ec507ca9ff64eb54b34975d6d638c4c064fc..692cf6071fff97a2aff799866d90a5a5f0c70185 100644 (file)
@@ -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;
index d67ed4b9337cb26dfd871bb2c15cbc8c10485cbc..a752b8f33f7d85067bc45d167a0f30e032eed3eb 100644 (file)
@@ -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. */