From 398ad2f29567b3a935132f18179f9bc286995798 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Fri, 19 Jun 2026 23:23:56 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20corriger=20InvalidUpgrade=20sur=20requ?= =?UTF-8?q?=C3=AAtes=20HTTP=20non-WebSocket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - process_request retourne None UNIQUEMENT pour /ws - Tous les autres chemins (/favicon.ico, etc.) reçoivent 404 - Évite que websockets tente un handshake sur des requêtes HTTP normales --- bot_direct.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot_direct.py b/bot_direct.py index e5f7424..892eb02 100644 --- a/bot_direct.py +++ b/bot_direct.py @@ -113,7 +113,10 @@ async def process_request(connection, request): if request.path == "/" or request.path == "/test.html": headers = Headers([("Content-Type", "text/html; charset=utf-8")]) return Response(200, "OK", headers, HTML_PAGE.encode()) - return None # Let WebSocket handler take over + if request.path == "/ws": + return None # Let WebSocket handler take over + # Return 404 for everything else (favicon, etc.) + return Response(404, "Not Found", Headers([]), b"") # ─── WebSocket Handler ─────────────────────────────────────── async def ws_handler(websocket):