MCPcopy Index your code
hub / github.com/masterking32/MasterHttpRelayVPN / parse_content_length

Function parse_content_length

src/proxy/proxy_support.py:46–57  ·  view source on GitHub ↗

Return Content-Length or 0. Matches only the exact header name.

(header_block: bytes)

Source from the content-addressed store, hash-verified

44
45
46def parse_content_length(header_block: bytes) -> int:
47 """Return Content-Length or 0. Matches only the exact header name."""
48 for raw_line in header_block.split(b"\r\n"):
49 name, sep, value = raw_line.partition(b":")
50 if not sep:
51 continue
52 if name.strip().lower() == b"content-length":
53 try:
54 return int(value.strip())
55 except ValueError:
56 return 0
57 return 0
58
59
60def has_unsupported_transfer_encoding(header_block: bytes) -> bool:

Callers 3

_relay_http_streamMethod · 0.85
_do_httpMethod · 0.85

Calls

no outgoing calls