commit 5b58c92dc9357a87aa3fe94c8121f683feb9c80e
|
|
Author: Frédéric Lécaille <flecaille@haproxy.com>
|
|
Date: Wed Jul 18 14:25:26 2018 +0200
|
|
|
|
BUG/MINOR: lua: Bad HTTP client request duration.
|
|
|
|
HTTP LUA applet callback should not update the date on which the HTTP client requests
|
|
arrive. This was done just after the LUA applet has completed its job.
|
|
|
|
This patch simply removes the affected statement. The same fixe has been applied
|
|
to TCP LUA applet callback.
|
|
|
|
To reproduce this issue, as reported by Patrick Hemmer, implement an HTTP LUA applet
|
|
which sleeps a bit before replying:
|
|
|
|
core.register_service("foo", "http", function(applet)
|
|
core.msleep(100)
|
|
applet:set_status(200)
|
|
applet:start_response()
|
|
end)
|
|
|
|
This had as a consequence to log %TR field with approximatively the same value as
|
|
the LUA sleep time.
|
|
|
|
Thank you to Patrick Hemmer for having reported this issue.
|
|
|
|
Must be backported to 1.8, 1.7 and 1.6.
|
|
|
|
(cherry picked from commit 83ed5d58d2c767d03ce97aef484863a6e1c37a94)
|
|
Signed-off-by: Willy Tarreau <w@1wt.eu>
|
|
|
|
diff --git a/src/hlua.c b/src/hlua.c
|
|
index daf775fc..8147ed15 100644
|
|
--- a/src/hlua.c
|
|
+++ b/src/hlua.c
|
|
@@ -6374,9 +6374,6 @@ static void hlua_applet_tcp_fct(struct appctx *ctx)
|
|
case HLUA_E_OK:
|
|
ctx->ctx.hlua_apptcp.flags |= APPLET_DONE;
|
|
|
|
- /* log time */
|
|
- strm->logs.tv_request = now;
|
|
-
|
|
/* eat the whole request */
|
|
co_skip(si_oc(si), si_ob(si)->o);
|
|
res->flags |= CF_READ_NULL;
|
|
@@ -6675,9 +6672,8 @@ static void hlua_applet_http_fct(struct appctx *ctx)
|
|
|
|
/* close the connection. */
|
|
|
|
- /* status / log */
|
|
+ /* status */
|
|
strm->txn->status = ctx->ctx.hlua_apphttp.status;
|
|
- strm->logs.tv_request = now;
|
|
|
|
/* eat the whole request */
|
|
co_skip(si_oc(si), si_ob(si)->o);
|