BUG/MEDIUM: lua: force server-close mode on Lua services

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.
This commit is contained in:
Willy Tarreau 2015-10-07 20:20:28 +02:00
parent 6457d0fac3
commit 0078bfcb43

@ -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;