Loading examples/httpauth.cpp +11 −14 Changes for examples/httpauth.cpp: 11 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -25,13 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <string.h> #include <cstring> #include <iostream> #include <systempp/sysconsole.h> #include <systempp/sysutils.h> #include <string.h> #include <systempp/syseventapi.h> #include <netplus/eventapi.h> #include "htmlpp/html.h" Loading @@ -40,15 +37,15 @@ #include "http.h" #include "httpd.h" class Controller : public sys::net::event { class Controller : public netplus::event { public: Controller(sys::net::socket* serversocket) : event(serversocket){ Controller(netplus::socket* serversocket) : event(serversocket){ }; void RequestEvent(sys::net::con *curcon){ void RequestEvent(netplus::con *curcon){ try{ sys::cout << "Parse Request\n" << sys::endl; std::cout << "Parse Request\n" << std::endl; libhttppp::HttpRequest curreq; curreq.parse(curcon); const char *cururl=curreq.getRequestURL(); Loading Loading @@ -102,9 +99,9 @@ public: curres.setState(HTTP401); curres.setVersion(HTTPVERSION(1.1)); curres.setContentType(nullptr); if(ncompare(cururl,strlen(cururl),"/httpbasicauth",13)==0){ if(strncmp(cururl,"/httpbasicauth",13)==0){ httpauth.setAuthType(BASICAUTH); }else if(ncompare(cururl,strlen(cururl),"/httpdigestauth",14)==0){ }else if(strncmp(cururl,"/httpdigestauth",14)==0){ httpauth.setAuthType(DIGESTAUTH); } httpauth.setRealm("httpauthtest"); Loading @@ -120,7 +117,7 @@ public: curres.send(curcon,nullptr,0); } }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr << e.what() << std::endl; throw e; } } Loading @@ -138,7 +135,7 @@ public: Controller controller(getServerSocket()); controller.runEventloop(); }catch(libhttppp::HTTPException &e){ sys::cout << e.what() << sys::endl; std::cout << e.what() << std::endl; } }; private: Loading examples/httpcon.cpp +10 −10 Changes for examples/httpcon.cpp: 10 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <systempp/sysconsole.h> #include <systempp/syseventapi.h> #include <iostream> #include <netplus/eventapi.h> #include "htmlpp/html.h" Loading @@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "http.h" #include "httpd.h" void sendResponse(sys::net::con *curcon,libhttppp::HttpRequest *curreq) { void sendResponse(netplus::con *curcon,libhttppp::HttpRequest *curreq) { libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setVersion(HTTPVERSION(1.1)); Loading @@ -60,20 +60,20 @@ void sendResponse(sys::net::con *curcon,libhttppp::HttpRequest *curreq) { curres.send(curcon,condat.c_str(),condat.size()); }; class Controller : public sys::net::event { class Controller : public netplus::event { public: Controller(sys::net::socket* serversocket) : event(serversocket){ Controller(netplus::socket* serversocket) : event(serversocket){ }; void RequestEvent(sys::net::con *curcon){ void RequestEvent(netplus::con *curcon){ try{ sys::cout << "Parse Request" << sys::endl; std::cout << "Parse Request" << std::endl; libhttppp::HttpRequest curreq; curreq.parse(curcon); sys::cout << "Send answer" << sys::endl; std::cout << "Send answer" << std::endl; sendResponse(curcon,&curreq); }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr << e.what() << std::endl; throw e; } } Loading @@ -90,7 +90,7 @@ public: Controller controller(getServerSocket()); controller.runEventloop(); }catch(libhttppp::HTTPException &e){ sys::cout << e.what() << sys::endl; std::cout << e.what() << std::endl; } }; private: Loading examples/httpcookie.cpp +16 −19 Changes for examples/httpcookie.cpp: 16 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -25,11 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <stdlib.h> #include <cstring> #include <cstdlib> #include <systempp/sysconsole.h> #include <systempp/syseventapi.h> #include <systempp/sysutils.h> #include <iostream> #include <netplus/eventapi.h> #include "htmlpp/html.h" Loading @@ -41,7 +41,7 @@ class CookieTest { public: CookieTest(sys::net::con *curcon,libhttppp::HttpRequest *curreq){ CookieTest(netplus::con *curcon,libhttppp::HttpRequest *curreq){ _Curcon=curcon; _Curreq=curreq; Loading Loading @@ -69,7 +69,7 @@ public: if(curform.getUrlcodedFormData()){ for(libhttppp::HttpForm::UrlcodedFormData *cururlform=curform.getUrlcodedFormData(); cururlform; cururlform=cururlform->nextUrlcodedFormData()){ if(ncompare(key,strlen(key),cururlform->getKey(),strlen(key))==0) if(strcmp(key,cururlform->getKey())==0) return cururlform->getValue(); } } Loading @@ -82,12 +82,9 @@ public: if(curform.getUrlcodedFormData()){ for(libhttppp::HttpForm::UrlcodedFormData *cururlform=curform.getUrlcodedFormData(); cururlform; cururlform=cururlform->nextUrlcodedFormData()){ if(ncompare(key,strlen(key),cururlform->getKey(), strlen(cururlform->getKey()))==0){ if(strcmp(key,cururlform->getKey())==0){ char ktmp[255]; scopy(cururlform->getValue(),cururlform->getValue()+ strlen(cururlform->getValue()), ktmp); memcpy(ktmp,cururlform->getValue(),strlen(cururlform->getValue())+1); return atoi(ktmp); } } Loading Loading @@ -128,25 +125,25 @@ private: libhtmlpp::HtmlString _HTMLDat; libhttppp::HttpCookie _Cookie; libhttppp::HttpResponse _Curres; sys::net::con *_Curcon; netplus::con *_Curcon; libhttppp::HttpRequest *_Curreq; }; class Controller : public sys::net::event { class Controller : public netplus::event { public: Controller(sys::net::socket* serversocket) : event(serversocket){ Controller(netplus::socket* serversocket) : event(serversocket){ }; void RequestEvent(sys::net::con *curcon){ void RequestEvent(netplus::con *curcon){ try{ sys::cout << "Parse Request" << sys::endl; std::cout << "Parse Request" << std::endl; libhttppp::HttpRequest curreq; curreq.parse(curcon); sys::cout << "Send answer" << sys::endl; std::cout << "Send answer" << std::endl; CookieTest(curcon,&curreq); }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr<< e.what() << std::endl; throw e; } } Loading @@ -164,7 +161,7 @@ public: Controller controller(getServerSocket()); controller.runEventloop(); }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr<< e.what() << std::endl; } }; private: Loading examples/httpform.cpp +9 −9 Changes for examples/httpform.cpp: 9 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <string.h> #include <systempp/sysconsole.h> #include <systempp/syseventapi.h> #include <iostream> #include <netplus/eventapi.h> #include <htmlpp/html.h> Loading @@ -38,20 +38,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "httpd.h" class Controller : public sys::net::event { class Controller : public netplus::event { public: Controller(sys::net::socket* serversocket) : event(serversocket){ Controller(netplus::socket* serversocket) : event(serversocket){ }; void RequestEvent(sys::net::con *curcon){ void RequestEvent(netplus::con *curcon){ libhttppp::HttpRequest curreq; libhtmlpp::HtmlString formdat; try { sys::cout << "Parse Request" << sys::endl; std::cout << "Parse Request" << std::endl; curreq.parse(curcon); Multiform(curreq, formdat); URlform(curreq, formdat); sys::cout << "Send answer" << sys::endl; std::cout << "Send answer" << std::endl; sendResponse(curcon, formdat); } Loading Loading @@ -109,7 +109,7 @@ private: } }; void sendResponse(sys::net::con* curcon, libhtmlpp::HtmlString formdat) { void sendResponse(netplus::con* curcon, libhtmlpp::HtmlString formdat) { libhttppp::HttpResponse curres; libhtmlpp::HtmlString condat; curres.setState(HTTP200); Loading Loading @@ -192,7 +192,7 @@ public: Controller controller(getServerSocket()); controller.runEventloop(); }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr << e.what() << std::endl; } }; private: Loading examples/httphello.cpp +7 −7 Changes for examples/httphello.cpp: 7 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -27,25 +27,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <string.h> #include <systempp/sysconsole.h> #include <systempp/syseventapi.h> #include <iostream> #include <netplus/eventapi.h> #include "http.h" #include "httpd.h" class Controller : public sys::net::event { class Controller : public netplus::event { public: Controller(sys::net::socket* serversocket) : event(serversocket){ Controller(netplus::socket* serversocket) : event(serversocket){ }; void RequestEvent(sys::net::con *curcon){ void RequestEvent(netplus::con *curcon){ try{ libhttppp::HttpResponse curres; const char *hello="<!DOCTYPE html><html><head><title>hello</title></head><body>Hello World</body></html>"; curres.setContentType("text/html"); curres.send(curcon,hello,strlen(hello)); }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr << e.what() << std::endl; throw e; } } Loading @@ -60,7 +60,7 @@ public: Controller controller(getServerSocket()); controller.runEventloop(); }catch(libhttppp::HTTPException &e){ sys::cout << e.what() << sys::endl; std::cout << e.what() << std::endl; } }; private: Loading Loading
examples/httpauth.cpp +11 −14 Changes for examples/httpauth.cpp: 11 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -25,13 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <string.h> #include <cstring> #include <iostream> #include <systempp/sysconsole.h> #include <systempp/sysutils.h> #include <string.h> #include <systempp/syseventapi.h> #include <netplus/eventapi.h> #include "htmlpp/html.h" Loading @@ -40,15 +37,15 @@ #include "http.h" #include "httpd.h" class Controller : public sys::net::event { class Controller : public netplus::event { public: Controller(sys::net::socket* serversocket) : event(serversocket){ Controller(netplus::socket* serversocket) : event(serversocket){ }; void RequestEvent(sys::net::con *curcon){ void RequestEvent(netplus::con *curcon){ try{ sys::cout << "Parse Request\n" << sys::endl; std::cout << "Parse Request\n" << std::endl; libhttppp::HttpRequest curreq; curreq.parse(curcon); const char *cururl=curreq.getRequestURL(); Loading Loading @@ -102,9 +99,9 @@ public: curres.setState(HTTP401); curres.setVersion(HTTPVERSION(1.1)); curres.setContentType(nullptr); if(ncompare(cururl,strlen(cururl),"/httpbasicauth",13)==0){ if(strncmp(cururl,"/httpbasicauth",13)==0){ httpauth.setAuthType(BASICAUTH); }else if(ncompare(cururl,strlen(cururl),"/httpdigestauth",14)==0){ }else if(strncmp(cururl,"/httpdigestauth",14)==0){ httpauth.setAuthType(DIGESTAUTH); } httpauth.setRealm("httpauthtest"); Loading @@ -120,7 +117,7 @@ public: curres.send(curcon,nullptr,0); } }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr << e.what() << std::endl; throw e; } } Loading @@ -138,7 +135,7 @@ public: Controller controller(getServerSocket()); controller.runEventloop(); }catch(libhttppp::HTTPException &e){ sys::cout << e.what() << sys::endl; std::cout << e.what() << std::endl; } }; private: Loading
examples/httpcon.cpp +10 −10 Changes for examples/httpcon.cpp: 10 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -25,8 +25,8 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <systempp/sysconsole.h> #include <systempp/syseventapi.h> #include <iostream> #include <netplus/eventapi.h> #include "htmlpp/html.h" Loading @@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "http.h" #include "httpd.h" void sendResponse(sys::net::con *curcon,libhttppp::HttpRequest *curreq) { void sendResponse(netplus::con *curcon,libhttppp::HttpRequest *curreq) { libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setVersion(HTTPVERSION(1.1)); Loading @@ -60,20 +60,20 @@ void sendResponse(sys::net::con *curcon,libhttppp::HttpRequest *curreq) { curres.send(curcon,condat.c_str(),condat.size()); }; class Controller : public sys::net::event { class Controller : public netplus::event { public: Controller(sys::net::socket* serversocket) : event(serversocket){ Controller(netplus::socket* serversocket) : event(serversocket){ }; void RequestEvent(sys::net::con *curcon){ void RequestEvent(netplus::con *curcon){ try{ sys::cout << "Parse Request" << sys::endl; std::cout << "Parse Request" << std::endl; libhttppp::HttpRequest curreq; curreq.parse(curcon); sys::cout << "Send answer" << sys::endl; std::cout << "Send answer" << std::endl; sendResponse(curcon,&curreq); }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr << e.what() << std::endl; throw e; } } Loading @@ -90,7 +90,7 @@ public: Controller controller(getServerSocket()); controller.runEventloop(); }catch(libhttppp::HTTPException &e){ sys::cout << e.what() << sys::endl; std::cout << e.what() << std::endl; } }; private: Loading
examples/httpcookie.cpp +16 −19 Changes for examples/httpcookie.cpp: 16 added lines, 19 removed lines. Original line number Diff line number Diff line Loading @@ -25,11 +25,11 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ #include <stdlib.h> #include <cstring> #include <cstdlib> #include <systempp/sysconsole.h> #include <systempp/syseventapi.h> #include <systempp/sysutils.h> #include <iostream> #include <netplus/eventapi.h> #include "htmlpp/html.h" Loading @@ -41,7 +41,7 @@ class CookieTest { public: CookieTest(sys::net::con *curcon,libhttppp::HttpRequest *curreq){ CookieTest(netplus::con *curcon,libhttppp::HttpRequest *curreq){ _Curcon=curcon; _Curreq=curreq; Loading Loading @@ -69,7 +69,7 @@ public: if(curform.getUrlcodedFormData()){ for(libhttppp::HttpForm::UrlcodedFormData *cururlform=curform.getUrlcodedFormData(); cururlform; cururlform=cururlform->nextUrlcodedFormData()){ if(ncompare(key,strlen(key),cururlform->getKey(),strlen(key))==0) if(strcmp(key,cururlform->getKey())==0) return cururlform->getValue(); } } Loading @@ -82,12 +82,9 @@ public: if(curform.getUrlcodedFormData()){ for(libhttppp::HttpForm::UrlcodedFormData *cururlform=curform.getUrlcodedFormData(); cururlform; cururlform=cururlform->nextUrlcodedFormData()){ if(ncompare(key,strlen(key),cururlform->getKey(), strlen(cururlform->getKey()))==0){ if(strcmp(key,cururlform->getKey())==0){ char ktmp[255]; scopy(cururlform->getValue(),cururlform->getValue()+ strlen(cururlform->getValue()), ktmp); memcpy(ktmp,cururlform->getValue(),strlen(cururlform->getValue())+1); return atoi(ktmp); } } Loading Loading @@ -128,25 +125,25 @@ private: libhtmlpp::HtmlString _HTMLDat; libhttppp::HttpCookie _Cookie; libhttppp::HttpResponse _Curres; sys::net::con *_Curcon; netplus::con *_Curcon; libhttppp::HttpRequest *_Curreq; }; class Controller : public sys::net::event { class Controller : public netplus::event { public: Controller(sys::net::socket* serversocket) : event(serversocket){ Controller(netplus::socket* serversocket) : event(serversocket){ }; void RequestEvent(sys::net::con *curcon){ void RequestEvent(netplus::con *curcon){ try{ sys::cout << "Parse Request" << sys::endl; std::cout << "Parse Request" << std::endl; libhttppp::HttpRequest curreq; curreq.parse(curcon); sys::cout << "Send answer" << sys::endl; std::cout << "Send answer" << std::endl; CookieTest(curcon,&curreq); }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr<< e.what() << std::endl; throw e; } } Loading @@ -164,7 +161,7 @@ public: Controller controller(getServerSocket()); controller.runEventloop(); }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr<< e.what() << std::endl; } }; private: Loading
examples/httpform.cpp +9 −9 Changes for examples/httpform.cpp: 9 added lines, 9 removed lines. Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <string.h> #include <systempp/sysconsole.h> #include <systempp/syseventapi.h> #include <iostream> #include <netplus/eventapi.h> #include <htmlpp/html.h> Loading @@ -38,20 +38,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "httpd.h" class Controller : public sys::net::event { class Controller : public netplus::event { public: Controller(sys::net::socket* serversocket) : event(serversocket){ Controller(netplus::socket* serversocket) : event(serversocket){ }; void RequestEvent(sys::net::con *curcon){ void RequestEvent(netplus::con *curcon){ libhttppp::HttpRequest curreq; libhtmlpp::HtmlString formdat; try { sys::cout << "Parse Request" << sys::endl; std::cout << "Parse Request" << std::endl; curreq.parse(curcon); Multiform(curreq, formdat); URlform(curreq, formdat); sys::cout << "Send answer" << sys::endl; std::cout << "Send answer" << std::endl; sendResponse(curcon, formdat); } Loading Loading @@ -109,7 +109,7 @@ private: } }; void sendResponse(sys::net::con* curcon, libhtmlpp::HtmlString formdat) { void sendResponse(netplus::con* curcon, libhtmlpp::HtmlString formdat) { libhttppp::HttpResponse curres; libhtmlpp::HtmlString condat; curres.setState(HTTP200); Loading Loading @@ -192,7 +192,7 @@ public: Controller controller(getServerSocket()); controller.runEventloop(); }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr << e.what() << std::endl; } }; private: Loading
examples/httphello.cpp +7 −7 Changes for examples/httphello.cpp: 7 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -27,25 +27,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <string.h> #include <systempp/sysconsole.h> #include <systempp/syseventapi.h> #include <iostream> #include <netplus/eventapi.h> #include "http.h" #include "httpd.h" class Controller : public sys::net::event { class Controller : public netplus::event { public: Controller(sys::net::socket* serversocket) : event(serversocket){ Controller(netplus::socket* serversocket) : event(serversocket){ }; void RequestEvent(sys::net::con *curcon){ void RequestEvent(netplus::con *curcon){ try{ libhttppp::HttpResponse curres; const char *hello="<!DOCTYPE html><html><head><title>hello</title></head><body>Hello World</body></html>"; curres.setContentType("text/html"); curres.send(curcon,hello,strlen(hello)); }catch(libhttppp::HTTPException &e){ sys::cerr << e.what() << sys::endl; std::cerr << e.what() << std::endl; throw e; } } Loading @@ -60,7 +60,7 @@ public: Controller controller(getServerSocket()); controller.runEventloop(); }catch(libhttppp::HTTPException &e){ sys::cout << e.what() << sys::endl; std::cout << e.what() << std::endl; } }; private: Loading