Add --nocertcheck, -n args to skip websocket server certificate verification for all builds.
This commit is contained in:
5
args.cpp
5
args.cpp
@@ -127,3 +127,8 @@ bool args_get_verbose(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
return get_arg_exists(argc, argv, "--verbose", "-v");
|
return get_arg_exists(argc, argv, "--verbose", "-v");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool args_get_nocertcheck(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
return get_arg_exists(argc, argv, "--nocertcheck", "-n");
|
||||||
|
}
|
||||||
|
1
args.h
1
args.h
@@ -16,5 +16,6 @@ bool args_get_cmd(int argc, char* argv[], std::string& cmd);
|
|||||||
bool args_get_dns(int argc, char* argv[], std::string& dns);
|
bool args_get_dns(int argc, char* argv[], std::string& dns);
|
||||||
bool args_get_info(int argc, char* argv[], std::string& info);
|
bool args_get_info(int argc, char* argv[], std::string& info);
|
||||||
bool args_get_verbose(int argc, char* argv[]);
|
bool args_get_verbose(int argc, char* argv[]);
|
||||||
|
bool args_get_nocertcheck(int argc, char* argv[]);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
18
main.cpp
18
main.cpp
@@ -60,6 +60,7 @@ int main(int argc, char* argv[])
|
|||||||
std::string arg_dns;
|
std::string arg_dns;
|
||||||
std::string arg_info;
|
std::string arg_info;
|
||||||
bool arg_verbose = false;
|
bool arg_verbose = false;
|
||||||
|
bool arg_nocertcheck = false;
|
||||||
|
|
||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
{
|
{
|
||||||
@@ -116,6 +117,13 @@ int main(int argc, char* argv[])
|
|||||||
arg_verbose = true;
|
arg_verbose = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// no websocket server certificate verification
|
||||||
|
if (args_get_nocertcheck(argc, argv))
|
||||||
|
{
|
||||||
|
arg_nocertcheck = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Print version info
|
// Print version info
|
||||||
usage_show_version();
|
usage_show_version();
|
||||||
|
|
||||||
@@ -160,11 +168,15 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
client_config.set_proxy(web::web_proxy(utility::conversions::to_string_t(arg_proxy)));
|
client_config.set_proxy(web::web_proxy(utility::conversions::to_string_t(arg_proxy)));
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
|
||||||
// skip certificate verification if debug build
|
// websocket server certificate verification
|
||||||
|
if (arg_nocertcheck)
|
||||||
|
{
|
||||||
|
// skip websocket server certificate verification
|
||||||
std::cout << "Skipping certificate verification." << std::endl;
|
std::cout << "Skipping certificate verification." << std::endl;
|
||||||
client_config.set_validate_certificates(false);
|
client_config.set_validate_certificates(false);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
web::websockets::client::websocket_callback_client client(client_config);
|
web::websockets::client::websocket_callback_client client(client_config);
|
||||||
std::condition_variable cv;
|
std::condition_variable cv;
|
||||||
std::mutex mx;
|
std::mutex mx;
|
||||||
|
@@ -25,6 +25,7 @@ void usage_show_help()
|
|||||||
std::cout << "Optional:" << std::endl;
|
std::cout << "Optional:" << std::endl;
|
||||||
std::cout << " -p, --proxy <addr> proxy address and port" << std::endl;
|
std::cout << " -p, --proxy <addr> proxy address and port" << std::endl;
|
||||||
std::cout << " -d, --dns <dns> dns suffix override" << std::endl;
|
std::cout << " -d, --dns <dns> dns suffix override" << std::endl;
|
||||||
|
std::cout << " -n, --nocertcheck skip websocket server certificate verification" << std::endl;
|
||||||
std::cout << " -v, --verbose verbose output" << std::endl;
|
std::cout << " -v, --verbose verbose output" << std::endl;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
std::cout << "Informational:" << std::endl;
|
std::cout << "Informational:" << std::endl;
|
||||||
|
Reference in New Issue
Block a user