Loading plugins/staticpage/static.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,7 @@ void blogi::StaticPage::editPage(const int tid,libhttppp::HttpRequest* req, libh if(!isdigit(curformdat->Value[i])){ libhttppp::HTTPException excep; excep[libhttppp::HTTPException::Error] << "Wrong formted Pageid!"; std::cout.write(curformdat->Value.data(),curformdat->Value.size())<<std::endl; throw excep; } } Loading plugins/youtube/youtube.cpp +12 −11 Original line number Diff line number Diff line Loading @@ -158,15 +158,16 @@ namespace blogi { *nreq.setData("host") << "www.googleapis.com" << ":" << 443; *nreq.setData("accept") << "text/json"; *nreq.setData("user-agent") << "blogi/1.0 (Alpha Version 0.1)"; nreq.send(&ycsock,&ysock); nreq.send(&ysock,&ycsock); std::shared_ptr<char[]> data(new char[16384], std::default_delete<char[]>()); char data[16384]; int recv,tries=0,chunklen=0; try{ for(;;){ try{ recv=ysock.recvData(&ycsock,data,16384); recv=ysock.recvData(&ycsock,data.get(),16384); break; }catch(netplus::NetException &re){ if(re.getErrorType()!=netplus::NetException::Note) Loading @@ -181,16 +182,16 @@ namespace blogi { throw he; } hsize=res.parse(data,recv); hsize=res.parse(data.get(),recv); recv-=hsize; memmove(data,data+hsize,recv); memmove(data.get(),data.get()+hsize,recv); cpos=0; try{ if(strcmp(res.getTransferEncoding(),"chunked")==0){ chunklen=readchunk(data,recv,cpos); chunklen=readchunk(data.get(),recv,cpos); chunked=true; }else{ throw; Loading @@ -205,7 +206,7 @@ namespace blogi { if(!chunked){ do{ try{ json.append(data+cpos,recv); json.append(data.get()+cpos,recv); rlen-=recv; if(rlen>0){ tries=0; Loading @@ -213,7 +214,7 @@ namespace blogi { cpos=0; for(;;){ try{ recv=ysock.recvData(&ycsock,data,16384); recv=ysock.recvData(&ycsock,data.get(),16384); break; }catch(netplus::NetException &re){ if(re.getErrorType()!=netplus::NetException::Note) Loading @@ -238,7 +239,7 @@ namespace blogi { if(recv - cpos > 0){ if(readed==chunklen){ if( (chunklen=readchunk(data,recv,cpos)) == 0 ){ if( (chunklen=readchunk(data.get(),recv,cpos)) == 0 ){ break; } readed=0; Loading @@ -246,14 +247,14 @@ namespace blogi { size_t len = (chunklen - readed) < (recv - cpos) ? (chunklen - readed) : (recv - cpos); json.append(data+cpos,len); json.append(data.get()+cpos,len); cpos+=len; readed+=len; }else{ cpos=0; for(;;){ try{ recv=ysock.recvData(&ycsock,data,16384); recv=ysock.recvData(&ycsock,data.get(),16384); break; }catch(netplus::NetException &e){ if(e.getErrorType()!=netplus::NetException::Note){ Loading src/blogi.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ void blogi::Blogi::loginPage(libhttppp::HttpRequest *curreq,const int tid){ PlgArgs->session->addSessionData(sessid,"username",username.c_str(), username.length()); libhttppp::HttpResponse curres; libhttppp::HttpCookie cookie; cookie.setcookie(&curres, "sessionid", sessid,nullptr,PlgArgs->config->getDomain(),-1, nullptr,false,"1","None"); cookie.setcookie(&curres, "sessionid", sessid,nullptr,nullptr,-1, nullptr,false,"1","None"); curres.setState(HTTP307); curres.setVersion(HTTPVERSION(1.1)); *curres.setData("Location") << PlgArgs->config->getstartpage(); Loading Loading @@ -434,6 +434,7 @@ public: }; }; #ifndef Windows void logFiles(const char *path,int fd){ int pfd=open(path,O_APPEND|O_CREAT|O_WRONLY,0x760); Loading @@ -444,6 +445,7 @@ void logFiles(const char *path,int fd){ dup2(pfd, fd); close(pfd); } #endif int main(int argc, char** argv){ cmdplus::CmdController *BlogiCmdCtl; Loading Loading
plugins/staticpage/static.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -238,6 +238,7 @@ void blogi::StaticPage::editPage(const int tid,libhttppp::HttpRequest* req, libh if(!isdigit(curformdat->Value[i])){ libhttppp::HTTPException excep; excep[libhttppp::HTTPException::Error] << "Wrong formted Pageid!"; std::cout.write(curformdat->Value.data(),curformdat->Value.size())<<std::endl; throw excep; } } Loading
plugins/youtube/youtube.cpp +12 −11 Original line number Diff line number Diff line Loading @@ -158,15 +158,16 @@ namespace blogi { *nreq.setData("host") << "www.googleapis.com" << ":" << 443; *nreq.setData("accept") << "text/json"; *nreq.setData("user-agent") << "blogi/1.0 (Alpha Version 0.1)"; nreq.send(&ycsock,&ysock); nreq.send(&ysock,&ycsock); std::shared_ptr<char[]> data(new char[16384], std::default_delete<char[]>()); char data[16384]; int recv,tries=0,chunklen=0; try{ for(;;){ try{ recv=ysock.recvData(&ycsock,data,16384); recv=ysock.recvData(&ycsock,data.get(),16384); break; }catch(netplus::NetException &re){ if(re.getErrorType()!=netplus::NetException::Note) Loading @@ -181,16 +182,16 @@ namespace blogi { throw he; } hsize=res.parse(data,recv); hsize=res.parse(data.get(),recv); recv-=hsize; memmove(data,data+hsize,recv); memmove(data.get(),data.get()+hsize,recv); cpos=0; try{ if(strcmp(res.getTransferEncoding(),"chunked")==0){ chunklen=readchunk(data,recv,cpos); chunklen=readchunk(data.get(),recv,cpos); chunked=true; }else{ throw; Loading @@ -205,7 +206,7 @@ namespace blogi { if(!chunked){ do{ try{ json.append(data+cpos,recv); json.append(data.get()+cpos,recv); rlen-=recv; if(rlen>0){ tries=0; Loading @@ -213,7 +214,7 @@ namespace blogi { cpos=0; for(;;){ try{ recv=ysock.recvData(&ycsock,data,16384); recv=ysock.recvData(&ycsock,data.get(),16384); break; }catch(netplus::NetException &re){ if(re.getErrorType()!=netplus::NetException::Note) Loading @@ -238,7 +239,7 @@ namespace blogi { if(recv - cpos > 0){ if(readed==chunklen){ if( (chunklen=readchunk(data,recv,cpos)) == 0 ){ if( (chunklen=readchunk(data.get(),recv,cpos)) == 0 ){ break; } readed=0; Loading @@ -246,14 +247,14 @@ namespace blogi { size_t len = (chunklen - readed) < (recv - cpos) ? (chunklen - readed) : (recv - cpos); json.append(data+cpos,len); json.append(data.get()+cpos,len); cpos+=len; readed+=len; }else{ cpos=0; for(;;){ try{ recv=ysock.recvData(&ycsock,data,16384); recv=ysock.recvData(&ycsock,data.get(),16384); break; }catch(netplus::NetException &e){ if(e.getErrorType()!=netplus::NetException::Note){ Loading
src/blogi.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ void blogi::Blogi::loginPage(libhttppp::HttpRequest *curreq,const int tid){ PlgArgs->session->addSessionData(sessid,"username",username.c_str(), username.length()); libhttppp::HttpResponse curres; libhttppp::HttpCookie cookie; cookie.setcookie(&curres, "sessionid", sessid,nullptr,PlgArgs->config->getDomain(),-1, nullptr,false,"1","None"); cookie.setcookie(&curres, "sessionid", sessid,nullptr,nullptr,-1, nullptr,false,"1","None"); curres.setState(HTTP307); curres.setVersion(HTTPVERSION(1.1)); *curres.setData("Location") << PlgArgs->config->getstartpage(); Loading Loading @@ -434,6 +434,7 @@ public: }; }; #ifndef Windows void logFiles(const char *path,int fd){ int pfd=open(path,O_APPEND|O_CREAT|O_WRONLY,0x760); Loading @@ -444,6 +445,7 @@ void logFiles(const char *path,int fd){ dup2(pfd, fd); close(pfd); } #endif int main(int argc, char** argv){ cmdplus::CmdController *BlogiCmdCtl; Loading