BUG/MINOR: http-ana: Don't overwrite outgoing data when an error is reported
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 23 Jan 2020 10:57:31 +0000 (11:57 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 12 Feb 2020 14:57:25 +0000 (15:57 +0100)
commitafce6c00eb3aeee6e44bfbbdc627d6606308623c
tree6747ece4d579e46660276a5028a98817aefcc226
parent9d1a68baa6ecd086755fc7afff85055a3ac82eba
BUG/MINOR: http-ana: Don't overwrite outgoing data when an error is reported

When an error is returned to a client, the right message is injected into the
response buffer. It is performed by http_server_error() or
http_replay_and_close(). Both ignore any data already present into the channel's
buffer. While it is legitimate to remove all input data, it is important to not
remove any outgoing data.

So now, we try to append the error message to the response buffer, only removing
input data. We rely on the channel_htx_copy_msg() function to do so. So this
patch depends on the following two commits:

  * MINOR: htx: Add a function to append an HTX message to another one
  * MINOR: htx/channel: Add a function to copy an HTX message in a channel's buffer

This patch must be backported as far as 1.9. However, above patches must be
backported first.

(cherry picked from commit 637259e044284882d343e757b1be25a975dcbbf2)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/http_ana.c