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, 1 Oct 2024 06:00:55 +0000 (08:00 +0200)
commit7ba52732e4fb387843bf00b3e08295e29141f3a3
tree185907e3ccb582513051e5dbf9f40949f7935462
parentad6f5987b4467f0b54d5dcb13503b00d15fda75e
BUG/MEDIUM: cli: Be sure to catch immediate client abort

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.

(cherry picked from commit 14a413033c15aa4622368348ac6b142e7ec2c989)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/cli.c