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

Method headers_received

tornado/websocket.py:1507–1535  ·  view source on GitHub ↗
(
        self,
        start_line: Union[httputil.RequestStartLine, httputil.ResponseStartLine],
        headers: httputil.HTTPHeaders,
    )

Source from the content-addressed store, hash-verified

1505 )
1506
1507 async def headers_received(
1508 self,
1509 start_line: Union[httputil.RequestStartLine, httputil.ResponseStartLine],
1510 headers: httputil.HTTPHeaders,
1511 ) -> None:
1512 assert isinstance(start_line, httputil.ResponseStartLine)
1513 if start_line.code != 101:
1514 await super().headers_received(start_line, headers)
1515 return
1516
1517 if self._timeout is not None:
1518 self.io_loop.remove_timeout(self._timeout)
1519 self._timeout = None
1520
1521 self.headers = headers
1522 self.protocol = self.get_websocket_protocol()
1523 self.protocol._process_server_headers(self.key, self.headers)
1524 self.protocol.stream = self.connection.detach()
1525
1526 IOLoop.current().add_callback(self.protocol._receive_frame_loop)
1527 self.protocol.start_pinging()
1528
1529 # Once we've taken over the connection, clear the final callback
1530 # we set on the http request. This deactivates the error handling
1531 # in simple_httpclient that would otherwise interfere with our
1532 # ability to see exceptions.
1533 self.final_callback = None # type: ignore
1534
1535 future_set_result_unless_cancelled(self.connect_future, self)
1536
1537 def write_message(
1538 self, message: Union[str, bytes, Dict[str, Any]], binary: bool = False

Callers

nothing calls this directly

Calls 8

currentMethod · 0.80
remove_timeoutMethod · 0.45
detachMethod · 0.45
add_callbackMethod · 0.45
start_pingingMethod · 0.45

Tested by

no test coverage detected