Always send Content-Length header.

Because without it, HTTP/1.1 (with persistence connection) clients will
keep waiting for more data.
This commit is contained in:
Chocobo1 2017-04-12 22:18:01 +08:00
parent 0b28fb6c6b
commit 9496b2a159

View file

@ -48,8 +48,7 @@ QByteArray ResponseGenerator::generate(Response response)
response.headers.remove(HEADER_CONTENT_ENCODING);
}
if (response.content.length() > 0)
response.headers[HEADER_CONTENT_LENGTH] = QString::number(response.content.length());
response.headers[HEADER_CONTENT_LENGTH] = QString::number(response.content.length());
QString ret(QLatin1String("HTTP/1.1 %1 %2\r\n%3\r\n"));