From db73430c5406291357c50e31d7d6f279e237cbe6 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 9 Dec 2017 16:24:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DKeep-Alive=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpSession.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index 8bad9172..636b88e9 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -389,9 +389,10 @@ inline HttpSession::KeyValue HttpSession::makeHttpHeader(bool bClose, int64_t iC static uint32_t reqCnt = mINI::Instance()[Config::Http::kMaxReqCount].as(); headerOut.emplace("Server", serverName); - headerOut.emplace("Connection", bClose ? "close" : - StrPrinter << "keep-alive: timeout=" << keepAliveSec - << ", max=" << reqCnt << endl); + headerOut.emplace("Connection", bClose ? "close" : "keep-alive"); + if(!bClose){ + headerOut.emplace("Keep-Alive",StrPrinter << "timeout=" << keepAliveSec << ", max=" << reqCnt << endl); + } headerOut.emplace("Date", dateStr()); if(iContentSize >=0 && pcContentType !=nullptr){ auto strContentType = StrPrinter << pcContentType << "; charset=" << charSet << endl;