diff options
author | Jose M Perez <[email protected]> | 2021-10-07 14:21:49 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2025-01-23 11:39:48 +0100 |
commit | 49061587be2cba33f750d8c45352d457c6e73ffa (patch) | |
tree | 7c4f99bb84bf0734a5a8936a077f92dadc36e607 | |
parent | 7f739cad6de9403391391b5811ac4a4af31e4688 (diff) | |
download | cowboy-49061587be2cba33f750d8c45352d457c6e73ffa.tar.gz cowboy-49061587be2cba33f750d8c45352d457c6e73ffa.tar.bz2 cowboy-49061587be2cba33f750d8c45352d457c6e73ffa.zip |
Add WS compression test where only server sets client_max_window_bits
When the server has a non-default value configured and the client
doesn't send one the extension negotiation should fail.
-rw-r--r-- | rebar.config | 2 | ||||
-rw-r--r-- | test/ws_SUITE.erl | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/rebar.config b/rebar.config index c22692c..dc2e25d 100644 --- a/rebar.config +++ b/rebar.config @@ -1,4 +1,4 @@ {deps, [ -{cowlib,".*",{git,"https://github.com/ninenines/cowlib","master"}},{ranch,".*",{git,"https://github.com/ninenines/ranch","1.8.0"}} +{cowlib,".*",{git,"https://github.com/ninenines/cowlib","master"}},{ranch,".*",{git,"https://github.com/ninenines/ranch","1.8.x"}} ]}. {erl_opts, [debug_info,warn_export_vars,warn_shadow_vars,warn_obsolete_guard,warn_missing_spec,warn_untyped_record]}. diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl index 9c1f880..f1559d8 100644 --- a/test/ws_SUITE.erl +++ b/test/ws_SUITE.erl @@ -267,6 +267,21 @@ ws_deflate_opts_client_max_window_bits_override(Config) -> = lists:keyfind("sec-websocket-extensions", 1, Headers2), ok. +%% @todo This might be better in an rfc7692_SUITE. +%% +%% 7.1.2.2 +%% If a received extension negotiation offer doesn't have the +%% "client_max_window_bits" extension parameter, the corresponding +%% extension negotiation response to the offer MUST NOT include the +%% "client_max_window_bits" extension parameter. +ws_deflate_opts_client_max_window_bits_only_in_server(Config) -> + doc("Handler is configured with non-default client max window bits but " + "client doesn't send the parameter; compression is disabled."), + {ok, _, Headers} = do_handshake("/ws_deflate_opts?client_max_window_bits", + "Sec-WebSocket-Extensions: permessage-deflate\r\n", Config), + false = lists:keyfind("sec-websocket-extensions", 1, Headers), + ok. + ws_deflate_opts_server_context_takeover(Config) -> doc("Handler is configured with server context takeover enabled."), {ok, _, Headers1} = do_handshake("/ws_deflate_opts?server_context_takeover", |