Skip to content

Commit e8d60be

Browse files
committed
Merge pull request #1362 from shmuelzon/zero-content-length
A content length of zero should also be sent
2 parents 95cf055 + 9e61e60 commit e8d60be

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

libraries/ESP8266WebServer/src/ESP8266WebServer.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,10 @@ void ESP8266WebServer::_prepareHeader(String& response, int code, const char* co
213213
content_type = "text/html";
214214

215215
sendHeader("Content-Type", content_type, true);
216-
if (_contentLength != CONTENT_LENGTH_UNKNOWN && _contentLength != CONTENT_LENGTH_NOT_SET) {
217-
sendHeader("Content-Length", String(_contentLength));
218-
}
219-
else if (contentLength > 0){
216+
if (_contentLength == CONTENT_LENGTH_NOT_SET) {
220217
sendHeader("Content-Length", String(contentLength));
218+
} else if (_contentLength != CONTENT_LENGTH_UNKNOWN) {
219+
sendHeader("Content-Length", String(_contentLength));
221220
}
222221
sendHeader("Connection", "close");
223222
sendHeader("Access-Control-Allow-Origin", "*");

0 commit comments

Comments
 (0)