cleanup - i leave chunked in system/output/add for now, document will get bit bigger i geuss

This commit is contained in:
Marcus 2024-10-26 04:52:37 +02:00
parent f4624f860e
commit bba1687022

View file

@ -425,12 +425,19 @@ String Proc_WebPage_system_output_add_POST(const String& var) {
void WebPage_system_output_add(AsyncWebServerRequest *request) { void WebPage_system_output_add(AsyncWebServerRequest *request) {
if(request->method() == HTTP_POST) { if(request->method() == HTTP_POST) {
//AsyncWebServerResponse *response = request->beginChunkedResponse("text/plain", Chunk_system_output_add_HTML, Proc_WebPage_system_output_add);
//request->send(response);
Serial.println(":: [Webserver:system:output:add] [POST] hello"); Serial.println(":: [Webserver:system:output:add] [POST] hello");
} else { } else {
// https://github.com/mathieucarbou/ESPAsyncWebServer?tab=readme-ov-file#chunked-response-containing-templates
//Write up to "maxLen" bytes into "buffer" and return the amount written.
//index equals the amount of bytes that have been already sent
//You will be asked for more data until 0 is returned
//Keep in mind that you can not delay or yield waiting for more data!
// https://forum.arduino.cc/t/espasyncwebserver-replay-page-size/1049106/19
// https://forum.arduino.cc/t/strlen-and-progmem/629376/3 - get len of PROGMEM
AsyncWebServerResponse *response = request->beginChunkedResponse("text/html", [](uint8_t *buffer, size_t maxlen, size_t index) -> size_t { AsyncWebServerResponse *response = request->beginChunkedResponse("text/html", [](uint8_t *buffer, size_t maxlen, size_t index) -> size_t {
// https://forum.arduino.cc/t/strlen-and-progmem/629376/3 // https://forum.arduino.cc/t/strlen-and-progmem/629376/3
size_t len_html = strlen_P(reinterpret_cast<const char *>(Page_system_output_add_HTML)); size_t len_html = strlen_P(reinterpret_cast<const char *>(Page_system_output_add_HTML));