2018-08-23 16:06:35 +00:00
|
|
|
# commit 7b6cc52784526c32efda44b873a4258d3ae0b8c7
|
|
|
|
# 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.
|
|
|
|
#
|
2020-06-21 16:42:57 +00:00
|
|
|
# This patch simply removes the affected statement. The same fix has been applied
|
2018-08-23 16:06:35 +00:00
|
|
|
# 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)
|
|
|
|
#
|
2021-08-07 09:41:56 +00:00
|
|
|
# This had as a consequence to log %TR field with approximately the same value as
|
2018-08-23 16:06:35 +00:00
|
|
|
# the LUA sleep time.
|
|
|
|
|
|
|
|
varnishtest "LUA bug"
|
2018-12-19 10:50:17 +00:00
|
|
|
#REQUIRE_OPTIONS=LUA
|
2019-03-29 14:07:24 +00:00
|
|
|
#REGTEST_TYPE=bug
|
2018-08-23 16:06:35 +00:00
|
|
|
|
|
|
|
feature ignore_unknown_macro
|
|
|
|
|
|
|
|
syslog Slog {
|
|
|
|
recv info
|
2018-11-16 14:54:23 +00:00
|
|
|
expect ~ "[^:\\[ ]\\[[0-9]*\\]: Ta=[0-9]* Tc=[0-9]* Td=[0-9]* Th=[0-9]* Ti=[0-9]* Tq=[0-9]* TR=[0-9]* Tr=[0-9]* Tt=[0-9]* Tw=[0-9]*$"
|
2018-08-23 16:06:35 +00:00
|
|
|
|
|
|
|
recv info
|
2018-11-16 14:54:23 +00:00
|
|
|
expect ~ "[^:\\[ ]\\[[0-9]*\\]: Tc=[0-9]* Td=[0-9]* Th=[0-9]* Tt=[0-9]* Tw=[0-9]*$"
|
2018-08-23 16:06:35 +00:00
|
|
|
} -start
|
|
|
|
|
2024-11-19 15:51:30 +00:00
|
|
|
haproxy h1 -conf {
|
2018-08-23 16:06:35 +00:00
|
|
|
global
|
2019-03-29 15:13:48 +00:00
|
|
|
lua-load ${testdir}/bad_http_clt_req_duration.lua
|
2018-08-23 16:06:35 +00:00
|
|
|
|
|
|
|
defaults
|
2021-11-18 16:46:22 +00:00
|
|
|
timeout client "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
timeout server "${HAPROXY_TEST_TIMEOUT-5s}"
|
|
|
|
timeout connect "${HAPROXY_TEST_TIMEOUT-5s}"
|
2018-08-23 16:06:35 +00:00
|
|
|
|
|
|
|
frontend f1
|
|
|
|
mode http
|
|
|
|
bind "fd@${f1}"
|
|
|
|
log ${Slog_addr}:${Slog_port} daemon
|
|
|
|
log-format Ta=%Ta\ Tc=%Tc\ Td=%Td\ Th=%Th\ Ti=%Ti\ Tq=%Tq\ TR=%TR\ Tr=%Tr\ Tt=%Tt\ Tw=%Tw
|
|
|
|
default_backend b1
|
|
|
|
|
|
|
|
backend b1
|
|
|
|
mode http
|
|
|
|
http-request use-service lua.foo.http
|
|
|
|
|
|
|
|
frontend f2
|
|
|
|
mode tcp
|
|
|
|
bind "fd@${f2}"
|
|
|
|
log ${Slog_addr}:${Slog_port} daemon
|
|
|
|
log-format Tc=%Tc\ Td=%Td\ Th=%Th\ Tt=%Tt\ Tw=%Tw
|
|
|
|
|
|
|
|
tcp-request inspect-delay 1s
|
|
|
|
tcp-request content use-service lua.foo.tcp
|
|
|
|
} -start
|
|
|
|
|
|
|
|
client c1 -connect "${h1_f1_sock}" {
|
|
|
|
txreq
|
|
|
|
rxresp
|
|
|
|
} -run
|
|
|
|
|
|
|
|
client c2 -connect "${h1_f2_sock}" {
|
|
|
|
txreq
|
|
|
|
rxresp
|
|
|
|
} -run
|
|
|
|
|
|
|
|
syslog Slog -wait
|