MCPcopy
hub / github.com/tornadoweb/tornado / _handle_websocket_headers

Method _handle_websocket_headers

tornado/websocket.py:899–907  ·  view source on GitHub ↗

Verifies all invariant- and required headers If a header is missing or have an incorrect value ValueError will be raised

(self, handler: WebSocketHandler)

Source from the content-addressed store, hash-verified

897 return
898
899 def _handle_websocket_headers(self, handler: WebSocketHandler) -> None:
900 """Verifies all invariant- and required headers
901
902 If a header is missing or have an incorrect value ValueError will be
903 raised
904 """
905 fields = ("Host", "Sec-Websocket-Key", "Sec-Websocket-Version")
906 if not all(map(lambda f: handler.request.headers.get(f), fields)):
907 raise ValueError("Missing/Invalid WebSocket headers")
908
909 @staticmethod
910 def compute_accept_value(key: Union[str, bytes]) -> str:

Callers 1

accept_connectionMethod · 0.95

Calls 2

allFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected