]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: cli: Don't warn about a too big command for incomplete commands
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 8 Apr 2024 05:41:17 +0000 (07:41 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 8 Apr 2024 09:49:13 +0000 (11:49 +0200)
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.

src/cli.c

index 30593f130abe81b75113500d37a7032c57116eea..02cb068439f48d5ac99a46b851a05913de79ac78 100644 (file)
--- 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;
                }