From 112ff607a10519004cbad5ffa0db6450a406b202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Wed, 21 Nov 2018 12:25:47 +0100 Subject: Create a security test suite based on old HTTP test cases --- test/old_http_SUITE.erl | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) (limited to 'test/old_http_SUITE.erl') diff --git a/test/old_http_SUITE.erl b/test/old_http_SUITE.erl index 8cd0939..f50bb48 100644 --- a/test/old_http_SUITE.erl +++ b/test/old_http_SUITE.erl @@ -194,28 +194,6 @@ keepalive_stream_loop(Config) -> end || Ref <- Refs], ok. -do_nc(Config, Input) -> - Cat = os:find_executable("cat"), - Nc = os:find_executable("nc"), - case {Cat, Nc} of - {false, _} -> - {skip, {notfound, cat}}; - {_, false} -> - {skip, {notfound, nc}}; - _Good -> - %% Throw garbage at the server then check if it's still up. - StrPort = integer_to_list(config(port, Config)), - _ = [os:cmd("cat " ++ Input ++ " | nc localhost " ++ StrPort) - || _ <- lists:seq(1, 100)], - 200 = do_get("/", Config) - end. - -nc_rand(Config) -> - do_nc(Config, "/dev/urandom"). - -nc_zero(Config) -> - do_nc(Config, "/dev/zero"). - rest_param_all(Config) -> ConnPid = gun_open(Config), %% Accept without param. @@ -415,30 +393,6 @@ rest_resource_etags_if_none_match(Config) -> {Ret, Type} end || {Status, ETag, Type} <- Tests]. -slowloris(Config) -> - Client = raw_open(Config), - try - [begin - ok = raw_send(Client, [C]), - receive after 250 -> ok end - end || C <- "GET / HTTP/1.1\r\nHost: localhost\r\n" - "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US)\r\n" - "Cookie: name=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r\n\r\n"], - error(failure) - catch error:{badmatch, _} -> - ok - end. - -slowloris2(Config) -> - Client = raw_open(Config), - ok = raw_send(Client, "GET / HTTP/1.1\r\n"), - receive after 300 -> ok end, - ok = raw_send(Client, "Host: localhost\r\n"), - receive after 300 -> ok end, - Data = raw_recv_head(Client), - {_, 408, _, _} = cow_http:parse_status_line(Data), - ok. - dbg_send_raw(ConnPid, Data) -> #{ socket := Socket, -- cgit v1.2.3