bstkchat 2.4.1__tar.gz → 2.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bstkchat
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: A real-time Terminal-based Chatting Application using unique room IDs.
5
5
  Author: BSTK Developers
6
6
  Project-URL: Homepage, https://github.com/BTKcreations/BSTKCHAT
@@ -57,7 +57,7 @@ from bstkchat.crypto import (
57
57
  sanitize_room_id,
58
58
  )
59
59
 
60
- APP_VERSION = "2.4.1"
60
+ APP_VERSION = "2.4.2"
61
61
  AUTO_AWAY_SECONDS = 300
62
62
  TYPING_TTL_SECONDS = 5.0
63
63
  TYPING_THROTTLE_SECONDS = 3.0
@@ -7,6 +7,7 @@ import json
7
7
  import os
8
8
  import queue
9
9
  import secrets
10
+ import sys
10
11
  import threading
11
12
  from http import HTTPStatus
12
13
  from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
@@ -40,6 +41,18 @@ def _load_web_html() -> bytes:
40
41
  return f.read()
41
42
 
42
43
 
44
+ class QuietThreadingHTTPServer(ThreadingHTTPServer):
45
+ """ThreadingHTTPServer that suppresses benign browser socket-abort tracebacks."""
46
+
47
+ def handle_error(self, request, client_address):
48
+ _, exc, _ = sys.exc_info()
49
+ if isinstance(exc, (ConnectionAbortedError, ConnectionResetError, BrokenPipeError)):
50
+ return
51
+ if isinstance(exc, OSError) and getattr(exc, "winerror", None) in (10053, 10054):
52
+ return
53
+ super().handle_error(request, client_address)
54
+
55
+
43
56
  class WebServer:
44
57
  """Localhost-only HTTP + SSE server bound to 127.0.0.1 with per-session token auth."""
45
58
 
@@ -64,6 +77,12 @@ class WebServer:
64
77
  class Handler(BaseHTTPRequestHandler):
65
78
  protocol_version = "HTTP/1.1"
66
79
 
80
+ def handle(self):
81
+ try:
82
+ super().handle()
83
+ except (ConnectionAbortedError, ConnectionResetError, BrokenPipeError):
84
+ pass
85
+
67
86
  def log_message(self, format, *args):
68
87
  # Suppress noisy stdout access logs so terminal TUI stays clean
69
88
  return
@@ -273,7 +292,7 @@ class WebServer:
273
292
 
274
293
  self._send_json(HTTPStatus.NOT_FOUND, {"error": "Not found"})
275
294
 
276
- self._httpd = ThreadingHTTPServer((self.host, self.port), Handler)
295
+ self._httpd = QuietThreadingHTTPServer((self.host, self.port), Handler)
277
296
  self._thread = threading.Thread(target=self._httpd.serve_forever, daemon=True)
278
297
  self._thread.start()
279
298
  return self.url
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bstkchat
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: A real-time Terminal-based Chatting Application using unique room IDs.
5
5
  Author: BSTK Developers
6
6
  Project-URL: Homepage, https://github.com/BTKcreations/BSTKCHAT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "bstkchat"
7
- version = "2.4.1"
7
+ version = "2.4.2"
8
8
  description = "A real-time Terminal-based Chatting Application using unique room IDs."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="bstkchat",
5
- version="2.4.1",
5
+ version="2.4.2",
6
6
  packages=find_packages(),
7
7
  package_data={"bstkchat": ["*.html"]},
8
8
  install_requires=[
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes