Re: [PATCH] REGTEST/MINOR: lua: Add reg testing files for 70d318c.

2018-09-04 Thread Willy Tarreau
On Tue, Sep 04, 2018 at 04:08:56PM +0200, Frederic Lecaille wrote:
> On 09/04/2018 04:01 PM, Frederic Lecaille wrote:
> > Another reg testing file for a LUA bug fixed by 70d318c commit.
> > 
> > Fred.
> > 
> 
> The same reg testing file but with indentation fixes.

Applied, thank you Fred.

Willy



Re: [PATCH] REGTEST/MINOR: lua: Add reg testing files for 70d318c.

2018-09-04 Thread Frederic Lecaille

On 09/04/2018 04:01 PM, Frederic Lecaille wrote:

Another reg testing file for a LUA bug fixed by 70d318c commit.

Fred.



The same reg testing file but with indentation fixes.


>From 7f01f387563564f1ee5ca718b4ad7562baa599b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20L=C3=A9caille?= 
Date: Tue, 4 Sep 2018 15:58:14 +0200
Subject: [PATCH] REGTEST/MINOR: lua: Add reg testing files for 70d318c.

---
 reg-tests/lua/b3.lua |  1 +
 reg-tests/lua/b3.vtc | 52 
 2 files changed, 53 insertions(+)
 create mode 100644 reg-tests/lua/b3.lua
 create mode 100644 reg-tests/lua/b3.vtc

diff --git a/reg-tests/lua/b3.lua b/reg-tests/lua/b3.lua
new file mode 100644
index ..cc897e73
--- /dev/null
+++ b/reg-tests/lua/b3.lua
@@ -0,0 +1 @@
+core.register_service("donothing", "http", function(applet) end)
diff --git a/reg-tests/lua/b3.vtc b/reg-tests/lua/b3.vtc
new file mode 100644
index ..c43381a8
--- /dev/null
+++ b/reg-tests/lua/b3.vtc
@@ -0,0 +1,52 @@
+# commit 70d318c
+# BUG/MEDIUM: lua: possible CLOSE-WAIT state with '\n' headers
+#
+# The Lua parser doesn't takes in account end-of-headers containing
+# only '\n'. It expects always '\r\n'. If a '\n' is processes the Lua
+# parser considers it miss 1 byte, and wait indefinitely for new data.
+#
+# When the client reaches their timeout, it closes the connection.
+# This close is not detected and the connection keep in CLOSE-WAIT
+# state.
+#
+# I guess that this patch fix only a visible part of the problem.
+# If the Lua HTTP parser wait for data, the timeout server or the
+# connectio closed by the client may stop the applet.
+
+varnishtest "possible CLOSE-WAIT with '\n' headers"
+
+feature ignore_unknown_macro
+
+syslog Slog -level info -repeat 100 {
+recv info
+expect ~ "haproxy\\[${h1_pid}\\]: Ta=[0-9]* Tc=[0-9]* Td=-1 Th=[0-9]* Ti=[0-9]* Tq=[0-9]* TR=[0-9] Tr=-1 Tt=[0-9]* Tw=[0-9]*"
+} -start
+
+haproxy h1 -conf {
+defaults
+timeout client  1s
+timeout connect 1s
+
+global
+lua-load ${testdir}/b3.lua
+nbthread 4
+
+frontend frt
+log ${Slog_addr}:${Slog_port} local0 debug err
+log-format Ta=%Ta\ Tc=%Tc\ Td=%Td\ Th=%Th\ Ti=%Ti\ Tq=%Tq\ TR=%TR\ Tr=%Tr\ Tt=%Tt\ Tw=%Tw
+mode http
+bind "fd@${frt}"
+http-request use-service lua.donothing
+} -start
+
+
+client c1 -connect ${h1_frt_sock} -repeat 100  {
+send "GET / HTTP/1.1\n\n"
+} -run
+
+syslog Slog -wait
+
+shell {
+ss -pt | grep CLOSE-WAIT.*haproxy
+exit $((!$?))
+}
-- 
2.11.0