crow
crow copied to clipboard
Crash using web sockets over https
Trying to combine ssl and websocket examples using VS2015 I've got a crash in SSLAdaptor::is_open()
at the moment of opening the connection. After some examination I found out that SSLAdaptor::ssl_socket_
is nullptr. It happens in Connection::handle()
when calling:
handler_->handle_upgrade(req, res, std::move(adaptor_));
and then adaptor_ is being accessed in lambda expression in Connection::do_read()
:
if (ret && adaptor_.is_open())
Is there any working example how to make websocket connection over https?
Thank you.
As a temporary workaround I have changed SSLAdaptor::ssl_socket_
from unique_ptr to to shared_ptr and defined move constructor for SSLAdaptor like this:
SSLAdaptor(SSLAdaptor&& other) : ssl_socket_(other.ssl_socket_)
{
}
So it works for me for now, but I have not examined all consequences yet.
Oh, my god, I also encountered this problem, which bothered me for two days or so, thank you very much for solving my problem.
You are welcome. You should also keep in mind that Crow has many problems in other aspects, one of them is lack of decent multi-threading support. Unfortunately this project seems to be abandoned so I had to move to Boost.Beast. It costed me some amount of time but it's worth it.
Ok, I understand, thank you very much for your guidance.