From dfb5449c3a3ac2dee8b71434cba0afdba29a6567 Mon Sep 17 00:00:00 2001 From: Fredrik Gustafsson Date: Mon, 30 Sep 2013 16:16:59 +0200 Subject: inets: added testcase for keep_alive_timeout --- lib/inets/test/httpd_basic_SUITE.erl | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'lib/inets/test/httpd_basic_SUITE.erl') diff --git a/lib/inets/test/httpd_basic_SUITE.erl b/lib/inets/test/httpd_basic_SUITE.erl index ddb79297b8..fa5c58c509 100644 --- a/lib/inets/test/httpd_basic_SUITE.erl +++ b/lib/inets/test/httpd_basic_SUITE.erl @@ -39,7 +39,8 @@ all() -> script_nocache, escaped_url_in_error_body, script_timeout, - slowdose + slowdose, + keep_alive_timeout ]. groups() -> @@ -373,6 +374,26 @@ escaped_url_in_error_body(Config) when is_list(Config) -> %%------------------------------------------------------------------------- %%------------------------------------------------------------------------- +keep_alive_timeout(doc) -> + ["Test the keep_alive_timeout option"]; +keep_alive_timeout(suite) -> + []; +keep_alive_timeout(Config) when is_list(Config) -> + HttpdConf = ?config(httpd_conf, Config), + {ok, Pid} = inets:start(httpd, [{port, 0}, {keep_alive, true}, {keep_alive_timeout, 2} | HttpdConf]), + Info = httpd:info(Pid), + Port = proplists:get_value(port, Info), + _Address = proplists:get_value(bind_address, Info), + {ok, S} = gen_tcp:connect("localhost", Port, []), + receive + after 3000 -> + {error, closed} = gen_tcp:send(S, "hey") + end, + inets:stop(httpd, Pid). + +%%------------------------------------------------------------------------- +%%------------------------------------------------------------------------- + script_timeout(doc) -> ["Test the httpd script_timeout option"]; script_timeout(suite) -> -- cgit v1.2.3