From 828077a681195cea51f0b89b1a027374b06895be Mon Sep 17 00:00:00 2001 From: bsnych <122523292+bsnych@users.noreply.github.com> Date: Wed, 23 Oct 2024 12:18:08 +0300 Subject: [PATCH] Added missing "reason" to ensure backward compatibility Reason added for Informational response to socket connection upgrade. This ensures backwards compatibility for older socket libraries like: OCaml/websokets --- src/wsproto/handshake.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wsproto/handshake.py b/src/wsproto/handshake.py index 72af722..a79bf07 100644 --- a/src/wsproto/handshake.py +++ b/src/wsproto/handshake.py @@ -286,7 +286,7 @@ def _accept(self, event: AcceptConnection) -> bytes: headers.append((b"Sec-WebSocket-Extensions", accepts)) response = h11.InformationalResponse( - status_code=101, headers=headers + event.extra_headers + status_code=101, headers=headers + event.extra_headers, reason=b"Switching Protocols" ) self._connection = Connection( ConnectionType.CLIENT if self.client else ConnectionType.SERVER,