]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: htx: Preserve HTX flags when draining data from an HTX message
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 22 Apr 2021 07:43:47 +0000 (09:43 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 27 Apr 2021 20:57:46 +0000 (22:57 +0200)
When all data of an HTX message are drained, we rely on htx_reset() to
reinit the message state. However, the flags must be preserved. It is, among
other things, important to preserve processing or parsing errors.

This patch must be backported as far as 2.0.

src/htx.c

index b0a0c6e3adbcb711061af50cdf037bec8e61e855..9bf40506d2f065c80a1bfd3ef8ba94683f0057cb 100644 (file)
--- a/src/htx.c
+++ b/src/htx.c
@@ -448,7 +448,10 @@ struct htx_ret htx_drain(struct htx *htx, uint32_t count)
        struct htx_ret htxret = { .blk = NULL, .ret = 0 };
 
        if (count == htx->data) {
+               uint32_t flags = htx->flags;
+
                htx_reset(htx);
+               htx->flags = flags; /* restore flags */
                htxret.ret = count;
                return htxret;
        }