]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: mux-spop; Don't report a read error if there are pending data
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 14 May 2025 07:33:46 +0000 (09:33 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 14 May 2025 09:51:58 +0000 (11:51 +0200)
When an read error is detected, no error must be reported on the SPOP
connection is there are still some data to parse. It is important to be sure
to process all data before reporting the error and be sure to not truncate
received frames. However, we must also take care to handle short read case
to not wait data that will never be received.

This patch must be backported to 3.1.

src/mux_spop.c

index 7b00087c79184a5cd70e44d7ba389ca2f1abe9e9..f8acb619b183a037dee24cb93b6cc039130a02e2 100644 (file)
@@ -2381,7 +2381,8 @@ static int spop_recv(struct spop_conn *spop_conn)
                TRACE_DATA("received read0", SPOP_EV_SPOP_CONN_RECV, conn);
                spop_conn->flags |= SPOP_CF_RCVD_SHUT;
        }
-       if (conn->flags & CO_FL_ERROR) {
+       if ((conn->flags & CO_FL_ERROR) &&
+           (!b_data(&spop_conn->dbuf) || (spop_conn->flags & SPOP_CF_DEM_SHORT_READ))) {
                TRACE_DATA("connection error", SPOP_EV_SPOP_CONN_RECV, conn);
                spop_conn->flags |= SPOP_CF_ERROR;
        }