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

Method _can_keep_alive

python/python3/tornado/http1connection.py:551–569  ·  view source on GitHub ↗
(
        self, start_line: httputil.RequestStartLine, headers: httputil.HTTPHeaders
    )

Source from the content-addressed store, hash-verified

549 future_set_result_unless_cancelled(future, None)
550
551 def _can_keep_alive(
552 self, start_line: httputil.RequestStartLine, headers: httputil.HTTPHeaders
553 ) -> bool:
554 if self.params.no_keep_alive:
555 return False
556 connection_header = headers.get("Connection")
557 if connection_header is not None:
558 connection_header = connection_header.lower()
559 if start_line.version == "HTTP/1.1":
560 return connection_header != "close"
561 elif (
562 "Content-Length" in headers
563 or headers.get("Transfer-Encoding", "").lower() == "chunked"
564 or getattr(start_line, "method", None) in ("HEAD", "GET")
565 ):
566 # start_line may be a request or response start line; only
567 # the former has a method attribute.
568 return connection_header == "keep-alive"
569 return False
570
571 def _finish_request(self, future: "Optional[Future[None]]") -> None:
572 self._clear_callbacks()

Callers 1

_read_messageMethod · 0.95

Calls 1

getMethod · 0.45

Tested by

no test coverage detected