From bbd62dd18165f30ec213395a6e913c146157cc27 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sat, 23 Feb 2019 09:56:52 -0800 Subject: [PATCH] ssl_stream is a public interface --- CHANGELOG.md | 1 + doc/qbk/quickref.xml | 4 +-- doc/source.dox | 12 ++++---- doc/xsl/includes_foot.xsl | 3 ++ include/boost/beast/ssl.hpp | 17 +++++++++++ .../core => ssl}/ssl_stream.hpp | 9 ++++-- test/beast/CMakeLists.txt | 4 ++- test/beast/Jamfile | 10 +++++-- .../CMakeLists.txt | 7 ++--- .../{experimental => _experimental}/Jamfile | 0 .../{experimental => _experimental}/error.cpp | 0 .../icy_stream.cpp | 0 .../ssl_stream.cpp | 0 .../stream.cpp | 0 test/beast/ssl.cpp | 11 +++++++ test/beast/ssl/CMakeLists.txt | 20 +++++++++++++ test/beast/ssl/Jamfile | 29 +++++++++++++++++++ test/beast/ssl/ssl_stream.cpp | 15 ++++++++++ 18 files changed, 125 insertions(+), 17 deletions(-) create mode 100644 include/boost/beast/ssl.hpp rename include/boost/beast/{_experimental/core => ssl}/ssl_stream.hpp (98%) rename test/beast/{experimental => _experimental}/CMakeLists.txt (74%) rename test/beast/{experimental => _experimental}/Jamfile (100%) rename test/beast/{experimental => _experimental}/error.cpp (100%) rename test/beast/{experimental => _experimental}/icy_stream.cpp (100%) rename test/beast/{experimental => _experimental}/ssl_stream.cpp (100%) rename test/beast/{experimental => _experimental}/stream.cpp (100%) create mode 100644 test/beast/ssl.cpp create mode 100644 test/beast/ssl/CMakeLists.txt create mode 100644 test/beast/ssl/Jamfile create mode 100644 test/beast/ssl/ssl_stream.cpp diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a0edfd..c00e32d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Version 219: * More split definitions in test::stream * Visual Studio 2017 minimum requirement for Windows * Better treatment of SSL short reads +* ssl_stream is a public interface -------------------------------------------------------------------------------- diff --git a/doc/qbk/quickref.xml b/doc/qbk/quickref.xml index ac55d4fb..4119a5f4 100644 --- a/doc/qbk/quickref.xml +++ b/doc/qbk/quickref.xml @@ -38,14 +38,15 @@ iequal iless rate_policy_access 🞲 + saved_handler 🞲 Classes (2 of 2) - saved_handler 🞲 span simple_rate_policy 🞲 + ssl_stream 🞲 static_string stable_async_op_base 🞲 string_param @@ -362,7 +363,6 @@ Classes - ssl_stream http::icy_stream test::fail_count test::handler 🞲 diff --git a/doc/source.dox b/doc/source.dox index a9c5737f..7f943c46 100644 --- a/doc/source.dox +++ b/doc/source.dox @@ -104,13 +104,14 @@ WARN_LOGFILE = #--------------------------------------------------------------------------- INPUT = \ $(LIB_DIR)/include/boost/beast/ \ - $(LIB_DIR)/include/boost/beast/core \ - $(LIB_DIR)/include/boost/beast/http \ - $(LIB_DIR)/include/boost/beast/websocket \ - $(LIB_DIR)/include/boost/beast/zlib \ $(LIB_DIR)/include/boost/beast/_experimental/core \ $(LIB_DIR)/include/boost/beast/_experimental/http \ - $(LIB_DIR)/include/boost/beast/_experimental/test + $(LIB_DIR)/include/boost/beast/_experimental/test \ + $(LIB_DIR)/include/boost/beast/core \ + $(LIB_DIR)/include/boost/beast/http \ + $(LIB_DIR)/include/boost/beast/ssl \ + $(LIB_DIR)/include/boost/beast/websocket \ + $(LIB_DIR)/include/boost/beast/zlib INPUT_ENCODING = UTF-8 FILE_PATTERNS = @@ -289,6 +290,7 @@ PREDEFINED = \ BOOST_BEAST_DOXYGEN \ BOOST_BEAST_USE_POSIX_FILE=1 \ BOOST_BEAST_USE_WIN32_FILE=1 \ + BOOST_BEAST_SPLIT_COMPILATION=1 \ BOOST_ASIO_INITFN_RESULT_TYPE(t,a)=__deduced__ \ GENERATING_DOCUMENTATION \ BOOST_BEAST_DECL diff --git a/doc/xsl/includes_foot.xsl b/doc/xsl/includes_foot.xsl index b5b91184..f50c71d5 100644 --- a/doc/xsl/includes_foot.xsl +++ b/doc/xsl/includes_foot.xsl @@ -6,6 +6,9 @@ Convenience header [include_file boost/beast/http.hpp] + + Convenience header [include_file boost/beast/ssl.hpp] + Convenience header [include_file boost/beast/websocket.hpp] diff --git a/include/boost/beast/ssl.hpp b/include/boost/beast/ssl.hpp new file mode 100644 index 00000000..fa77d9b7 --- /dev/null +++ b/include/boost/beast/ssl.hpp @@ -0,0 +1,17 @@ +// +// 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 +// + +#ifndef BOOST_BEAST_SSL_HPP +#define BOOST_BEAST_SSL_HPP + +#include + +#include + +#endif diff --git a/include/boost/beast/_experimental/core/ssl_stream.hpp b/include/boost/beast/ssl/ssl_stream.hpp similarity index 98% rename from include/boost/beast/_experimental/core/ssl_stream.hpp rename to include/boost/beast/ssl/ssl_stream.hpp index 0a2bd98f..a1b602d1 100644 --- a/include/boost/beast/_experimental/core/ssl_stream.hpp +++ b/include/boost/beast/ssl/ssl_stream.hpp @@ -16,6 +16,11 @@ #include #include + +// VFALCO We include this because anyone who uses ssl will +// very likely need to check for ssl::error::stream_truncated +#include + #include #include #include @@ -37,11 +42,11 @@ namespace beast { strand. @par Example - To use this template with a `net::ip::tcp::socket`, you would write: + To use this template with a @ref tcp_stream, you would write: @code net::io_context ioc; net::ssl::context ctx{net::ssl::context::sslv23}; - boost::beast::ssl_stream sock{ioc, ctx}; + beast::ssl_stream sock{ioc, ctx}; @endcode In addition to providing an interface identical to `net::ssl::stream`, diff --git a/test/beast/CMakeLists.txt b/test/beast/CMakeLists.txt index 00a181cc..8fd08765 100644 --- a/test/beast/CMakeLists.txt +++ b/test/beast/CMakeLists.txt @@ -11,9 +11,10 @@ add_definitions (-DBOOST_BEAST_ALLOW_DEPRECATED) add_definitions (-DBOOST_BEAST_TESTS) +add_subdirectory (_experimental) add_subdirectory (core) -add_subdirectory (experimental) add_subdirectory (http) +add_subdirectory (ssl) add_subdirectory (websocket) add_subdirectory (zlib) @@ -30,6 +31,7 @@ add_executable (tests-beast Jamfile core.cpp http.cpp + ssl.cpp version.cpp websocket.cpp zlib.cpp diff --git a/test/beast/Jamfile b/test/beast/Jamfile index b557f011..6cb681b7 100644 --- a/test/beast/Jamfile +++ b/test/beast/Jamfile @@ -10,32 +10,36 @@ alias run-tests : [ compile core.cpp ] [ compile http.cpp ] + [ compile ssl.cpp ] [ compile version.cpp ] [ compile websocket.cpp ] [ compile zlib.cpp ] + _experimental//run-tests core//run-tests http//run-tests + ssl//run-tests websocket//run-tests zlib//run-tests - experimental//run-tests ; alias fat-tests : + _experimental//fat-tests core//fat-tests http//fat-tests + ssl//fat-tests websocket//fat-tests zlib//fat-tests - experimental//fat-tests ; explicit fat-tests ; alias run-fat-tests : + _experimental//run-fat-tests core//run-fat-tests http//run-fat-tests + ssl//run-fat-tests websocket//run-fat-tests zlib//run-fat-tests - experimental//run-fat-tests ; explicit run-fat-tests ; diff --git a/test/beast/experimental/CMakeLists.txt b/test/beast/_experimental/CMakeLists.txt similarity index 74% rename from test/beast/experimental/CMakeLists.txt rename to test/beast/_experimental/CMakeLists.txt index 5b870f5a..ced4b54f 100644 --- a/test/beast/experimental/CMakeLists.txt +++ b/test/beast/_experimental/CMakeLists.txt @@ -9,17 +9,16 @@ GroupSources (include/boost/beast beast) GroupSources (test/extras/include/boost/beast extras) -GroupSources (test/beast/experimental "/") +GroupSources (test/beast/_experimental "/") -add_executable (tests-beast-experimental +add_executable (tests-beast-_experimental ${BOOST_BEAST_FILES} ${EXTRAS_FILES} ${TEST_MAIN} Jamfile error.cpp icy_stream.cpp - ssl_stream.cpp stream.cpp ) -set_property(TARGET tests-beast-experimental PROPERTY FOLDER "tests") +set_property(TARGET tests-beast-_experimental PROPERTY FOLDER "tests") diff --git a/test/beast/experimental/Jamfile b/test/beast/_experimental/Jamfile similarity index 100% rename from test/beast/experimental/Jamfile rename to test/beast/_experimental/Jamfile diff --git a/test/beast/experimental/error.cpp b/test/beast/_experimental/error.cpp similarity index 100% rename from test/beast/experimental/error.cpp rename to test/beast/_experimental/error.cpp diff --git a/test/beast/experimental/icy_stream.cpp b/test/beast/_experimental/icy_stream.cpp similarity index 100% rename from test/beast/experimental/icy_stream.cpp rename to test/beast/_experimental/icy_stream.cpp diff --git a/test/beast/experimental/ssl_stream.cpp b/test/beast/_experimental/ssl_stream.cpp similarity index 100% rename from test/beast/experimental/ssl_stream.cpp rename to test/beast/_experimental/ssl_stream.cpp diff --git a/test/beast/experimental/stream.cpp b/test/beast/_experimental/stream.cpp similarity index 100% rename from test/beast/experimental/stream.cpp rename to test/beast/_experimental/stream.cpp diff --git a/test/beast/ssl.cpp b/test/beast/ssl.cpp new file mode 100644 index 00000000..3bb9e409 --- /dev/null +++ b/test/beast/ssl.cpp @@ -0,0 +1,11 @@ +// +// 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 +// + +// Test that header file is self-contained. +#include diff --git a/test/beast/ssl/CMakeLists.txt b/test/beast/ssl/CMakeLists.txt new file mode 100644 index 00000000..84fb22a1 --- /dev/null +++ b/test/beast/ssl/CMakeLists.txt @@ -0,0 +1,20 @@ +# +# 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 +# + +GroupSources (include/boost/beast beast) +GroupSources (test/beast/ssl "/") + +add_executable (tests-beast-ssl + ${BOOST_BEAST_FILES} + ${TEST_MAIN} + Jamfile + ssl_stream.cpp +) + +set_property(TARGET tests-beast-ssl PROPERTY FOLDER "tests") diff --git a/test/beast/ssl/Jamfile b/test/beast/ssl/Jamfile new file mode 100644 index 00000000..50a3e787 --- /dev/null +++ b/test/beast/ssl/Jamfile @@ -0,0 +1,29 @@ +# +# 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 +# + +local SOURCES = + ssl_stream.cpp + ; + +local RUN_TESTS ; + +for local f in $(SOURCES) +{ + RUN_TESTS += [ run $(f) $(TEST_MAIN) ] ; +} + +alias run-tests : $(RUN_TESTS) ; + +exe fat-tests : $(TEST_MAIN) $(SOURCES) ; + +explicit fat-tests ; + +run $(TEST_MAIN) $(SOURCES) : : : : run-fat-tests ; + +explicit run-fat-tests ; diff --git a/test/beast/ssl/ssl_stream.cpp b/test/beast/ssl/ssl_stream.cpp new file mode 100644 index 00000000..6ac4745c --- /dev/null +++ b/test/beast/ssl/ssl_stream.cpp @@ -0,0 +1,15 @@ +// +// 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 +// + +#if BOOST_BEAST_USE_OPENSSL + +// Test that header file is self-contained. +#include + +#endif