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.
- {bstkchat-2.4.1 → bstkchat-2.4.2}/PKG-INFO +1 -1
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat/cli.py +1 -1
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat/web.py +20 -1
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat.egg-info/PKG-INFO +1 -1
- {bstkchat-2.4.1 → bstkchat-2.4.2}/pyproject.toml +1 -1
- {bstkchat-2.4.1 → bstkchat-2.4.2}/setup.py +1 -1
- {bstkchat-2.4.1 → bstkchat-2.4.2}/README.md +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat/__init__.py +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat/chain.py +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat/config.py +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat/crypto.py +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat/web_ui.html +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat.egg-info/SOURCES.txt +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat.egg-info/dependency_links.txt +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat.egg-info/entry_points.txt +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat.egg-info/requires.txt +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/bstkchat.egg-info/top_level.txt +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/setup.cfg +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/tests/test_chain.py +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/tests/test_cli.py +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/tests/test_crypto.py +0 -0
- {bstkchat-2.4.1 → bstkchat-2.4.2}/tests/test_web.py +0 -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 =
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|