From 0648a513e8ff8c69163ed365741081a1d3a3ab7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20=C3=96sterlund?= Date: Tue, 24 Feb 2026 09:46:17 +0100 Subject: [PATCH] Remove Content-Length header from chunked response HTTP does not allow Content-Length header to be set when Transfer-Encoding is present (https://greenbytes.de/tech/webdav/rfc2616.html#rfc.section.4.4) When chunked, Transfer-Encoding is set. This causes issues, for example when adding the camera to HomeAssistant, since it causes an error in the http library. This commit removes the Content-Length header in this case. --- ESP32_PrusaConnectCam/WebServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ESP32_PrusaConnectCam/WebServer.cpp b/ESP32_PrusaConnectCam/WebServer.cpp index 33faf38..1082f50 100644 --- a/ESP32_PrusaConnectCam/WebServer.cpp +++ b/ESP32_PrusaConnectCam/WebServer.cpp @@ -64,7 +64,6 @@ void Server_InitWebServer() { } return len; }); - response->addHeader("Content-Length", String(total_len)); request->send(response); } else { @@ -1350,3 +1349,4 @@ String Server_TranslateBoolToString(bool i_data) { } /* EOF */ +