mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 20:30:23 +00:00
Fix compress buffering tests before OTP 20.1
This commit is contained in:
parent
0223f69fcd
commit
3f5af49cfd
1 changed files with 14 additions and 4 deletions
|
@ -198,8 +198,13 @@ opts_compress_buffering_true(Config0) ->
|
||||||
Z = zlib:open(),
|
Z = zlib:open(),
|
||||||
zlib:inflateInit(Z, 31),
|
zlib:inflateInit(Z, 31),
|
||||||
%% The data gets buffered because it is too small.
|
%% The data gets buffered because it is too small.
|
||||||
{data, nofin, Data1} = gun:await(ConnPid, Ref, 500),
|
%% In zlib versions before OTP 20.1 the gzip header was also buffered.
|
||||||
<<>> = iolist_to_binary(zlib:inflate(Z, Data1)),
|
<<>> = case gun:await(ConnPid, Ref, 500) of
|
||||||
|
{data, nofin, Data1} ->
|
||||||
|
iolist_to_binary(zlib:inflate(Z, Data1));
|
||||||
|
{error, timeout} ->
|
||||||
|
<<>>
|
||||||
|
end,
|
||||||
gun:close(ConnPid)
|
gun:close(ConnPid)
|
||||||
after
|
after
|
||||||
cowboy:stop_listener(?FUNCTION_NAME)
|
cowboy:stop_listener(?FUNCTION_NAME)
|
||||||
|
@ -258,8 +263,13 @@ set_options_compress_buffering_true(Config0) ->
|
||||||
Z = zlib:open(),
|
Z = zlib:open(),
|
||||||
zlib:inflateInit(Z, 31),
|
zlib:inflateInit(Z, 31),
|
||||||
%% The data gets buffered because it is too small.
|
%% The data gets buffered because it is too small.
|
||||||
{data, nofin, Data1} = gun:await(ConnPid, Ref, 500),
|
%% In zlib versions before OTP 20.1 the gzip header was also buffered.
|
||||||
<<>> = iolist_to_binary(zlib:inflate(Z, Data1)),
|
<<>> = case gun:await(ConnPid, Ref, 500) of
|
||||||
|
{data, nofin, Data1} ->
|
||||||
|
iolist_to_binary(zlib:inflate(Z, Data1));
|
||||||
|
{error, timeout} ->
|
||||||
|
<<>>
|
||||||
|
end,
|
||||||
gun:close(ConnPid)
|
gun:close(ConnPid)
|
||||||
after
|
after
|
||||||
cowboy:stop_listener(?FUNCTION_NAME)
|
cowboy:stop_listener(?FUNCTION_NAME)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue