]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: htx: Add a field to set the memory used by headers in the HTX start-line
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 15 May 2019 12:56:47 +0000 (14:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 28 May 2019 05:42:12 +0000 (07:42 +0200)
The field hdrs_bytes has been added in the structure htx_sl. It should be used
to set how many bytes are help by all headers, from the start-line to the
corresponding EOH block. it must be set to -1 if it is unknown.

include/common/htx.h
src/htx.c

index 55d493131a7b14a42901ac85d17bce1ed0ddb263..ec9909851d84837309f3d17c558ef73107188968 100644 (file)
@@ -139,6 +139,9 @@ struct htx_sl {
 
        /* XXX 2 bytes unused */
 
+       int32_t hdrs_bytes;  /* Bytes held by all headers from this start-line
+                             * to the corresponding EOH. -1 if unknown */
+
        unsigned int len[3]; /* length of differnt parts of the start-line */
        char         l[0];
 };
index 3a2252febf05fb37f077a0835310b29931a57c17..bc2ecbdf3d6ed1ba41d58dd7b6c4548f6ef2ff12 100644 (file)
--- a/src/htx.c
+++ b/src/htx.c
@@ -633,6 +633,8 @@ struct htx_sl *htx_replace_stline(struct htx *htx, struct htx_blk *blk, const st
        sl = htx_get_blk_ptr(htx, blk);
        sl->info = tmp.info;
        sl->flags = tmp.flags;
+       if (sl->hdrs_bytes != -1)
+               sl->hdrs_bytes += delta;
 
        HTX_SL_P1_LEN(sl) = p1.len;
        HTX_SL_P2_LEN(sl) = p2.len;
@@ -669,7 +671,7 @@ struct htx_sl *htx_add_stline(struct htx *htx, enum htx_blk_type type, unsigned
        sl = htx_get_blk_ptr(htx, blk);
        if (htx->sl_pos == -1)
                htx->sl_pos = htx_get_blk_pos(htx, blk);
-
+       sl->hdrs_bytes = -1;
        sl->flags = flags;
 
        HTX_SL_P1_LEN(sl) = p1.len;