diff --git a/ZLToolKit b/ZLToolKit index 086b14bd..e79d24b5 160000 --- a/ZLToolKit +++ b/ZLToolKit @@ -1 +1 @@ -Subproject commit 086b14bdc9924f7f86f53d0fa542b8568bff5bc8 +Subproject commit e79d24b51051ed9b3bd9c66b9d8ace3c76a0411a diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index eccecd5d..6301f927 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,6 @@ -#查找SDL2是否安装 +execute_process(COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/ssl.pem ${EXECUTABLE_OUTPUT_PATH}/) + +#查找SDL2是否安装 find_package(SDL2 QUIET) if (SDL2_FOUND) include_directories(${SDL2_INCLUDE_DIR}) diff --git a/tests/test_server.pem b/tests/ssl.pem similarity index 100% rename from tests/test_server.pem rename to tests/ssl.pem diff --git a/tests/test_httpApi.cpp b/tests/test_httpApi.cpp index bb5aed49..2bbc6642 100644 --- a/tests/test_httpApi.cpp +++ b/tests/test_httpApi.cpp @@ -112,26 +112,16 @@ int main(int argc,char *argv[]){ //加载配置文件,如果配置文件不存在就创建一个 loadIniConfig(); -#ifdef ENABLE_OPENSSL - //请把证书"test_httpApi.pem"放置在本程序可执行程序同目录下 - try{ - //加载证书,证书包含公钥和私钥 - SSL_Initor::Instance().loadServerPem((exePath() + ".pem").data()); - }catch(...){ - ErrorL << "请把证书:" << (exeName() + ".pem") << "放置在本程序可执行程序同目录下:" << exeDir() << endl; - return 0; - } -#endif //ENABLE_OPENSSL + //加载证书,证书包含公钥和私钥 + SSL_Initor::Instance().loadServerPem((exeDir() + "ssl.pem").data()); //开启http服务器 TcpServer::Ptr httpSrv(new TcpServer()); httpSrv->start(mINI::Instance()[Http::kPort]);//默认80 -#ifdef ENABLE_OPENSSL //如果支持ssl,还可以开启https服务器 TcpServer::Ptr httpsSrv(new TcpServer()); httpsSrv->start(mINI::Instance()[Http::kSSLPort]);//默认443 -#endif //ENABLE_OPENSSL InfoL << "你可以在浏览器输入:http://127.0.0.1/api/my_api?key0=val0&key1=参数1" << endl; diff --git a/tests/test_server.cpp b/tests/test_server.cpp index 84f54d2c..f7d572a3 100644 --- a/tests/test_server.cpp +++ b/tests/test_server.cpp @@ -274,15 +274,8 @@ int main(int argc,char *argv[]) { " rtsp地址 : rtsp://127.0.0.1/live/0\n" " rtmp地址 : rtmp://127.0.0.1/live/0"; - //请把证书"test_server.pem"放置在本程序可执行程序同目录下 - try { - //加载证书,证书包含公钥和私钥 - SSL_Initor::Instance().loadServerPem((exePath() + ".pem").data()); - } catch (...) { - ErrorL << "请把证书:" << (exeName() + ".pem") << "放置在本程序可执行程序同目录下:" << exeDir() << endl; - proxyMap.clear(); - return 0; - } + //加载证书,证书包含公钥和私钥 + SSL_Initor::Instance().loadServerPem((exeDir() + "ssl.pem").data()); uint16_t shellPort = mINI::Instance()[Shell::kPort]; uint16_t rtspPort = mINI::Instance()[Rtsp::kPort];