]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: cli: Be sure to catch immediate client abort
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 24 Sep 2024 15:50:09 +0000 (17:50 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 24 Sep 2024 16:01:38 +0000 (18:01 +0200)
A client abort while nothing was sent is properly handled except when this
immediately happens after the connection was accepted. The read0 event is
caught before the CLI applet is created. In that case, the shutdown is not
handled and the applet is no longer wakeup. In that case, the stream remains
blocked and no timeout are armed.

The bug was due to the fact that when the applet I/O handler was called for
the first time, the applet context was initialized and nothing more was
performed. A shutdown, if any, would be handled on the next call. In that
case, it was too late.

Now, afet the init step, we loop to eval the first command. There is no
command here but the shutdown will be tested.

This patch should fix the issue #2727. It must be backported to 3.0.

src/cli.c

index 01a7216f09b8e5c32169cfc403fe03cc9c7b9c1c..c1cbe76bee95507e277ef61ad246266481bec3dc 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -1070,7 +1070,6 @@ static void cli_io_handler(struct appctx *appctx)
                if (appctx->st0 == CLI_ST_INIT) {
                        /* reset severity to default at init */
                        cli_init(appctx);
-                       break;
                }
                else if (appctx->st0 == CLI_ST_END) {
                        applet_set_eos(appctx);