]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: lua: force server-close mode on Lua services
authorWilly Tarreau <w@1wt.eu>
Wed, 7 Oct 2015 18:20:28 +0000 (20:20 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 7 Oct 2015 18:24:05 +0000 (20:24 +0200)
Thierry reported that keep-alive still didn't cope well with Lua
services. The reason is that for now applets have to be closed at
the end of a transaction so we want to work in server-close mode,
which isn't noticeable by the client since it still sees keep-alive.
Additionally we want to enable the request body transfer analyser
which will be needed to synchronize with the response analyser to
indicate the end of the transfer.

src/hlua.c

index ae3fe8938f6bdbc0ef2c1fbff18c6ca90b43fbaf..9bfe34d1f0551775e23a0a1d950b2d8a2b00ed59 100644 (file)
@@ -5755,6 +5755,16 @@ static int hlua_applet_http_init(struct appctx *ctx, struct proxy *px, struct st
        txn = strm->txn;
        msg = &txn->req;
 
+       /* We want two things in HTTP mode :
+        *  - enforce server-close mode if we were in keep-alive, so that the
+        *    applet is released after each response ;
+        *  - enable request body transfer to the applet in order to resync
+        *    with the response body.
+        */
+       if ((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_KAL)
+               txn->flags = (txn->flags & ~TX_CON_WANT_MSK) | TX_CON_WANT_SCL;
+       req->analysers |= AN_REQ_HTTP_XFER_BODY;
+
        HLUA_INIT(hlua);
        ctx->ctx.hlua_apphttp.left_bytes = -1;
        ctx->ctx.hlua_apphttp.flags = 0;