Loading examples/httpauth.cpp +8 −8 Changes for examples/httpauth.cpp: 8 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -39,14 +39,14 @@ class Controller : public libhttppp::HttpEvent { public: Controller(std::shared_ptr<netplus::socket> serversocket) : HttpEvent(serversocket){ Controller(netplus::socket &serversocket) : HttpEvent(serversocket){ }; void RequestEvent(std::shared_ptr<libhttppp::HttpRequest> &curreq, const int tid,ULONG_PTR args){ void RequestEvent(libhttppp::HttpRequest &curreq, const int tid,ULONG_PTR args){ try{ std::cout << "Parse Request\n" << std::endl; if(curreq->getRequestURL()=="/"){ if(curreq.getRequestURL()=="/"){ libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setVersion(HTTPVERSION(1.1)); Loading @@ -67,8 +67,8 @@ public: libhtmlpp::HtmlString html; libhtmlpp::print(condat.parse(),html); curres.send(curreq,html.data(),html.size()); }else if(curreq->getRequestURL()=="/httpbasicauth" || curreq->getRequestURL()== "/httpdigestauth"){ }else if(curreq.getRequestURL()=="/httpbasicauth" || curreq.getRequestURL()== "/httpdigestauth"){ libhttppp::HttpAuth httpauth; httpauth.parse(curreq); const char *username=httpauth.getUsername(); Loading Loading @@ -100,13 +100,13 @@ public: curres.setState(HTTP401); curres.setVersion(HTTPVERSION(1.1)); curres.setContentType(nullptr); if(curreq->getRequestURL()=="/httpbasicauth"){ if(curreq.getRequestURL()=="/httpbasicauth"){ httpauth.setAuthType(BASICAUTH); }else if(curreq->getRequestURL()=="/httpdigestauth"){ }else if(curreq.getRequestURL()=="/httpdigestauth"){ httpauth.setAuthType(DIGESTAUTH); } httpauth.setRealm("httpauthtest"); httpauth.setAuth(std::make_shared<libhttppp::HttpResponse>(curres)); httpauth.setAuth(curres); curres.send(curreq,std::vector<char>(),0); return; } Loading examples/httpcon.cpp +5 −5 Changes for examples/httpcon.cpp: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "http.h" #include "httpd.h" void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { void sendResponse(libhttppp::HttpRequest &curreq) { libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setVersion(HTTPVERSION(1.1)); Loading @@ -50,9 +50,9 @@ void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { << " <style> </style>" << " </head>" << "<body>"; if(curreq->isMobile()) if(curreq.isMobile()) condat << "<span>You are using a mobile Browser!</span><br>"; for(libhttppp::HttpHeader::HeaderData *preq = curreq->getfirstHeaderData(); preq; preq=preq->nextHeaderData()){ for(libhttppp::HttpHeader::HeaderData *preq = curreq.getfirstHeaderData(); preq; preq=preq->nextHeaderData()){ condat << preq->getkey() << ": "; for(libhttppp::HttpHeader::HeaderData::Values *cval=preq->getfirstValue(); cval; cval=cval->nextvalue()){ Loading @@ -69,10 +69,10 @@ void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { class Controller : public libhttppp::HttpEvent { public: Controller(std::shared_ptr<netplus::socket> serversocket) : HttpEvent(serversocket){ Controller(netplus::socket &serversocket) : HttpEvent(serversocket){ }; void RequestEvent(std::shared_ptr<libhttppp::HttpRequest> curreq, const int tid,ULONG_PTR args){ void RequestEvent(libhttppp::HttpRequest &curreq, const int tid,ULONG_PTR args){ try{ std::cout << "Send answer" << std::endl; sendResponse(curreq); Loading examples/httpcookie.cpp +5 −5 Changes for examples/httpcookie.cpp: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ class CookieTest { public: CookieTest(std::shared_ptr<libhttppp::HttpRequest> &curreq) : _Curreq(curreq) { CookieTest(libhttppp::HttpRequest &curreq) : _Curreq(curreq) { _Curres.setState(HTTP200); _Curres.setVersion(HTTPVERSION(1.1)); _Curres.setContentType("text/html"); Loading Loading @@ -107,7 +107,7 @@ public: libhttppp::HttpForm curform; curform.parse(_Curreq); if(getData("key",curform)!=nullptr){ _Cookie.setcookie(std::make_shared<libhttppp::HttpResponse>(_Curres),getData("key",curform),getData("value",curform),getData("comment",curform),getData("domain",curform), _Cookie.setcookie(_Curres,getData("key",curform),getData("value",curform),getData("comment",curform),getData("domain",curform), getDataInt("max-age",curform),getData("path",curform),false,getData("version",curform)); } }; Loading @@ -127,15 +127,15 @@ private: libhtmlpp::HtmlString _HTMLDat; libhttppp::HttpCookie _Cookie; libhttppp::HttpResponse _Curres; std::shared_ptr<libhttppp::HttpRequest> &_Curreq; libhttppp::HttpRequest &_Curreq; }; class Controller : public libhttppp::HttpEvent { public: Controller(std::shared_ptr<netplus::socket> serversocket) : HttpEvent(serversocket){ Controller(netplus::socket& serversocket) : HttpEvent(serversocket){ }; void RequestEvent(std::shared_ptr <libhttppp::HttpRequest> &curreq, const int tid,ULONG_PTR args){ void RequestEvent(libhttppp::HttpRequest &curreq, const int tid,ULONG_PTR args){ try{ std::cout << "Send answer" << std::endl; CookieTest ctest(curreq); Loading examples/httphello.cpp +3 −3 Changes for examples/httphello.cpp: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -36,14 +36,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class Controller : public libhttppp::HttpEvent { public: Controller(std::shared_ptr<netplus::socket> serversocket) : HttpEvent(serversocket){ Controller(netplus::socket &serversocket) : HttpEvent(serversocket){ }; void RequestEvent(std::shared_ptr<libhttppp::HttpRequest> &curreq, const int tid,ULONG_PTR args){ void RequestEvent(libhttppp::HttpRequest &curreq, const int tid,ULONG_PTR args){ try{ libhttppp::HttpResponse curres; std::vector<char> hello; std::copy(HTMLHELLO, HTMLHELLO + sizeof(HTMLHELLO) - 1, std::back_inserter(hello)); std::copy(HTMLHELLO, HTMLHELLO + sizeof(HTMLHELLO), std::back_inserter(hello)); curres.setContentType("text/html"); curres.send(curreq,hello,hello.size()); }catch(libhttppp::HTTPException &e){ Loading examples/httpproxy.cpp +4 −4 Changes for examples/httpproxy.cpp: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "http.h" #include "httpd.h" void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { void sendResponse(libhttppp::HttpRequest &curreq) { libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setVersion(HTTPVERSION(1.1)); Loading @@ -51,7 +51,7 @@ void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { << " </head>" << "<body>"; for(libhttppp::HttpHeader::HeaderData *preq = curreq->getfirstHeaderData(); preq; preq=preq->nextHeaderData()){ for(libhttppp::HttpHeader::HeaderData *preq = curreq.getfirstHeaderData(); preq; preq=preq->nextHeaderData()){ condat << preq->getkey() << ": "; for(libhttppp::HttpHeader::HeaderData::Values *cval=preq->getfirstValue(); cval; cval=cval->nextvalue()){ Loading @@ -69,10 +69,10 @@ void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { class Controller : public libhttppp::HttpEvent { public: Controller(std::shared_ptr<netplus::socket> serversocket) : HttpEvent(serversocket){ Controller(netplus::socket &serversocket) : HttpEvent(serversocket){ }; void RequestEvent(std::shared_ptr<libhttppp::HttpRequest> &curreq, const int tid,ULONG_PTR args){ void RequestEvent(libhttppp::HttpRequest &curreq, const int tid,ULONG_PTR args){ try{ std::cout << "Send answer" << std::endl; sendResponse(curreq); Loading Loading
examples/httpauth.cpp +8 −8 Changes for examples/httpauth.cpp: 8 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -39,14 +39,14 @@ class Controller : public libhttppp::HttpEvent { public: Controller(std::shared_ptr<netplus::socket> serversocket) : HttpEvent(serversocket){ Controller(netplus::socket &serversocket) : HttpEvent(serversocket){ }; void RequestEvent(std::shared_ptr<libhttppp::HttpRequest> &curreq, const int tid,ULONG_PTR args){ void RequestEvent(libhttppp::HttpRequest &curreq, const int tid,ULONG_PTR args){ try{ std::cout << "Parse Request\n" << std::endl; if(curreq->getRequestURL()=="/"){ if(curreq.getRequestURL()=="/"){ libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setVersion(HTTPVERSION(1.1)); Loading @@ -67,8 +67,8 @@ public: libhtmlpp::HtmlString html; libhtmlpp::print(condat.parse(),html); curres.send(curreq,html.data(),html.size()); }else if(curreq->getRequestURL()=="/httpbasicauth" || curreq->getRequestURL()== "/httpdigestauth"){ }else if(curreq.getRequestURL()=="/httpbasicauth" || curreq.getRequestURL()== "/httpdigestauth"){ libhttppp::HttpAuth httpauth; httpauth.parse(curreq); const char *username=httpauth.getUsername(); Loading Loading @@ -100,13 +100,13 @@ public: curres.setState(HTTP401); curres.setVersion(HTTPVERSION(1.1)); curres.setContentType(nullptr); if(curreq->getRequestURL()=="/httpbasicauth"){ if(curreq.getRequestURL()=="/httpbasicauth"){ httpauth.setAuthType(BASICAUTH); }else if(curreq->getRequestURL()=="/httpdigestauth"){ }else if(curreq.getRequestURL()=="/httpdigestauth"){ httpauth.setAuthType(DIGESTAUTH); } httpauth.setRealm("httpauthtest"); httpauth.setAuth(std::make_shared<libhttppp::HttpResponse>(curres)); httpauth.setAuth(curres); curres.send(curreq,std::vector<char>(),0); return; } Loading
examples/httpcon.cpp +5 −5 Changes for examples/httpcon.cpp: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "http.h" #include "httpd.h" void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { void sendResponse(libhttppp::HttpRequest &curreq) { libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setVersion(HTTPVERSION(1.1)); Loading @@ -50,9 +50,9 @@ void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { << " <style> </style>" << " </head>" << "<body>"; if(curreq->isMobile()) if(curreq.isMobile()) condat << "<span>You are using a mobile Browser!</span><br>"; for(libhttppp::HttpHeader::HeaderData *preq = curreq->getfirstHeaderData(); preq; preq=preq->nextHeaderData()){ for(libhttppp::HttpHeader::HeaderData *preq = curreq.getfirstHeaderData(); preq; preq=preq->nextHeaderData()){ condat << preq->getkey() << ": "; for(libhttppp::HttpHeader::HeaderData::Values *cval=preq->getfirstValue(); cval; cval=cval->nextvalue()){ Loading @@ -69,10 +69,10 @@ void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { class Controller : public libhttppp::HttpEvent { public: Controller(std::shared_ptr<netplus::socket> serversocket) : HttpEvent(serversocket){ Controller(netplus::socket &serversocket) : HttpEvent(serversocket){ }; void RequestEvent(std::shared_ptr<libhttppp::HttpRequest> curreq, const int tid,ULONG_PTR args){ void RequestEvent(libhttppp::HttpRequest &curreq, const int tid,ULONG_PTR args){ try{ std::cout << "Send answer" << std::endl; sendResponse(curreq); Loading
examples/httpcookie.cpp +5 −5 Changes for examples/httpcookie.cpp: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ class CookieTest { public: CookieTest(std::shared_ptr<libhttppp::HttpRequest> &curreq) : _Curreq(curreq) { CookieTest(libhttppp::HttpRequest &curreq) : _Curreq(curreq) { _Curres.setState(HTTP200); _Curres.setVersion(HTTPVERSION(1.1)); _Curres.setContentType("text/html"); Loading Loading @@ -107,7 +107,7 @@ public: libhttppp::HttpForm curform; curform.parse(_Curreq); if(getData("key",curform)!=nullptr){ _Cookie.setcookie(std::make_shared<libhttppp::HttpResponse>(_Curres),getData("key",curform),getData("value",curform),getData("comment",curform),getData("domain",curform), _Cookie.setcookie(_Curres,getData("key",curform),getData("value",curform),getData("comment",curform),getData("domain",curform), getDataInt("max-age",curform),getData("path",curform),false,getData("version",curform)); } }; Loading @@ -127,15 +127,15 @@ private: libhtmlpp::HtmlString _HTMLDat; libhttppp::HttpCookie _Cookie; libhttppp::HttpResponse _Curres; std::shared_ptr<libhttppp::HttpRequest> &_Curreq; libhttppp::HttpRequest &_Curreq; }; class Controller : public libhttppp::HttpEvent { public: Controller(std::shared_ptr<netplus::socket> serversocket) : HttpEvent(serversocket){ Controller(netplus::socket& serversocket) : HttpEvent(serversocket){ }; void RequestEvent(std::shared_ptr <libhttppp::HttpRequest> &curreq, const int tid,ULONG_PTR args){ void RequestEvent(libhttppp::HttpRequest &curreq, const int tid,ULONG_PTR args){ try{ std::cout << "Send answer" << std::endl; CookieTest ctest(curreq); Loading
examples/httphello.cpp +3 −3 Changes for examples/httphello.cpp: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -36,14 +36,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. class Controller : public libhttppp::HttpEvent { public: Controller(std::shared_ptr<netplus::socket> serversocket) : HttpEvent(serversocket){ Controller(netplus::socket &serversocket) : HttpEvent(serversocket){ }; void RequestEvent(std::shared_ptr<libhttppp::HttpRequest> &curreq, const int tid,ULONG_PTR args){ void RequestEvent(libhttppp::HttpRequest &curreq, const int tid,ULONG_PTR args){ try{ libhttppp::HttpResponse curres; std::vector<char> hello; std::copy(HTMLHELLO, HTMLHELLO + sizeof(HTMLHELLO) - 1, std::back_inserter(hello)); std::copy(HTMLHELLO, HTMLHELLO + sizeof(HTMLHELLO), std::back_inserter(hello)); curres.setContentType("text/html"); curres.send(curreq,hello,hello.size()); }catch(libhttppp::HTTPException &e){ Loading
examples/httpproxy.cpp +4 −4 Changes for examples/httpproxy.cpp: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "http.h" #include "httpd.h" void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { void sendResponse(libhttppp::HttpRequest &curreq) { libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setVersion(HTTPVERSION(1.1)); Loading @@ -51,7 +51,7 @@ void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { << " </head>" << "<body>"; for(libhttppp::HttpHeader::HeaderData *preq = curreq->getfirstHeaderData(); preq; preq=preq->nextHeaderData()){ for(libhttppp::HttpHeader::HeaderData *preq = curreq.getfirstHeaderData(); preq; preq=preq->nextHeaderData()){ condat << preq->getkey() << ": "; for(libhttppp::HttpHeader::HeaderData::Values *cval=preq->getfirstValue(); cval; cval=cval->nextvalue()){ Loading @@ -69,10 +69,10 @@ void sendResponse(std::shared_ptr<libhttppp::HttpRequest> &curreq) { class Controller : public libhttppp::HttpEvent { public: Controller(std::shared_ptr<netplus::socket> serversocket) : HttpEvent(serversocket){ Controller(netplus::socket &serversocket) : HttpEvent(serversocket){ }; void RequestEvent(std::shared_ptr<libhttppp::HttpRequest> &curreq, const int tid,ULONG_PTR args){ void RequestEvent(libhttppp::HttpRequest &curreq, const int tid,ULONG_PTR args){ try{ std::cout << "Send answer" << std::endl; sendResponse(curreq); Loading