From 3b2b8a333adb5241985e7418c9042142f7c804b5 Mon Sep 17 00:00:00 2001 From: Florian Date: Wed, 25 Mar 2026 07:23:06 -0500 Subject: [PATCH] [WebUI] Fix BLE config page connection reset on load (#2295) ble_script is defined as "" (empty string). Passing it to server.sendContent("") signals end of HTTP chunked transfer, closing the response prematurely. All subsequent chunks then fail with errno 104 "Connection reset by peer". Guard the call with a length check so the empty string is never sent as a chunk terminator. Co-authored-by: Florian <1technophile@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) --- main/webUI.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main/webUI.cpp b/main/webUI.cpp index 77e3961..d456861 100644 --- a/main/webUI.cpp +++ b/main/webUI.cpp @@ -1089,7 +1089,9 @@ void handleBL() { serializeJson(modules, jsonChar, measureJson(modules) + 1); beginChunkedResponse(); sendHeaderChunk((String(gateway_name) + " - Configure BLE").c_str()); - server.sendContent(ble_script); + if (strlen(ble_script) > 0) { + server.sendContent(ble_script); + } server.sendContent(script); server.sendContent(style);