From 85d05fff340198bb9af332b7fd503f7c8883e634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 29 Jan 2013 19:12:34 +0100 Subject: Fix chunked streaming of request body and improve speed --- test/http_SUITE.erl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/http_SUITE.erl') diff --git a/test/http_SUITE.erl b/test/http_SUITE.erl index 25ce595..637bb0d 100644 --- a/test/http_SUITE.erl +++ b/test/http_SUITE.erl @@ -73,6 +73,7 @@ -export([stream_body_set_resp/1]). -export([stream_body_set_resp_close/1]). -export([te_chunked/1]). +-export([te_chunked_chopped/1]). -export([te_chunked_delayed/1]). -export([te_identity/1]). @@ -133,6 +134,7 @@ groups() -> stream_body_set_resp, stream_body_set_resp_close, te_chunked, + te_chunked_chopped, te_chunked_delayed, te_identity ], @@ -1037,6 +1039,21 @@ te_chunked(Config) -> {ok, 200, _, Client3} = cowboy_client:response(Client2), {ok, Body, _} = cowboy_client:response_body(Client3). +te_chunked_chopped(Config) -> + Client = ?config(client, Config), + Body = list_to_binary(io_lib:format("~p", [lists:seq(1, 100)])), + Body2 = iolist_to_binary(body_to_chunks(50, Body, [])), + {ok, Client2} = cowboy_client:request(<<"GET">>, + build_url("/echo/body", Config), + [{<<"transfer-encoding">>, <<"chunked">>}], Client), + {ok, Transport, Socket} = cowboy_client:transport(Client2), + _ = [begin + ok = Transport:send(Socket, << C >>), + ok = timer:sleep(10) + end || << C >> <= Body2], + {ok, 200, _, Client3} = cowboy_client:response(Client2), + {ok, Body, _} = cowboy_client:response_body(Client3). + te_chunked_delayed(Config) -> Client = ?config(client, Config), Body = list_to_binary(io_lib:format("~p", [lists:seq(1, 100)])), -- cgit v1.2.3