From: Christopher Faulet Date: Wed, 11 Aug 2021 13:46:29 +0000 (+0200) Subject: BUG/MINOR: tcpcheck: Properly detect pending HTTP data in output buffer X-Git-Tag: v2.5-dev4~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47bfd7b9b78c71ffa08d65f0cef475f5d2ae7b80;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/tcpcheck.c b/src/tcpcheck.c index 9610760d75..e57b05fc6f 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);