Skip to content

Commit

Permalink
Add WS compression test where only server sets client_max_window_bits
Browse files Browse the repository at this point in the history
When the server has a non-default value configured and the client
doesn't send one the extension negotiation should fail.
  • Loading branch information
Kuroneer authored and essen committed Jan 23, 2025
1 parent 7f739ca commit 4906158
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
@@ -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]}.
15 changes: 15 additions & 0 deletions test/ws_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 4906158

Please sign in to comment.