0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Add headers_huge test, demonstrating issue #3 is fixed.

The previous commit switching to raw recv + erlang:decode_packet/3
works around the OTP bug regarding headers size in http recv.
This commit is contained in:
Loïc Hoguin 2011-05-05 17:11:27 +02:00
parent 29e71cf4da
commit 470baff61f

View file

@ -18,7 +18,8 @@
-export([all/0, groups/0, init_per_suite/1, end_per_suite/1,
init_per_group/2, end_per_group/2]). %% ct.
-export([headers_dupe/1, nc_rand/1, pipeline/1, raw/1]). %% http.
-export([headers_dupe/1, headers_huge/1,
nc_rand/1, pipeline/1, raw/1]). %% http.
-export([http_200/1, http_404/1, websocket/1]). %% http and https.
%% ct.
@ -28,7 +29,8 @@ all() ->
groups() ->
BaseTests = [http_200, http_404],
[{http, [], [headers_dupe, nc_rand, pipeline, raw, websocket] ++ BaseTests},
[{http, [], [headers_dupe, headers_huge,
nc_rand, pipeline, raw, websocket] ++ BaseTests},
{https, [], BaseTests}].
init_per_suite(Config) ->
@ -100,6 +102,12 @@ headers_dupe(Config) ->
nomatch = binary:match(Data, <<"Connection: keep-alive">>),
ok = gen_tcp:close(Socket).
headers_huge(Config) ->
Cookie = lists:flatten(["whatever_man_biiiiiiiiiiiig_cookie_me_want_77="
"Wed Apr 06 2011 10:38:52 GMT-0500 (CDT)" || _N <- lists:seq(1, 1000)]),
{_Packet, 200} = raw_req(["GET / HTTP/1.0\r\nHost: localhost\r\n"
"Set-Cookie: ", Cookie, "\r\n\r\n"], Config).
nc_rand(Config) ->
Cat = os:find_executable("cat"),
Nc = os:find_executable("nc"),