From 93317bcd56a39fc70020143d6f4e6a615a45111f Mon Sep 17 00:00:00 2001 From: UltraQbik Date: Sun, 25 Aug 2024 01:36:38 +0300 Subject: Add checks --- main.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 36d70aa..599fd85 100644 --- a/main.py +++ b/main.py @@ -134,11 +134,16 @@ class HTTPServer: try: request = self._recv_request(client) if request is not None: + print( + f"ip: {client.getpeername()[0]}\n" + f"{request.type}\n" + f"{request.path}\n" + f"{request.path_args}", end="\n\n") self._client_request_handler(client, request) except ssl.SSLEOFError: - pass # idc - except TimeoutError: - print("Client timeout") + pass + except OSError as e: + print(f"Request dropped due to: {e}") except Exception as e: print(e) @@ -269,7 +274,8 @@ class HTTPServer: time.sleep(0.005) except ssl.SSLEOFError: break - except TimeoutError: + except OSError as e: + print(f"Client dropped due to: {e}") break return None -- cgit 1.4.1