fix sendfile bug

This commit is contained in:
an-tao 2018-06-21 13:13:07 +08:00
parent 6adc6ce9a6
commit 34a63b7962
1 changed files with 1 additions and 3 deletions

View File

@ -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);