MCPcopy
hub / github.com/urllib3/urllib3 / _read_until

Function _read_until

test/contrib/test_socks.py:64–75  ·  view source on GitHub ↗

Read from the socket until the character is received.

(sock: socket.socket, char: bytes)

Source from the content-addressed store, hash-verified

62
63
64def _read_until(sock: socket.socket, char: bytes) -> bytes:
65 """
66 Read from the socket until the character is received.
67 """
68 chunks = []
69 while True:
70 chunk = sock.recv(1)
71 chunks.append(chunk)
72 if chunk == char:
73 break
74
75 return b"".join(chunks)
76
77
78def _address_from_socket(sock: socket.socket) -> bytes | str:

Callers 1

Calls 1

recvMethod · 0.45

Tested by

no test coverage detected