]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: tcpcheck: Properly detect pending HTTP data in output buffer
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 11 Aug 2021 13:46:29 +0000 (15:46 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 12 Aug 2021 05:49:23 +0000 (07:49 +0200)
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

index 9610760d75e705879b56e13bdacdb7186383b98e..e57b05fc6f6c3dd71ae8d7e387b33fc37acbd38c 100644 (file)
@@ -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);