Allow non standard cert dir
This commit is contained in:
parent
2914e1fa59
commit
b695f4cb6c
@ -64,8 +64,7 @@ elseif(UNIX)
|
|||||||
target_compile_definitions(ixwebsocket PRIVATE
|
target_compile_definitions(ixwebsocket PRIVATE
|
||||||
IXWEBSOCKET_USE_TLS
|
IXWEBSOCKET_USE_TLS
|
||||||
IXWEBSOCKET_USE_OPEN_SSL
|
IXWEBSOCKET_USE_OPEN_SSL
|
||||||
SSL_CERT_DIR=/etc/ssl/certs
|
IXWEBSOCKET_OPEN_SSL_CERTS="/etc/ssl/certs/"
|
||||||
SSL_CERT_FILE=/etc/ssl/cert.pem
|
|
||||||
)
|
)
|
||||||
target_compile_options(ixwebsocket PRIVATE
|
target_compile_options(ixwebsocket PRIVATE
|
||||||
-nodefaultlibs
|
-nodefaultlibs
|
||||||
@ -96,6 +95,7 @@ elseif(WIN32)
|
|||||||
target_compile_definitions(ixwebsocket PRIVATE
|
target_compile_definitions(ixwebsocket PRIVATE
|
||||||
IXWEBSOCKET_USE_TLS
|
IXWEBSOCKET_USE_TLS
|
||||||
IXWEBSOCKET_USE_OPEN_SSL
|
IXWEBSOCKET_USE_OPEN_SSL
|
||||||
|
IXWEBSOCKET_OPEN_SSL_CERTS=NULL
|
||||||
)
|
)
|
||||||
if(DEBUG)
|
if(DEBUG)
|
||||||
target_compile_options(ixwebsocket PRIVATE
|
target_compile_options(ixwebsocket PRIVATE
|
||||||
|
|||||||
@ -506,7 +506,7 @@ namespace ix
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (SSL_CTX_load_verify_locations(
|
if (SSL_CTX_load_verify_locations(
|
||||||
_ssl_context, _tlsOptions.caFile.c_str(), NULL) != 1)
|
_ssl_context, _tlsOptions.caFile.c_str(), IXWEBSOCKET_OPEN_SSL_CERTS) != 1)
|
||||||
{
|
{
|
||||||
auto sslErr = ERR_get_error();
|
auto sslErr = ERR_get_error();
|
||||||
errMsg = "OpenSSL failed - SSL_CTX_load_verify_locations(\"" +
|
errMsg = "OpenSSL failed - SSL_CTX_load_verify_locations(\"" +
|
||||||
|
|||||||
@ -10,7 +10,12 @@ Websocket::Websocket(std::string host,
|
|||||||
ix::initNetSystem();
|
ix::initNetSystem();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ix::SocketTLSOptions options;
|
||||||
|
options.caFile = "CUSTOM";
|
||||||
|
options.tls = true;
|
||||||
|
|
||||||
webSocket = new ix::WebSocket();
|
webSocket = new ix::WebSocket();
|
||||||
|
webSocket->setTLSOptions(options);
|
||||||
webSocket->enableAutomaticReconnection();
|
webSocket->enableAutomaticReconnection();
|
||||||
webSocket->setUrl(host);
|
webSocket->setUrl(host);
|
||||||
webSocket->setOnMessageCallback([this](const ix::WebSocketMessagePtr &msg) {
|
webSocket->setOnMessageCallback([this](const ix::WebSocketMessagePtr &msg) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user