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.
This commit is contained in:
Christopher Faulet 2024-04-08 07:41:17 +02:00
parent 0046922aed
commit 70251a2aeb

View File

@ -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;
}