Loading plugins/content/content.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -338,7 +338,7 @@ namespace blogi { resp.setVersion(HTTPVERSION(1.1)); resp.setState(HTTP307); resp.setContentType("text/html"); *resp.setData("Location") << ccurl; resp.setHeaderData("Location")->push_back(ccurl); resp.send(curreq,nullptr,0); return; } Loading plugins/nginxfiler/filer.cpp +8 −5 Original line number Diff line number Diff line Loading @@ -180,11 +180,14 @@ namespace blogi { nreq.setRequestType(GETREQUEST); nreq.setRequestURL(nurl.c_str()); nreq.setRequestVersion(HTTPVERSION(1.1)); *nreq.setData("connection") = "keep-alive"; *nreq.setData("host") << _NHost.c_str() << ":" << _NPort; *nreq.setData("accept") = "text/json"; *nreq.setData("user-agent") = "blogi/1.0 (Alpha Version 0.1)"; nreq.send(srvsock.get(),cltsock.get()); nreq.setHeaderData("connection")->push_back("keep-alive"); std::string cohost = _NHost; cohost += ':'; cohost += _NPort; nreq.setHeaderData("host")->push_back(cohost); nreq.setHeaderData("accept")->push_back("text/json"); nreq.setHeaderData("user-agent")->push_back("blogi/1.0 (Alpha Version 0.1)"); nreq.send(cltsock.get()); std::shared_ptr<char[]> data(new char[16384], std::default_delete<char[]>()); Loading plugins/youtube/youtube.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -154,11 +154,11 @@ namespace blogi { churl+="&channelId="; churl+=dbres[0][2]; churl+="&part=snippet,id&order=date"; nreq.setRequestURL(churl.c_str()); nreq.setRequestVersion(HTTPVERSION(1.1)); *nreq.setData("connection") << "keep-alive"; *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(&ysock,&ycsock); nreq.setHeaderData("connection")->push_back("keep-alive"); nreq.setHeaderData("host")->push_back("www.googleapis.com:443"); nreq.setHeaderData("accept")->push_back("text/json"); nreq.setHeaderData("user-agent")->push_back("blogi/1.0 (Alpha Version 0.1)"); nreq.send(&ycsock); std::shared_ptr<char[]> data(new char[16384], std::default_delete<char[]>()); Loading src/blogi.cpp +11 −11 Original line number Diff line number Diff line Loading @@ -199,7 +199,7 @@ void blogi::Blogi::loginPage(libhttppp::HttpRequest *curreq,const int tid,const libhttppp::HttpResponse curres; curres.setState(HTTP307); curres.setVersion(HTTPVERSION(1.1)); *curres.setData("Location") << PlgArgs->config->getstartpage(); curres.setHeaderData("Location")->push_back(PlgArgs->config->getstartpage()); curres.setContentType("text/html"); curres.send(curreq, nullptr, 0); }else{ Loading Loading @@ -228,8 +228,8 @@ void blogi::Blogi::loginPage(libhttppp::HttpRequest *curreq,const int tid,const void blogi::Blogi::logoutPage(libhttppp::HttpRequest *curreq,const int tid,const char *sessiondid){ const char *host; for(libhttppp::HttpHeader::HeaderData *preq = curreq->getfirstHeaderData(); preq; preq=curreq->nextHeaderData(preq)){ if(strncmp(curreq->getKey(preq),"Host",4)==0) host=curreq->getValue(preq); if(strncmp(preq->getkey(),"Host",4)==0) host=preq->at(0).getvalue().c_str(); } libhttppp::HttpResponse curres; libhttppp::HttpCookie cookie; Loading @@ -241,7 +241,7 @@ void blogi::Blogi::logoutPage(libhttppp::HttpRequest *curreq,const int tid,const curres.setState(HTTP307); curres.setVersion(HTTPVERSION(1.1)); *curres.setData("Location") << PlgArgs->config->getstartpage(); curres.setHeaderData("Location")->push_back(PlgArgs->config->getstartpage()); curres.setContentType("text/html"); curres.setContentLength(0); curres.send(curreq,nullptr,0); Loading Loading @@ -306,13 +306,13 @@ void blogi::Blogi::settingsPage(libhttppp::HttpRequest* curreq,const int tid,con void blogi::Blogi::RequestEvent(libhttppp::HttpRequest *curreq,const int tid,ULONG_PTR args){ char url[512]; try{; libhttppp::HttpHeader::HeaderData *hip=curreq->getData("x-real-ip"); libhttppp::HttpHeader::HeaderData *useragent=curreq->getData("user-agent"); libhttppp::HttpHeader::HeaderData *hip=curreq->getHeaderData("x-real-ip"); libhttppp::HttpHeader::HeaderData *useragent=curreq->getHeaderData("user-agent"); if(hip) std::cout <<"Request from: " << curreq->getData(hip) << " url: " << curreq->getRequestURL(); std::cout <<"Request from: " << hip->at(0).getvalue() << " url: " << curreq->getRequestURL(); if(useragent) std::cout << " agent: " << curreq->getData(useragent); std::cout << " agent: " << useragent->at(0).getvalue(); std::cout << std::endl; Loading Loading @@ -355,11 +355,11 @@ RETRY_REQUEST: blogi::print(*Cookiebanner,curreq->getRequest(),index,CookieEl); }else{ char buf[255]; sessid=sess.createSession(buf,curreq->getData(curreq->getData("user-agent"))); sessid=sess.createSession(buf,curreq->getHeaderData("user-agent")->at(0).getvalue().c_str()); cookie.setcookie(&curres, "sessionid", sessid,nullptr,PlgArgs->config->getCookieDomain() ,-1,"/",false,"1","Lax"); curres.setState(HTTP307); curres.setVersion(HTTPVERSION(1.1)); *curres.setData("Location") << curreq->getRequest(); curres.setHeaderData("Location")->push_back(curreq->getRequest()); curres.setContentType("text/html"); curres.send(curreq, nullptr, 0); return; Loading @@ -371,7 +371,7 @@ RETRY_REQUEST: if(strcmp(curreq->getRequestURL(),"/")==0 || strcmp(curreq->getRequestURL(),PlgArgs->config->getprefix())==0){ curres.setState(HTTP307); curres.setVersion(HTTPVERSION(1.1)); *curres.setData("Location") << PlgArgs->config->getstartpage(); curres.setHeaderData("Location")->push_back(PlgArgs->config->getstartpage()); curres.setContentType("text/html"); curres.send(curreq, nullptr, 0); return; Loading src/theme.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ bool blogi::Theme::Controller(const int tid,libhttppp::HttpRequest *req){ libhttppp::HttpResponse resp; resp.setVersion(HTTPVERSION(1.1)); resp.setState(HTTP200); *resp.setData("cache-control") << "max-age=31536000"; resp.setHeaderData("cache-control")->push_back("max-age=31536000"); if(curfile->Type==ThemeFilesTypes::IMAGE){ if(curfile->Ending=="svg") Loading @@ -167,9 +167,9 @@ bool blogi::Theme::Controller(const int tid,libhttppp::HttpRequest *req){ resp.setContentType("application/octet-stream"); } if( curfile->Compressed.length() >0 && req->getData("accept-encoding") && strstr(req->getData(req->getData("accept-encoding")),"br") ){ *resp.setData("content-encoding") << "br"; if( curfile->Compressed.length() >0 && req->getHeaderData("accept-encoding") && req->getHeaderData("accept-encoding")->at(0).getvalue().find("br")!=std::string::npos ){ resp.setHeaderData("content-encoding")->push_back("br"); resp.setContentLength(curfile->Compressed.length()); resp.send(req,nullptr,-1); }else{ Loading @@ -195,8 +195,8 @@ bool blogi::Theme::Response(const int tid,libhttppp::HttpRequest *req){ for(auto curfile=_PublicFiles.begin(); curfile!=_PublicFiles.end(); curfile++){ if(publicf.compare(strlen(_Config.config->getprefix()),curfile->Path.length(),curfile->Path,0,curfile->Path.length())==0){ if(req->SendData.pos < curfile->Content.length() ){ if( curfile->Compressed.length() >0 && req->getData("accept-encoding") && strstr(req->getData(req->getData("accept-encoding")),"br") ){ if( curfile->Compressed.length() >0 && req->getHeaderData("accept-encoding") && req->getHeaderData("accept-encoding")->at(0).getvalue().find("br") != std::string::npos){ size_t len = BLOCKSIZE < curfile->Compressed.length()-req->SendData.pos ? BLOCKSIZE : curfile->Compressed.length()-req->SendData.pos; req->SendData.append(curfile->Compressed.substr(req->SendData.pos,len).c_str(),len); Loading Loading
plugins/content/content.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -338,7 +338,7 @@ namespace blogi { resp.setVersion(HTTPVERSION(1.1)); resp.setState(HTTP307); resp.setContentType("text/html"); *resp.setData("Location") << ccurl; resp.setHeaderData("Location")->push_back(ccurl); resp.send(curreq,nullptr,0); return; } Loading
plugins/nginxfiler/filer.cpp +8 −5 Original line number Diff line number Diff line Loading @@ -180,11 +180,14 @@ namespace blogi { nreq.setRequestType(GETREQUEST); nreq.setRequestURL(nurl.c_str()); nreq.setRequestVersion(HTTPVERSION(1.1)); *nreq.setData("connection") = "keep-alive"; *nreq.setData("host") << _NHost.c_str() << ":" << _NPort; *nreq.setData("accept") = "text/json"; *nreq.setData("user-agent") = "blogi/1.0 (Alpha Version 0.1)"; nreq.send(srvsock.get(),cltsock.get()); nreq.setHeaderData("connection")->push_back("keep-alive"); std::string cohost = _NHost; cohost += ':'; cohost += _NPort; nreq.setHeaderData("host")->push_back(cohost); nreq.setHeaderData("accept")->push_back("text/json"); nreq.setHeaderData("user-agent")->push_back("blogi/1.0 (Alpha Version 0.1)"); nreq.send(cltsock.get()); std::shared_ptr<char[]> data(new char[16384], std::default_delete<char[]>()); Loading
plugins/youtube/youtube.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -154,11 +154,11 @@ namespace blogi { churl+="&channelId="; churl+=dbres[0][2]; churl+="&part=snippet,id&order=date"; nreq.setRequestURL(churl.c_str()); nreq.setRequestVersion(HTTPVERSION(1.1)); *nreq.setData("connection") << "keep-alive"; *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(&ysock,&ycsock); nreq.setHeaderData("connection")->push_back("keep-alive"); nreq.setHeaderData("host")->push_back("www.googleapis.com:443"); nreq.setHeaderData("accept")->push_back("text/json"); nreq.setHeaderData("user-agent")->push_back("blogi/1.0 (Alpha Version 0.1)"); nreq.send(&ycsock); std::shared_ptr<char[]> data(new char[16384], std::default_delete<char[]>()); Loading
src/blogi.cpp +11 −11 Original line number Diff line number Diff line Loading @@ -199,7 +199,7 @@ void blogi::Blogi::loginPage(libhttppp::HttpRequest *curreq,const int tid,const libhttppp::HttpResponse curres; curres.setState(HTTP307); curres.setVersion(HTTPVERSION(1.1)); *curres.setData("Location") << PlgArgs->config->getstartpage(); curres.setHeaderData("Location")->push_back(PlgArgs->config->getstartpage()); curres.setContentType("text/html"); curres.send(curreq, nullptr, 0); }else{ Loading Loading @@ -228,8 +228,8 @@ void blogi::Blogi::loginPage(libhttppp::HttpRequest *curreq,const int tid,const void blogi::Blogi::logoutPage(libhttppp::HttpRequest *curreq,const int tid,const char *sessiondid){ const char *host; for(libhttppp::HttpHeader::HeaderData *preq = curreq->getfirstHeaderData(); preq; preq=curreq->nextHeaderData(preq)){ if(strncmp(curreq->getKey(preq),"Host",4)==0) host=curreq->getValue(preq); if(strncmp(preq->getkey(),"Host",4)==0) host=preq->at(0).getvalue().c_str(); } libhttppp::HttpResponse curres; libhttppp::HttpCookie cookie; Loading @@ -241,7 +241,7 @@ void blogi::Blogi::logoutPage(libhttppp::HttpRequest *curreq,const int tid,const curres.setState(HTTP307); curres.setVersion(HTTPVERSION(1.1)); *curres.setData("Location") << PlgArgs->config->getstartpage(); curres.setHeaderData("Location")->push_back(PlgArgs->config->getstartpage()); curres.setContentType("text/html"); curres.setContentLength(0); curres.send(curreq,nullptr,0); Loading Loading @@ -306,13 +306,13 @@ void blogi::Blogi::settingsPage(libhttppp::HttpRequest* curreq,const int tid,con void blogi::Blogi::RequestEvent(libhttppp::HttpRequest *curreq,const int tid,ULONG_PTR args){ char url[512]; try{; libhttppp::HttpHeader::HeaderData *hip=curreq->getData("x-real-ip"); libhttppp::HttpHeader::HeaderData *useragent=curreq->getData("user-agent"); libhttppp::HttpHeader::HeaderData *hip=curreq->getHeaderData("x-real-ip"); libhttppp::HttpHeader::HeaderData *useragent=curreq->getHeaderData("user-agent"); if(hip) std::cout <<"Request from: " << curreq->getData(hip) << " url: " << curreq->getRequestURL(); std::cout <<"Request from: " << hip->at(0).getvalue() << " url: " << curreq->getRequestURL(); if(useragent) std::cout << " agent: " << curreq->getData(useragent); std::cout << " agent: " << useragent->at(0).getvalue(); std::cout << std::endl; Loading Loading @@ -355,11 +355,11 @@ RETRY_REQUEST: blogi::print(*Cookiebanner,curreq->getRequest(),index,CookieEl); }else{ char buf[255]; sessid=sess.createSession(buf,curreq->getData(curreq->getData("user-agent"))); sessid=sess.createSession(buf,curreq->getHeaderData("user-agent")->at(0).getvalue().c_str()); cookie.setcookie(&curres, "sessionid", sessid,nullptr,PlgArgs->config->getCookieDomain() ,-1,"/",false,"1","Lax"); curres.setState(HTTP307); curres.setVersion(HTTPVERSION(1.1)); *curres.setData("Location") << curreq->getRequest(); curres.setHeaderData("Location")->push_back(curreq->getRequest()); curres.setContentType("text/html"); curres.send(curreq, nullptr, 0); return; Loading @@ -371,7 +371,7 @@ RETRY_REQUEST: if(strcmp(curreq->getRequestURL(),"/")==0 || strcmp(curreq->getRequestURL(),PlgArgs->config->getprefix())==0){ curres.setState(HTTP307); curres.setVersion(HTTPVERSION(1.1)); *curres.setData("Location") << PlgArgs->config->getstartpage(); curres.setHeaderData("Location")->push_back(PlgArgs->config->getstartpage()); curres.setContentType("text/html"); curres.send(curreq, nullptr, 0); return; Loading
src/theme.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -152,7 +152,7 @@ bool blogi::Theme::Controller(const int tid,libhttppp::HttpRequest *req){ libhttppp::HttpResponse resp; resp.setVersion(HTTPVERSION(1.1)); resp.setState(HTTP200); *resp.setData("cache-control") << "max-age=31536000"; resp.setHeaderData("cache-control")->push_back("max-age=31536000"); if(curfile->Type==ThemeFilesTypes::IMAGE){ if(curfile->Ending=="svg") Loading @@ -167,9 +167,9 @@ bool blogi::Theme::Controller(const int tid,libhttppp::HttpRequest *req){ resp.setContentType("application/octet-stream"); } if( curfile->Compressed.length() >0 && req->getData("accept-encoding") && strstr(req->getData(req->getData("accept-encoding")),"br") ){ *resp.setData("content-encoding") << "br"; if( curfile->Compressed.length() >0 && req->getHeaderData("accept-encoding") && req->getHeaderData("accept-encoding")->at(0).getvalue().find("br")!=std::string::npos ){ resp.setHeaderData("content-encoding")->push_back("br"); resp.setContentLength(curfile->Compressed.length()); resp.send(req,nullptr,-1); }else{ Loading @@ -195,8 +195,8 @@ bool blogi::Theme::Response(const int tid,libhttppp::HttpRequest *req){ for(auto curfile=_PublicFiles.begin(); curfile!=_PublicFiles.end(); curfile++){ if(publicf.compare(strlen(_Config.config->getprefix()),curfile->Path.length(),curfile->Path,0,curfile->Path.length())==0){ if(req->SendData.pos < curfile->Content.length() ){ if( curfile->Compressed.length() >0 && req->getData("accept-encoding") && strstr(req->getData(req->getData("accept-encoding")),"br") ){ if( curfile->Compressed.length() >0 && req->getHeaderData("accept-encoding") && req->getHeaderData("accept-encoding")->at(0).getvalue().find("br") != std::string::npos){ size_t len = BLOCKSIZE < curfile->Compressed.length()-req->SendData.pos ? BLOCKSIZE : curfile->Compressed.length()-req->SendData.pos; req->SendData.append(curfile->Compressed.substr(req->SendData.pos,len).c_str(),len); Loading