diff --git a/lib/src/HttpServer.cc b/lib/src/HttpServer.cc index 3f00599f..2a94fca0 100755 --- a/lib/src/HttpServer.cc +++ b/lib/src/HttpServer.cc @@ -171,7 +171,7 @@ void HttpServer::onRequest(const TcpConnectionPtr& conn, const HttpRequestPtr& r //use gzip LOG_TRACE<<"Use gzip to compress the body"; char *zbuf=new char[response->getBody().length()]; - size_t zlen; + size_t zlen=response->getBody().length(); if(gzcompress(response->getBody().data(), response->getBody().length(), zbuf,&zlen)>=0) diff --git a/lib/src/Utilities.cc b/lib/src/Utilities.cc index fd9aa390..961257d7 100755 --- a/lib/src/Utilities.cc +++ b/lib/src/Utilities.cc @@ -1,5 +1,6 @@ #include #include +#include #include #include namespace drogon{ @@ -245,7 +246,11 @@ int gzcompress(const char *data, const size_t ndata, c_stream.next_out = (Bytef *)zdata; c_stream.avail_out = *nzdata; while(c_stream.avail_in != 0 && c_stream.total_out < *nzdata) { - if(deflate(&c_stream, Z_NO_FLUSH) != Z_OK) return-1; + if(deflate(&c_stream, Z_NO_FLUSH) != Z_OK) + { + LOG_ERROR<<"compress err:"<