From 47bfd7b9b78c71ffa08d65f0cef475f5d2ae7b80 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 11 Aug 2021 15:46:29 +0200 Subject: [PATCH] BUG/MINOR: tcpcheck: Properly detect pending HTTP data in output buffer In tcpcheck_eval_send(), the condition to detect there are still pending data in the output buffer is buggy. Presence of raw data must be tested for TCP connection only. But a condition on the connection was missing to be sure it is not an HTX connection. This patch must be backported as far as 2.2. --- src/tcpcheck.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tcpcheck.c b/src/tcpcheck.c index 9610760d7..e57b05fc6 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -1304,7 +1304,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_send(struct check *check, struct tcpcheck_r } /* Data already pending in the output buffer, send them now */ - if (b_data(&check->bo)) { + if ((IS_HTX_CONN(conn) && !htx_is_empty(htxbuf(&check->bo))) || (!IS_HTX_CONN(conn) && b_data(&check->bo))) { TRACE_DEVEL("Data still pending, try to send it now", CHK_EV_TCPCHK_SND|CHK_EV_TX_DATA, check); goto do_send; } @@ -1448,7 +1448,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_send(struct check *check, struct tcpcheck_r goto out; } } - if ((IS_HTX_CONN(conn) && !htx_is_empty(htxbuf(&check->bo))) || b_data(&check->bo)) { + if ((IS_HTX_CONN(conn) && !htx_is_empty(htxbuf(&check->bo))) || (!IS_HTX_CONN(conn) && b_data(&check->bo))) { cs->conn->mux->subscribe(cs, SUB_RETRY_SEND, &check->wait_list); ret = TCPCHK_EVAL_WAIT; TRACE_DEVEL("data not fully sent, wait", CHK_EV_TCPCHK_SND|CHK_EV_TX_DATA, check);