diff options
author | Bartek Walkowicz <[email protected]> | 2018-03-01 14:49:57 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-03-14 17:15:06 +0100 |
commit | 21317093285190f854acaf223db2e08f79069757 (patch) | |
tree | e234a0e8e32b39f87bdfc2282b09611d71a55fc8 /test/http2_SUITE.erl | |
parent | f9092126fafe063513444ca2b3c2aec6af14ed7b (diff) | |
download | cowboy-21317093285190f854acaf223db2e08f79069757.tar.gz cowboy-21317093285190f854acaf223db2e08f79069757.tar.bz2 cowboy-21317093285190f854acaf223db2e08f79069757.zip |
Add case for handling infinity for idle/request_timeout
Currently cowboy assumes that idle_timeout or request_timeout is
a number and always starts timers. Similar situation takes place
in case of preface_timeout for http2. This commit adds case for
handling infinity as a timeout, allowing to not start mentioned
timers.
Diffstat (limited to 'test/http2_SUITE.erl')
-rw-r--r-- | test/http2_SUITE.erl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/http2_SUITE.erl b/test/http2_SUITE.erl index 8ffe2fd..933a2b2 100644 --- a/test/http2_SUITE.erl +++ b/test/http2_SUITE.erl @@ -59,6 +59,23 @@ inactivity_timeout(Config) -> {ok, << _:24, 7:8, _:72, 2:32 >>} = gen_tcp:recv(Socket, 17, 1000), ok. +preface_timeout_infinity(Config) -> + doc("Ensure infinity for preface_timeout is accepted"), + ProtoOpts = #{ + env => #{dispatch => cowboy_router:compile(init_routes(Config))}, + preface_timeout => infinity + }, + {ok, Pid} = cowboy:start_clear(preface_timeout_infinity, [{port, 0}], ProtoOpts), + Ref = erlang:monitor(process, Pid), + Port = ranch:get_port(preface_timeout_infinity), + {ok, _} = do_handshake([{port, Port}|Config]), + receive + {'DOWN', Ref, process, Pid, Reason} -> + error(Reason) + after 1000 -> + cowboy:stop_listener(preface_timeout_infinity) + end. + resp_iolist_body(Config) -> doc("Regression test when response bodies are iolists that " "include improper lists, empty lists and empty binaries. " |