mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Fix sending HTTP/2 bodies as iolists out of order
This commit is contained in:
parent
d329ca4b60
commit
819a47a220
1 changed files with 3 additions and 2 deletions
|
@ -51,7 +51,7 @@ split(N, [List|Tail], Acc0) ->
|
|||
IolistSize = iolist_size(Before),
|
||||
if
|
||||
IolistSize < N ->
|
||||
split(N - IolistSize, [After|Tail], Before);
|
||||
split(N - IolistSize, [After|Tail], lists:reverse(Before));
|
||||
true ->
|
||||
{ok, Before, [After|Tail]}
|
||||
end;
|
||||
|
@ -71,7 +71,8 @@ split_test_() ->
|
|||
{10, <<"Hello!">>, "Hello!", ""},
|
||||
{10, ["He", [<<"ll">>], $o, [["!"]]], "Hello!", ""},
|
||||
{10, ["Hel"|<<"lo!">>], "Hello!", ""},
|
||||
{10, [[<<>>|<<>>], [], <<"Hello world!">>], "Hello worl", "d!"}
|
||||
{10, [[<<>>|<<>>], [], <<"Hello world!">>], "Hello worl", "d!"},
|
||||
{10, [[<<"He">>|<<"llo">>], [$\s], <<"world!">>], "Hello worl", "d!"}
|
||||
],
|
||||
[{iolist_to_binary(V), fun() ->
|
||||
{B, A} = split(N, V),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue