aboutsummaryrefslogtreecommitdiffstats
path: root/test/old_http_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'test/old_http_SUITE.erl')
-rw-r--r--test/old_http_SUITE.erl100
1 files changed, 0 insertions, 100 deletions
diff --git a/test/old_http_SUITE.erl b/test/old_http_SUITE.erl
index 0448407..9eef4fd 100644
--- a/test/old_http_SUITE.erl
+++ b/test/old_http_SUITE.erl
@@ -446,106 +446,6 @@ slowloris2(Config) ->
{_, 408, _, _} = cow_http:parse_status_line(Data),
ok.
-te_chunked(Config) ->
- Body = list_to_binary(io_lib:format("~p", [lists:seq(1, 100)])),
- ConnPid = gun_open(Config),
- Ref = gun:post(ConnPid, "/echo/body", [{<<"content-type">>, <<"text/plain">>}]),
- gun:data(ConnPid, Ref, fin, Body),
- {response, nofin, 200, _} = gun:await(ConnPid, Ref),
- {ok, Body} = gun:await_body(ConnPid, Ref),
- ok.
-
-do_body_to_chunks(_, <<>>, Acc) ->
- lists:reverse([<<"0\r\n\r\n">>|Acc]);
-do_body_to_chunks(ChunkSize, Body, Acc) ->
- BodySize = byte_size(Body),
- ChunkSize2 = case BodySize < ChunkSize of
- true -> BodySize;
- false -> ChunkSize
- end,
- << Chunk:ChunkSize2/binary, Rest/binary >> = Body,
- ChunkSizeBin = integer_to_binary(ChunkSize2, 16),
- do_body_to_chunks(ChunkSize, Rest,
- [<< ChunkSizeBin/binary, "\r\n", Chunk/binary, "\r\n" >>|Acc]).
-
-te_chunked_chopped(Config) ->
- Body = list_to_binary(io_lib:format("~p", [lists:seq(1, 100)])),
- Body2 = iolist_to_binary(do_body_to_chunks(50, Body, [])),
- ConnPid = gun_open(Config),
- Ref = gun:post(ConnPid, "/echo/body",
- [{<<"content-type">>, <<"text/plain">>}]),
- _ = [begin
- ok = dbg_send_raw(ConnPid, << C >>),
- receive after 10 -> ok end
- end || << C >> <= Body2],
- {response, nofin, 200, _} = gun:await(ConnPid, Ref),
- {ok, Body} = gun:await_body(ConnPid, Ref),
- ok.
-
-te_chunked_delayed(Config) ->
- Body = list_to_binary(io_lib:format("~p", [lists:seq(1, 100)])),
- Chunks = do_body_to_chunks(50, Body, []),
- ConnPid = gun_open(Config),
- Ref = gun:post(ConnPid, "/echo/body",
- [{<<"content-type">>, <<"text/plain">>}]),
- _ = [begin
- ok = dbg_send_raw(ConnPid, Chunk),
- receive after 10 -> ok end
- end || Chunk <- Chunks],
- {response, nofin, 200, _} = gun:await(ConnPid, Ref),
- {ok, Body} = gun:await_body(ConnPid, Ref),
- ok.
-
-te_chunked_split_body(Config) ->
- Body = list_to_binary(io_lib:format("~p", [lists:seq(1, 100)])),
- Chunks = do_body_to_chunks(50, Body, []),
- ConnPid = gun_open(Config),
- Ref = gun:post(ConnPid, "/echo/body",
- [{<<"content-type">>, <<"text/plain">>}]),
- _ = [begin
- case Chunk of
- <<"0\r\n\r\n">> ->
- ok = dbg_send_raw(ConnPid, Chunk);
- _ ->
- [Size, ChunkBody, <<>>] =
- binary:split(Chunk, [<<"\r\n">>], [global]),
- PartASize = random:uniform(byte_size(ChunkBody)),
- <<PartA:PartASize/binary, PartB/binary>> = ChunkBody,
- ok = dbg_send_raw(ConnPid, [Size, <<"\r\n">>, PartA]),
- receive after 10 -> ok end,
- ok = dbg_send_raw(ConnPid, [PartB, <<"\r\n">>])
- end
- end || Chunk <- Chunks],
- {response, nofin, 200, _} = gun:await(ConnPid, Ref),
- {ok, Body} = gun:await_body(ConnPid, Ref),
- ok.
-
-te_chunked_split_crlf(Config) ->
- Body = list_to_binary(io_lib:format("~p", [lists:seq(1, 100)])),
- Chunks = do_body_to_chunks(50, Body, []),
- ConnPid = gun_open(Config),
- Ref = gun:post(ConnPid, "/echo/body",
- [{<<"content-type">>, <<"text/plain">>}]),
- _ = [begin
- %% Split in the newline just before the end of the chunk.
- Len = byte_size(Chunk) - (random:uniform(2) - 1),
- << Chunk2:Len/binary, End/binary >> = Chunk,
- ok = dbg_send_raw(ConnPid, Chunk2),
- receive after 10 -> ok end,
- ok = dbg_send_raw(ConnPid, End)
- end || Chunk <- Chunks],
- {response, nofin, 200, _} = gun:await(ConnPid, Ref),
- {ok, Body} = gun:await_body(ConnPid, Ref),
- ok.
-
-te_identity(Config) ->
- Body = list_to_binary(io_lib:format("~p", [lists:seq(1, 100)])),
- ConnPid = gun_open(Config),
- Ref = gun:post(ConnPid, "/echo/body", [], Body),
- {response, nofin, 200, _} = gun:await(ConnPid, Ref),
- {ok, Body} = gun:await_body(ConnPid, Ref),
- ok.
-
dbg_send_raw(ConnPid, Data) ->
#{
socket := Socket,