diff options
author | Loïc Hoguin <[email protected]> | 2014-07-17 13:54:29 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-07-17 13:54:29 +0200 |
commit | 99061274b6dc602614a07a8751ea3925950f6b80 (patch) | |
tree | d911ecf2b32464ef67a12f02dec809300686dc42 /test | |
parent | 9980348a1cd74a41b3024f0b01d6fef301d8288b (diff) | |
parent | b10b34a8f204ed409a6fc936e199557bfe3b0975 (diff) | |
download | cowboy-99061274b6dc602614a07a8751ea3925950f6b80.tar.gz cowboy-99061274b6dc602614a07a8751ea3925950f6b80.tar.bz2 cowboy-99061274b6dc602614a07a8751ea3925950f6b80.zip |
Merge branch 'http-1-0-keepalive' of git://github.com/heroku/cowboy
Diffstat (limited to 'test')
-rw-r--r-- | test/http_SUITE.erl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl index e5a9256..0417ad0 100644 --- a/test/http_SUITE.erl +++ b/test/http_SUITE.erl @@ -426,6 +426,34 @@ http10_hostless(Config) -> [{port, Port10}|Config]), cowboy:stop_listener(http10_hostless). +http10_keepalive_default(Config) -> + Normal = "GET / HTTP/1.0\r\nhost: localhost\r\n\r\n", + Client = raw_open(Config), + ok = raw_send(Client, Normal), + case catch raw_recv_head(Client) of + {'EXIT', _} -> error(closed); + _ -> ok + end, + ok = raw_send(Client, Normal), + case catch raw_recv_head(Client) of + {'EXIT', _} -> closed; + _ -> error(not_closed) + end. + +http10_keepalive_forced(Config) -> + Keepalive = "GET / HTTP/1.0\r\nhost: localhost\r\nConnection: keep-alive\r\n\r\n", + Client = raw_open(Config), + ok = raw_send(Client, Keepalive), + case catch raw_recv_head(Client) of + {'EXIT', _} -> error(closed); + _ -> ok + end, + ok = raw_send(Client, Keepalive), + case catch raw_recv_head(Client) of + {'EXIT', Err} -> error({closed, Err}); + _ -> ok + end. + keepalive_max(Config) -> {ConnPid, MRef} = gun_monitor_open(Config), Refs = [gun:get(ConnPid, "/", [{<<"connection">>, <<"keep-alive">>}]) |