]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MEDIUM: mux-h1: Stop to use HTX extra value when formatting message
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 18 Sep 2025 07:22:37 +0000 (09:22 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 8 Oct 2025 09:10:42 +0000 (11:10 +0200)
We now rely on the <kop> value to format the message payload before
sending it. It is no longer necessary to use the HTX extra field.

src/mux_h1.c

index df248a460f2883d698441017d311e2c054314ae7..d0385ea28b7c6b49dfb0652b6ec10fc4a9579926 100644 (file)
@@ -2983,10 +2983,8 @@ static size_t h1_make_data(struct h1s *h1s, struct h1m *h1m, struct buffer *buf,
            htx_get_blk_type(blk) == HTX_BLK_DATA &&
            htx_get_blk_value(htx, blk).len == count) {
                void *old_area;
-               uint64_t extra;
                int eom = (htx->flags & HTX_FL_EOM);
 
-               extra = htx->extra;
                old_area = h1c->obuf.area;
                h1c->obuf.area = buf->area;
                h1c->obuf.head = sizeof(struct htx) + blk->addr;
@@ -2997,7 +2995,6 @@ static size_t h1_make_data(struct h1s *h1s, struct h1m *h1m, struct buffer *buf,
 
                htx = (struct htx *)buf->area;
                htx_reset(htx);
-               htx->extra = extra;
 
                if (h1m->flags & H1_MF_CLEN) {
                        if (count > h1m->curr_len) {
@@ -3030,7 +3027,8 @@ static size_t h1_make_data(struct h1s *h1s, struct h1m *h1m, struct buffer *buf,
                                                    H1_EV_TX_DATA|H1_EV_STRM_ERR|H1_EV_H1C_ERR|H1_EV_H1S_ERR, h1c->conn, h1s);
                                        goto error;
                                }
-                               h1m->curr_len = count + (htx->extra != HTX_UNKOWN_PAYLOAD_LENGTH ? htx->extra : 0);
+                               h1m->curr_len = (h1s->sd->kop ? h1s->sd->kop : count);
+                               h1s->sd->kop = 0;
 
                                /* Because chunk meta-data are prepended, the chunk size of the current chunk
                                 * must be handled before the end of the previous chunk.
@@ -3117,11 +3115,12 @@ static size_t h1_make_data(struct h1s *h1s, struct h1m *h1m, struct buffer *buf,
                        if (h1m->flags & H1_MF_CHNK) {
                                /* If is a new chunk, prepend the chunk size */
                                if (h1m->state == H1_MSG_CHUNK_SIZE) {
-                                       h1m->curr_len = (htx->extra && htx->extra != HTX_UNKOWN_PAYLOAD_LENGTH ? htx->data + htx->extra : vlen);
+                                       h1m->curr_len = (h1s->sd->kop ? h1s->sd->kop : vlen);
                                        if (!h1_append_chunk_size(&outbuf, h1m->curr_len)) {
                                                h1m->curr_len = 0;
                                                goto full;
                                        }
+                                       h1s->sd->kop = 0;
                                        h1m->state = H1_MSG_DATA;
                                }