]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: lua: Bad HTTP client request duration.
authorFrédéric Lécaille <flecaille@haproxy.com>
Wed, 18 Jul 2018 12:25:26 +0000 (14:25 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 24 Aug 2018 12:49:30 +0000 (14:49 +0200)
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.

src/hlua.c

index 65986473a0d13bafefd8ae6b70c7ac399247a590..edb4f68cac7ea33ff6e9632ecce1e98990b359ff 100644 (file)
@@ -6459,9 +6459,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), co_data(si_oc(si)));
                res->flags |= CF_READ_NULL;
@@ -6790,9 +6787,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), co_data(si_oc(si)));