]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: h2: prevent stream opening before connection reverse completed
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 14 Aug 2023 14:38:23 +0000 (16:38 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 24 Aug 2023 15:03:08 +0000 (17:03 +0200)
commit5053e8914218de4bae733a6019f9bad9df5b12cd
tree24da5da7ce98a8ff1689557f7f0576cf88d12cf0
parent6820b9b3937e0e07c9af543d424bde0cbcc3f757
MEDIUM: h2: prevent stream opening before connection reverse completed

HTTP/2 demux must be handled with care for active reverse connection.
Until accept has been completed, it should be forbidden to handle
HEADERS frame as session is not yet ready to handle streams.

To implement this, use the flag H2_CF_DEM_TOOMANY which blocks demux
process. This flag is automatically set just after conn_reverse()
invocation. The flag is removed on rev_accept_conn() callback via a new
H2 ctl enum. H2 tasklet is woken up to restart demux process.

As a side-effect, reporting in H2 mux may be blocked as demux functions
are used to convert error status at the connection level with
CO_FL_ERROR. To ensure error is reported for a reverse connection, check
h2c_is_dead() specifically for this case in h2_wake(). This change also
has its own side-effect : h2c_is_dead() conditions have been adjusted to
always exclude !h2c->conn->owner condition which is always true for
reverse connection or else H2 mux may kill them unexpectedly.
include/haproxy/connection-t.h
src/mux_h2.c
src/proto_reverse_connect.c