diff options
author | Loïc Hoguin <[email protected]> | 2018-11-22 10:41:02 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-11-22 10:41:02 +0100 |
commit | 3f5af49cfd74f2e5dafacd3dfbf3eb7fa6634f0d (patch) | |
tree | dc05a7c6a0bf5930b855ecd2c2cb9487b40060c5 /test/compress_SUITE.erl | |
parent | 0223f69fcd2252a4b686b2815e6ee287b1484551 (diff) | |
download | cowboy-3f5af49cfd74f2e5dafacd3dfbf3eb7fa6634f0d.tar.gz cowboy-3f5af49cfd74f2e5dafacd3dfbf3eb7fa6634f0d.tar.bz2 cowboy-3f5af49cfd74f2e5dafacd3dfbf3eb7fa6634f0d.zip |
Fix compress buffering tests before OTP 20.1
Diffstat (limited to 'test/compress_SUITE.erl')
-rw-r--r-- | test/compress_SUITE.erl | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/compress_SUITE.erl b/test/compress_SUITE.erl index 148eb46..2fa006a 100644 --- a/test/compress_SUITE.erl +++ b/test/compress_SUITE.erl @@ -198,8 +198,13 @@ opts_compress_buffering_true(Config0) -> Z = zlib:open(), zlib:inflateInit(Z, 31), %% The data gets buffered because it is too small. - {data, nofin, Data1} = gun:await(ConnPid, Ref, 500), - <<>> = iolist_to_binary(zlib:inflate(Z, Data1)), + %% In zlib versions before OTP 20.1 the gzip header was also buffered. + <<>> = case gun:await(ConnPid, Ref, 500) of + {data, nofin, Data1} -> + iolist_to_binary(zlib:inflate(Z, Data1)); + {error, timeout} -> + <<>> + end, gun:close(ConnPid) after cowboy:stop_listener(?FUNCTION_NAME) @@ -258,8 +263,13 @@ set_options_compress_buffering_true(Config0) -> Z = zlib:open(), zlib:inflateInit(Z, 31), %% The data gets buffered because it is too small. - {data, nofin, Data1} = gun:await(ConnPid, Ref, 500), - <<>> = iolist_to_binary(zlib:inflate(Z, Data1)), + %% In zlib versions before OTP 20.1 the gzip header was also buffered. + <<>> = case gun:await(ConnPid, Ref, 500) of + {data, nofin, Data1} -> + iolist_to_binary(zlib:inflate(Z, Data1)); + {error, timeout} -> + <<>> + end, gun:close(ConnPid) after cowboy:stop_listener(?FUNCTION_NAME) |