修复Keep-Alive的bug

This commit is contained in:
xiongziliang 2017-12-09 16:24:07 +08:00
parent e8e35dcfe4
commit db73430c54

View File

@ -389,9 +389,10 @@ inline HttpSession::KeyValue HttpSession::makeHttpHeader(bool bClose, int64_t iC
static uint32_t reqCnt = mINI::Instance()[Config::Http::kMaxReqCount].as<uint32_t>(); static uint32_t reqCnt = mINI::Instance()[Config::Http::kMaxReqCount].as<uint32_t>();
headerOut.emplace("Server", serverName); headerOut.emplace("Server", serverName);
headerOut.emplace("Connection", bClose ? "close" : headerOut.emplace("Connection", bClose ? "close" : "keep-alive");
StrPrinter << "keep-alive: timeout=" << keepAliveSec if(!bClose){
<< ", max=" << reqCnt << endl); headerOut.emplace("Keep-Alive",StrPrinter << "timeout=" << keepAliveSec << ", max=" << reqCnt << endl);
}
headerOut.emplace("Date", dateStr()); headerOut.emplace("Date", dateStr());
if(iContentSize >=0 && pcContentType !=nullptr){ if(iContentSize >=0 && pcContentType !=nullptr){
auto strContentType = StrPrinter << pcContentType << "; charset=" << charSet << endl; auto strContentType = StrPrinter << pcContentType << "; charset=" << charSet << endl;