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

Method _parse_headers

tornado/http1connection.py:583–593  ·  view source on GitHub ↗
(self, data: bytes)

Source from the content-addressed store, hash-verified

581 future_set_result_unless_cancelled(self._finish_future, None)
582
583 def _parse_headers(self, data: bytes) -> Tuple[str, httputil.HTTPHeaders]:
584 # The lstrip removes newlines that some implementations sometimes
585 # insert between messages of a reused connection. Per RFC 7230,
586 # we SHOULD ignore at least one empty line before the request.
587 # http://tools.ietf.org/html/rfc7230#section-3.5
588 data_str = native_str(data.decode("latin1")).lstrip("\r\n")
589 # RFC 7230 section allows for both CRLF and bare LF.
590 eol = data_str.find("\n")
591 start_line = data_str[:eol].rstrip("\r")
592 headers = httputil.HTTPHeaders.parse(data_str[eol:])
593 return start_line, headers
594
595 def _read_body(
596 self,

Callers 1

_read_messageMethod · 0.95

Calls 2

findMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected