Skip to content

Commit 4596e9d

Browse files
committed
Advertise support for client_max_window_bits by default.
This doesn't change anything in the default setup (compression="deflate") because it sets client_max_window_bits to 12 explicitly. If a client is configured with extensions=[ClientPerMessageDeflateFactory()] this change gives the server the option to limit client_max_window_bits. Specifically, this makes such a client compatible with a websockets server using the default setup (compression="deflate").
1 parent 5e0f002 commit 4596e9d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/websockets/extensions/permessage_deflate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def __init__(
286286
server_no_context_takeover: bool = False,
287287
client_no_context_takeover: bool = False,
288288
server_max_window_bits: Optional[int] = None,
289-
client_max_window_bits: Optional[Union[int, bool]] = None,
289+
client_max_window_bits: Optional[Union[int, bool]] = True,
290290
compress_settings: Optional[Dict[str, Any]] = None,
291291
) -> None:
292292
"""

tests/legacy/test_client_server.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,12 @@ def test_extension_client_rejection(self):
834834
ServerPerMessageDeflateFactory(),
835835
]
836836
)
837-
@with_client("/extensions", extensions=[ClientPerMessageDeflateFactory()])
837+
@with_client(
838+
"/extensions",
839+
extensions=[
840+
ClientPerMessageDeflateFactory(client_max_window_bits=False),
841+
],
842+
)
838843
def test_extension_no_match_then_match(self):
839844
# The order requested by the client has priority.
840845
server_extensions = self.loop.run_until_complete(self.client.recv())

0 commit comments

Comments
 (0)