How can one use cpp-netlib to implement a HTTPS-server?
- cpp-netlib can be used as a HTTP server (see service selector, handler and main in my example code).
- With boost::asio setting up a SSL connection is not too hard (see my attempt at SSL).
- cpp-netlib accepts a boost::asio::io_service via the options provided to the constructor (cpp-netlib reference)
The following questions stop me from combining asio SSL and cpp-netlib:
Both SSL via asio and cpp-netlib use an asio acceptor that listens to a port (e.g. 80 or 443) and then a separate session for the actual connection.
I assume that for HTTPS:
- You use the asio ssl acceptor
- Which instantiates a connection
- Then perform the SSL handshake over this connection, and finally
- Have cpp-netlib serve HTTP over this connection
But how can I separate cpp-netlib's HTTP connection handler from the acceptor is uses?
Or does one pass a io_service from the asio SSL connection? If so, which one? Or are they all the same?
Or is there a completely different route to take?
The most recent release of cpp-netlib contains a working example. You'll find it in cpp-netlib-0.11.1RC2/libs/network/example/http/ssl. The github files are there: https://github.com/cpp-netlib/cpp-netlib/tree/0.11-devel/libs/network/example/http/ssl
You have to use an async_server.