]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: htx: remove comments about "must be < 256 MB"
authorWilly Tarreau <w@1wt.eu>
Thu, 26 Aug 2021 14:07:22 +0000 (16:07 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Sep 2021 14:15:29 +0000 (16:15 +0200)
Since commit "BUG/MINOR: config: reject configs using HTTP with bufsize
>= 256 MB" we are now sure that it's not possible anymore to have an HTX
block of a size 256 MB or more, even after concatenation thanks to the
tests for len >= htx_free_data_space(). Let's remove these now obsolete
comments.

A BUG_ON() was added in htx_add_blk() to track any such exception if
the conditions would change later, to complete the one that is performed
on the start address that must remain within the buffer.

include/haproxy/htx.h
src/htx.c

index e94e3da474240422974fcc6bf34d5e6b71dc39e2..b6d95274e9d35e729850502b4883c65aabbeef9f 100644 (file)
@@ -439,7 +439,6 @@ static inline struct htx_sl *htx_add_stline(struct htx *htx, enum htx_blk_type t
 
        size = sizeof(*sl) + p1.len + p2.len + p3.len;
 
-       /* FIXME: check size (< 256MB) */
        blk = htx_add_blk(htx, type, size);
        if (!blk)
                return NULL;
index 3b49e78d17a970c2e3d81ca6aae84f06f85dc600..05ba03ba9d38b27d549a1754b98850e2ac071c0a 100644 (file)
--- a/src/htx.c
+++ b/src/htx.c
@@ -316,6 +316,7 @@ struct htx_blk *htx_add_blk(struct htx *htx, enum htx_blk_type type, uint32_t bl
 {
        struct htx_blk *blk;
 
+       BUG_ON(blksz >= 256 << 20);
        blk = htx_reserve_nxblk(htx, blksz);
        if (!blk)
                return NULL;
@@ -546,7 +547,6 @@ struct htx_blk *htx_add_data_atonce(struct htx *htx, struct ist data)
        goto add_new_block;
 
   append_data:
-       /* FIXME: check v.len + data.len < 256MB */
        /* Append data and update the block itself */
        ptr = htx_get_blk_ptr(htx, tailblk);
        memcpy(ptr+sz, data.ptr, len);
@@ -559,7 +559,6 @@ struct htx_blk *htx_add_data_atonce(struct htx *htx, struct ist data)
        data = istadv(data, len);
 
   add_new_block:
-       /* FIXME: check data.len (< 256MB) */
        blk = htx_add_blk(htx, HTX_BLK_DATA, data.len);
        if (!blk)
                return NULL;
@@ -915,7 +914,6 @@ struct htx_ret htx_reserve_max_data(struct htx *htx)
        return (struct htx_ret){.ret = sz, .blk = tailblk};
 
   rsv_new_block:
-       /* FIXME: check data.len (< 256MB) */
        blk = htx_add_blk(htx, HTX_BLK_DATA, len);
        if (!blk)
                return (struct htx_ret){.ret = 0, .blk = NULL};
@@ -973,7 +971,6 @@ size_t htx_add_data(struct htx *htx, const struct ist data)
                len = room;
 
   append_data:
-       /* FIXME: check v.len + data.len < 256MB */
        /* Append data and update the block itself */
        ptr = htx_get_blk_ptr(htx, tailblk);
        memcpy(ptr + sz, data.ptr, len);
@@ -986,7 +983,6 @@ size_t htx_add_data(struct htx *htx, const struct ist data)
        return len;
 
   add_new_block:
-       /* FIXME: check data.len (< 256MB) */
        blk = htx_add_blk(htx, HTX_BLK_DATA, len);
        if (!blk)
                return 0;