MCPcopy Create free account
hub / github.com/apache/trafficserver / wait_for_headers_complete

Function wait_for_headers_complete

tests/gold_tests/post/http_utils.py:23–39  ·  view source on GitHub ↗

Wait for the headers to be complete. :param sock: The socket to read from. :returns: The bytes read off the socket.

(sock: socket.socket)

Source from the content-addressed store, hash-verified

21
22
23def wait_for_headers_complete(sock: socket.socket) -> bytes:
24 """Wait for the headers to be complete.
25
26 :param sock: The socket to read from.
27 :returns: The bytes read off the socket.
28 """
29 headers = b""
30 while True:
31 data = sock.recv(1024)
32 if not data:
33 print("Socket closed.")
34 break
35 print(f'Received:\n{data}')
36 headers += data
37 if b"\r\n\r\n" in headers:
38 break
39 return headers
40
41
42def determine_outstanding_bytes_to_read(read_bytes: bytes) -> int:

Callers 4

drain_responseFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
drain_responseFunction · 0.90

Calls 1

recvMethod · 0.45

Tested by

no test coverage detected