BUG/MEDIUM: cli: Notify cli applet won't consume data during request processing
The CLI applet process one request after another. Thus, when several
requests are pipelined, it is important to notify it won't consume remaining
outgoing data while it is processing a request. Otherwise, the applet may be
woken up in loop. For instance, it may happen with the HTTP client while we
are waiting for the server response if a shutr is received.
This patch must be backported in all supported versions after an observation
period. But a massive refactoring was performed in 2.6. So, for the 2.5 and
below, the patch will have to be adapted. Note also that, AFAIK, the bug can
only be triggered by the HTTP client for now.
diff --git a/src/cli.c b/src/cli.c
index 5cb34cb..bd77418 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -1136,8 +1136,10 @@
}
/* If the output functions are still there, it means they require more room. */
- if (appctx->st0 >= CLI_ST_OUTPUT)
+ if (appctx->st0 >= CLI_ST_OUTPUT) {
+ applet_wont_consume(appctx);
break;
+ }
/* Now we close the output if one of the writers did so,
* or if we're not in interactive mode and the request
@@ -1152,6 +1154,8 @@
/* switch state back to GETREQ to read next requests */
appctx->st0 = CLI_ST_GETREQ;
+ applet_will_consume(appctx);
+
/* reactivate the \n at the end of the response for the next command */
appctx->st1 &= ~APPCTX_CLI_ST1_NOLF;