mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-09 16:47:18 +02:00
MINOR: cli: Remove useless loop on commands to find unescaped semi-colon
This loop was added to detect pipelined commands when only co_getline() was used to get commands. Now, co_getdelim() is used and the semi-colon is also considered as a command delimiter. As side effet, the last semi-colon, if any, is no longer replaced by a newline. Thus, we must take care to adapt the test to detect partial commands.
This commit is contained in:
parent
73806f0675
commit
e018e8a419
18
src/cli.c
18
src/cli.c
@ -987,29 +987,13 @@ static void cli_io_handler(struct appctx *appctx)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(appctx->st1 & APPCTX_CLI_ST1_PAYLOAD)) {
|
|
||||||
/* seek for a possible unescaped semi-colon. If we find
|
|
||||||
* one, we replace it with an LF and skip only this part.
|
|
||||||
*/
|
|
||||||
for (len = 0; len < reql; len++) {
|
|
||||||
if (str[len] == '\\') {
|
|
||||||
len++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (str[len] == ';') {
|
|
||||||
str[len] = '\n';
|
|
||||||
reql = len + 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* now it is time to check that we have a full line,
|
/* now it is time to check that we have a full line,
|
||||||
* remove the trailing \n and possibly \r, then cut the
|
* remove the trailing \n and possibly \r, then cut the
|
||||||
* line.
|
* line.
|
||||||
*/
|
*/
|
||||||
len = reql - 1;
|
len = reql - 1;
|
||||||
if (str[len] != '\n') {
|
if (str[len] != '\n' && str[len] != ';') {
|
||||||
se_fl_set(appctx->sedesc, SE_FL_ERROR);
|
se_fl_set(appctx->sedesc, SE_FL_ERROR);
|
||||||
appctx->st0 = CLI_ST_END;
|
appctx->st0 = CLI_ST_END;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user