]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: Handle interactive mode in cli handler
authorAndrew Hayworth <andrew.hayworth@getbraintree.com>
Fri, 2 Oct 2015 15:08:10 +0000 (15:08 +0000)
committerWilly Tarreau <w@1wt.eu>
Mon, 12 Oct 2015 18:54:50 +0000 (20:54 +0200)
commite32d1867f6c4b1452c71e2920c816997d5d6f77d
tree68df50639cb72b12d3bbda368c0efbdd7c63fbe8
parenta72db18243a31498d4d03aa998864e6eca175255
BUG/MINOR: Handle interactive mode in cli handler

A previous commit broke the interactive stats cli prompt. Specifically,
it was not clear that we could be in STAT_CLI_PROMPT when we get to
the output functions for the cli handler, and the switch statement did
not handle this case. We would then fall through to the default
statement, which was recently changed to set error flags on the socket.
This in turn causes the socket to be closed, which is not what we wanted
in this specific case.

To fix, we add a case for STAT_CLI_PROMPT, and simply break out of the
switch statement.

Testing:
 - Connected to unix stats socket, issued 'prompt', observed that I
   could issue multiple consecutive commands.
 - Connected to unix stats socket, issued 'prompt', observed that socket
   timed out after inactivity expired.
 - Connected to unix stats socket, issued 'prompt' then 'set timeout cli
   5', observed that socket timed out after 5 seconds expired.
 - Connected to unix stats socket, issued invalid commands, received
   usage output.
 - Connected to unix stats socket, issued 'show info', received info
   output and socket disconnected.
 - Connected to unix stats socket, issued 'show stat', received stats
   output and socket disconnected.
 - Repeated above tests with TCP stats socket.

[wt: no backport needed, this was introduced during the applet rework in 1.6]
src/dumpstats.c