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.3.13~12 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=d28f06cfa162efdf958dc0a795e2700d6942a899;p=haproxy-2.3.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. (cherry picked from commit 47bfd7b9b78c71ffa08d65f0cef475f5d2ae7b80) Signed-off-by: Willy Tarreau (cherry picked from commit 18280ca240afe28f79a1bbfa5c8f6949230bfe1c) [wt: ctx adj: no trace in 2.3] Signed-off-by: Willy Tarreau --- diff --git a/src/tcpcheck.c b/src/tcpcheck.c index fc9d956..f9f4cc6 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -1233,8 +1233,9 @@ 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))) { goto do_send; + } /* Always release input buffer when a new send is evaluated */ check_release_buf(check, &check->bi); @@ -1375,7 +1376,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; goto out;