1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-21 10:26:06 +03:00

Merge pull request #1362 from shmuelzon/zero-content-length

A content length of zero should also be sent
This commit is contained in:
Ivan Grokhotkov 2016-01-10 23:16:56 +03:00
commit e8d60be62a

View File

@ -213,11 +213,10 @@ void ESP8266WebServer::_prepareHeader(String& response, int code, const char* co
content_type = "text/html"; content_type = "text/html";
sendHeader("Content-Type", content_type, true); sendHeader("Content-Type", content_type, true);
if (_contentLength != CONTENT_LENGTH_UNKNOWN && _contentLength != CONTENT_LENGTH_NOT_SET) { if (_contentLength == CONTENT_LENGTH_NOT_SET) {
sendHeader("Content-Length", String(_contentLength));
}
else if (contentLength > 0){
sendHeader("Content-Length", String(contentLength)); sendHeader("Content-Length", String(contentLength));
} else if (_contentLength != CONTENT_LENGTH_UNKNOWN) {
sendHeader("Content-Length", String(_contentLength));
} }
sendHeader("Connection", "close"); sendHeader("Connection", "close");
sendHeader("Access-Control-Allow-Origin", "*"); sendHeader("Access-Control-Allow-Origin", "*");