Examples use ssl_stream

fix #1455
This commit is contained in:
Vinnie Falco
2019-02-16 05:29:13 -08:00
parent 22dcb4a3cb
commit 00e8c381cd
6 changed files with 11 additions and 6 deletions

View File

@ -8,6 +8,7 @@ Version 215:
* Rename to async_op_base::invoke_now
* Add async_op_base::invoke
* Remove CppCon2018 example
* Examples use ssl_stream
--------------------------------------------------------------------------------

View File

@ -18,6 +18,7 @@
#include <boost/beast/core.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/version.hpp>
#include <boost/beast/_experimental/core/ssl_stream.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl/error.hpp>
@ -66,7 +67,7 @@ int main(int argc, char** argv)
// These objects perform our I/O
tcp::resolver resolver{ioc};
ssl::stream<tcp::socket> stream{ioc, ctx};
beast::ssl_stream<tcp::socket> stream{ioc, ctx};
// Set SNI Hostname (many hosts need this to handshake successfully)
if(! SSL_set_tlsext_host_name(stream.native_handle(), host))

View File

@ -18,6 +18,7 @@
#include <boost/beast/core.hpp>
#include <boost/beast/http.hpp>
#include <boost/beast/version.hpp>
#include <boost/beast/_experimental/core/ssl_stream.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl/stream.hpp>
#include <boost/config.hpp>
@ -258,7 +259,7 @@ do_session(
beast::error_code ec;
// Construct the stream around the socket
ssl::stream<tcp::socket&> stream{socket, ctx};
beast::ssl_stream<tcp::socket&> stream{socket, ctx};
// Perform the SSL handshake
stream.handshake(ssl::stream_base::server, ec);
@ -269,7 +270,7 @@ do_session(
beast::flat_buffer buffer;
// This lambda is used to send messages
send_lambda<ssl::stream<tcp::socket&>> lambda{stream, close, ec};
send_lambda<beast::ssl_stream<tcp::socket&>> lambda{stream, close, ec};
for(;;)
{

View File

@ -55,7 +55,7 @@ do_session(
// These objects perform our I/O
tcp::resolver resolver{ioc};
websocket::stream<ssl::stream<
websocket::stream<beast::ssl_stream<
beast::tcp_stream<net::io_context::executor_type>>> ws(ioc, ctx);
// Look up the domain name

View File

@ -18,6 +18,7 @@
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/beast/websocket/ssl.hpp>
#include <boost/beast/_experimental/core/ssl_stream.hpp>
#include <boost/asio/connect.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl/stream.hpp>
@ -61,7 +62,7 @@ int main(int argc, char** argv)
// These objects perform our I/O
tcp::resolver resolver{ioc};
websocket::stream<ssl::stream<tcp::socket>> ws{ioc, ctx};
websocket::stream<beast::ssl_stream<tcp::socket>> ws{ioc, ctx};
// Look up the domain name
auto const results = resolver.resolve(host, port);

View File

@ -18,6 +18,7 @@
#include <boost/beast/core.hpp>
#include <boost/beast/websocket.hpp>
#include <boost/beast/websocket/ssl.hpp>
#include <boost/beast/_experimental/core/ssl_stream.hpp>
#include <boost/asio/ip/tcp.hpp>
#include <boost/asio/ssl/stream.hpp>
#include <cstdlib>
@ -42,7 +43,7 @@ do_session(tcp::socket& socket, ssl::context& ctx)
try
{
// Construct the websocket stream around the socket
websocket::stream<ssl::stream<tcp::socket&>> ws{socket, ctx};
websocket::stream<beast::ssl_stream<tcp::socket&>> ws{socket, ctx};
// Perform the SSL handshake
ws.next_layer().handshake(ssl::stream_base::server);