]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: htx: Remove unsued hdrs_bytes field from the HTX start-line
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 22 Apr 2021 07:50:14 +0000 (09:50 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 28 Apr 2021 08:51:08 +0000 (10:51 +0200)
Thanks to the htx_xfer_blks() refactoring, it is now possible to remove
hdrs_bytes field from the start-line because no function rely on it anymore.

include/haproxy/htx-t.h
include/haproxy/htx.h
src/h1_htx.c
src/h2.c
src/htx.c

index e49b0ee86c74fe405d28a4221569877ed0f581cf..00703412d102b9a8f2952dbf11928720d76df722 100644 (file)
@@ -187,10 +187,6 @@ struct htx_sl {
 
        /* XXX 2 bytes unused */
 
-       int32_t hdrs_bytes;  /* Bytes held by all headers, as seen by the mux
-                             * during parsing, from this start-line to the
-                             * corresponding EOH. -1 if unknown */
-
        unsigned int len[3]; /* length of different parts of the start-line */
        char         l[VAR_ARRAY];
 };
index 242397cbbc767c0df131a890dadf7f869c29a4c2..ce6b7853f8ebee53da8eadc583eb0eeebd15c042 100644 (file)
@@ -446,7 +446,6 @@ static inline struct htx_sl *htx_add_stline(struct htx *htx, enum htx_blk_type t
        blk->info += size;
 
        sl = htx_get_blk_ptr(htx, blk);
-       sl->hdrs_bytes = -1;
        sl->flags = flags;
 
        HTX_SL_P1_LEN(sl) = p1.len;
index 136bf461eea68d95d84ac0cbea39d2b9d0a594d2..dfc6b89c9bacd4c6760e301ff7ab29785997e557 100644 (file)
@@ -152,7 +152,6 @@ static int h1_postparse_req_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
        struct htx_sl *sl;
        struct ist meth, uri, vsn;
        unsigned int flags;
-       size_t used;
 
        /* <h1sl> is always defined for a request */
        meth = h1sl->rq.m;
@@ -178,7 +177,6 @@ static int h1_postparse_req_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
                h1m->curr_len = h1m->body_len = 0;
        }
 
-       used = htx_used_space(htx);
        flags = h1m_htx_sl_flags(h1m);
        sl = htx_add_stline(htx, HTX_BLK_REQ_SL, flags, meth, uri, vsn);
        if (!sl || !htx_add_all_headers(htx, hdrs))
@@ -194,8 +192,6 @@ static int h1_postparse_req_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
                if (uri.len > 4 && (uri.ptr[0] | 0x20) == 'h')
                        sl->flags |= ((uri.ptr[4] == ':') ? HTX_SL_F_SCHM_HTTP : HTX_SL_F_SCHM_HTTPS);
        }
-       /* Set bytes used in the HTX message for the headers now */
-       sl->hdrs_bytes = htx_used_space(htx) - used;
 
        /* If body length cannot be determined, set htx->extra to
         * ULLONG_MAX. This value is impossible in other cases.
@@ -222,7 +218,6 @@ static int h1_postparse_res_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
        struct htx_sl *sl;
        struct ist vsn, status, reason;
        unsigned int flags;
-       size_t used;
        uint16_t code = 0;
 
        if (h1sl) {
@@ -285,16 +280,12 @@ static int h1_postparse_res_hdrs(struct h1m *h1m, union h1_sl *h1sl, struct htx
                h1m->flags |= H1_MF_XFER_LEN;
        }
 
-       used = htx_used_space(htx);
        flags = h1m_htx_sl_flags(h1m);
        sl = htx_add_stline(htx, HTX_BLK_RES_SL, flags, vsn, status, reason);
        if (!sl || !htx_add_all_headers(htx, hdrs))
                goto error;
        sl->info.res.status = code;
 
-       /* Set bytes used in the HTX message for the headers now */
-       sl->hdrs_bytes = htx_used_space(htx) - used;
-
        /* If body length cannot be determined, set htx->extra to
         * ULLONG_MAX. This value is impossible in other cases.
         */
index 9ff3c938e7659b915c4288b071390b4a7a98d0bf..27a7a4e900eff746cc0eadd358f10b7191dae695 100644 (file)
--- a/src/h2.c
+++ b/src/h2.c
@@ -369,7 +369,6 @@ int h2_make_htx_request(struct http_hdr *list, struct htx *htx, unsigned int *ms
        int phdr;
        int ret;
        int i;
-       uint32_t used = htx_used_space(htx);
        struct htx_sl *sl = NULL;
        unsigned int sl_flags = 0;
        const char *ctl;
@@ -554,9 +553,6 @@ int h2_make_htx_request(struct http_hdr *list, struct htx *htx, unsigned int *ms
        if (!htx_add_endof(htx, HTX_BLK_EOH))
                goto fail;
 
-       /* Set bytes used in the HTX message for the headers now */
-       sl->hdrs_bytes = htx_used_space(htx) - used;
-
        ret = 1;
        return ret;
 
@@ -670,7 +666,6 @@ int h2_make_htx_response(struct http_hdr *list, struct htx *htx, unsigned int *m
        int phdr;
        int ret;
        int i;
-       uint32_t used = htx_used_space(htx);
        struct htx_sl *sl = NULL;
        unsigned int sl_flags = 0;
        const char *ctl;
@@ -801,9 +796,6 @@ int h2_make_htx_response(struct http_hdr *list, struct htx *htx, unsigned int *m
        if (!htx_add_endof(htx, HTX_BLK_EOH))
                goto fail;
 
-       /* Set bytes used in the HTX message for the headers now */
-       sl->hdrs_bytes = htx_used_space(htx) - used;
-
        ret = 1;
        return ret;
 
index 53646b903f29ddadb1722088c155997fd577d61b..28b2c47b679aced97089d1d973460eef8ecaa996 100644 (file)
--- a/src/htx.c
+++ b/src/htx.c
@@ -808,7 +808,6 @@ struct htx_sl *htx_replace_stline(struct htx *htx, struct htx_blk *blk, const st
        sl = htx_get_blk_ptr(htx, blk);
        tmp.info = sl->info;
        tmp.flags = sl->flags;
-       tmp.hdrs_bytes = sl->hdrs_bytes;
 
        sz = htx_get_blksz(blk);
        delta = sizeof(*sl) + p1.len + p2.len + p3.len - sz;
@@ -829,7 +828,6 @@ 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;
-       sl->hdrs_bytes = tmp.hdrs_bytes;
 
        HTX_SL_P1_LEN(sl) = p1.len;
        HTX_SL_P2_LEN(sl) = p2.len;