]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: htx: Save hdrs_bytes when the HTX start-line is replaced
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 25 Jun 2019 19:31:26 +0000 (21:31 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 26 Jun 2019 07:57:49 +0000 (09:57 +0200)
The HTX start-line contains the number of bytes held by all headers as seen by
the mux during the parsing. So it must not be updated during analysis. It was
done when the start-line is replaced, so this update was removed at this
place. But we still save it from the old start-line to not loose it. It should
not be used outside the mux, but there is no reason to skip it. It is a bug,
however it should have no impact.

This patch must be backported to 2.0.

src/htx.c

index 814925985c0e53b7b330ca22af38bdab62cfbc0d..502184aff47753de19555ade6c567e34039f8dd0 100644 (file)
--- a/src/htx.c
+++ b/src/htx.c
@@ -760,6 +760,7 @@ 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;
@@ -778,8 +779,7 @@ 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;
+       sl->hdrs_bytes = tmp.hdrs_bytes;
 
        HTX_SL_P1_LEN(sl) = p1.len;
        HTX_SL_P2_LEN(sl) = p2.len;