Question

How can one use cpp-netlib to implement a HTTPS-server?

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:

    1. You use the asio ssl acceptor
    2. Which instantiates a connection
    3. Then perform the SSL handshake over this connection, and finally
    4. 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?

Était-ce utile?

La solution 2

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.

Autres conseils

A long shot, but have you tried the following:

  • #define BOOST_NETWORK_ENABLE_HTTPS
    before including the boost network http client.

  • Make sure OpenSSL is in the compiler path.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top