diff options
| author | UltraQbik <no1skill@yandex.ru> | 2024-08-27 02:06:37 +0300 |
|---|---|---|
| committer | UltraQbik <no1skill@yandex.ru> | 2024-08-27 02:06:37 +0300 |
| commit | 5a2ef5d76d035c13841f549bd490a035cb1a53d5 (patch) | |
| tree | 17e242ca6cd225c6f87bb2cd5de77cc8809a5ef7 | |
| parent | 4210e49bd057d4ad1652dc9282728483ef72a7d7 (diff) | |
| download | httpy-5a2ef5d76d035c13841f549bd490a035cb1a53d5.tar.gz httpy-5a2ef5d76d035c13841f549bd490a035cb1a53d5.zip | |
update thingy
| -rw-r--r-- | main.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/main.py b/main.py index cd4a0a7..8995e3f 100644 --- a/main.py +++ b/main.py @@ -88,7 +88,13 @@ class HTTPServer: # listen and respond handler while not self.stop_event.is_set(): # accept new client - client = self._accept() + try: + client = self._accept() + except ssl.SSLEOFError: + continue + except OSError: + print("Ignoring exception:\n", traceback.format_exc()) + continue if client is None: continue @@ -214,11 +220,6 @@ class HTTPServer: return self.sock.accept()[0] except BlockingIOError: time.sleep(0.005) - except ssl.SSLEOFError: - break - except OSError as e: - print(f"Client dropped due to: {e}") - break return None def fetch_file_headers(self, path: str) -> dict[str, Any] | None: |