From 7143d32059aa3a9b167748c721b9efba7f828147 Mon Sep 17 00:00:00 2001 From: TD-er Date: Mon, 16 Dec 2024 16:38:49 +0100 Subject: [PATCH] [Webserver] Fix stalled web requests and not saving rules via Ethernet --- src/src/DataStructs/Web_StreamingBuffer.cpp | 6 +++++- src/src/WebServer/Rules.cpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/src/DataStructs/Web_StreamingBuffer.cpp b/src/src/DataStructs/Web_StreamingBuffer.cpp index a5fed60de1..4c47871300 100644 --- a/src/src/DataStructs/Web_StreamingBuffer.cpp +++ b/src/src/DataStructs/Web_StreamingBuffer.cpp @@ -221,6 +221,8 @@ void Web_StreamingBuffer::startStream(bool allowOriginAll, sentBytes = 0; buf.clear(); buf.reserve(CHUNKED_BUFFER_SIZE); + web_server.client().setNoDelay(true); + web_server.client().setSSE(false); if (beforeTXRam < 3000) { lowMemorySkip = true; @@ -290,6 +292,7 @@ void Web_StreamingBuffer::endStream() { lowMemorySkip = false; } delay(5); +// web_server.client().stop(); } @@ -402,7 +405,7 @@ void Web_StreamingBuffer::sendHeaderBlocking(bool allowOriginAll, web_server.sendHeader(F("Access-Control-Allow-Origin"), origin); } web_server.send(httpCode, content_type, EMPTY_STRING); - +#ifdef ESP8266 // dont wait on 2.3.0. Memory returns just too slow. while ((ESP.getFreeHeap() < freeBeforeSend) && !timeOutReached(beginWait + timeout)) { @@ -411,6 +414,7 @@ void Web_StreamingBuffer::sendHeaderBlocking(bool allowOriginAll, #endif delay(1); } +#endif #endif // if defined(ESP8266) && defined(ARDUINO_ESP8266_RELEASE_2_3_0) delay(0); } diff --git a/src/src/WebServer/Rules.cpp b/src/src/WebServer/Rules.cpp index ecde7b476f..28a5ce04cb 100644 --- a/src/src/WebServer/Rules.cpp +++ b/src/src/WebServer/Rules.cpp @@ -549,7 +549,9 @@ void Rule_showRuleTextArea(const String& fileName) { addHtml(F("")); + #if FEATURE_RULES_EASY_COLOR_CODE addHtml(F("")); + #endif html_TR_TD(); addHtml(F("Current size: "));