Change some code

This commit is contained in:
antao 2018-09-04 11:19:12 +08:00
parent a4f32e0452
commit b0546e1277
6 changed files with 11 additions and 12 deletions

View File

@ -3,8 +3,6 @@
//
#include "TimeFilter.h"
#include <trantor/utils/Date.h>
#include <trantor/utils/Logger.h>
#define VDate "visitDate"
void TimeFilter::doFilter(const HttpRequestPtr& req,
const FilterCallback &cb,
@ -26,8 +24,10 @@ void TimeFilter::doFilter(const HttpRequestPtr& req,
}
else
{
auto res=std::shared_ptr<HttpResponse>(drogon::HttpResponse::newHttpResponse());
res->setBody("Visit interval should be at least 10 seconds");
Json::Value json;
json["result"]="error";
json["message"]="Visit interval should be at least 10 seconds";
auto res=HttpResponse::newHttpJsonResponse(json);
cb(res);
return;
}

View File

@ -39,7 +39,7 @@ int FileUpload::parse(const HttpRequest &req)
std::cout << "boundary[" << boundary << "]" << std::endl;
std::string content = req.query();
std::string::size_type pos1, pos2;
pos1 = pos2 = 0;
pos1 = 0;
pos2 = content.find(boundary);
while (1)
{

View File

@ -165,7 +165,7 @@ void HttpServer::onRequest(const TcpConnectionPtr& conn, const HttpRequestPtr& r
response->setCloseConnection(_close);
if(response->getContentTypeCode()<CT_APPLICATION_OCTET_STREAM&&
response->getBody().length()>4096&&
response->getBody().length()>1024&&
req->getHeader("Accept-Encoding").find("gzip")!=std::string::npos)
{
//use gzip
@ -195,7 +195,6 @@ void HttpServer::onRequest(const TcpConnectionPtr& conn, const HttpRequestPtr& r
conn->shutdown();
}
});

View File

@ -104,9 +104,9 @@ void SharedLibManager::managerLibs()
return;
}
{
std::ofstream fout(lockFile);
}
// {
// std::ofstream fout(lockFile);
// }
std::string cmd="drogon_ctl create view ";
cmd.append(filename).append(" -o ").append(libPath);
LOG_TRACE<<cmd;

View File

@ -70,7 +70,7 @@ namespace drogon{
{
std::vector<std::string> ret;
std::string::size_type pos1, pos2;
pos1 = pos2 = 0;
pos2 = 0;
pos1 = str.find(separator);
while (pos1 != std::string::npos)
{

View File

@ -6,7 +6,7 @@ namespace drogon{
class WebSocketConnectionImpl:public WebSocketConnection
{
public:
WebSocketConnectionImpl(const trantor::TcpConnectionPtr &conn);
explicit WebSocketConnectionImpl(const trantor::TcpConnectionPtr &conn);
virtual void send(const char *msg,uint64_t len) override;
virtual void send(const std::string &msg) override;