MCPcopy Create free account
hub / github.com/EasyIME/PIME / accept_connection

Method accept_connection

python/python3/tornado/websocket.py:856–874  ·  view source on GitHub ↗
(self, handler: WebSocketHandler)

Source from the content-addressed store, hash-verified

854 self._selected_subprotocol = value
855
856 async def accept_connection(self, handler: WebSocketHandler) -> None:
857 try:
858 self._handle_websocket_headers(handler)
859 except ValueError:
860 handler.set_status(400)
861 log_msg = "Missing/Invalid WebSocket headers"
862 handler.finish(log_msg)
863 gen_log.debug(log_msg)
864 return
865
866 try:
867 await self._accept_connection(handler)
868 except asyncio.CancelledError:
869 self._abort()
870 return
871 except ValueError:
872 gen_log.debug("Malformed WebSocket request received", exc_info=True)
873 self._abort()
874 return
875
876 def _handle_websocket_headers(self, handler: WebSocketHandler) -> None:
877 """Verifies all invariant- and required headers

Callers

nothing calls this directly

Calls 6

_accept_connectionMethod · 0.95
set_statusMethod · 0.80
debugMethod · 0.80
_abortMethod · 0.80
finishMethod · 0.45

Tested by

no test coverage detected