From 1cc7205249bd0fa86603183bdb4e39a7c06efa47 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Tue, 17 Nov 2026 18:31:48 -0500 Subject: [PATCH] fix(ws): allow HTTP upgrades with small message limits --- python/albedo_plugins/ws.py | 3 ++- robot-docs/kernel.md | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/python/albedo_plugins/ws.py b/python/albedo_plugins/ws.py index 02bae2829..70363b912 100644 --- a/python/albedo_plugins/ws.py +++ b/python/albedo_plugins/ws.py @@ -22,6 +22,7 @@ import urllib.parse from albedo_plugins import proxy as albedo_proxy GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" +HTTP_READ_LIMIT = 64 * 1024 TEXT, BINARY, CLOSE, PING, PONG, CONTINUATION = 0x1, 0x2, 0x8, 0x9, 0xA, 0x0 @@ -100,7 +101,7 @@ class SimpleWebSocketClient: proxy, tls=parsed.scheme == "wss", timeout=timeout, - limit=max_message_bytes, + limit=max(HTTP_READ_LIMIT, max_message_bytes), ) key = base64.b64encode(os.urandom(16)).decode("ascii") path = parsed.path or "/" diff --git a/robot-docs/kernel.md b/robot-docs/kernel.md index d02516430..ada7544ca 100644 --- a/robot-docs/kernel.md +++ b/robot-docs/kernel.md @@ -137,7 +137,9 @@ imports every plugin module, then each plugin package's submodules after that switch. The shared WebSocket client counts data fragments toward the message size limit. -Close, ping, and pong frames have a separate 125-byte payload limit. +Close, ping, and pong frames have a separate 125-byte payload limit. The HTTP +upgrade can read header lines up to at least 64 KiB, even when the message limit +is smaller. ## Execution and results -- knotmirror 0.0.1