Loading src/httpd.cpp +8 −38 Changes for src/httpd.cpp: 8 added lines, 38 removed lines. Original line number Diff line number Diff line Loading @@ -135,8 +135,7 @@ libhttppp::HttpD::HttpD(int argc, char** argv) { HTTPDCmdController.registerCmd("httpaddr",'a', true,"","Address to listen"); HTTPDCmdController.registerCmd("httpport", 'p', false, 8080, "Port to listen"); HTTPDCmdController.registerCmd("maxconnections", 'm',false, MAXDEFAULTCONN, "Max connections that can connect"); HTTPDCmdController.registerCmd("httpscert", 'c',false,"", "HTTPS Certfile"); HTTPDCmdController.registerCmd("httpskey", 'k',false, "", "HTTPS Keyfile"); HTTPDCmdController.registerCmd("httpsder", 's',false,"", "SSL DER File"); /*Parse Parameters*/ HTTPDCmdController.parseCmd(argc,argv); Loading Loading @@ -170,44 +169,15 @@ libhttppp::HttpD::HttpD(int argc, char** argv) { maxconnections = HTTPDCmdController.getCmdbyKey("maxconnections")->getValueInt(); /*get httpaddress from console paramter*/ std::string sslcertpath; if (HTTPDCmdController.getCmdbyKey("httpscert")) sslcertpath = HTTPDCmdController.getCmdbyKey("httpscert")->getValue(); /*get httpaddress from console paramter*/ std::string sslkeypath; if (HTTPDCmdController.getCmdbyKey("httpskey")) sslkeypath = HTTPDCmdController.getCmdbyKey("httpskey")->getValue(); std::string derfile; if (HTTPDCmdController.getCmdbyKey("httpsder")) derfile = HTTPDCmdController.getCmdbyKey("httpsder")->getValue(); try { if (!sslcertpath.empty() && !sslkeypath.empty()) { std::vector<char> cert,key; std::ifstream keyfile(sslkeypath); if(keyfile.is_open()){ while(keyfile.peek() != EOF){ key.push_back((char)keyfile.get()); } keyfile.close(); } key.push_back('\0'); std::ifstream certfile(sslcertpath); if(certfile.is_open()){ while(certfile.peek() != EOF){ cert.push_back((char)certfile.get()); } certfile.close(); } cert.push_back('\0'); // _ServerSocket = new netplus::ssl(httpaddr, port, maxconnections,-1,(const unsigned char*)cert.data(), // cert.size(),(const unsigned char*)key.data(),key.size()); if (!derfile.empty()) { netplus::x509cert x509; x509.loadFromFile(derfile); _ServerSocket = std::make_unique<netplus::ssl>(httpaddr, port, maxconnections,-1,x509); }else{ #ifndef Windows if (portset == true) Loading Loading
src/httpd.cpp +8 −38 Changes for src/httpd.cpp: 8 added lines, 38 removed lines. Original line number Diff line number Diff line Loading @@ -135,8 +135,7 @@ libhttppp::HttpD::HttpD(int argc, char** argv) { HTTPDCmdController.registerCmd("httpaddr",'a', true,"","Address to listen"); HTTPDCmdController.registerCmd("httpport", 'p', false, 8080, "Port to listen"); HTTPDCmdController.registerCmd("maxconnections", 'm',false, MAXDEFAULTCONN, "Max connections that can connect"); HTTPDCmdController.registerCmd("httpscert", 'c',false,"", "HTTPS Certfile"); HTTPDCmdController.registerCmd("httpskey", 'k',false, "", "HTTPS Keyfile"); HTTPDCmdController.registerCmd("httpsder", 's',false,"", "SSL DER File"); /*Parse Parameters*/ HTTPDCmdController.parseCmd(argc,argv); Loading Loading @@ -170,44 +169,15 @@ libhttppp::HttpD::HttpD(int argc, char** argv) { maxconnections = HTTPDCmdController.getCmdbyKey("maxconnections")->getValueInt(); /*get httpaddress from console paramter*/ std::string sslcertpath; if (HTTPDCmdController.getCmdbyKey("httpscert")) sslcertpath = HTTPDCmdController.getCmdbyKey("httpscert")->getValue(); /*get httpaddress from console paramter*/ std::string sslkeypath; if (HTTPDCmdController.getCmdbyKey("httpskey")) sslkeypath = HTTPDCmdController.getCmdbyKey("httpskey")->getValue(); std::string derfile; if (HTTPDCmdController.getCmdbyKey("httpsder")) derfile = HTTPDCmdController.getCmdbyKey("httpsder")->getValue(); try { if (!sslcertpath.empty() && !sslkeypath.empty()) { std::vector<char> cert,key; std::ifstream keyfile(sslkeypath); if(keyfile.is_open()){ while(keyfile.peek() != EOF){ key.push_back((char)keyfile.get()); } keyfile.close(); } key.push_back('\0'); std::ifstream certfile(sslcertpath); if(certfile.is_open()){ while(certfile.peek() != EOF){ cert.push_back((char)certfile.get()); } certfile.close(); } cert.push_back('\0'); // _ServerSocket = new netplus::ssl(httpaddr, port, maxconnections,-1,(const unsigned char*)cert.data(), // cert.size(),(const unsigned char*)key.data(),key.size()); if (!derfile.empty()) { netplus::x509cert x509; x509.loadFromFile(derfile); _ServerSocket = std::make_unique<netplus::ssl>(httpaddr, port, maxconnections,-1,x509); }else{ #ifndef Windows if (portset == true) Loading