about summary refs log tree commit diff
path: root/main.py
diff options
context:
space:
mode:
authorUltraQbik <no1skill@yandex.ru>2024-08-25 01:36:38 +0300
committerUltraQbik <no1skill@yandex.ru>2024-08-25 01:36:38 +0300
commit93317bcd56a39fc70020143d6f4e6a615a45111f (patch)
tree780e457a7a4edaf9dabf66f5943017d61b599078 /main.py
parent11b2fa6e8d6846673374e618a3d0556ed7012dfe (diff)
downloadhttpy-93317bcd56a39fc70020143d6f4e6a615a45111f.tar.gz
httpy-93317bcd56a39fc70020143d6f4e6a615a45111f.zip
Add checks
Diffstat (limited to 'main.py')
-rw-r--r--main.py14
1 files changed, 10 insertions, 4 deletions
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