mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 15:17:01 +02:00
BUG/MEDIUM: cli: Don't consume data if outbuf is full or not available
The output buffer must be available to process a command, at least to be able to emit error messages. When this buffer is full or cannot be allocated, we must wait. In that case, we must take care to notify the SE will not consume input data. It is important to avoid wakeup in loop, especially when the client aborts. When the output buffer is available again and no longer full, and the CLI applet is waiting for a command line, it must notify it will consume input data. This patch must be backported as far as 3.0.
This commit is contained in:
parent
96badf86a2
commit
396f0252bf
@ -1086,10 +1086,9 @@ int cli_parse_cmdline(struct appctx *appctx)
|
||||
*/
|
||||
void cli_io_handler(struct appctx *appctx)
|
||||
{
|
||||
if (applet_fl_test(appctx, APPCTX_FL_OUTBLK_ALLOC|APPCTX_FL_OUTBLK_FULL))
|
||||
goto out;
|
||||
|
||||
if (!appctx_get_buf(appctx, &appctx->outbuf)) {
|
||||
if (applet_fl_test(appctx, APPCTX_FL_OUTBLK_ALLOC|APPCTX_FL_OUTBLK_FULL) ||
|
||||
!appctx_get_buf(appctx, &appctx->outbuf)) {
|
||||
applet_wont_consume(appctx);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1108,6 +1107,7 @@ void cli_io_handler(struct appctx *appctx)
|
||||
break;
|
||||
}
|
||||
else if (appctx->st0 == CLI_ST_PARSE_CMDLINE) {
|
||||
applet_will_consume(appctx);
|
||||
if (cli_parse_cmdline(appctx) == 0) {
|
||||
/* Now we close the output if we're not in interactive
|
||||
* mode and the request buffer is empty. This still
|
||||
|
Loading…
Reference in New Issue
Block a user