aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2012-05-05 07:53:17 +0200
committerLoïc Hoguin <[email protected]>2012-05-05 07:53:17 +0200
commit90bae59307394a0cb2642db504da53f234cf6b42 (patch)
tree1d3f4b794c63e6414f34cc35689010a0cfdf8d5b /test
parent5ffeb9e7e9befdd7a06465c4b51c619c62fa7175 (diff)
downloadcowboy-90bae59307394a0cb2642db504da53f234cf6b42.tar.gz
cowboy-90bae59307394a0cb2642db504da53f234cf6b42.tar.bz2
cowboy-90bae59307394a0cb2642db504da53f234cf6b42.zip
Add a test checking requests with size around the MTU
Diffstat (limited to 'test')
-rw-r--r--test/http_SUITE.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl
index 82b7cae..97caafe 100644
--- a/test/http_SUITE.erl
+++ b/test/http_SUITE.erl
@@ -29,6 +29,7 @@
-export([check_raw_status/1]).
-export([check_status/1]).
-export([chunked_response/1]).
+-export([echo_body/1]).
-export([error_chain_handle_after_reply/1]).
-export([error_chain_handle_before_reply/1]).
-export([error_handle_after_reply/1]).
@@ -74,6 +75,7 @@ groups() ->
check_raw_status,
check_status,
chunked_response,
+ echo_body,
error_chain_handle_after_reply,
error_chain_handle_before_reply,
error_handle_after_reply,
@@ -394,6 +396,20 @@ chunked_response(Config) ->
{ok, {{"HTTP/1.1", 200, "OK"}, _, "chunked_handler\r\nworks fine!"}}
= httpc:request(binary_to_list(build_url("/chunked_response", Config))).
+%% Check if sending requests whose size is around the MTU breaks something.
+echo_body(Config) ->
+ Client = ?config(client, Config),
+ {ok, [{mtu, MTU}]} = inet:ifget("lo", [mtu]),
+ [begin
+ Body = list_to_binary(lists:duplicate(Size, $a)),
+ {ok, Client2} = cowboy_client:request(<<"POST">>,
+ build_url("/echo/body", Config),
+ [{<<"connection">>, <<"close">>}],
+ Body, Client),
+ {ok, 200, _, Client3} = cowboy_client:response(Client2),
+ {ok, Body, _} = cowboy_client:response_body(Client3)
+ end || Size <- lists:seq(MTU - 500, MTU)].
+
error_chain_handle_after_reply(Config) ->
Client = ?config(client, Config),
{ok, Client2} = cowboy_client:request(<<"GET">>,