0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Ignore malformed accept-encoding headers in cowboy_compress_h

This commit is contained in:
Marcos Ferreira 2019-12-23 22:31:47 -03:00 committed by Loïc Hoguin
parent aa1a7d09f3
commit 3b85b808ae
No known key found for this signature in database
GPG key ID: 8A9DF795F6FED764
2 changed files with 24 additions and 2 deletions

View file

@ -62,6 +62,15 @@ do_get(Path, ReqHeaders, Config) ->
%% Tests.
gzip_accept_encoding_malformed(Config) ->
doc("Send malformed accept-encoding; get an uncompressed response."),
{200, Headers, _} = do_get("/reply/large",
[{<<"accept-encoding">>, <<";">>}], Config),
false = lists:keyfind(<<"content-encoding">>, 1, Headers),
false = lists:keyfind(<<"vary">>, 1, Headers),
{_, <<"100000">>} = lists:keyfind(<<"content-length">>, 1, Headers),
ok.
gzip_accept_encoding_missing(Config) ->
doc("Don't send accept-encoding; get an uncompressed response."),
{200, Headers, _} = do_get("/reply/large",
@ -80,6 +89,15 @@ gzip_accept_encoding_no_gzip(Config) ->
{_, <<"100000">>} = lists:keyfind(<<"content-length">>, 1, Headers),
ok.
gzip_accept_encoding_not_supported(Config) ->
doc("Send unsupported accept-encoding; get an uncompressed response."),
{200, Headers, _} = do_get("/reply/large",
[{<<"accept-encoding">>, <<"application/gzip">>}], Config),
false = lists:keyfind(<<"content-encoding">>, 1, Headers),
false = lists:keyfind(<<"vary">>, 1, Headers),
{_, <<"100000">>} = lists:keyfind(<<"content-length">>, 1, Headers),
ok.
gzip_reply_content_encoding(Config) ->
doc("Reply with content-encoding header; get an uncompressed response."),
{200, Headers, _} = do_get("/reply/content-encoding",