handle_transport_init received error: TLS handshake failed,WebSocket Connection [::1]:6643 - "" - 0 websocketpp.transport.asio.socket:5 TLS handshake timed out
I use the example of the tls_server , but it not work. I debug the program,find the verify_subject_alternative_name function and verify_common_name function return false, how can l fix it? Can anyone help me, Thank you!
Hei, I have the same error !!
` [2021-03-02 15:28:29] [connect] Successful connection
[2021-03-02 15:28:29] [error] handle_transport_init received error: TLS handshake failed
[2021-03-02 15:28:29] [info] asio async_shutdown error: asio.ssl:336462231 (shutdown while in init) set_reconnecting_listener `
In the end, I didn't solve it!I use nginx to do forwarding....
------------------ 原始邮件 ------------------ 发件人: "zaphoyd/websocketpp" <[email protected]>; 发送时间: 2021年3月2日(星期二) 晚上10:30 收件人: "zaphoyd/websocketpp"<[email protected]>; 抄送: "294450950"<[email protected]>;"Author"<[email protected]>; 主题: Re: [zaphoyd/websocketpp] handle_transport_init received error: TLS handshake failed,WebSocket Connection [::1]:6643 - "" - 0 websocketpp.transport.asio.socket:5 TLS handshake timed out (#848)
Hei, I have the same error !!
[2021-03-02 15:28:29] [connect] Successful connection [2021-03-02 15:28:29] [error] handle_transport_init received error: TLS handshake failed [2021-03-02 15:28:29] [info] asio async_shutdown error: asio.ssl:336462231 (shutdown while in init) set_reconnecting_listener
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Instead of using the verify_common_name and verify_subject_alternative_name functions in the example, this worked for me:
websocketpp::lib::shared_ptr<websocketpp::lib::asio::ssl::context> on_tls_init(const char * hostname, websocketpp::connection_hdl) {
auto ctx = websocketpp::lib::make_shared<boost::asio::ssl::context>(boost::asio::ssl::context::sslv23);
try {
ctx->set_options(boost::asio::ssl::context::default_workarounds |
boost::asio::ssl::context::no_tlsv1 |
boost::asio::ssl::context::no_sslv2 |
boost::asio::ssl::context::no_sslv3 |
boost::asio::ssl::context::single_dh_use);
ctx->set_verify_mode(boost::asio::ssl::verify_peer);
ctx->set_default_verify_paths();
ctx->set_verify_callback(boost::asio::ssl::host_name_verification(std::string(hostname)));
} catch (std::exception& e) {
// handle exception
}
return ctx;
}