Loading plugins/nginxfiler/filer.cpp +14 −7 Original line number Diff line number Diff line Loading @@ -162,11 +162,10 @@ namespace blogi { std::shared_ptr<netplus::tcp> cltsock; try{ try{ srvsock=std::make_shared<netplus::tcp>(); srvsock=std::make_shared<netplus::tcp>(-1); cltsock=std::make_shared<netplus::tcp>(_NHost.c_str(),_NPort,1,0); cltsock->setTimeout(1); srvsock->connect(cltsock.get()); }catch(netplus::NetException &e){ libhttppp::HTTPException he; he[libhttppp::HTTPException::Error] << e.what(); Loading Loading @@ -211,7 +210,7 @@ namespace blogi { std::string json; std::vector<char> json; libhttppp::HttpResponse res; size_t hsize=0,cpos; bool chunked=false; Loading Loading @@ -244,7 +243,7 @@ namespace blogi { if(!chunked){ do{ try{ json.append(data.get()+cpos,recv); json.insert(json.end(),data.get()+cpos,data.get()+recv); rlen-=recv; if(rlen>0){ for(;;){ Loading Loading @@ -284,7 +283,8 @@ namespace blogi { size_t len = (chunklen - readed) < (recv - cpos) ? (chunklen - readed) : (recv - cpos); json.append(data.get()+cpos,len); std::copy(data.get()+cpos,data.get()+(cpos+len),std::back_inserter(json)); cpos+=len; readed+=len; }else{ Loading Loading @@ -312,10 +312,17 @@ namespace blogi { }; } json.push_back('\0'); std::cout << json.data() << std::endl; struct json_object *ndir; ndir = json_tokener_parse(json.c_str()); if(!ndir){ enum json_tokener_error jerrno; ndir = json_tokener_parse_verbose(json.data(),&jerrno); if(jerrno != json_tokener_success){ libhttppp::HTTPException e; e[libhttppp::HTTPException::Error] << "nginxfiler: counld't read json !"; throw e; Loading Loading
plugins/nginxfiler/filer.cpp +14 −7 Original line number Diff line number Diff line Loading @@ -162,11 +162,10 @@ namespace blogi { std::shared_ptr<netplus::tcp> cltsock; try{ try{ srvsock=std::make_shared<netplus::tcp>(); srvsock=std::make_shared<netplus::tcp>(-1); cltsock=std::make_shared<netplus::tcp>(_NHost.c_str(),_NPort,1,0); cltsock->setTimeout(1); srvsock->connect(cltsock.get()); }catch(netplus::NetException &e){ libhttppp::HTTPException he; he[libhttppp::HTTPException::Error] << e.what(); Loading Loading @@ -211,7 +210,7 @@ namespace blogi { std::string json; std::vector<char> json; libhttppp::HttpResponse res; size_t hsize=0,cpos; bool chunked=false; Loading Loading @@ -244,7 +243,7 @@ namespace blogi { if(!chunked){ do{ try{ json.append(data.get()+cpos,recv); json.insert(json.end(),data.get()+cpos,data.get()+recv); rlen-=recv; if(rlen>0){ for(;;){ Loading Loading @@ -284,7 +283,8 @@ namespace blogi { size_t len = (chunklen - readed) < (recv - cpos) ? (chunklen - readed) : (recv - cpos); json.append(data.get()+cpos,len); std::copy(data.get()+cpos,data.get()+(cpos+len),std::back_inserter(json)); cpos+=len; readed+=len; }else{ Loading Loading @@ -312,10 +312,17 @@ namespace blogi { }; } json.push_back('\0'); std::cout << json.data() << std::endl; struct json_object *ndir; ndir = json_tokener_parse(json.c_str()); if(!ndir){ enum json_tokener_error jerrno; ndir = json_tokener_parse_verbose(json.data(),&jerrno); if(jerrno != json_tokener_success){ libhttppp::HTTPException e; e[libhttppp::HTTPException::Error] << "nginxfiler: counld't read json !"; throw e; Loading