Skip to content

Commit

Permalink
[Webserver] Fix stalled web requests and not saving rules via Ethernet
Browse files Browse the repository at this point in the history
  • Loading branch information
TD-er committed Dec 16, 2024
1 parent 13555c1 commit 7143d32
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/src/DataStructs/Web_StreamingBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -290,6 +292,7 @@ void Web_StreamingBuffer::endStream() {
lowMemorySkip = false;
}
delay(5);
// web_server.client().stop();
}


Expand Down Expand Up @@ -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)) {
Expand All @@ -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);
}
2 changes: 2 additions & 0 deletions src/src/WebServer/Rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,9 @@ void Rule_showRuleTextArea(const String& fileName) {
addHtml(F("<textarea id='rules' name='rules' rows='30' wrap='off'>"));
size = streamFromFS(fileName, true);
addHtml(F("</textarea>"));
#if FEATURE_RULES_EASY_COLOR_CODE
addHtml(F("<script>initCM();</script>"));
#endif

html_TR_TD();
addHtml(F("Current size: <span id='size'>"));
Expand Down

0 comments on commit 7143d32

Please sign in to comment.