[asio-users] SSL + HTTP Server 3 examples...
Brought to you by:
chris_kohlhoff
From: barcaroller <bar...@gm...> - 2010-12-04 00:30:19
|
I combined some of the SSL server sample code with the HTTP 3 server sample code to create a multi-threaded HTTPS server. It almost works fine. If I point my browser to my HTTPS server, it does an SSL handshake for every GET request (eventhough my HTTPS server returns a "connection: keep-alive" header in its replies). The first handshake and read/write HTML data works great, but then my HTTPS server accepts the second HTTP request, creates a brand new SSL session object (with a brand new SSL socket), passes it the existing SSL context, and the second handshake fails with this obscure message: asio.error.category: asio.ssl asio.error.message: asio.ssl error asio.error.code: 336433429 The error originated in the ASIO SSL sample server code (async_handshake): session::start() socket_.async_handshake(...) // <--- here session::handle_handshake(...) This happens only for the second (and subsequent) handshakes. I've tried several things, but nothing seems to work. Do I need to re-initailize the SSL context when the second SSL session is created? Do I need to re-initialize the io_service that is passed to the second SSL session/connection? I know this is not much to go on but I thought I'd ask before pasting the (rather extensive) source code. Thanks much. |