From d2215097a780deb668e6ccce4edab3e6bd95afbe Mon Sep 17 00:00:00 2001 From: drjones Date: Fri, 3 Apr 2026 05:47:57 -0700 Subject: [PATCH] Fix web UI hang: use send_P for 15 KB HTML response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The setContentLength + send(200,type,"") + sendContent() three-step pattern was unreliable — WebServer::send() with an empty String body can mark the response complete internally, causing sendContent() to be silently dropped. send_P() handles Content-Length, header prep, and chunked body delivery from const flash data in a single call with zero heap allocation. Made-with: Cursor --- src/main.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 96945f9..751094a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2240,17 +2240,7 @@ window.addEventListener('resize',capDrawWave); )HTML"; static void handleRoot() { - // ETag based on compile timestamp — browser caches until next flash - server.sendHeader("ETag", "\"" __DATE__ __TIME__ "\""); - server.sendHeader("Cache-Control", "no-cache"); // revalidate via ETag, don't re-download - if (server.hasHeader("If-None-Match") && - server.header("If-None-Match") == "\"" __DATE__ __TIME__ "\"") { - server.send(304); // Not Modified — browser uses cached copy, saves ~15 KB - return; - } - server.setContentLength(sizeof(kHtml) - 1); - server.send(200, "text/html; charset=utf-8", ""); - server.sendContent(kHtml, sizeof(kHtml) - 1); + server.send_P(200, "text/html; charset=utf-8", kHtml, sizeof(kHtml) - 1); } static void handleLog() {