From e4342b51b2d42c8ca821ee43cb63590e43c485ad Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Mon, 4 Mar 2019 17:25:50 -0800 Subject: [PATCH] SSL teardowns are in an associated namespace --- CHANGELOG.md | 1 + include/boost/beast/websocket/impl/ssl.hpp | 2 - include/boost/beast/websocket/ssl.hpp | 2 - test/beast/websocket/CMakeLists.txt | 1 + test/beast/websocket/Jamfile | 1 + test/beast/websocket/ssl.cpp | 74 ++++++++++++++++++++++ 6 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 test/beast/websocket/ssl.cpp diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fee401d..a5008a55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Version 228: * The Fields concept is deprecated (API Change) * Fix includes.xsl for newer doxygen * Tidy up quick reference +* SSL teardowns are in an associated namespace -------------------------------------------------------------------------------- diff --git a/include/boost/beast/websocket/impl/ssl.hpp b/include/boost/beast/websocket/impl/ssl.hpp index 03a959a2..f5530226 100644 --- a/include/boost/beast/websocket/impl/ssl.hpp +++ b/include/boost/beast/websocket/impl/ssl.hpp @@ -14,7 +14,6 @@ namespace boost { namespace beast { -namespace websocket { /* @@ -54,7 +53,6 @@ async_teardown( std::forward(handler)); } -} // websocket } // beast } // boost diff --git a/include/boost/beast/websocket/ssl.hpp b/include/boost/beast/websocket/ssl.hpp index ecd48910..ecf0407b 100644 --- a/include/boost/beast/websocket/ssl.hpp +++ b/include/boost/beast/websocket/ssl.hpp @@ -17,7 +17,6 @@ namespace boost { namespace beast { -namespace websocket { /** Tear down a `net::ssl::stream`. @@ -79,7 +78,6 @@ async_teardown( net::ssl::stream& stream, TeardownHandler&& handler); -} // websocket } // beast } // boost diff --git a/test/beast/websocket/CMakeLists.txt b/test/beast/websocket/CMakeLists.txt index 14e11db0..21685116 100644 --- a/test/beast/websocket/CMakeLists.txt +++ b/test/beast/websocket/CMakeLists.txt @@ -32,6 +32,7 @@ add_executable (tests-beast-websocket read2.cpp read3.cpp rfc6455.cpp + ssl.cpp stream.cpp stream_base.cpp stream_explicit.cpp diff --git a/test/beast/websocket/Jamfile b/test/beast/websocket/Jamfile index a2769339..e276d909 100644 --- a/test/beast/websocket/Jamfile +++ b/test/beast/websocket/Jamfile @@ -22,6 +22,7 @@ local SOURCES = read2.cpp read3.cpp rfc6455.cpp + ssl.cpp stream.cpp stream_base.cpp stream_explicit.cpp diff --git a/test/beast/websocket/ssl.cpp b/test/beast/websocket/ssl.cpp new file mode 100644 index 00000000..d810c781 --- /dev/null +++ b/test/beast/websocket/ssl.cpp @@ -0,0 +1,74 @@ +// +// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// Official repository: https://github.com/boostorg/beast +// + +// VFALCO This causes a compilation error +#include + +// Test that header file is self-contained. +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace beast { +namespace websocket { + +class ssl_test : public unit_test::suite +{ +public: + template + void + testTeardown() + { + net::io_context ioc; + net::ssl::context ctx(net::ssl::context::sslv23); + Socket ss(ioc, ctx); + + struct handler + { + void + operator()(error_code) + { + } + }; + + websocket::stream ws(ioc, ctx); + + BEAST_EXPECT(static_cast< + void(websocket::stream::*)( + close_reason const&)>( + &websocket::stream::close)); + + BEAST_EXPECT(static_cast< + void(websocket::stream::*)( + close_reason const&, error_code&)>( + &websocket::stream::close)); + } + + void + run() override + { + testTeardown< + boost::asio::ssl::stream< + boost::asio::basic_stream_socket< + boost::asio::ip::tcp, + boost::asio::executor>>>(); + + } +}; + +BEAST_DEFINE_TESTSUITE(beast,websocket,ssl); + +} // websocket +} // beast +} // boost