From 9496b2a159f6da53aa854b6a11fd3d56b4b132b0 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 12 Apr 2017 22:18:01 +0800 Subject: [PATCH] Always send Content-Length header. Because without it, HTTP/1.1 (with persistence connection) clients will keep waiting for more data. --- src/base/http/responsegenerator.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/base/http/responsegenerator.cpp b/src/base/http/responsegenerator.cpp index 2e070ee86..c59459bc1 100644 --- a/src/base/http/responsegenerator.cpp +++ b/src/base/http/responsegenerator.cpp @@ -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"));