]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: stats: Wait the body before processing POST requests
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 15 Aug 2019 20:26:48 +0000 (22:26 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 15 Aug 2019 20:26:50 +0000 (22:26 +0200)
The stats applet waits to have a full body to process POST requests. Because
when it is waiting for the end of a request it does not produce anything, the
applet may be blocked. The client side is blocked because the stats applet does
not consume anything and the applet is waiting because all the body is not
received. Registering the analyzer AN_REQ_HTTP_BODY when a POST request is sent
for the stats applet solves the issue.

This patch must be backported to 2.0.

src/http_ana.c

index 3f681c0f59d4e7d211ac891578f3bd24b7d8e538..b2069e3ead59e7bcde45ac76a1c6b0b6b5fb3882 100644 (file)
@@ -4484,8 +4484,11 @@ static int http_handle_stats(struct stream *s, struct channel *req)
        if (txn->meth == HTTP_METH_GET || txn->meth == HTTP_METH_HEAD)
                appctx->st0 = STAT_HTTP_HEAD;
        else if (txn->meth == HTTP_METH_POST) {
-               if (appctx->ctx.stats.flags & STAT_ADMIN)
+               if (appctx->ctx.stats.flags & STAT_ADMIN) {
                        appctx->st0 = STAT_HTTP_POST;
+                       if (msg->msg_state < HTTP_MSG_DATA)
+                               req->analysers |= AN_REQ_HTTP_BODY;
+               }
                else {
                        /* POST without admin level */
                        appctx->ctx.stats.flags &= ~STAT_CHUNKED;