]> git.kaiwu.me - haproxy.git/commitdiff
MINOR: htx: don't mark the message unordered when data follow a NOOP block
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 3 Dec 2026 14:59:06 +0000 (15:59 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Dec 2026 13:53:05 +0000 (14:53 +0100)
When data are added after a block of a greater type, the HTX message is
marked as unordered. But a NOOP block may be found anywhere in a
message. So data added after a NOOP block without EOM must not be
considered as unordered. Otherwise a useless defragmentation may be
performed.

src/htx.c

index 10bd40498f7b7a3ab3084ed02f8b84038f86ae6d..29e419d40e5434f08372cc86933fa7066f66d5f7 100644 (file)
--- a/src/htx.c
+++ b/src/htx.c
@@ -636,7 +636,10 @@ struct htx_blk *__htx_add_data_type_atonce(struct htx *htx, struct ist data, enu
        if (tailblk->flags & HTX_BLK_FL_EOM)
                goto add_new_block;
        if (htx_get_blk_type(tailblk) != type) {
-               if (htx_get_blk_type(tailblk) > type)
+               /* A NOOP block may be found anywhere, so it does not make the
+                * message unordered.
+                */
+               if (htx_get_blk_type(tailblk) > type && htx_get_blk_type(tailblk) != HTX_BLK_NOOP)
                        flags |= HTX_FL_UNORDERED;
                goto add_new_block;
        }
@@ -1153,7 +1156,10 @@ struct htx_ret htx_reserve_max_data(struct htx *htx)
        if (tailblk->flags & HTX_BLK_FL_EOM)
                goto rsv_new_block;
        if (htx_get_blk_type(tailblk) != HTX_BLK_DATA) {
-               if (htx_get_blk_type(tailblk) > HTX_BLK_DATA)
+               /* A NOOP block may be found anywhere, so it does not make the
+                * message unordered.
+                */
+               if (htx_get_blk_type(tailblk) > HTX_BLK_DATA && htx_get_blk_type(tailblk) != HTX_BLK_NOOP)
                        flags |= HTX_FL_UNORDERED;
                goto rsv_new_block;
        }
@@ -1237,7 +1243,10 @@ size_t htx_add_data_type(struct htx *htx, const struct ist data, enum htx_blk_ty
        if (tailblk->flags & HTX_BLK_FL_EOM)
                goto add_new_block;
        if (htx_get_blk_type(tailblk) != type) {
-               if (htx_get_blk_type(tailblk) > type)
+               /* A NOOP block may be found anywhere, so it does not make the
+                * message unordered.
+                */
+               if (htx_get_blk_type(tailblk) > type && htx_get_blk_type(tailblk) != HTX_BLK_NOOP)
                        flags |= HTX_FL_UNORDERED;
                goto add_new_block;
        }