diff options
| author | UltraQbik <no1skill@yandex.ru> | 2024-08-27 02:07:39 +0300 |
|---|---|---|
| committer | UltraQbik <no1skill@yandex.ru> | 2024-08-27 02:07:39 +0300 |
| commit | 8c71d4bc69483a49dc0116af05d48a04f4f22466 (patch) | |
| tree | b92019e3be4d861c47c22c870828a2943570105a | |
| parent | 5a2ef5d76d035c13841f549bd490a035cb1a53d5 (diff) | |
| download | httpy-8c71d4bc69483a49dc0116af05d48a04f4f22466.tar.gz httpy-8c71d4bc69483a49dc0116af05d48a04f4f22466.zip | |
update thingy x2
| -rw-r--r-- | main.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/main.py b/main.py index 8995e3f..cd4a0a7 100644 --- a/main.py +++ b/main.py @@ -88,13 +88,7 @@ class HTTPServer: # listen and respond handler while not self.stop_event.is_set(): # accept new client - try: - client = self._accept() - except ssl.SSLEOFError: - continue - except OSError: - print("Ignoring exception:\n", traceback.format_exc()) - continue + client = self._accept() if client is None: continue @@ -220,6 +214,11 @@ 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: |