]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: htx: Transfer HTX_FL_EOM flag on success in htx_append_msg()
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Jul 2026 10:03:27 +0000 (12:03 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 28 Jul 2026 13:28:29 +0000 (15:28 +0200)
htx_append_msg() function copy all blocks from a source message to a
destination one. But it never take care to also transfer HTX_FL_EOM flag if
necessary on success. It is important because this function is used to copy
error messages during HTTP analysis.

It seems to be harmless because when an error is triggered the stream is
also closed and most of time a raw copy is performed instead of a
block-per-block copy. But this could lead to prematurely close the
connection at the end of the response.

This patch should be backported to all supported versions.

src/htx.c

index 4d2d4cf959b1289b54de7021a9077aa647380c28..1fe5c85cff7f31a0774b4a3ae371d19c9512f669 100644 (file)
--- a/src/htx.c
+++ b/src/htx.c
@@ -1344,7 +1344,8 @@ void htx_move_blk_before(struct htx *htx, struct htx_blk **blk, struct htx_blk *
 
 /* Append the HTX message <src> to the HTX message <dst>. It returns 1 on
  * success and 0 on error.  All the message or nothing is copied. If an error
- * occurred, all blocks from <src> already appended to <dst> are truncated.
+ * occurred, all blocks from <src> already appended to <dst> are truncated. On
+ * success, the EOM flag is set on <dst> if also set on <src>.
  */
 int htx_append_msg(struct htx *dst, const struct htx *src)
 {
@@ -1365,7 +1366,7 @@ int htx_append_msg(struct htx *dst, const struct htx *src)
                newblk->info = blk->info;
                htx_memcpy(htx_get_blk_ptr(dst, newblk), htx_get_blk_ptr(src, blk), blksz);
        }
-
+       dst->flags |= (src->flags & HTX_FL_EOM);
        return 1;
 
   error: