]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: mux-h1: Don't pretend connection was released for TCP>H1>H2 upgrade
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 30 Apr 2025 12:16:42 +0000 (14:16 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 30 Apr 2025 12:44:42 +0000 (14:44 +0200)
When an applicative upgrade of the H1 multiplexer is performed, we must not
pretend the connection was released.  Indeed, in that case, a H1 stream is
still their with a stream connector attached on it. It must be detached
first before releasing the H1 connection and the underlying connection. So
it is important to not pretend the connection was already released.

Concretely, in that case h1_process() must return 0 instead of -1. It is
minor error because, AFAIK, it is harmless. But it is not correct. So let's
fix it to avoid futur bugs.

To be clear, this happens when a TCP connection is upgraded to H1 connection
and a H2 preface is detected, leading to a second upgrade from H1 to H2.

This patch may be backport to all stable versions.

src/mux_h1.c

index 864d3cce2379aac1bc583409a332f617a1815fef..6fef116bd26288f91678e19c2ca1f17238d22d47 100644 (file)
@@ -4250,6 +4250,7 @@ static int h1_process(struct h1c * h1c)
                }
                h1_alert(h1s);
                TRACE_DEVEL("waiting to release the SC before releasing the connection", H1_EV_H1C_WAKE);
+               return 0;
        }
        else {
                h1_release(h1c);