From: Christopher Faulet Date: Mon, 8 Apr 2024 05:41:17 +0000 (+0200) Subject: BUG/MINOR: cli: Don't warn about a too big command for incomplete commands X-Git-Tag: v3.0-dev8~115 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=70251a2aeb5930f3fc25aadf979d5ce5007d0f9d;p=thirdparty%2Fhaproxy.git BUG/MINOR: cli: Don't warn about a too big command for incomplete commands When a command is too big to fit in a buffer, a error is returned before closing. However, the error is also returned if the command is small enough but incomplete. It happens on abort. In this case, the error must not be reported. The regression was introduced when a dedicated sn_buf callbac function was added. To fix the issue, both cases are now handled separately. No backport needed. --- diff --git a/src/cli.c b/src/cli.c index 30593f130a..02cb068439 100644 --- a/src/cli.c +++ b/src/cli.c @@ -943,11 +943,16 @@ size_t cli_snd_buf(struct appctx *appctx, struct buffer *buf, size_t count, unsi len = b_getline(buf, ret, count, str, b_room(&appctx->inbuf) - 1); if (!len) { - if (!b_room(buf) || (count > b_room(&appctx->inbuf) - 1) || (flags & CO_SFL_LAST_DATA)) { + if (!b_room(buf) || (count > b_room(&appctx->inbuf) - 1)) { cli_err(appctx, "The command is too big for the buffer size. Please change tune.bufsize in the configuration to use a bigger command.\n"); applet_set_error(appctx); b_reset(&appctx->inbuf); } + else if (flags & CO_SFL_LAST_DATA) { + applet_set_eos(appctx); + applet_set_error(appctx); + b_reset(&appctx->inbuf); + } break; }