Commit Graph

3 Commits

Author SHA1 Message Date
Christopher Faulet da93802ffc BUG/MEDIUM: mux-h1: Don't release H1 stream upgraded from TCP on error
When an error occurred during the request parsing, the H1 multiplexer is
responsible to sent a response to the client and to release the H1 stream
and the H1 connection. In HTTP mode, it is not an issue because at this
stage the H1 connection is in embryonic state. Thus it can be released
immediately.

However, it is a problem if the connection was first upgraded from a TCP
connection. In this case, a stream-connector is attached. The H1 stream is
not orphan. Thus it must not be released at this stage. It must be detached
first. Otherwise a BUG_ON() is triggered in h1s_destroy().

So now, the H1S is destroyed on early errors but only if the H1C is in
embryonic state.

This patch may be related to #1966. It must be backported to 2.7.
2022-12-15 09:51:31 +01:00
Willy Tarreau ab4fa24cd8 REGTESTS: http_upgrade: fix incorrect expectation on TCP->H1->H2
Commit e1b9e1bb1 ("REGTESTS: Add script to tests TCP to HTTP upgrades")
included a mistake in the TCP->H1->H2 test, it expected a close while
it ought to expect a 400 bad req, which is what the mux returns in this
case. It happens that this used to work fine with older versions of
vtest which see the close regardless of the 400, but since Vtest commit
8d6c6bd ("Leak-plugging on barriers"), this doesn't work anymore.

Let's fix this by expecting the proper response. This should be backported
where this regtest is present, but only after verifying that it still
works; indeed at the time of writing it's uncertain whether an earlier
version used to immediately close.
2021-08-20 11:02:28 +02:00
Christopher Faulet e1b9e1bb1e REGTESTS: Add script to tests TCP to HTTP upgrades
This script tests various TCP>HTTP upgrade scenarios and also performs some
checks for invalid/forbidden upgrades.
2021-04-01 13:51:22 +02:00