You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.8 KiB

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