@@ -230,7 +230,7 @@ void ESPWebServer::_prepareStreamFile(size_t fileSize, const String& contentType
230
230
}
231
231
232
232
void ESPWebServer::send (int code, const char * content_type, const String& content) {
233
- _contentLength = content.length ();
233
+ if (_contentLength == CONTENT_LENGTH_NOT_SET) _contentLength = content.length ();
234
234
_activeResponse->setStatusCode (code);
235
235
_activeResponse->setHeader (" Content-Type" , content_type);
236
236
_standardHeaders ();
@@ -246,7 +246,7 @@ void ESPWebServer::send(int code, const String& content_type, const String& cont
246
246
}
247
247
248
248
void ESPWebServer::send_P (int code, PGM_P content_type, PGM_P content) {
249
- _contentLength = strlen_P (content);
249
+ if (_contentLength == CONTENT_LENGTH_NOT_SET) _contentLength = strlen_P (content);
250
250
_activeResponse->setStatusCode (code);
251
251
String memContentType (FPSTR (content_type));
252
252
_activeResponse->setHeader (" Content-Type" , memContentType.c_str ());
@@ -255,7 +255,7 @@ void ESPWebServer::send_P(int code, PGM_P content_type, PGM_P content) {
255
255
}
256
256
257
257
void ESPWebServer::send_P (int code, PGM_P content_type, PGM_P content, size_t contentLength) {
258
- _contentLength = contentLength;
258
+ if (_contentLength == CONTENT_LENGTH_NOT_SET) _contentLength = contentLength;
259
259
_activeResponse->setStatusCode (code);
260
260
String memContentType (FPSTR (content_type));
261
261
_activeResponse->setHeader (" Content-Type" , memContentType.c_str ());
0 commit comments