Drain the response from the server. :param sock: The socket to read the response from.
(sock: socket.socket)
| 78 | |
| 79 | |
| 80 | def drain_response(sock: socket.socket) -> None: |
| 81 | """Drain the response from the server. |
| 82 | |
| 83 | :param sock: The socket to read the response from. |
| 84 | """ |
| 85 | print('Waiting for the response to complete.') |
| 86 | read_bytes: bytes = wait_for_headers_complete(sock) |
| 87 | try: |
| 88 | num_bytes_to_drain: int = determine_outstanding_bytes_to_read(read_bytes) |
| 89 | except ValueError: |
| 90 | print('No CL found') |
| 91 | return |
| 92 | if num_bytes_to_drain > 0: |
| 93 | drain_socket(sock, read_bytes, num_bytes_to_drain) |
| 94 | print('Response complete.') |
| 95 | |
| 96 | |
| 97 | def main() -> int: |
no test coverage detected