Browse Source

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.
Loïc Hoguin 14 years ago
parent
commit
470baff61f
1 changed files with 10 additions and 2 deletions
  1. 10 2
      test/http_SUITE.erl

+ 10 - 2
test/http_SUITE.erl

@@ -18,7 +18,8 @@
 
 
 -export([all/0, groups/0, init_per_suite/1, end_per_suite/1,
 -export([all/0, groups/0, init_per_suite/1, end_per_suite/1,
 	init_per_group/2, end_per_group/2]). %% ct.
 	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.
 -export([http_200/1, http_404/1, websocket/1]). %% http and https.
 
 
 %% ct.
 %% ct.
@@ -28,7 +29,8 @@ all() ->
 
 
 groups() ->
 groups() ->
 	BaseTests = [http_200, http_404],
 	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}].
 	{https, [], BaseTests}].
 
 
 init_per_suite(Config) ->
 init_per_suite(Config) ->
@@ -100,6 +102,12 @@ headers_dupe(Config) ->
 	nomatch = binary:match(Data, <<"Connection: keep-alive">>),
 	nomatch = binary:match(Data, <<"Connection: keep-alive">>),
 	ok = gen_tcp:close(Socket).
 	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) ->
 nc_rand(Config) ->
 	Cat = os:find_executable("cat"),
 	Cat = os:find_executable("cat"),
 	Nc = os:find_executable("nc"),
 	Nc = os:find_executable("nc"),