From 34a63b7962118a1ec79f816d03a3ad52fa2f61f7 Mon Sep 17 00:00:00 2001 From: an-tao <20741618@qq.com> Date: Thu, 21 Jun 2018 13:13:07 +0800 Subject: [PATCH] fix sendfile bug --- lib/src/HttpAppFramework.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/src/HttpAppFramework.cc b/lib/src/HttpAppFramework.cc index 53d3ee17..c024f688 100755 --- a/lib/src/HttpAppFramework.cc +++ b/lib/src/HttpAppFramework.cc @@ -557,11 +557,9 @@ void HttpAppFrameworkImpl::readSendFile(const std::string& filePath,const HttpRe std::streambuf * pbuf = infile.rdbuf(); std::streamsize size = pbuf->pubseekoff(0,infile.end); pbuf->pubseekoff(0,infile.beg); // rewind - std::string str; - str.reserve(size); - pbuf->sgetn (&str[0],size); str.resize(size); + pbuf->sgetn (&str[0],size); infile.close(); resp->setStatusCode(HttpResponse::k200Ok);