diff --git a/.travis.yml b/.travis.yml index 6a6ab527..35a9c076 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,6 @@ env: # to boost's .tar.gz. - LCOV_ROOT=$HOME/lcov - VALGRIND_ROOT=$HOME/valgrind-install - - BOOST_ROOT=$HOME/boost_1_58_0 - - BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.58.0/boost_1_58_0.tar.gz' addons: apt: @@ -36,11 +34,14 @@ matrix: # gcc coverage - compiler: gcc env: + - TOOLSET=gcc + - COMPILER=g++-6 + - CXXSTD=c++11 - GCC_VER=6 - VARIANT=coverage - ADDRESS_MODEL=64 - DO_VALGRIND=false - - BUILD_SYSTEM=cmake + #- BUILD_SYSTEM=cmake - PATH=$PWD/cmake/bin:$PATH addons: apt: @@ -55,6 +56,9 @@ matrix: # older GCC, release - compiler: gcc env: + - TOOLSET=gcc + - COMPILER=g++-4.8 + - CXXSTD=c++11 - GCC_VER=4.8 - VARIANT=release - DO_VALGRIND=false @@ -71,11 +75,14 @@ matrix: # later GCC - compiler: gcc env: + - TOOLSET=gcc + - COMPILER=g++-5 + - CXXSTD=c++11 - GCC_VER=5 - VARIANT=release - DO_VALGRIND=true - ADDRESS_MODEL=64 - - BUILD_SYSTEM=cmake + #- BUILD_SYSTEM=cmake - PATH=$PWD/cmake/bin:$PATH addons: apt: @@ -90,13 +97,16 @@ matrix: # clang ubsan+asan - compiler: clang env: + - TOOLSET=clang + - COMPILER=clang++ + - CXXSTD=c++11 - GCC_VER=5 - VARIANT=ubasan - CLANG_VER=3.8 - DO_VALGRIND=false - ADDRESS_MODEL=64 - UBSAN_OPTIONS='print_stacktrace=1' - - BUILD_SYSTEM=cmake + #- BUILD_SYSTEM=cmake - PATH=$PWD/cmake/bin:$PATH - PATH=$PWD/llvm-$LLVM_VERSION/bin:$PATH addons: @@ -111,7 +121,6 @@ matrix: cache: directories: - - $BOOST_ROOT - $VALGRIND_ROOT - llvm-$LLVM_VERSION - cmake @@ -119,8 +128,88 @@ cache: before_install: &base_before_install - scripts/install-dependencies.sh +install: + - export BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true + - cd .. + - git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root + - cd boost-root + - export BOOST_ROOT="`pwd`" + - export PATH="`pwd`":$PATH + - git submodule update --init tools/build + - git submodule update --init tools/boostdep + - git submodule update --init libs/config + - git submodule update --init libs/any + - git submodule update --init libs/asio + - git submodule update --init libs/algorithm + - git submodule update --init libs/array + - git submodule update --init libs/assert + - git submodule update --init libs/atomic + - git submodule update --init libs/bind + - git submodule update --init libs/chrono + - git submodule update --init libs/concept_check + - git submodule update --init libs/config + - git submodule update --init libs/container + - git submodule update --init libs/context + - git submodule update --init libs/conversion + - git submodule update --init libs/core + - git submodule update --init libs/coroutine + - git submodule update --init libs/date_time + - git submodule update --init libs/detail + - git submodule update --init libs/endian + - git submodule update --init libs/exception + - git submodule update --init libs/filesystem + - git submodule update --init libs/foreach + - git submodule update --init libs/function + - git submodule update --init libs/function_types + - git submodule update --init libs/functional + - git submodule update --init libs/fusion + - git submodule update --init libs/integer + - git submodule update --init libs/intrusive + - git submodule update --init libs/io + - git submodule update --init libs/iostreams + - git submodule update --init libs/iterator + - git submodule update --init libs/lambda + - git submodule update --init libs/lexical_cast + - git submodule update --init libs/locale + - git submodule update --init libs/logic + - git submodule update --init libs/math + - git submodule update --init libs/move + - git submodule update --init libs/mpl + - git submodule update --init libs/numeric/conversion + - git submodule update --init libs/optional + - git submodule update --init libs/pool + - git submodule update --init libs/predef + - git submodule update --init libs/preprocessor + - git submodule update --init libs/program_options + - git submodule update --init libs/proto + - git submodule update --init libs/random + - git submodule update --init libs/range + - git submodule update --init libs/ratio + - git submodule update --init libs/rational + - git submodule update --init libs/regex + - git submodule update --init libs/serialization + - git submodule update --init libs/smart_ptr + - git submodule update --init libs/static_assert + - git submodule update --init libs/system + - git submodule update --init libs/thread + - git submodule update --init libs/throw_exception + - git submodule update --init libs/tokenizer + - git submodule update --init libs/tti + - git submodule update --init libs/tuple + - git submodule update --init libs/type_index + - git submodule update --init libs/type_traits + - git submodule update --init libs/typeof + - git submodule update --init libs/unordered + - git submodule update --init libs/utility + - git submodule update --init libs/variant + - git submodule update --init libs/winapi + - rm -rf libs/beast + - mkdir libs/beast + - cp -r $TRAVIS_BUILD_DIR/* libs/beast + - ./bootstrap.sh + script: - - travis_retry scripts/build-and-test.sh + - travis_retry libs/beast/scripts/build-and-test.sh after_script: - cat nohup.out || echo "nohup.out already deleted" diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ca50347..54b38159 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +Version 86: + +* Boost prep + +-------------------------------------------------------------------------------- + Version 85: * Fix test failure diff --git a/CMakeLists.txt b/CMakeLists.txt index ddedf36c..b46e43f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,11 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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 +# cmake_minimum_required (VERSION 3.5.2) @@ -53,6 +60,11 @@ endif() option (Boost_USE_STATIC_LIBS "Use static libraries for boost" ON) +add_definitions (-DBOOST_ASIO_DISABLE_BOOST_ARRAY=1) +add_definitions (-DBOOST_ASIO_DISABLE_BOOST_BIND=1) +add_definitions (-DBOOST_ASIO_DISABLE_BOOST_DATE_TIME=1) +add_definitions (-DBOOST_ASIO_DISABLE_BOOST_REGEX=1) + set(BOOST_COMPONENTS system) if (Beast_BUILD_EXAMPLES OR Beast_BUILD_TESTS) list(APPEND BOOST_COMPONENTS coroutine context filesystem program_options thread) @@ -82,10 +94,10 @@ endif() find_package(OpenSSL) if (OPENSSL_FOUND) - add_definitions (-DBEAST_USE_OPENSSL=1) + add_definitions (-DBOOST_BEAST_USE_OPENSSL=1) else() - add_definitions (-DBEAST_USE_OPENSSL=0) + add_definitions (-DBOOST_BEAST_USE_OPENSSL=0) message("OpenSSL not found.") endif() @@ -116,18 +128,18 @@ endfunction() if ("${VARIANT}" STREQUAL "coverage") if (MSVC) else() - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2 -fprofile-arcs -ftest-coverage") - set (CMAKE_BUILD_TYPE RELWITHDEBINFO) - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov") + set (CMAKE_BUILD_TYPE DEBUG) + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2 --coverage") + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") endif() elseif ("${VARIANT}" STREQUAL "ubasan") if (MSVC) else() - set (CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -DBEAST_NO_SLOW_TESTS=1 -msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist.supp") - set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined") set (CMAKE_BUILD_TYPE RELWITHDEBINFO) + set (CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -DBOOST_BEAST_NO_SLOW_TESTS=1 -msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=${PROJECT_SOURCE_DIR}/scripts/blacklist.supp") + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address,undefined") endif() elseif ("${VARIANT}" STREQUAL "debug") @@ -165,9 +177,9 @@ if (OPENSSL_FOUND) include_directories (${OPENSSL_INCLUDE_DIR}) endif() -file(GLOB_RECURSE BEAST_INCLUDES - ${PROJECT_SOURCE_DIR}/include/beast/*.hpp - ${PROJECT_SOURCE_DIR}/include/beast/*.ipp +file(GLOB_RECURSE BOOST_BEAST_INCLUDES + ${PROJECT_SOURCE_DIR}/include/boost/beast/*.hpp + ${PROJECT_SOURCE_DIR}/include/boost/beast/*.ipp ) file(GLOB_RECURSE COMMON_INCLUDES @@ -179,8 +191,8 @@ file(GLOB_RECURSE EXAMPLE_INCLUDES ) file(GLOB_RECURSE EXTRAS_INCLUDES - ${PROJECT_SOURCE_DIR}/extras/beast/*.hpp - ${PROJECT_SOURCE_DIR}/extras/beast/*.ipp + ${PROJECT_SOURCE_DIR}/extras/boost/beast/*.hpp + ${PROJECT_SOURCE_DIR}/extras/boost/beast/*.ipp ) if (Beast_BUILD_TESTS) diff --git a/Jamroot b/Jamfile similarity index 84% rename from Jamroot rename to Jamfile index a35ffbb5..5db09a25 100644 --- a/Jamroot +++ b/Jamfile @@ -1,9 +1,11 @@ # -# Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com) +# Copyright (c) 2013-2017 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 +# import os ; import feature ; @@ -53,17 +55,17 @@ if [ os.name ] = MACOSX } variant coverage : - release + debug : - "-msse4.2 -fprofile-arcs -ftest-coverage" - "-lgcov" + "-msse4.2 --coverage" + "--coverage" ; variant ubasan : release : - "-msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=scripts/blacklist.supp" + "-msse4.2 -funsigned-char -fno-omit-frame-pointer -fsanitize=address,undefined -fsanitize-blacklist=libs/beast/scripts/blacklist.supp" "-fsanitize=address,undefined" ; @@ -72,7 +74,6 @@ project beast /boost//headers . ./extras - ./include #/boost//headers /boost/system//boost_system /boost/coroutine//boost_coroutine @@ -83,6 +84,10 @@ project beast multi shared on + BOOST_ASIO_DISABLE_BOOST_ARRAY=1 + BOOST_ASIO_DISABLE_BOOST_BIND=1 + BOOST_ASIO_DISABLE_BOOST_DATE_TIME=1 + BOOST_ASIO_DISABLE_BOOST_REGEX=1 gcc:-std=c++11 gcc:-Wno-unused-parameter gcc:-Wno-unused-variable # Temporary until we can figure out -isystem @@ -108,8 +113,4 @@ project beast NT,gcc-cygwin:__USE_W32_SOCKETS : usage-requirements : - build-dir bin ; - -build-project test ; -build-project example ; diff --git a/appveyor.yml b/appveyor.yml index e6f93604..e19318e4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -22,9 +22,8 @@ install: # - git checkout boost-1.64.0 - xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\beast\ - git submodule update --init tools/build - - git submodule update --init libs/config - git submodule update --init tools/boostdep -# - python tools/boostdep/depinst/depinst.py beast + - git submodule update --init libs/config - git submodule update --init libs/any - git submodule update --init libs/asio - git submodule update --init libs/algorithm @@ -64,7 +63,6 @@ install: - git submodule update --init libs/mpl - git submodule update --init libs/numeric/conversion - git submodule update --init libs/optional -# - git submodule update --init libs/phoenix - git submodule update --init libs/pool - git submodule update --init libs/predef - git submodule update --init libs/preprocessor @@ -77,7 +75,6 @@ install: - git submodule update --init libs/regex - git submodule update --init libs/serialization - git submodule update --init libs/smart_ptr -# - git submodule update --init libs/spirit - git submodule update --init libs/static_assert - git submodule update --init libs/system - git submodule update --init libs/thread diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index cfaad504..fde3a395 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,4 +1,11 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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 +# add_subdirectory (echo-op) add_subdirectory (http-client) diff --git a/example/Jamfile b/example/Jamfile index 61c87b8f..e7059521 100644 --- a/example/Jamfile +++ b/example/Jamfile @@ -4,6 +4,8 @@ # 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 +# build-project echo-op ; build-project http-client ; diff --git a/example/common/detect_ssl.hpp b/example/common/detect_ssl.hpp index 298a644b..c0f2793d 100644 --- a/example/common/detect_ssl.hpp +++ b/example/common/detect_ssl.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_COMMON_DETECT_SSL_HPP -#define BEAST_EXAMPLE_COMMON_DETECT_SSL_HPP +#ifndef BOOST_BEAST_EXAMPLE_COMMON_DETECT_SSL_HPP +#define BOOST_BEAST_EXAMPLE_COMMON_DETECT_SSL_HPP #include #include @@ -19,7 +21,7 @@ //[example_core_detect_ssl_1 -#include +#include #include /** Return `true` if a buffer contains a TLS/SSL client handshake. @@ -50,7 +52,7 @@ is_ssl_handshake(ConstBufferSequence const& buffers); //] -using namespace beast; +using namespace boost::beast; //[example_core_detect_ssl_2 @@ -263,8 +265,8 @@ async_detect_ssl( // uses the result and handler specializations associated with // the completion token to help customize the return value. // - beast::async_completion< - CompletionToken, void(beast::error_code, boost::tribool)> init{token}; + boost::beast::async_completion< + CompletionToken, void(boost::beast::error_code, boost::tribool)> init{token}; // Create the composed operation and launch it. This is a constructor // call followed by invocation of operator(). We use handler_type @@ -275,7 +277,7 @@ async_detect_ssl( detect_ssl_op>{ stream, buffer, init.completion_handler}( - beast::error_code{}, 0); + boost::beast::error_code{}, 0); // This hook lets the caller see a return value when appropriate. // For example this might return std::future if @@ -381,7 +383,7 @@ public: // Our main entry point. This will get called as our // intermediate operations complete. Definition below. // - void operator()(beast::error_code ec, std::size_t bytes_transferred); + void operator()(boost::beast::error_code ec, std::size_t bytes_transferred); }; //] @@ -398,7 +400,7 @@ template< class Handler> void detect_ssl_op:: -operator()(beast::error_code ec, std::size_t bytes_transferred) +operator()(boost::beast::error_code ec, std::size_t bytes_transferred) { // Execute the state machine switch(step_) diff --git a/example/common/helpers.hpp b/example/common/helpers.hpp index 784adc56..a3a72335 100644 --- a/example/common/helpers.hpp +++ b/example/common/helpers.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_COMMON_HELPERS_HPP -#define BEAST_EXAMPLE_COMMON_HELPERS_HPP +#ifndef BOOST_BEAST_EXAMPLE_COMMON_HELPERS_HPP +#define BOOST_BEAST_EXAMPLE_COMMON_HELPERS_HPP #include #include diff --git a/example/common/mime_types.hpp b/example/common/mime_types.hpp index 65f646f9..0037fc00 100644 --- a/example/common/mime_types.hpp +++ b/example/common/mime_types.hpp @@ -4,20 +4,22 @@ // 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 BEAST_EXAMPLE_COMMON_MIME_TYPES_HPP -#define BEAST_EXAMPLE_COMMON_MIME_TYPES_HPP +#ifndef BOOST_BEAST_EXAMPLE_COMMON_MIME_TYPES_HPP +#define BOOST_BEAST_EXAMPLE_COMMON_MIME_TYPES_HPP -#include +#include #include // Return a reasonable mime type based on the extension of a file. // template -beast::string_view +boost::beast::string_view mime_type(boost::filesystem::path const& path) { - using beast::iequals; + using boost::beast::iequals; auto const ext = path.extension().string(); if(iequals(ext, ".txt")) return "text/plain"; if(iequals(ext, ".htm")) return "text/html"; diff --git a/example/common/rfc7231.hpp b/example/common/rfc7231.hpp index 1ee20441..65aac7cd 100644 --- a/example/common/rfc7231.hpp +++ b/example/common/rfc7231.hpp @@ -4,12 +4,14 @@ // 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 BEAST_EXAMPLE_COMMON_RFC7231_HPP -#define BEAST_EXAMPLE_COMMON_RFC7231_HPP +#ifndef BOOST_BEAST_EXAMPLE_COMMON_RFC7231_HPP +#define BOOST_BEAST_EXAMPLE_COMMON_RFC7231_HPP -#include -#include +#include +#include namespace rfc7231 { @@ -27,11 +29,11 @@ namespace rfc7231 { */ template bool -is_expect_100_continue(beast::http::request< - Body, beast::http::basic_fields> const& req) +is_expect_100_continue(boost::beast::http::request< + Body, boost::beast::http::basic_fields> const& req) { - return beast::iequals( - req[beast::http::field::expect], "100-continue"); + return boost::beast::iequals( + req[boost::beast::http::field::expect], "100-continue"); } } // rfc7231 diff --git a/example/common/root_certificates.hpp b/example/common/root_certificates.hpp index 7d935a56..445999a3 100644 --- a/example/common/root_certificates.hpp +++ b/example/common/root_certificates.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP -#define BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP +#ifndef BOOST_BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP +#define BOOST_BEAST_EXAMPLE_COMMON_ROOT_CERTIFICATES_HPP #include #include diff --git a/example/common/session_alloc.hpp b/example/common/session_alloc.hpp index cb1df6a1..f1c940f7 100644 --- a/example/common/session_alloc.hpp +++ b/example/common/session_alloc.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_COMMON_SESSION_ALLOC_HPP -#define BEAST_EXAMPLE_COMMON_SESSION_ALLOC_HPP +#ifndef BOOST_BEAST_EXAMPLE_COMMON_SESSION_ALLOC_HPP +#define BOOST_BEAST_EXAMPLE_COMMON_SESSION_ALLOC_HPP #include #include @@ -18,7 +20,7 @@ #include #if 1 -#include "extras/beast/unit_test/dstream.hpp" +#include "extras/boost/beast/unit_test/dstream.hpp" #endif template diff --git a/example/common/ssl_stream.hpp b/example/common/ssl_stream.hpp index 4238ecde..a23a0256 100644 --- a/example/common/ssl_stream.hpp +++ b/example/common/ssl_stream.hpp @@ -4,12 +4,14 @@ // 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 BEAST_EXAMPLE_COMMON_SSL_STREAM_HPP -#define BEAST_EXAMPLE_COMMON_SSL_STREAM_HPP +#ifndef BOOST_BEAST_EXAMPLE_COMMON_SSL_STREAM_HPP +#define BOOST_BEAST_EXAMPLE_COMMON_SSL_STREAM_HPP -// This include is necessary to work with `ssl::stream` and `beast::websocket::stream` -#include +// This include is necessary to work with `ssl::stream` and `boost::beast::websocket::stream` +#include #include #include @@ -292,42 +294,42 @@ public: template friend void - teardown(beast::websocket::teardown_tag, + teardown(boost::beast::websocket::teardown_tag, ssl_stream& stream, boost::system::error_code& ec); template friend void - async_teardown(beast::websocket::teardown_tag, + async_teardown(boost::beast::websocket::teardown_tag, ssl_stream& stream, TeardownHandler&& handler); }; -// These hooks are used to inform beast::websocket::stream on +// These hooks are used to inform boost::beast::websocket::stream on // how to tear down the connection as part of the WebSocket // protocol specifications template inline void -teardown(beast::websocket::teardown_tag, +teardown(boost::beast::websocket::teardown_tag, ssl_stream& stream, boost::system::error_code& ec) { // Just forward it to the wrapped ssl::stream - using beast::websocket::teardown; - teardown(beast::websocket::teardown_tag{}, *stream.p_, ec); + using boost::beast::websocket::teardown; + teardown(boost::beast::websocket::teardown_tag{}, *stream.p_, ec); } template inline void -async_teardown(beast::websocket::teardown_tag, +async_teardown(boost::beast::websocket::teardown_tag, ssl_stream& stream, TeardownHandler&& handler) { // Just forward it to the wrapped ssl::stream - using beast::websocket::async_teardown; - async_teardown(beast::websocket::teardown_tag{}, + using boost::beast::websocket::async_teardown; + async_teardown(boost::beast::websocket::teardown_tag{}, *stream.p_, std::forward(handler)); } diff --git a/example/common/write_msg.hpp b/example/common/write_msg.hpp index 115f380c..7bcba353 100644 --- a/example/common/write_msg.hpp +++ b/example/common/write_msg.hpp @@ -4,16 +4,18 @@ // 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 BEAST_EXAMPLE_COMMON_WRITE_MSG_HPP -#define BEAST_EXAMPLE_COMMON_WRITE_MSG_HPP +#ifndef BOOST_BEAST_EXAMPLE_COMMON_WRITE_MSG_HPP +#define BOOST_BEAST_EXAMPLE_COMMON_WRITE_MSG_HPP -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -44,15 +46,15 @@ class write_msg_op // operation takes ownership of the message and destroys // it when it is done. // - beast::http::message msg; + boost::beast::http::message msg; // Serializer for the message - beast::http::serializer sr; + boost::beast::http::serializer sr; data( Handler& handler, AsyncWriteStream& stream_, - beast::http::message&& msg_) + boost::beast::http::message&& msg_) : stream(stream_) , msg(std::move(msg_)) , sr(msg) @@ -67,7 +69,7 @@ class write_msg_op // and it also helps to meet Asio's deallocate-before-invocation // guarantee. // - beast::handler_ptr d_; + boost::beast::handler_ptr d_; public: // Asio can move and copy the handler, we support both @@ -99,16 +101,16 @@ public: operator()() { auto& d = *d_; - beast::http::async_write( + boost::beast::http::async_write( d.stream, d.sr, std::move(*this)); } // Completion handler // - // This gets called when beast::http::async_write completes + // This gets called when boost::beast::http::async_write completes // void - operator()(beast::error_code ec) + operator()(boost::beast::error_code ec) { d_.invoke(ec); } @@ -196,27 +198,27 @@ template< class AsyncWriteStream, bool isRequest, class Body, class Fields, class WriteHandler> -beast::async_return_type +boost::beast::async_return_type async_write_msg( AsyncWriteStream& stream, - beast::http::message&& msg, + boost::beast::http::message&& msg, WriteHandler&& handler) { static_assert( - beast::is_async_write_stream::value, + boost::beast::is_async_write_stream::value, "AsyncWriteStream requirements not met"); - static_assert(beast::http::is_body::value, + static_assert(boost::beast::http::is_body::value, "Body requirements not met"); - static_assert(beast::http::is_body_reader::value, + static_assert(boost::beast::http::is_body_reader::value, "BodyReader requirements not met"); - beast::async_completion init{handler}; + boost::beast::async_completion init{handler}; ::detail::write_msg_op< AsyncWriteStream, - beast::handler_type, + boost::beast::handler_type, isRequest, Body, Fields>{ init.completion_handler, stream, diff --git a/example/doc/http_examples.hpp b/example/doc/http_examples.hpp index e0d6aad6..f55eab16 100644 --- a/example/doc/http_examples.hpp +++ b/example/doc/http_examples.hpp @@ -4,8 +4,10 @@ // 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 +// -#include +#include #include /* This file contains the functions and classes found in the documentation @@ -15,7 +17,8 @@ building a network application. */ -// The documentation assumes the beast::http namespace +// The documentation assumes the boost::beast::http namespace +namespace boost { namespace beast { namespace http { @@ -1234,3 +1237,4 @@ print_chunked_body( } // http } // beast +} // boost diff --git a/example/echo-op/CMakeLists.txt b/example/echo-op/CMakeLists.txt index d6af8439..68072c03 100644 --- a/example/echo-op/CMakeLists.txt +++ b/example/echo-op/CMakeLists.txt @@ -1,11 +1,19 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/echo-op "/") add_executable (echo-op - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} + Jamfile echo_op.cpp ) diff --git a/example/echo-op/Jamfile b/example/echo-op/Jamfile index cfc32495..b6c1b18a 100644 --- a/example/echo-op/Jamfile +++ b/example/echo-op/Jamfile @@ -4,6 +4,8 @@ # 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 +# exe echo-op : echo_op.cpp diff --git a/example/echo-op/echo_op.cpp b/example/echo-op/echo_op.cpp index 150c76fc..af372386 100644 --- a/example/echo-op/echo_op.cpp +++ b/example/echo-op/echo_op.cpp @@ -4,8 +4,10 @@ // 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 +// -#include +#include #include #include #include @@ -21,7 +23,7 @@ auto async_echo(AsyncStream& stream, CompletionToken&& token) //] - -> beast::async_return_type; + -> boost::beast::async_return_type; //[example_core_echo_op_2 @@ -64,9 +66,9 @@ async_echo(AsyncStream& stream, CompletionToken&& token) template< class AsyncStream, class CompletionToken> -beast::async_return_type< /*< The [link beast.ref.beast__async_return_type `async_return_type`] customizes the return value based on the completion token >*/ +boost::beast::async_return_type< /*< The [link beast.ref.beast__async_return_type `async_return_type`] customizes the return value based on the completion token >*/ CompletionToken, - void(beast::error_code)> /*< This is the signature for the completion handler >*/ + void(boost::beast::error_code)> /*< This is the signature for the completion handler >*/ async_echo( AsyncStream& stream, CompletionToken&& token); @@ -97,7 +99,7 @@ class echo_op // re-use of memory allocated by composed operations during // a continuation. // - boost::asio::basic_streambuf> buffer; + boost::asio::basic_streambuf> buffer; // handler_ptr requires that the first parameter to the // contained object constructor is a reference to the @@ -106,7 +108,7 @@ class echo_op explicit state(Handler& handler, AsyncStream& stream_) : stream(stream_) , buffer((std::numeric_limits::max)(), - beast::handler_alloc{handler}) + boost::beast::handler_alloc{handler}) { } }; @@ -123,7 +125,7 @@ class echo_op // asio_handler_allocate // asio_handler_deallocate // - beast::handler_ptr p_; + boost::beast::handler_ptr p_; public: // Boost.Asio requires that handlers are CopyConstructible. @@ -145,7 +147,7 @@ public: // The entry point for this handler. This will get called // as our intermediate operations complete. Definition below. // - void operator()(beast::error_code ec, std::size_t bytes_transferred); + void operator()(boost::beast::error_code ec, std::size_t bytes_transferred); // The next four functions are required for our class // to meet the requirements for composed operations. @@ -177,7 +179,7 @@ public: // template void echo_op:: -operator()(beast::error_code ec, std::size_t bytes_transferred) +operator()(boost::beast::error_code ec, std::size_t bytes_transferred) { // Store a reference to our state. The address of the state won't // change, and this solves the problem where dereferencing the @@ -199,7 +201,7 @@ operator()(beast::error_code ec, std::size_t bytes_transferred) // async_read_until could have read past the newline, // use buffer_prefix to make sure we only send one line return boost::asio::async_write(p.stream, - beast::buffer_prefix(bytes_transferred, p.buffer.data()), std::move(*this)); + boost::beast::buffer_prefix(bytes_transferred, p.buffer.data()), std::move(*this)); case 2: p.buffer.consume(bytes_transferred); @@ -295,20 +297,20 @@ class echo_op; // Read a line and echo it back // template -beast::async_return_type +boost::beast::async_return_type async_echo(AsyncStream& stream, CompletionToken&& token) { // Make sure stream meets the requirements. We use static_assert // to cause a friendly message instead of an error novel. // - static_assert(beast::is_async_stream::value, + static_assert(boost::beast::is_async_stream::value, "AsyncStream requirements not met"); // This helper manages some of the handler's lifetime and // uses the result and handler specializations associated with // the completion token to help customize the return value. // - beast::async_completion init{token}; + boost::beast::async_completion init{token}; // Create the composed operation and launch it. This is a constructor // call followed by invocation of operator(). We use handler_type @@ -316,8 +318,8 @@ async_echo(AsyncStream& stream, CompletionToken&& token) // allowing user-defined specializations of the async_result template // to be used. // - echo_op>{ - stream, init.completion_handler}(beast::error_code{}, 0); + echo_op>{ + stream, init.completion_handler}(boost::beast::error_code{}, 0); // This hook lets the caller see a return value when appropriate. // For example this might return std::future if @@ -346,7 +348,7 @@ int main(int, char** argv) acceptor.listen(); acceptor.accept(sock); async_echo(sock, - [&](beast::error_code ec) + [&](boost::beast::error_code ec) { if(ec) std::cerr << argv[0] << ": " << ec.message() << std::endl; diff --git a/example/http-client-ssl/CMakeLists.txt b/example/http-client-ssl/CMakeLists.txt index 3abb8b8d..60df163f 100644 --- a/example/http-client-ssl/CMakeLists.txt +++ b/example/http-client-ssl/CMakeLists.txt @@ -1,12 +1,20 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/common common) GroupSources(example/http-client-ssl "/") add_executable (http-client-ssl - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${COMMON_INCLUDES} + Jamfile http_client_ssl.cpp ) diff --git a/example/http-client-ssl/Jamfile b/example/http-client-ssl/Jamfile index d322b946..cac09415 100644 --- a/example/http-client-ssl/Jamfile +++ b/example/http-client-ssl/Jamfile @@ -4,6 +4,8 @@ # 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 +# import os ; diff --git a/example/http-client-ssl/http_client_ssl.cpp b/example/http-client-ssl/http_client_ssl.cpp index 046b21fc..2583e18a 100644 --- a/example/http-client-ssl/http_client_ssl.cpp +++ b/example/http-client-ssl/http_client_ssl.cpp @@ -4,26 +4,28 @@ // 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 +// #include "../common/root_certificates.hpp" -#include -#include -#include +#include +#include +#include #include #include #include #include -using tcp = boost::asio::ip::tcp; // from -namespace ssl = boost::asio::ssl; // from -namespace http = beast::http; // from +using tcp = boost::asio::ip::tcp; // from +namespace ssl = boost::asio::ssl; // from +namespace http = boost::beast::http; // from int main() { // A helper for reporting errors auto const fail = - [](std::string what, beast::error_code ec) + [](std::string what, boost::beast::error_code ec) { std::cerr << what << ": " << ec.message() << std::endl; std::cerr.flush(); @@ -72,7 +74,7 @@ int main() req.version = 11; req.set(http::field::host, host + ":" + std::to_string(sock.remote_endpoint().port())); - req.set(http::field::user_agent, BEAST_VERSION_STRING); + req.set(http::field::user_agent, BOOST_BEAST_VERSION_STRING); req.prepare_payload(); // Write the HTTP request to the remote host @@ -81,7 +83,7 @@ int main() return fail("write", ec); // This buffer is used for reading and must be persisted - beast::flat_buffer b; + boost::beast::flat_buffer b; // Declare a container to hold the response http::response res; diff --git a/example/http-client/CMakeLists.txt b/example/http-client/CMakeLists.txt index 59044b47..2b7d8ef0 100644 --- a/example/http-client/CMakeLists.txt +++ b/example/http-client/CMakeLists.txt @@ -1,12 +1,19 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/http-client "/") add_executable (http-client - ${BEAST_INCLUDES} - ${EXTRAS_INCLUDES} + ${BOOST_BEAST_INCLUDES} + Jamfile http_client.cpp ) diff --git a/example/http-client/Jamfile b/example/http-client/Jamfile index a39360ea..96c7660e 100644 --- a/example/http-client/Jamfile +++ b/example/http-client/Jamfile @@ -4,6 +4,8 @@ # 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 +# exe http-client : http_client.cpp diff --git a/example/http-client/http_client.cpp b/example/http-client/http_client.cpp index ff4b2039..8396f106 100644 --- a/example/http-client/http_client.cpp +++ b/example/http-client/http_client.cpp @@ -4,31 +4,32 @@ // 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 //[example_http_client -#include -#include -#include +#include +#include +#include #include #include #include #include -using tcp = boost::asio::ip::tcp; // from -namespace http = beast::http; // from +using tcp = boost::asio::ip::tcp; // from +namespace http = boost::beast::http; // from int main() { // A helper for reporting errors auto const fail = - [](std::string what, beast::error_code ec) + [](std::string what, boost::beast::error_code ec) { std::cerr << what << ": " << ec.message() << std::endl; return EXIT_FAILURE; }; - beast::error_code ec; + boost::beast::error_code ec; // Set up an asio socket boost::asio::io_service ios; @@ -50,7 +51,7 @@ int main() http::request req{http::verb::get, "/", 11}; req.set(http::field::host, host + ":" + std::to_string(sock.remote_endpoint().port())); - req.set(http::field::user_agent, BEAST_VERSION_STRING); + req.set(http::field::user_agent, BOOST_BEAST_VERSION_STRING); req.prepare_payload(); // Write the HTTP request to the remote host @@ -59,7 +60,7 @@ int main() return fail("write", ec); // This buffer is used for reading and must be persisted - beast::flat_buffer b; + boost::beast::flat_buffer b; // Declare a container to hold the response http::response res; @@ -78,7 +79,7 @@ int main() // not_connected happens sometimes // so don't bother reporting it. // - if(ec && ec != beast::errc::not_connected) + if(ec && ec != boost::beast::errc::not_connected) return fail("shutdown", ec); // If we get here then the connection is closed gracefully diff --git a/example/http-crawl/CMakeLists.txt b/example/http-crawl/CMakeLists.txt index 477f699c..c33a5e4a 100644 --- a/example/http-crawl/CMakeLists.txt +++ b/example/http-crawl/CMakeLists.txt @@ -1,12 +1,19 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/http-crawl "/") add_executable (http-crawl - ${BEAST_INCLUDES} - ${EXTRAS_INCLUDES} + ${BOOST_BEAST_INCLUDES} + Jamfile urls_large_data.hpp urls_large_data.cpp http_crawl.cpp diff --git a/example/http-crawl/Jamfile b/example/http-crawl/Jamfile index 180be9ec..6d033229 100644 --- a/example/http-crawl/Jamfile +++ b/example/http-crawl/Jamfile @@ -4,6 +4,8 @@ # 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 +# exe http-crawl : http_crawl.cpp diff --git a/example/http-crawl/http_crawl.cpp b/example/http-crawl/http_crawl.cpp index 03ae5172..e22dcf0f 100644 --- a/example/http-crawl/http_crawl.cpp +++ b/example/http-crawl/http_crawl.cpp @@ -4,22 +4,24 @@ // 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 +// #include "urls_large_data.hpp" -#include -#include -#include +#include +#include +#include #include #include #include -using tcp = boost::asio::ip::tcp; // from -namespace http = beast::http; // from +using tcp = boost::asio::ip::tcp; // from +namespace http = boost::beast::http; // from template void -err(beast::error_code const& ec, String const& what) +err(boost::beast::error_code const& ec, String const& what) { std::cerr << what << ": " << ec.message() << std::endl; } @@ -33,7 +35,7 @@ main(int, char const*[]) { // A helper for reporting errors auto const fail = - [](std::string what, beast::error_code ec) + [](std::string what, boost::beast::error_code ec) { std::cerr << what << ": " << ec.message() << std::endl; std::cerr.flush(); @@ -46,7 +48,7 @@ main(int, char const*[]) // Loop over all the URLs for(auto const& host : urls_large_data()) { - beast::error_code ec; + boost::beast::error_code ec; // Look up the domain name tcp::resolver r(ios); @@ -77,7 +79,7 @@ main(int, char const*[]) // Set up an HTTP GET request http::request req{http::verb::get, "/", 11}; req.set(http::field::host, host + std::string(":") + std::to_string(ep.port())); - req.set(http::field::user_agent, BEAST_VERSION_STRING); + req.set(http::field::user_agent, BOOST_BEAST_VERSION_STRING); // Set the Connection: close field, this way the server will close // the connection. This consumes less resources (no TIME_WAIT) because @@ -95,7 +97,7 @@ main(int, char const*[]) // "half-close" here to shut down our end. // sock.shutdown(tcp::socket::shutdown_send, ec); - if(ec && ec != beast::errc::not_connected) + if(ec && ec != boost::beast::errc::not_connected) return fail("shutdown", ec); } if(ec) @@ -105,7 +107,7 @@ main(int, char const*[]) } // This buffer is needed for reading - beast::multi_buffer b; + boost::beast::multi_buffer b; // The response will go into this object http::response res; @@ -129,7 +131,7 @@ main(int, char const*[]) // Now we do the other half of the close, // which is to shut down the receiver. sock.shutdown(tcp::socket::shutdown_receive, ec); - if(ec && ec != beast::errc::not_connected) + if(ec && ec != boost::beast::errc::not_connected) return fail("shutdown", ec); std::cout << res << std::endl; diff --git a/example/http-crawl/urls_large_data.cpp b/example/http-crawl/urls_large_data.cpp index 61d68ba4..0756962d 100644 --- a/example/http-crawl/urls_large_data.cpp +++ b/example/http-crawl/urls_large_data.cpp @@ -4,6 +4,8 @@ // 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 +// #include "urls_large_data.hpp" diff --git a/example/http-crawl/urls_large_data.hpp b/example/http-crawl/urls_large_data.hpp index da4d8eb5..10f77e37 100644 --- a/example/http-crawl/urls_large_data.hpp +++ b/example/http-crawl/urls_large_data.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_HTTP_CRAWL_URLS_LARGE_DATA_HPP -#define BEAST_EXAMPLE_HTTP_CRAWL_URLS_LARGE_DATA_HPP +#ifndef BOOST_BEAST_EXAMPLE_HTTP_CRAWL_URLS_LARGE_DATA_HPP +#define BOOST_BEAST_EXAMPLE_HTTP_CRAWL_URLS_LARGE_DATA_HPP #include diff --git a/example/http-server-fast/CMakeLists.txt b/example/http-server-fast/CMakeLists.txt index 5668ec1b..79580679 100644 --- a/example/http-server-fast/CMakeLists.txt +++ b/example/http-server-fast/CMakeLists.txt @@ -1,12 +1,20 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/common common) GroupSources(example/http-server-fast "/") add_executable (http-server-fast - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${COMMON_INCLUDES} + Jamfile fields_alloc.hpp http_server_fast.cpp ) diff --git a/example/http-server-fast/Jamfile b/example/http-server-fast/Jamfile index 3285b7ac..3a568df0 100644 --- a/example/http-server-fast/Jamfile +++ b/example/http-server-fast/Jamfile @@ -4,6 +4,8 @@ # 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 +# exe http-server-fast : http_server_fast.cpp diff --git a/example/http-server-fast/fields_alloc.hpp b/example/http-server-fast/fields_alloc.hpp index 7550ccb0..b34277b3 100644 --- a/example/http-server-fast/fields_alloc.hpp +++ b/example/http-server-fast/fields_alloc.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_FIELDS_ALLOC_HPP -#define BEAST_EXAMPLE_FIELDS_ALLOC_HPP +#ifndef BOOST_BEAST_EXAMPLE_FIELDS_ALLOC_HPP +#define BOOST_BEAST_EXAMPLE_FIELDS_ALLOC_HPP #include #include diff --git a/example/http-server-fast/http_server_fast.cpp b/example/http-server-fast/http_server_fast.cpp index 95078fc1..0b3751f0 100644 --- a/example/http-server-fast/http_server_fast.cpp +++ b/example/http-server-fast/http_server_fast.cpp @@ -4,14 +4,16 @@ // 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 +// #include "fields_alloc.hpp" #include "../common/mime_types.hpp" -#include -#include -#include +#include +#include +#include #include #include #include @@ -23,9 +25,9 @@ #include #include -namespace ip = boost::asio::ip; // from -using tcp = boost::asio::ip::tcp; // from -namespace http = beast::http; // from +namespace ip = boost::asio::ip; // from +using tcp = boost::asio::ip::tcp; // from +namespace http = boost::beast::http; // from class http_worker { @@ -47,7 +49,7 @@ public: private: using alloc_t = fields_alloc; - using request_body_t = http::basic_dynamic_body>; + using request_body_t = http::basic_dynamic_body>; // The acceptor used to listen for incoming connections. tcp::acceptor& acceptor_; @@ -59,7 +61,7 @@ private: tcp::socket socket_{acceptor_.get_io_service()}; // The buffer for performing reads - beast::flat_static_buffer<8192> buffer_; + boost::beast::flat_static_buffer<8192> buffer_; // The allocator used for the fields in the request and reply. alloc_t alloc_{8192}; @@ -86,13 +88,13 @@ private: void accept() { // Clean up any previous connection. - beast::error_code ec; + boost::beast::error_code ec; socket_.close(ec); buffer_.consume(buffer_.size()); acceptor_.async_accept( socket_, - [this](beast::error_code ec) + [this](boost::beast::error_code ec) { if (ec) { @@ -131,7 +133,7 @@ private: socket_, buffer_, *parser_, - [this](beast::error_code ec) + [this](boost::beast::error_code ec) { if (ec) accept(); @@ -179,7 +181,7 @@ private: http::async_write( socket_, *string_serializer_, - [this](beast::error_code ec) + [this](boost::beast::error_code ec) { socket_.shutdown(tcp::socket::shutdown_send, ec); string_serializer_.reset(); @@ -188,7 +190,7 @@ private: }); } - void send_file(beast::string_view target) + void send_file(boost::beast::string_view target) { // Request path must be absolute and not contain "..". if (target.empty() || target[0] != '/' || target.find("..") != std::string::npos) @@ -205,10 +207,10 @@ private: target.size()); http::file_body::value_type file; - beast::error_code ec; + boost::beast::error_code ec; file.open( full_path.c_str(), - beast::file_mode::read, + boost::beast::file_mode::read, ec); if(ec) { @@ -235,7 +237,7 @@ private: http::async_write( socket_, *file_serializer_, - [this](beast::error_code ec) + [this](boost::beast::error_code ec) { socket_.shutdown(tcp::socket::shutdown_send, ec); file_serializer_.reset(); @@ -250,7 +252,7 @@ private: if (request_deadline_.expires_at() <= std::chrono::steady_clock::now()) { // Close socket to cancel any outstanding operation. - beast::error_code ec; + boost::beast::error_code ec; socket_.close(); // Sleep indefinitely until we're given a new deadline. @@ -259,7 +261,7 @@ private: } request_deadline_.async_wait( - [this](beast::error_code) + [this](boost::beast::error_code) { check_deadline(); }); diff --git a/example/http-server-small/CMakeLists.txt b/example/http-server-small/CMakeLists.txt index dfb1ade7..b49d4a52 100644 --- a/example/http-server-small/CMakeLists.txt +++ b/example/http-server-small/CMakeLists.txt @@ -1,11 +1,19 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/http-server-small "/") add_executable (http-server-small - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} + Jamfile http_server_small.cpp ) diff --git a/example/http-server-small/Jamfile b/example/http-server-small/Jamfile index 2acfe2cb..d52b46fd 100644 --- a/example/http-server-small/Jamfile +++ b/example/http-server-small/Jamfile @@ -4,6 +4,8 @@ # 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 +# exe http-server-small : http_server_small.cpp diff --git a/example/http-server-small/http_server_small.cpp b/example/http-server-small/http_server_small.cpp index f73c7734..c30870fe 100644 --- a/example/http-server-small/http_server_small.cpp +++ b/example/http-server-small/http_server_small.cpp @@ -4,10 +4,12 @@ // 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 +// -#include -#include -#include +#include +#include +#include #include #include #include @@ -16,9 +18,9 @@ #include #include -namespace ip = boost::asio::ip; // from -using tcp = boost::asio::ip::tcp; // from -namespace http = beast::http; // from +namespace ip = boost::asio::ip; // from +using tcp = boost::asio::ip::tcp; // from +namespace http = boost::beast::http; // from namespace my_program_state { @@ -57,7 +59,7 @@ private: tcp::socket socket_; // The buffer for performing reads. - beast::flat_buffer buffer_{8192}; + boost::beast::flat_buffer buffer_{8192}; // The request message. http::request request_; @@ -79,7 +81,7 @@ private: socket_, buffer_, request_, - [self](beast::error_code ec) + [self](boost::beast::error_code ec) { if(!ec) self->process_request(); @@ -106,7 +108,7 @@ private: // we do not recognize the request method. response_.result(http::status::bad_request); response_.set(http::field::content_type, "text/plain"); - beast::ostream(response_.body) + boost::beast::ostream(response_.body) << "Invalid request-method '" << request_.method_string().to_string() << "'"; @@ -123,7 +125,7 @@ private: if(request_.target() == "/count") { response_.set(http::field::content_type, "text/html"); - beast::ostream(response_.body) + boost::beast::ostream(response_.body) << "\n" << "Request count\n" << "\n" @@ -137,7 +139,7 @@ private: else if(request_.target() == "/time") { response_.set(http::field::content_type, "text/html"); - beast::ostream(response_.body) + boost::beast::ostream(response_.body) << "\n" << "Current time\n" << "\n" @@ -152,7 +154,7 @@ private: { response_.result(http::status::not_found); response_.set(http::field::content_type, "text/plain"); - beast::ostream(response_.body) << "File not found\r\n"; + boost::beast::ostream(response_.body) << "File not found\r\n"; } } @@ -167,7 +169,7 @@ private: http::async_write( socket_, response_, - [self](beast::error_code ec) + [self](boost::beast::error_code ec) { self->socket_.shutdown(tcp::socket::shutdown_send, ec); self->deadline_.cancel(); @@ -181,7 +183,7 @@ private: auto self = shared_from_this(); deadline_.async_wait( - [self](beast::error_code ec) + [self](boost::beast::error_code ec) { if(!ec) { @@ -197,7 +199,7 @@ void http_server(tcp::acceptor& acceptor, tcp::socket& socket) { acceptor.async_accept(socket, - [&](beast::error_code ec) + [&](boost::beast::error_code ec) { if(!ec) std::make_shared(std::move(socket))->start(); diff --git a/example/http-server-threaded/CMakeLists.txt b/example/http-server-threaded/CMakeLists.txt index a11dbfa0..9dd68477 100644 --- a/example/http-server-threaded/CMakeLists.txt +++ b/example/http-server-threaded/CMakeLists.txt @@ -1,12 +1,20 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/common common) GroupSources(example/http-server-threaded "/") add_executable (http-server-threaded - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${COMMON_INCLUDES} + Jamfile http_server_threaded.cpp ) diff --git a/example/http-server-threaded/Jamfile b/example/http-server-threaded/Jamfile index f2f5f16e..0486e062 100644 --- a/example/http-server-threaded/Jamfile +++ b/example/http-server-threaded/Jamfile @@ -4,6 +4,8 @@ # 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 +# exe http-server-threaded : http_server_threaded.cpp diff --git a/example/http-server-threaded/http_server_threaded.cpp b/example/http-server-threaded/http_server_threaded.cpp index e75b3796..e33857c6 100644 --- a/example/http-server-threaded/http_server_threaded.cpp +++ b/example/http-server-threaded/http_server_threaded.cpp @@ -4,12 +4,14 @@ // 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 +// #include "../common/mime_types.hpp" -#include -#include -#include +#include +#include +#include #include #include #include @@ -26,19 +28,19 @@ // //------------------------------------------------------------------------------ -namespace ip = boost::asio::ip; // from -using tcp = boost::asio::ip::tcp; // from -namespace http = beast::http; // from +namespace ip = boost::asio::ip; // from +using tcp = boost::asio::ip::tcp; // from +namespace http = boost::beast::http; // from class connection : public std::enable_shared_from_this { tcp::socket sock_; - beast::string_view root_; + boost::beast::string_view root_; public: explicit - connection(tcp::socket&& sock, beast::string_view root) + connection(tcp::socket&& sock, boost::beast::string_view root) : sock_(std::move(sock)) , root_(root) { @@ -57,10 +59,10 @@ public: private: // Send a client error response http::response> - client_error(http::status result, beast::string_view text) + client_error(http::status result, boost::beast::string_view text) { http::response> res{result, 11}; - res.set(http::field::server, BEAST_VERSION_STRING); + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/plain"); res.set(http::field::connection, "close"); res.body = text; @@ -74,7 +76,7 @@ private: not_found() const { http::response res{http::status::not_found, 11}; - res.set(http::field::server, BEAST_VERSION_STRING); + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/html"); res.set(http::field::connection, "close"); res.body = "The file was not found"; @@ -85,10 +87,10 @@ private: // Return an HTTP Server Error // http::response - server_error(beast::error_code const& ec) const + server_error(boost::beast::error_code const& ec) const { http::response res{http::status::internal_server_error, 11}; - res.set(http::field::server, BEAST_VERSION_STRING); + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, "text/html"); res.set(http::field::connection, "close"); res.body = "Error: " + ec.message(); @@ -98,15 +100,15 @@ private: // Return a file response to an HTTP GET request // - http::response + http::response get(boost::filesystem::path const& full_path, - beast::error_code& ec) const + boost::beast::error_code& ec) const { http::response res; - res.set(http::field::server, BEAST_VERSION_STRING); + res.set(http::field::server, BOOST_BEAST_VERSION_STRING); res.set(http::field::content_type, mime_type(full_path)); res.set(http::field::connection, "close"); - res.body.open(full_path.string().c_str(), beast::file_mode::scan, ec); + res.body.open(full_path.string().c_str(), boost::beast::file_mode::scan, ec); if(ec) return res; res.set(http::field::content_length, res.body.size()); @@ -116,7 +118,7 @@ private: // Handle a request template void - do_request(http::request const& req, beast::error_code& ec) + do_request(http::request const& req, boost::beast::error_code& ec) { // verb must be get if(req.method() != http::verb::get) @@ -137,10 +139,10 @@ private: auto full_path = root_.to_string(); full_path.append(req.target().data(), req.target().size()); - beast::error_code file_ec; + boost::beast::error_code file_ec; auto res = get(full_path, file_ec); - if(file_ec == beast::errc::no_such_file_or_directory) + if(file_ec == boost::beast::errc::no_such_file_or_directory) { http::write(sock_, not_found(), ec); } @@ -160,8 +162,8 @@ private: { try { - beast::error_code ec; - beast::flat_buffer buffer; + boost::beast::error_code ec; + boost::beast::flat_buffer buffer; for(;;) { http::request_parser parser; @@ -171,18 +173,18 @@ private: if(ec == http::error::end_of_stream) break; if(ec) - throw beast::system_error{ec}; + throw boost::beast::system_error{ec}; do_request(parser.get(), ec); if(ec) { if(ec != http::error::end_of_stream) - throw beast::system_error{ec}; + throw boost::beast::system_error{ec}; break; } } sock_.shutdown(tcp::socket::shutdown_both, ec); if(ec && ec != boost::asio::error::not_connected) - throw beast::system_error{ec}; + throw boost::beast::system_error{ec}; } catch (const std::exception& e) { diff --git a/example/server-framework/CMakeLists.txt b/example/server-framework/CMakeLists.txt index c111c352..18d14219 100644 --- a/example/server-framework/CMakeLists.txt +++ b/example/server-framework/CMakeLists.txt @@ -1,6 +1,13 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/server-framework "/") GroupSources(example/common "common") @@ -10,9 +17,10 @@ file(GLOB_RECURSE SERVER_INCLUDES ) add_executable (server-framework - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${COMMON_INCLUDES} ${SERVER_INCLUDES} + Jamfile main.cpp ) diff --git a/example/server-framework/Jamfile b/example/server-framework/Jamfile index 80d0406b..82e9bb51 100644 --- a/example/server-framework/Jamfile +++ b/example/server-framework/Jamfile @@ -4,6 +4,8 @@ # 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 +# exe server-framework : main.cpp diff --git a/example/server-framework/README.md b/example/server-framework/README.md index 25bdc411..ffb5c1bd 100644 --- a/example/server-framework/README.md +++ b/example/server-framework/README.md @@ -1,5 +1,5 @@ Beast + src="https://raw.githubusercontent.com/boostorg/beast/master/doc/images/readme.png"> # HTTP and WebSocket built on Boost.Asio in C++11 @@ -67,7 +67,7 @@ ports created in the example program, and the HTTP services contained by the HTTP ports: ServerFramework + src="https://raw.githubusercontent.com/boostorg/beast/master/doc/images/server.png"> ## PortHandler Requirements ```C++ diff --git a/example/server-framework/file_service.hpp b/example/server-framework/file_service.hpp index 8c7056d8..18731974 100644 --- a/example/server-framework/file_service.hpp +++ b/example/server-framework/file_service.hpp @@ -4,18 +4,20 @@ // 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 BEAST_EXAMPLE_SERVER_FILE_SERVICE_HPP -#define BEAST_EXAMPLE_SERVER_FILE_SERVICE_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_FILE_SERVICE_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_FILE_SERVICE_HPP #include "framework.hpp" #include "../common/mime_types.hpp" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include @@ -51,7 +53,7 @@ public: explicit file_service( boost::filesystem::path const& root, - beast::string_view server) + boost::beast::string_view server) : root_(root) , server_(server) { @@ -109,7 +111,7 @@ public: respond( Stream&&, endpoint_type const& ep, - beast::http::request&& req, + boost::beast::http::request&& req, Send const& send) const { boost::ignore_unused(ep); @@ -117,7 +119,7 @@ public: // Determine our action based on the method switch(req.method()) { - case beast::http::verb::get: + case boost::beast::http::verb::get: { // For GET requests we deliver the actual file boost::filesystem::path rel_path(req.target().to_string()); @@ -129,10 +131,10 @@ public: // Calculate full path from root boost::filesystem::path full_path = root_ / rel_path; - beast::error_code ec; + boost::beast::error_code ec; auto res = get(req, full_path, ec); - if(ec == beast::errc::no_such_file_or_directory) + if(ec == boost::beast::errc::no_such_file_or_directory) { send(not_found(req, rel_path)); } @@ -149,7 +151,7 @@ public: return true; } - case beast::http::verb::head: + case boost::beast::http::verb::head: { // We are just going to give them the headers they // would otherwise get, but without the body. @@ -160,10 +162,10 @@ public: // Calculate full path from root boost::filesystem::path full_path = root_ / rel_path; - beast::error_code ec; + boost::beast::error_code ec; auto res = head(req, full_path, ec); - if(ec == beast::errc::no_such_file_or_directory) + if(ec == boost::beast::errc::no_such_file_or_directory) { send(not_found(req, rel_path)); } @@ -194,17 +196,17 @@ private: // Return an HTTP Not Found response // template - beast::http::response + boost::beast::http::response not_found( - beast::http::request const& req, + boost::beast::http::request const& req, boost::filesystem::path const& rel_path) const { boost::ignore_unused(rel_path); - beast::http::response res; + boost::beast::http::response res; res.version = req.version; - res.result(beast::http::status::not_found); - res.set(beast::http::field::server, server_); - res.set(beast::http::field::content_type, "text/html"); + res.result(boost::beast::http::status::not_found); + res.set(boost::beast::http::field::server, server_); + res.set(boost::beast::http::field::content_type, "text/html"); res.body = "The file was not found"; // VFALCO append rel_path res.prepare_payload(); return res; @@ -213,18 +215,18 @@ private: // Return an HTTP Server Error // template - beast::http::response + boost::beast::http::response server_error( - beast::http::request const& req, + boost::beast::http::request const& req, boost::filesystem::path const& rel_path, error_code const& ec) const { boost::ignore_unused(rel_path); - beast::http::response res; + boost::beast::http::response res; res.version = req.version; - res.result(beast::http::status::internal_server_error); - res.set(beast::http::field::server, server_); - res.set(beast::http::field::content_type, "text/html"); + res.result(boost::beast::http::status::internal_server_error); + res.set(boost::beast::http::field::server, server_); + res.set(boost::beast::http::field::content_type, "text/html"); res.body = "Error: " + ec.message(); res.prepare_payload(); return res; @@ -233,43 +235,43 @@ private: // Return a file response to an HTTP GET request // template - boost::optional> + boost::optional> get( - beast::http::request const& req, + boost::beast::http::request const& req, boost::filesystem::path const& full_path, - beast::error_code& ec) const + boost::beast::error_code& ec) const { - beast::http::response res; + boost::beast::http::response res; res.version = req.version; - res.set(beast::http::field::server, server_); - res.set(beast::http::field::content_type, mime_type(full_path)); - res.body.open(full_path.string().c_str(), beast::file_mode::scan, ec); + res.set(boost::beast::http::field::server, server_); + res.set(boost::beast::http::field::content_type, mime_type(full_path)); + res.body.open(full_path.string().c_str(), boost::beast::file_mode::scan, ec); if(ec) return boost::none; - res.set(beast::http::field::content_length, res.body.size()); + res.set(boost::beast::http::field::content_length, res.body.size()); return {std::move(res)}; } // Return a response to an HTTP HEAD request // template - boost::optional> + boost::optional> head( - beast::http::request const& req, + boost::beast::http::request const& req, boost::filesystem::path const& full_path, - beast::error_code& ec) const + boost::beast::error_code& ec) const { - beast::http::response res; + boost::beast::http::response res; res.version = req.version; - res.set(beast::http::field::server, server_); - res.set(beast::http::field::content_type, mime_type(full_path)); + res.set(boost::beast::http::field::server, server_); + res.set(boost::beast::http::field::content_type, mime_type(full_path)); // Use a manual file body here - beast::http::file_body::value_type body; - body.open(full_path.string().c_str(), beast::file_mode::scan, ec); + boost::beast::http::file_body::value_type body; + body.open(full_path.string().c_str(), boost::beast::file_mode::scan, ec); if(ec) return boost::none; - res.set(beast::http::field::content_length, body.size()); + res.set(boost::beast::http::field::content_length, body.size()); return {std::move(res)}; } }; diff --git a/example/server-framework/framework.hpp b/example/server-framework/framework.hpp index 6c288c93..d9c86719 100644 --- a/example/server-framework/framework.hpp +++ b/example/server-framework/framework.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_SERVER_FRAMEWORK_HPP -#define BEAST_EXAMPLE_SERVER_FRAMEWORK_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_FRAMEWORK_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_FRAMEWORK_HPP #include #include diff --git a/example/server-framework/http_async_port.hpp b/example/server-framework/http_async_port.hpp index 7231ca7c..15be3e68 100644 --- a/example/server-framework/http_async_port.hpp +++ b/example/server-framework/http_async_port.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_SERVER_HTTP_ASYNC_PORT_HPP -#define BEAST_EXAMPLE_SERVER_HTTP_ASYNC_PORT_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_HTTP_ASYNC_PORT_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_HTTP_ASYNC_PORT_HPP #include "server.hpp" @@ -16,12 +18,12 @@ #include "../common/rfc7231.hpp" #include "../common/write_msg.hpp" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -57,7 +59,7 @@ class queued_http_write_impl : public queued_http_write Stream& stream_; // The message to send, which we acquire by move or copy - beast::http::message msg_; + boost::beast::http::message msg_; // The handler to invoke when the send completes. Handler handler_; @@ -70,7 +72,7 @@ public: template queued_http_write_impl( Stream& stream, - beast::http::message&& msg, + boost::beast::http::message&& msg, DeducedHandler&& handler) : stream_(stream) , msg_(std::move(msg)) @@ -105,7 +107,7 @@ template< std::unique_ptr make_queued_http_write( Stream& stream, - beast::http::message&& msg, + boost::beast::http::message&& msg, Handler&& handler) { return std::unique_ptr{ @@ -158,10 +160,10 @@ protected: endpoint_type ep_; // The buffer for performing reads - beast::flat_buffer buffer_; + boost::beast::flat_buffer buffer_; // The parser for reading the requests - boost::optional> parser_; + boost::optional> parser_; // This is the queue of outgoing messages std::vector> queue_; @@ -177,7 +179,7 @@ protected: public: // Constructor async_http_con_base( - beast::string_view server_name, + boost::beast::string_view server_name, std::ostream& log, service_list const& services, std::size_t id, @@ -267,7 +269,7 @@ protected: parser_.emplace(std::piecewise_construct, std::make_tuple(1024 * 1024)); // Read just the header - beast::http::async_read_header( + boost::beast::http::async_read_header( impl().stream(), buffer_, *parser_, @@ -299,7 +301,7 @@ protected: // sends a message template void - operator()(beast::http::response&& res) const + operator()(boost::beast::http::response&& res) const { self_.do_write(std::move(res)); } @@ -311,7 +313,7 @@ protected: { // This happens when the other end closes gracefully // - if(ec == beast::http::error::end_of_stream) + if(ec == boost::beast::http::error::end_of_stream) { // VFALCO what about the write queue? return impl().do_shutdown(); @@ -342,7 +344,7 @@ protected: // Read the rest of the message, if any. // - beast::http::async_read( + boost::beast::http::async_read( impl().stream(), buffer_, *parser_, @@ -413,7 +415,7 @@ protected: // template void - do_write(beast::http::response&& res) + do_write(boost::beast::http::response&& res) { // See if a write is in progress if(! writing_) @@ -459,7 +461,7 @@ protected: // should be closed afterwards. For example if // we send a Connection: close. // - if(ec == beast::http::error::end_of_stream) + if(ec == boost::beast::http::error::end_of_stream) return impl().do_shutdown(); // On failure just log and return @@ -565,7 +567,7 @@ private: // not_connected happens under normal // circumstances so don't bother reporting it. // - if(ec && ec != beast::errc::not_connected) + if(ec && ec != boost::beast::errc::not_connected) return this->fail("shutdown", ec); } }; diff --git a/example/server-framework/http_base.hpp b/example/server-framework/http_base.hpp index 6dddb079..e8c853b4 100644 --- a/example/server-framework/http_base.hpp +++ b/example/server-framework/http_base.hpp @@ -4,14 +4,16 @@ // 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 BEAST_EXAMPLE_SERVER_HTTP_BASE_HPP -#define BEAST_EXAMPLE_SERVER_HTTP_BASE_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_HTTP_BASE_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_HTTP_BASE_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -25,11 +27,11 @@ namespace framework { */ class http_base { - beast::string_view server_name_; + boost::beast::string_view server_name_; public: explicit - http_base(beast::string_view server_name) + http_base(boost::beast::string_view server_name) : server_name_(server_name) { } @@ -38,17 +40,17 @@ protected: // Returns a bad request result response // template - beast::http::response - bad_request(beast::http::request const& req) const + boost::beast::http::response + bad_request(boost::beast::http::request const& req) const { - beast::http::response res; + boost::beast::http::response res; // Match the version to the request res.version = req.version; - res.result(beast::http::status::bad_request); - res.set(beast::http::field::server, server_name_); - res.set(beast::http::field::content_type, "text/html"); + res.result(boost::beast::http::status::bad_request); + res.set(boost::beast::http::field::server, server_name_); + res.set(boost::beast::http::field::content_type, "text/html"); res.body = "Bad request"; res.prepare_payload(); return res; @@ -57,16 +59,16 @@ protected: // Returns a 100 Continue result response // template - beast::http::response - continue_100(beast::http::request const& req) const + boost::beast::http::response + continue_100(boost::beast::http::request const& req) const { - beast::http::response res; + boost::beast::http::response res; // Match the version to the request res.version = req.version; - res.result(beast::http::status::continue_); - res.set(beast::http::field::server, server_name_); + res.result(boost::beast::http::status::continue_); + res.set(boost::beast::http::field::server, server_name_); return res; } diff --git a/example/server-framework/http_sync_port.hpp b/example/server-framework/http_sync_port.hpp index 2cd20477..fe8f28cc 100644 --- a/example/server-framework/http_sync_port.hpp +++ b/example/server-framework/http_sync_port.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_SERVER_HTTP_SYNC_PORT_HPP -#define BEAST_EXAMPLE_SERVER_HTTP_SYNC_PORT_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_HTTP_SYNC_PORT_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_HTTP_SYNC_PORT_HPP #include "server.hpp" @@ -16,13 +18,13 @@ #include "../common/rfc7231.hpp" #include "../common/write_msg.hpp" -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -68,12 +70,12 @@ class sync_http_con_base endpoint_type ep_; // The buffer for performing reads - beast::flat_buffer buffer_; + boost::beast::flat_buffer buffer_; public: /// Constructor sync_http_con_base( - beast::string_view server_name, + boost::beast::string_view server_name, std::ostream& log, service_list const& services, std::size_t id, @@ -155,10 +157,10 @@ private: template void operator()( - beast::http::response&& res) const + boost::beast::http::response&& res) const { - beast::http::serializer sr{res}; - beast::http::write(self_.impl().stream(), sr, ec_); + boost::beast::http::serializer sr{res}; + boost::beast::http::write(self_.impl().stream(), sr, ec_); } }; @@ -189,19 +191,19 @@ private: // We construct the dynamic body with a 1MB limit // to prevent vulnerability to buffer attacks. // - beast::http::request_parser parser( + boost::beast::http::request_parser parser( std::piecewise_construct, std::make_tuple(1024* 1024)); // Read the header first - beast::http::read_header(impl().stream(), buffer_, parser, ec); + boost::beast::http::read_header(impl().stream(), buffer_, parser, ec); // This happens when the other end closes gracefully // - if(ec == beast::http::error::end_of_stream) + if(ec == boost::beast::http::error::end_of_stream) { // Give the derived class a chance to do stuff impl().do_shutdown(ec); - if(ec && ec != beast::errc::not_connected) + if(ec && ec != boost::beast::errc::not_connected) return fail("shutdown", ec); return; } @@ -228,11 +230,11 @@ private: // should be closed afterwards. For example if // we send a Connection: close. // - if(ec == beast::http::error::end_of_stream) + if(ec == boost::beast::http::error::end_of_stream) { // Give the derived class a chance to do stuff impl().do_shutdown(ec); - if(ec && ec != beast::errc::not_connected) + if(ec && ec != boost::beast::errc::not_connected) return fail("shutdown", ec); return; } @@ -245,7 +247,7 @@ private: // Read the rest of the message, if any. // - beast::http::read(impl().stream(), buffer_, parser, ec); + boost::beast::http::read(impl().stream(), buffer_, parser, ec); // Shouldn't be getting end_of_stream here; // that would mean that we got an incomplete @@ -272,11 +274,11 @@ private: // should be closed afterwards. For example if // we send a Connection: close. // - if(ec == beast::http::error::end_of_stream) + if(ec == boost::beast::http::error::end_of_stream) { // Give the derived class a chance to do stuff impl().do_shutdown(ec); - if(ec && ec != beast::errc::not_connected) + if(ec && ec != boost::beast::errc::not_connected) return fail("shutdown", ec); return; } @@ -293,10 +295,10 @@ private: // should be closed afterwards. For example if // we send a Connection: close. // - if(ec == beast::http::error::end_of_stream) + if(ec == boost::beast::http::error::end_of_stream) { // Give the derived class a chance to do stuff - if(ec && ec != beast::errc::not_connected) + if(ec && ec != boost::beast::errc::not_connected) return fail("shutdown", ec); return; } diff --git a/example/server-framework/https_ports.hpp b/example/server-framework/https_ports.hpp index 8a4a5c24..79908277 100644 --- a/example/server-framework/https_ports.hpp +++ b/example/server-framework/https_ports.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_SERVER_HTTPS_PORTS_HPP -#define BEAST_EXAMPLE_SERVER_HTTPS_PORTS_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_HTTPS_PORTS_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_HTTPS_PORTS_HPP #include "http_sync_port.hpp" #include "http_async_port.hpp" diff --git a/example/server-framework/main.cpp b/example/server-framework/main.cpp index b89582b2..bdddee02 100644 --- a/example/server-framework/main.cpp +++ b/example/server-framework/main.cpp @@ -4,6 +4,8 @@ // 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 +// #include "server.hpp" @@ -12,7 +14,7 @@ #include "ws_async_port.hpp" #include "ws_sync_port.hpp" -#if BEAST_USE_OPENSSL +#if BOOST_BEAST_USE_OPENSSL #include "https_ports.hpp" #include "multi_port.hpp" #include "wss_ports.hpp" @@ -58,17 +60,17 @@ sig_wait() */ class set_ws_options { - beast::websocket::permessage_deflate pmd_; + boost::beast::websocket::permessage_deflate pmd_; public: - set_ws_options(beast::websocket::permessage_deflate const& pmd) + set_ws_options(boost::beast::websocket::permessage_deflate const& pmd) : pmd_(pmd) { } template void - operator()(beast::websocket::stream& ws) const + operator()(boost::beast::websocket::stream& ws) const { ws.auto_fragment(false); ws.set_option(pmd_); @@ -82,7 +84,7 @@ main( char const* av[]) { using namespace framework; - using namespace beast::http; + using namespace boost::beast::http; // Helper for reporting failures // @@ -131,7 +133,7 @@ main( boost::filesystem::path const root = vm["root"].as(); // These settings will be applied to all new websocket connections - beast::websocket::permessage_deflate pmd; + boost::beast::websocket::permessage_deflate pmd; pmd.client_enable = true; pmd.server_enable = true; pmd.compLevel = 3; @@ -263,7 +265,7 @@ main( // an installed and configured OpenSSL as part of the build. // -#if BEAST_USE_OPENSSL +#if BOOST_BEAST_USE_OPENSSL ssl_certificate cert; diff --git a/example/server-framework/multi_port.hpp b/example/server-framework/multi_port.hpp index c576058e..3a1eac41 100644 --- a/example/server-framework/multi_port.hpp +++ b/example/server-framework/multi_port.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_SERVER_MULTI_PORT_HPP -#define BEAST_EXAMPLE_SERVER_MULTI_PORT_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_MULTI_PORT_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_MULTI_PORT_HPP #include "ws_async_port.hpp" #include "http_async_port.hpp" @@ -15,7 +17,7 @@ #include "../common/detect_ssl.hpp" -#include +#include #include @@ -54,7 +56,7 @@ class multi_con boost::asio::ssl::context& ctx_; // Holds the data we read during ssl detection - beast::flat_static_buffer<6> buffer_; + boost::beast::flat_static_buffer<6> buffer_; public: // Constructor @@ -181,7 +183,7 @@ private: // not_connected happens under normal // circumstances so don't bother reporting it. // - if(ec && ec != beast::errc::not_connected) + if(ec && ec != boost::beast::errc::not_connected) return this->fail("shutdown", ec); } }; @@ -213,8 +215,8 @@ protected: // crash with gcc and clang using libstdc++ // The types of the on_stream callback - using on_new_stream_cb1 = boost::function&)>; - using on_new_stream_cb2 = boost::function>&)>; + using on_new_stream_cb1 = boost::function&)>; + using on_new_stream_cb2 = boost::function>&)>; // Reference to the server instance that made us server& instance_; @@ -244,7 +246,7 @@ public: should have this equivalent signature: @code template - void callback(beast::websocket::stream&); + void callback(boost::beast::websocket::stream&); @endcode In C++14 this can be accomplished with a generic lambda. In C++11 it will be necessary to write out a lambda manually, @@ -280,7 +282,7 @@ public: on_upgrade( socket_type&& sock, endpoint_type ep, - beast::http::request&& req) + boost::beast::http::request&& req) { // Create the connection and call the version of // run that takes the request since we have it already @@ -311,7 +313,7 @@ public: on_upgrade( ssl_stream&& stream, endpoint_type ep, - beast::http::request&& req) + boost::beast::http::request&& req) { std::make_shared( std::move(stream), diff --git a/example/server-framework/server.hpp b/example/server-framework/server.hpp index 6157714c..0cfa3973 100644 --- a/example/server-framework/server.hpp +++ b/example/server-framework/server.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_FRAMEWORK_SERVER_HPP -#define BEAST_EXAMPLE_FRAMEWORK_SERVER_HPP +#ifndef BOOST_BEAST_EXAMPLE_FRAMEWORK_SERVER_HPP +#define BOOST_BEAST_EXAMPLE_FRAMEWORK_SERVER_HPP #include "framework.hpp" diff --git a/example/server-framework/service_list.hpp b/example/server-framework/service_list.hpp index 71d73ae7..b873b31d 100644 --- a/example/server-framework/service_list.hpp +++ b/example/server-framework/service_list.hpp @@ -4,13 +4,15 @@ // 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 BEAST_EXAMPLE_SERVER_SERVICE_LIST_HPP -#define BEAST_EXAMPLE_SERVER_SERVICE_LIST_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_SERVICE_LIST_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_SERVICE_LIST_HPP #include "framework.hpp" -#include +#include #include #include @@ -118,7 +120,7 @@ public: respond( Stream&& stream, endpoint_type const& ep, - beast::http::request&& req, + boost::beast::http::request&& req, Send const& send) const { return try_respond( @@ -141,7 +143,7 @@ private: try_respond( Stream&&, endpoint_type const&, - beast::http::request&&, + boost::beast::http::request&&, Send const&, C const&) const { @@ -162,7 +164,7 @@ private: try_respond( Stream&& stream, endpoint_type const& ep, - beast::http::request&& req, + boost::beast::http::request&& req, Send const& send, C const&) const { diff --git a/example/server-framework/ssl_certificate.hpp b/example/server-framework/ssl_certificate.hpp index aaa2e0b8..31201d07 100644 --- a/example/server-framework/ssl_certificate.hpp +++ b/example/server-framework/ssl_certificate.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_SERVER_SSL_CERTIFICATE_HPP -#define BEAST_EXAMPLE_SERVER_SSL_CERTIFICATE_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_SSL_CERTIFICATE_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_SSL_CERTIFICATE_HPP #include #include diff --git a/example/server-framework/ws_async_port.hpp b/example/server-framework/ws_async_port.hpp index c799ab9f..f7146943 100644 --- a/example/server-framework/ws_async_port.hpp +++ b/example/server-framework/ws_async_port.hpp @@ -4,14 +4,16 @@ // 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 BEAST_EXAMPLE_SERVER_WS_ASYNC_PORT_HPP -#define BEAST_EXAMPLE_SERVER_WS_ASYNC_PORT_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_WS_ASYNC_PORT_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_WS_ASYNC_PORT_HPP #include "server.hpp" -#include -#include +#include +#include #include #include #include @@ -47,7 +49,7 @@ class async_ws_con_base endpoint_type ep_; // This is used to hold the message data - beast::multi_buffer buffer_; + boost::beast::multi_buffer buffer_; protected: // The strand makes sure that our data is @@ -59,7 +61,7 @@ public: // Constructor template async_ws_con_base( - beast::string_view server_name, + boost::beast::string_view server_name, std::ostream& log, std::size_t id, endpoint_type const& ep, @@ -92,16 +94,16 @@ public: // template void - run(beast::http::request const& req) + run(boost::beast::http::request const& req) { // Call the overload of accept() which takes // the request by parameter, instead of reading // it from the network. // impl().stream().async_accept_ex(req, - [&](beast::websocket::response_type& res) + [&](boost::beast::websocket::response_type& res) { - res.set(beast::http::field::server, server_name_); + res.set(boost::beast::http::field::server, server_name_); }, strand_.wrap(std::bind( &async_ws_con_base::on_accept, @@ -118,9 +120,9 @@ protected: // to send back the response. // impl().stream().async_accept_ex( - [&](beast::websocket::response_type& res) + [&](boost::beast::websocket::response_type& res) { - res.set(beast::http::field::server, server_name_); + res.set(boost::beast::http::field::server, server_name_); }, strand_.wrap(std::bind( &async_ws_con_base::on_accept, @@ -133,7 +135,7 @@ protected: void fail(std::string what, error_code ec) { - if(ec != beast::websocket::error::closed) + if(ec != boost::beast::websocket::error::closed) log_ << "[#" << id_ << " " << ep_ << "] " << what << ": " << ec.message() << std::endl; @@ -224,7 +226,7 @@ class async_ws_con // The stream should be created before the base class so // use the "base from member" idiom. // - , public base_from_member> + , public base_from_member> // Constructs last, destroys first // @@ -240,7 +242,7 @@ public: async_ws_con( socket_type&& sock, Args&&... args) - : base_from_member>(std::move(sock)) + : base_from_member>(std::move(sock)) , async_ws_con_base(std::forward(args)...) { } @@ -252,7 +254,7 @@ public: // class to work with different return types for `stream()` such // as a `boost::asio::ip::tcp::socket&` or a `boost::asio::ssl::stream&` // - beast::websocket::stream& + boost::beast::websocket::stream& stream() { return this->member; @@ -282,7 +284,7 @@ class ws_async_port // The type of the on_new_stream callback // using on_new_stream_cb = - boost::function&)>; + boost::function&)>; server& instance_; std::ostream& log_; @@ -301,7 +303,7 @@ public: should have this equivalent signature: @code template - void callback(beast::websocket::stream&); + void callback(boost::beast::websocket::stream&); @endcode In C++14 this can be accomplished with a generic lambda. In C++11 it will be necessary to write out a lambda manually, @@ -357,7 +359,7 @@ public: on_upgrade( socket_type&& sock, endpoint_type ep, - beast::http::request&& req) + boost::beast::http::request&& req) { std::make_shared( std::move(sock), diff --git a/example/server-framework/ws_sync_port.hpp b/example/server-framework/ws_sync_port.hpp index 4ebea95f..9e4f2228 100644 --- a/example/server-framework/ws_sync_port.hpp +++ b/example/server-framework/ws_sync_port.hpp @@ -4,14 +4,16 @@ // 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 BEAST_EXAMPLE_SERVER_WS_SYNC_PORT_HPP -#define BEAST_EXAMPLE_SERVER_WS_SYNC_PORT_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_WS_SYNC_PORT_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_WS_SYNC_PORT_HPP #include "server.hpp" -#include -#include +#include +#include #include #include #include @@ -60,7 +62,7 @@ public: // template sync_ws_con_base( - beast::string_view server_name, + boost::beast::string_view server_name, std::ostream& log, std::size_t id, endpoint_type const& ep, @@ -95,9 +97,9 @@ public: // template void - run(beast::http::request&& req) + run(boost::beast::http::request&& req) { - BOOST_ASSERT(beast::websocket::is_upgrade(req)); + BOOST_ASSERT(boost::beast::websocket::is_upgrade(req)); // We need to transfer ownership of the request object into // the lambda, but there's no C++14 lambda capture @@ -119,7 +121,7 @@ protected: // Don't report the "closed" error since that // happens under normal circumstances. // - if(ec && ec != beast::websocket::error::closed) + if(ec && ec != boost::beast::websocket::error::closed) { log_ << "[#" << id_ << " " << ep_ << "] " << @@ -148,9 +150,9 @@ private: // to send back the response. // impl().stream().accept_ex( - [&](beast::websocket::response_type& res) + [&](boost::beast::websocket::response_type& res) { - res.insert(beast::http::field::server, server_name_); + res.insert(boost::beast::http::field::server, server_name_); }, ec); @@ -172,7 +174,7 @@ private: class lambda { std::shared_ptr self_; - beast::http::request req_; + boost::beast::http::request req_; public: // Constructor @@ -181,11 +183,11 @@ private: // lambda( std::shared_ptr self, - beast::http::request&& req) + boost::beast::http::request&& req) : self_(std::move(self)) , req_(std::move(req)) { - BOOST_ASSERT(beast::websocket::is_upgrade(req_)); + BOOST_ASSERT(boost::beast::websocket::is_upgrade(req_)); } // Invoke the lambda @@ -193,7 +195,7 @@ private: void operator()() { - BOOST_ASSERT(beast::websocket::is_upgrade(req_)); + BOOST_ASSERT(boost::beast::websocket::is_upgrade(req_)); error_code ec; { // Move the message to the stack so we can get @@ -207,9 +209,9 @@ private: // it from the network. // self_->impl().stream().accept_ex(req, - [&](beast::websocket::response_type& res) + [&](boost::beast::websocket::response_type& res) { - res.insert(beast::http::field::server, self_->server_name_); + res.insert(boost::beast::http::field::server, self_->server_name_); }, ec); } @@ -233,7 +235,7 @@ private: // This buffer holds the message. We place a one // megabyte limit on the size to prevent abuse. // - beast::multi_buffer buffer{1024*1024}; + boost::beast::multi_buffer buffer{1024*1024}; // Read the message // @@ -276,7 +278,7 @@ class sync_ws_con // The stream should be created before the base class so // use the "base from member" idiom. // - , public base_from_member> + , public base_from_member> // Constructs last, destroys first // @@ -290,7 +292,7 @@ public: sync_ws_con( socket_type&& sock, Args&&... args) - : base_from_member>(std::move(sock)) + : base_from_member>(std::move(sock)) , sync_ws_con_base(std::forward(args)...) { } @@ -302,7 +304,7 @@ public: // class to work with different return types for `stream()` such // as a `boost::asio::ip::tcp::socket&` or a `boost::asio::ssl::stream&` // - beast::websocket::stream& + boost::beast::websocket::stream& stream() { return this->member; @@ -337,7 +339,7 @@ class ws_sync_port // The type of the on_new_stream callback // using on_new_stream_cb = - boost::function&)>; + boost::function&)>; server& instance_; std::ostream& log_; @@ -356,7 +358,7 @@ public: should have this equivalent signature: @code template - void callback(beast::websocket::stream&); + void callback(boost::beast::websocket::stream&); @endcode In C++14 this can be accomplished with a generic lambda. In C++11 it will be necessary to write out a lambda manually, @@ -412,7 +414,7 @@ public: on_upgrade( socket_type&& sock, endpoint_type ep, - beast::http::request&& req) + boost::beast::http::request&& req) { // Create the connection object and run it, // transferring ownership of the ugprade request. diff --git a/example/server-framework/ws_upgrade_service.hpp b/example/server-framework/ws_upgrade_service.hpp index d4d8f5d6..1245be31 100644 --- a/example/server-framework/ws_upgrade_service.hpp +++ b/example/server-framework/ws_upgrade_service.hpp @@ -4,14 +4,16 @@ // 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 BEAST_EXAMPLE_SERVER_WS_UPGRADE_SERVICE_HPP -#define BEAST_EXAMPLE_SERVER_WS_UPGRADE_SERVICE_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_WS_UPGRADE_SERVICE_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_WS_UPGRADE_SERVICE_HPP #include "framework.hpp" -#include -#include +#include +#include #include namespace framework { @@ -73,13 +75,13 @@ public: respond( Stream&& stream, endpoint_type const& ep, - beast::http::request&& req, + boost::beast::http::request&& req, Send const&) const { // If its not an upgrade request, return `false` // to indicate that we are not handling it. // - if(! beast::websocket::is_upgrade(req)) + if(! boost::beast::websocket::is_upgrade(req)) return false; // Its an ugprade request, so transfer ownership diff --git a/example/server-framework/wss_ports.hpp b/example/server-framework/wss_ports.hpp index ff7f87e1..55d612d4 100644 --- a/example/server-framework/wss_ports.hpp +++ b/example/server-framework/wss_ports.hpp @@ -4,9 +4,11 @@ // 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 BEAST_EXAMPLE_SERVER_WSS_PORTS_HPP -#define BEAST_EXAMPLE_SERVER_WSS_PORTS_HPP +#ifndef BOOST_BEAST_EXAMPLE_SERVER_WSS_PORTS_HPP +#define BOOST_BEAST_EXAMPLE_SERVER_WSS_PORTS_HPP #include "ws_sync_port.hpp" #include "ws_async_port.hpp" @@ -36,7 +38,7 @@ class sync_wss_con // The stream should be created before the base class so // use the "base from member" idiom. // - , public base_from_member>> + , public base_from_member>> // Constructs last, destroys first // @@ -53,7 +55,7 @@ public: socket_type&& sock, boost::asio::ssl::context& ctx, Args&&... args) - : base_from_member>>(std::move(sock), ctx) + : base_from_member>>(std::move(sock), ctx) , sync_ws_con_base(std::forward(args)...) { } @@ -64,7 +66,7 @@ public: sync_wss_con( ssl_stream&& stream, Args&&... args) - : base_from_member>>(std::move(stream)) + : base_from_member>>(std::move(stream)) , sync_ws_con_base(std::forward(args)...) { } @@ -76,7 +78,7 @@ public: // class to work with different return types for `stream()` such // as a `boost::asio::ip::tcp::socket&` or a `boost::asio::ssl::stream&` // - beast::websocket::stream>& + boost::beast::websocket::stream>& stream() { return this->member; @@ -116,7 +118,7 @@ class async_wss_con // The stream should be created before the base class so // use the "base from member" idiom. // - , public base_from_member>> + , public base_from_member>> // Constructs last, destroys first // @@ -132,7 +134,7 @@ public: socket_type&& sock, boost::asio::ssl::context& ctx, Args&&... args) - : base_from_member>>(std::move(sock), ctx) + : base_from_member>>(std::move(sock), ctx) , async_ws_con_base(std::forward(args)...) { } @@ -143,7 +145,7 @@ public: async_wss_con( ssl_stream&& stream, Args&&... args) - : base_from_member>>(std::move(stream)) + : base_from_member>>(std::move(stream)) , async_ws_con_base(std::forward(args)...) { } @@ -155,7 +157,7 @@ public: // class to work with different return types for `stream()` such // as a `boost::asio::ip::tcp::socket&` or a `boost::asio::ssl::stream&` // - beast::websocket::stream>& + boost::beast::websocket::stream>& stream() { return this->member; @@ -211,10 +213,10 @@ class wss_sync_port // The types of the on_new_stream callbacks // using on_new_stream_cb1 = - boost::function&)>; + boost::function&)>; using on_new_stream_cb2 = - boost::function>&)>; + boost::function>&)>; server& instance_; std::ostream& log_; @@ -237,7 +239,7 @@ public: should have this equivalent signature: @code template - void callback(beast::websocket::stream&); + void callback(boost::beast::websocket::stream&); @endcode In C++14 this can be accomplished with a generic lambda. In C++11 it will be necessary to write out a lambda manually, @@ -297,7 +299,7 @@ public: on_upgrade( ssl_stream&& stream, endpoint_type ep, - beast::http::request&& req) + boost::beast::http::request&& req) { // Create the connection object and run it, // transferring ownership of the ugprade request. @@ -328,10 +330,10 @@ class wss_async_port // The types of the on_new_stream callbacks // using on_new_stream_cb1 = - boost::function&)>; + boost::function&)>; using on_new_stream_cb2 = - boost::function>&)>; + boost::function>&)>; // Reference to the server instance that made us server& instance_; @@ -361,7 +363,7 @@ public: should have this equivalent signature: @code template - void callback(beast::websocket::stream&); + void callback(boost::beast::websocket::stream&); @endcode In C++14 this can be accomplished with a generic lambda. In C++11 it will be necessary to write out a lambda manually, @@ -421,7 +423,7 @@ public: on_upgrade( ssl_stream&& stream, endpoint_type ep, - beast::http::request&& req) + boost::beast::http::request&& req) { std::make_shared( std::move(stream), diff --git a/example/websocket-client-ssl/CMakeLists.txt b/example/websocket-client-ssl/CMakeLists.txt index 676c2784..e185fe72 100644 --- a/example/websocket-client-ssl/CMakeLists.txt +++ b/example/websocket-client-ssl/CMakeLists.txt @@ -1,11 +1,19 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/websocket-client-ssl "/") add_executable (websocket-client-ssl - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} + Jamfile websocket_client_ssl.cpp ) diff --git a/example/websocket-client-ssl/Jamfile b/example/websocket-client-ssl/Jamfile index a0a0a2a7..49132cd6 100644 --- a/example/websocket-client-ssl/Jamfile +++ b/example/websocket-client-ssl/Jamfile @@ -4,6 +4,8 @@ # 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 +# import os ; diff --git a/example/websocket-client-ssl/websocket_client_ssl.cpp b/example/websocket-client-ssl/websocket_client_ssl.cpp index eb739f03..d937dc0d 100644 --- a/example/websocket-client-ssl/websocket_client_ssl.cpp +++ b/example/websocket-client-ssl/websocket_client_ssl.cpp @@ -4,12 +4,14 @@ // 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 +// #include "../common/root_certificates.hpp" -#include -#include -#include +#include +#include +#include #include #include #include @@ -18,13 +20,13 @@ using tcp = boost::asio::ip::tcp; // from namespace ssl = boost::asio::ssl; // from -namespace websocket = beast::websocket; // from +namespace websocket = boost::beast::websocket; // from int main() { // A helper for reporting errors auto const fail = - [](std::string what, beast::error_code ec) + [](std::string what, boost::beast::error_code ec) { std::cerr << what << ": " << ec.message() << std::endl; std::cerr.flush(); @@ -81,7 +83,7 @@ int main() return fail("write", ec); // This buffer will hold the incoming message - beast::multi_buffer b; + boost::beast::multi_buffer b; // Read the message into our buffer ws.read(b, ec); @@ -94,13 +96,13 @@ int main() return fail("close", ec); // The buffers() function helps print a ConstBufferSequence - std::cout << beast::buffers(b.data()) << std::endl; + std::cout << boost::beast::buffers(b.data()) << std::endl; // WebSocket says that to close a connection you have // to keep reading messages until you receive a close frame. // Beast delivers the close frame as an error from read. // - beast::drain_buffer drain; // Throws everything away efficiently + boost::beast::drain_buffer drain; // Throws everything away efficiently for(;;) { // Keep reading messages... diff --git a/example/websocket-client/CMakeLists.txt b/example/websocket-client/CMakeLists.txt index 0e97d947..b7f41847 100644 --- a/example/websocket-client/CMakeLists.txt +++ b/example/websocket-client/CMakeLists.txt @@ -1,12 +1,19 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/websocket-client "/") add_executable (websocket-client - ${BEAST_INCLUDES} - ${EXTRAS_INCLUDES} + ${BOOST_BEAST_INCLUDES} + Jamfile websocket_client.cpp ) diff --git a/example/websocket-client/Jamfile b/example/websocket-client/Jamfile index 9dc2a5d4..842ca8f5 100644 --- a/example/websocket-client/Jamfile +++ b/example/websocket-client/Jamfile @@ -4,6 +4,8 @@ # 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 +# exe websocket-client : websocket_client.cpp diff --git a/example/websocket-client/websocket_client.cpp b/example/websocket-client/websocket_client.cpp index 642bfe6f..d73fb727 100644 --- a/example/websocket-client/websocket_client.cpp +++ b/example/websocket-client/websocket_client.cpp @@ -4,24 +4,26 @@ // 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 +// //[example_websocket_client -#include -#include +#include +#include #include #include #include #include -using tcp = boost::asio::ip::tcp; // from -namespace websocket = beast::websocket; // from +using tcp = boost::asio::ip::tcp; // from +namespace websocket = boost::beast::websocket; // from int main() { // A helper for reporting errors auto const fail = - [](std::string what, beast::error_code ec) + [](std::string what, boost::beast::error_code ec) { std::cerr << what << ": " << ec.message() << std::endl; std::cerr.flush(); @@ -60,7 +62,7 @@ int main() return fail("write", ec); // This buffer will hold the incoming message - beast::multi_buffer b; + boost::beast::multi_buffer b; // Read the message into our buffer ws.read(b, ec); @@ -73,13 +75,13 @@ int main() return fail("close", ec); // The buffers() function helps print a ConstBufferSequence - std::cout << beast::buffers(b.data()) << std::endl; + std::cout << boost::beast::buffers(b.data()) << std::endl; // WebSocket says that to close a connection you have // to keep reading messages until you receive a close frame. // Beast delivers the close frame as an error from read. // - beast::drain_buffer drain; // Throws everything away efficiently + boost::beast::drain_buffer drain; // Throws everything away efficiently for(;;) { // Keep reading messages... diff --git a/example/websocket-server-async/CMakeLists.txt b/example/websocket-server-async/CMakeLists.txt index 4aa0846b..e4226953 100644 --- a/example/websocket-server-async/CMakeLists.txt +++ b/example/websocket-server-async/CMakeLists.txt @@ -1,12 +1,20 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/common common) GroupSources(example/websocket-server-async "/") add_executable (websocket-server-async - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${COMMON_INCLUDES} + Jamfile websocket_server_async.cpp ) diff --git a/example/websocket-server-async/Jamfile b/example/websocket-server-async/Jamfile index 59571f2f..475571c3 100644 --- a/example/websocket-server-async/Jamfile +++ b/example/websocket-server-async/Jamfile @@ -4,6 +4,8 @@ # 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 +# exe websocket-server-async : websocket_server_async.cpp diff --git a/example/websocket-server-async/websocket_server_async.cpp b/example/websocket-server-async/websocket_server_async.cpp index fa3acf11..00ffc491 100644 --- a/example/websocket-server-async/websocket_server_async.cpp +++ b/example/websocket-server-async/websocket_server_async.cpp @@ -4,11 +4,13 @@ // 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 +// #include "../common/helpers.hpp" -#include -#include +#include +#include #include #include #include @@ -20,10 +22,10 @@ #include #include -namespace http = beast::http; // from -namespace websocket = beast::websocket; // from -namespace ip = boost::asio::ip; // from -using tcp = boost::asio::ip::tcp; // from +namespace http = boost::beast::http; // from +namespace websocket = boost::beast::websocket; // from +namespace ip = boost::asio::ip; // from +using tcp = boost::asio::ip::tcp; // from //------------------------------------------------------------------------------ // @@ -38,7 +40,7 @@ using tcp = boost::asio::ip::tcp; // from */ class server { - using error_code = beast::error_code; // Saves typing + using error_code = boost::beast::error_code; // Saves typing using clock_type = std::chrono::steady_clock; // For the timer using stream_type = @@ -63,8 +65,8 @@ class server boost::asio::basic_waitable_timer< clock_type> timer_; // Needed for timeouts boost::asio::io_service::strand strand_;// Needed when threads > 1 - beast::multi_buffer buffer_; // Stores the current message - beast::drain_buffer drain_; // Helps discard data on close + boost::beast::multi_buffer buffer_; // Stores the current message + boost::beast::drain_buffer drain_; // Helps discard data on close std::size_t id_; // A small unique id public: @@ -395,7 +397,7 @@ int main(int argc, char* argv[]) s.on_new_stream(set_stream_options{pmd}); // Open the listening port - beast::error_code ec; + boost::beast::error_code ec; s.open(tcp::endpoint{address, port}, ec); if(ec) { diff --git a/extras/beast/doc_debug.hpp b/extras/boost/beast/doc_debug.hpp similarity index 97% rename from extras/beast/doc_debug.hpp rename to extras/boost/beast/doc_debug.hpp index 7023c8a2..85248281 100644 --- a/extras/beast/doc_debug.hpp +++ b/extras/boost/beast/doc_debug.hpp @@ -5,12 +5,12 @@ // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // -#ifndef BEAST_DOC_DEBUG_HPP -#define BEAST_DOC_DEBUG_HPP +#ifndef BOOST_BEAST_DOC_DEBUG_HPP +#define BOOST_BEAST_DOC_DEBUG_HPP namespace beast { -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN /// doc type (documentation debug helper) using doc_type = int; diff --git a/extras/beast/test/fail_counter.hpp b/extras/boost/beast/test/fail_counter.hpp similarity index 94% rename from extras/beast/test/fail_counter.hpp rename to extras/boost/beast/test/fail_counter.hpp index 8c577cbe..317726b7 100644 --- a/extras/beast/test/fail_counter.hpp +++ b/extras/boost/beast/test/fail_counter.hpp @@ -4,13 +4,16 @@ // 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 BEAST_TEST_FAIL_COUNTER_HPP -#define BEAST_TEST_FAIL_COUNTER_HPP +#ifndef BOOST_BEAST_TEST_FAIL_COUNTER_HPP +#define BOOST_BEAST_TEST_FAIL_COUNTER_HPP -#include +#include #include +namespace boost { namespace beast { namespace test { @@ -156,6 +159,7 @@ public: } // test } // beast +} // boost namespace boost { namespace system { diff --git a/extras/beast/test/fail_stream.hpp b/extras/boost/beast/test/fail_stream.hpp similarity index 91% rename from extras/beast/test/fail_stream.hpp rename to extras/boost/beast/test/fail_stream.hpp index c4b38538..eb0b7892 100644 --- a/extras/beast/test/fail_stream.hpp +++ b/extras/boost/beast/test/fail_stream.hpp @@ -4,18 +4,21 @@ // 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 BEAST_TEST_FAIL_STREAM_HPP -#define BEAST_TEST_FAIL_STREAM_HPP +#ifndef BOOST_BEAST_TEST_FAIL_STREAM_HPP +#define BOOST_BEAST_TEST_FAIL_STREAM_HPP -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include +namespace boost { namespace beast { namespace test { @@ -188,5 +191,6 @@ public: } // test } // beast +} // boost #endif diff --git a/extras/beast/test/fuzz.hpp b/extras/boost/beast/test/fuzz.hpp similarity index 89% rename from extras/beast/test/fuzz.hpp rename to extras/boost/beast/test/fuzz.hpp index 8be01658..763c4323 100644 --- a/extras/beast/test/fuzz.hpp +++ b/extras/boost/beast/test/fuzz.hpp @@ -4,14 +4,17 @@ // 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 BEAST_TEST_FUZZ_HPP -#define BEAST_TEST_FUZZ_HPP +#ifndef BOOST_BEAST_TEST_FUZZ_HPP +#define BOOST_BEAST_TEST_FUZZ_HPP -#include -#include +#include +#include #include +namespace boost { namespace beast { namespace test { @@ -97,5 +100,6 @@ fuzz( } // test } // beast +} // boost #endif diff --git a/extras/beast/test/pipe_stream.hpp b/extras/boost/beast/test/pipe_stream.hpp similarity index 96% rename from extras/beast/test/pipe_stream.hpp rename to extras/boost/beast/test/pipe_stream.hpp index b4069024..3d9d56ab 100644 --- a/extras/beast/test/pipe_stream.hpp +++ b/extras/boost/beast/test/pipe_stream.hpp @@ -4,17 +4,19 @@ // 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 BEAST_TEST_PIPE_STREAM_HPP -#define BEAST_TEST_PIPE_STREAM_HPP +#ifndef BOOST_BEAST_TEST_PIPE_STREAM_HPP +#define BOOST_BEAST_TEST_PIPE_STREAM_HPP -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -24,6 +26,7 @@ #include #include +namespace boost { namespace beast { namespace test { @@ -525,5 +528,6 @@ async_write_some(ConstBufferSequence const& buffers, } // test } // beast +} // boost #endif diff --git a/extras/beast/test/sig_wait.hpp b/extras/boost/beast/test/sig_wait.hpp similarity index 78% rename from extras/beast/test/sig_wait.hpp rename to extras/boost/beast/test/sig_wait.hpp index cadd2166..a180967f 100644 --- a/extras/beast/test/sig_wait.hpp +++ b/extras/boost/beast/test/sig_wait.hpp @@ -4,12 +4,15 @@ // 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 BEAST_TEST_SIG_WAIT_HPP -#define BEAST_TEST_SIG_WAIT_HPP +#ifndef BOOST_BEAST_TEST_SIG_WAIT_HPP +#define BOOST_BEAST_TEST_SIG_WAIT_HPP #include +namespace boost { namespace beast { namespace test { @@ -30,5 +33,6 @@ sig_wait() } // test } // beast +} // boost #endif diff --git a/extras/beast/test/string_iostream.hpp b/extras/boost/beast/test/string_iostream.hpp similarity index 91% rename from extras/beast/test/string_iostream.hpp rename to extras/boost/beast/test/string_iostream.hpp index eeeb7e21..7b36725d 100644 --- a/extras/beast/test/string_iostream.hpp +++ b/extras/boost/beast/test/string_iostream.hpp @@ -4,20 +4,23 @@ // 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 BEAST_TEST_STRING_IOSTREAM_HPP -#define BEAST_TEST_STRING_IOSTREAM_HPP +#ifndef BOOST_BEAST_TEST_STRING_IOSTREAM_HPP +#define BOOST_BEAST_TEST_STRING_IOSTREAM_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace test { @@ -169,5 +172,6 @@ public: } // test } // beast +} // boost #endif diff --git a/extras/beast/test/string_istream.hpp b/extras/boost/beast/test/string_istream.hpp similarity index 91% rename from extras/beast/test/string_istream.hpp rename to extras/boost/beast/test/string_istream.hpp index c9692b87..e004c6fe 100644 --- a/extras/beast/test/string_istream.hpp +++ b/extras/boost/beast/test/string_istream.hpp @@ -4,19 +4,22 @@ // 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 BEAST_TEST_STRING_ISTREAM_HPP -#define BEAST_TEST_STRING_ISTREAM_HPP +#ifndef BOOST_BEAST_TEST_STRING_ISTREAM_HPP +#define BOOST_BEAST_TEST_STRING_ISTREAM_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace test { @@ -157,5 +160,6 @@ public: } // test } // beast +} // boost #endif diff --git a/extras/beast/test/string_ostream.hpp b/extras/boost/beast/test/string_ostream.hpp similarity index 90% rename from extras/beast/test/string_ostream.hpp rename to extras/boost/beast/test/string_ostream.hpp index dd57d8a9..a09b320f 100644 --- a/extras/beast/test/string_ostream.hpp +++ b/extras/boost/beast/test/string_ostream.hpp @@ -4,20 +4,23 @@ // 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 BEAST_TEST_STRING_OSTREAM_HPP -#define BEAST_TEST_STRING_OSTREAM_HPP +#ifndef BOOST_BEAST_TEST_STRING_OSTREAM_HPP +#define BOOST_BEAST_TEST_STRING_OSTREAM_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace test { @@ -145,5 +148,6 @@ public: } // test } // beast +} // boost #endif diff --git a/extras/beast/test/test_allocator.hpp b/extras/boost/beast/test/test_allocator.hpp similarity index 95% rename from extras/beast/test/test_allocator.hpp rename to extras/boost/beast/test/test_allocator.hpp index bc468de2..c29aea57 100644 --- a/extras/beast/test/test_allocator.hpp +++ b/extras/boost/beast/test/test_allocator.hpp @@ -4,14 +4,17 @@ // 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 BEAST_TEST_TEST_ALLOCATOR_HPP -#define BEAST_TEST_TEST_ALLOCATOR_HPP +#ifndef BOOST_BEAST_TEST_TEST_ALLOCATOR_HPP +#define BOOST_BEAST_TEST_TEST_ALLOCATOR_HPP #include #include #include +namespace boost { namespace beast { namespace test { @@ -162,5 +165,6 @@ public: } // test } // beast +} // boost #endif diff --git a/extras/beast/test/yield_to.hpp b/extras/boost/beast/test/yield_to.hpp similarity index 93% rename from extras/beast/test/yield_to.hpp rename to extras/boost/beast/test/yield_to.hpp index df5b8a34..c06eab8e 100644 --- a/extras/beast/test/yield_to.hpp +++ b/extras/boost/beast/test/yield_to.hpp @@ -4,9 +4,11 @@ // 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 BEAST_TEST_YIELD_TO_HPP -#define BEAST_TEST_YIELD_TO_HPP +#ifndef BOOST_BEAST_TEST_YIELD_TO_HPP +#define BOOST_BEAST_TEST_YIELD_TO_HPP #include #include @@ -17,6 +19,7 @@ #include #include +namespace boost { namespace beast { namespace test { @@ -78,7 +81,7 @@ public: @param fn... One or more functions to invoke. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template void yield_to(FN&&... fn) @@ -130,5 +133,6 @@ spawn(F0&& f, FN&&... fn) } // test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/amount.hpp b/extras/boost/beast/unit_test/amount.hpp similarity index 85% rename from extras/beast/unit_test/amount.hpp rename to extras/boost/beast/unit_test/amount.hpp index a045d4d7..7022b6fb 100644 --- a/extras/beast/unit_test/amount.hpp +++ b/extras/boost/beast/unit_test/amount.hpp @@ -4,14 +4,17 @@ // 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 BEAST_UNIT_TEST_AMOUNT_HPP -#define BEAST_UNIT_TEST_AMOUNT_HPP +#ifndef BOOST_BEAST_UNIT_TEST_AMOUNT_HPP +#define BOOST_BEAST_UNIT_TEST_AMOUNT_HPP #include #include #include +namespace boost { namespace beast { namespace unit_test { @@ -51,5 +54,6 @@ operator<<(std::ostream& s, amount const& t) } // unit_test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/detail/const_container.hpp b/extras/boost/beast/unit_test/detail/const_container.hpp similarity index 89% rename from extras/beast/unit_test/detail/const_container.hpp rename to extras/boost/beast/unit_test/detail/const_container.hpp index ed613537..d45a25d4 100644 --- a/extras/beast/unit_test/detail/const_container.hpp +++ b/extras/boost/beast/unit_test/detail/const_container.hpp @@ -4,10 +4,13 @@ // 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 BEAST_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP -#define BEAST_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP +#ifndef BOOST_BEAST_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP +#define BOOST_BEAST_UNIT_TEST_DETAIL_CONST_CONTAINER_HPP +namespace boost { namespace beast { namespace unit_test { namespace detail { @@ -87,5 +90,6 @@ public: } // detail } // unit_test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/dstream.hpp b/extras/boost/beast/unit_test/dstream.hpp similarity index 93% rename from extras/beast/unit_test/dstream.hpp rename to extras/boost/beast/unit_test/dstream.hpp index fe02a26e..9ebf5eb1 100644 --- a/extras/beast/unit_test/dstream.hpp +++ b/extras/boost/beast/unit_test/dstream.hpp @@ -4,9 +4,11 @@ // 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 BEAST_UNIT_TEST_DSTREAM_HPP -#define BEAST_UNIT_TEST_DSTREAM_HPP +#ifndef BOOST_BEAST_UNIT_TEST_DSTREAM_HPP +#define BOOST_BEAST_UNIT_TEST_DSTREAM_HPP #include #include @@ -20,6 +22,7 @@ //#include #endif +namespace boost { namespace beast { namespace unit_test { @@ -122,5 +125,6 @@ using dwstream = std::wostream&; } // unit_test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/global_suites.hpp b/extras/boost/beast/unit_test/global_suites.hpp similarity index 78% rename from extras/beast/unit_test/global_suites.hpp rename to extras/boost/beast/unit_test/global_suites.hpp index 90664da4..5033f603 100644 --- a/extras/beast/unit_test/global_suites.hpp +++ b/extras/boost/beast/unit_test/global_suites.hpp @@ -4,12 +4,15 @@ // 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 BEAST_UNIT_TEST_GLOBAL_SUITES_HPP -#define BEAST_UNIT_TEST_GLOBAL_SUITES_HPP +#ifndef BOOST_BEAST_UNIT_TEST_GLOBAL_SUITES_HPP +#define BOOST_BEAST_UNIT_TEST_GLOBAL_SUITES_HPP -#include +#include +namespace boost { namespace beast { namespace unit_test { @@ -47,5 +50,6 @@ global_suites() } // unit_test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/main.cpp b/extras/boost/beast/unit_test/main.cpp similarity index 87% rename from extras/beast/unit_test/main.cpp rename to extras/boost/beast/unit_test/main.cpp index e6c1464a..cf277556 100644 --- a/extras/beast/unit_test/main.cpp +++ b/extras/boost/beast/unit_test/main.cpp @@ -4,13 +4,15 @@ // 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 +// -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -27,6 +29,7 @@ # endif #endif +namespace boost { namespace beast { namespace unit_test { @@ -71,13 +74,14 @@ print(std::ostream& os) } // unit_test } // beast +} // boost // Simple main used to produce stand // alone executables that run unit tests. int main(int ac, char const* av[]) { using namespace std; - using namespace beast::unit_test; + using namespace boost::beast::unit_test; #if BOOST_MSVC { diff --git a/extras/beast/unit_test/match.hpp b/extras/boost/beast/unit_test/match.hpp similarity index 94% rename from extras/beast/unit_test/match.hpp rename to extras/boost/beast/unit_test/match.hpp index c41043f7..ce4bdb11 100644 --- a/extras/beast/unit_test/match.hpp +++ b/extras/boost/beast/unit_test/match.hpp @@ -4,13 +4,16 @@ // 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 BEAST_UNIT_TEST_MATCH_HPP -#define BEAST_UNIT_TEST_MATCH_HPP +#ifndef BOOST_BEAST_UNIT_TEST_MATCH_HPP +#define BOOST_BEAST_UNIT_TEST_MATCH_HPP -#include +#include #include +namespace boost { namespace beast { namespace unit_test { @@ -169,5 +172,6 @@ match_library(std::string const& name) } // unit_test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/recorder.hpp b/extras/boost/beast/unit_test/recorder.hpp similarity index 85% rename from extras/beast/unit_test/recorder.hpp rename to extras/boost/beast/unit_test/recorder.hpp index f8587bcb..40d285b0 100644 --- a/extras/beast/unit_test/recorder.hpp +++ b/extras/boost/beast/unit_test/recorder.hpp @@ -4,13 +4,16 @@ // 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 BEAST_UNIT_TEST_RECORDER_HPP -#define BEAST_UNIT_TEST_RECORDER_HPP +#ifndef BOOST_BEAST_UNIT_TEST_RECORDER_HPP +#define BOOST_BEAST_UNIT_TEST_RECORDER_HPP -#include -#include +#include +#include +namespace boost { namespace beast { namespace unit_test { @@ -88,5 +91,6 @@ private: } // unit_test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/reporter.hpp b/extras/boost/beast/unit_test/reporter.hpp similarity index 95% rename from extras/beast/unit_test/reporter.hpp rename to extras/boost/beast/unit_test/reporter.hpp index cb2e3317..fef7d878 100644 --- a/extras/beast/unit_test/reporter.hpp +++ b/extras/boost/beast/unit_test/reporter.hpp @@ -4,12 +4,14 @@ // 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 BEAST_UNIT_TEST_REPORTER_HPP -#define BEAST_UNIT_TEST_REPORTER_HPP +#ifndef BOOST_BEAST_UNIT_TEST_REPORTER_HPP +#define BOOST_BEAST_UNIT_TEST_REPORTER_HPP -#include -#include +#include +#include #include #include #include @@ -21,6 +23,7 @@ #include #include +namespace boost { namespace beast { namespace unit_test { @@ -291,5 +294,6 @@ using reporter = detail::reporter<>; } // unit_test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/results.hpp b/extras/boost/beast/unit_test/results.hpp similarity index 95% rename from extras/beast/unit_test/results.hpp rename to extras/boost/beast/unit_test/results.hpp index 6ae014af..3319ffdf 100644 --- a/extras/beast/unit_test/results.hpp +++ b/extras/boost/beast/unit_test/results.hpp @@ -4,15 +4,18 @@ // 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 BEAST_UNIT_TEST_RESULTS_HPP -#define BEAST_UNIT_TEST_RESULTS_HPP +#ifndef BOOST_BEAST_UNIT_TEST_RESULTS_HPP +#define BOOST_BEAST_UNIT_TEST_RESULTS_HPP -#include +#include #include #include +namespace boost { namespace beast { namespace unit_test { @@ -238,5 +241,6 @@ public: } // unit_test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/runner.hpp b/extras/boost/beast/unit_test/runner.hpp similarity index 96% rename from extras/beast/unit_test/runner.hpp rename to extras/boost/beast/unit_test/runner.hpp index a150edf6..63eda692 100644 --- a/extras/beast/unit_test/runner.hpp +++ b/extras/boost/beast/unit_test/runner.hpp @@ -4,16 +4,19 @@ // 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 BEAST_UNIT_TEST_RUNNER_H_INCLUDED -#define BEAST_UNIT_TEST_RUNNER_H_INCLUDED +#ifndef BOOST_BEAST_UNIT_TEST_RUNNER_H_INCLUDED +#define BOOST_BEAST_UNIT_TEST_RUNNER_H_INCLUDED -#include +#include #include #include #include #include +namespace boost { namespace beast { namespace unit_test { @@ -284,5 +287,6 @@ runner::log(std::string const& s) } // unit_test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/suite.hpp b/extras/boost/beast/unit_test/suite.hpp similarity index 92% rename from extras/beast/unit_test/suite.hpp rename to extras/boost/beast/unit_test/suite.hpp index ce0ec909..e9b353dc 100644 --- a/extras/beast/unit_test/suite.hpp +++ b/extras/boost/beast/unit_test/suite.hpp @@ -4,11 +4,13 @@ // 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 BEAST_UNIT_TEST_SUITE_HPP -#define BEAST_UNIT_TEST_SUITE_HPP +#ifndef BOOST_BEAST_UNIT_TEST_SUITE_HPP +#define BOOST_BEAST_UNIT_TEST_SUITE_HPP -#include +#include #include #include #include @@ -16,6 +18,7 @@ #include #include +namespace boost { namespace beast { namespace unit_test { @@ -52,7 +55,7 @@ enum abort_t Derived classes execute a series of testcases, where each testcase is a series of pass/fail tests. To provide a unit test using this class, - derive from it and use the BEAST_DEFINE_UNIT_TEST macro in a + derive from it and use the BOOST_BEAST_DEFINE_UNIT_TEST macro in a translation unit. */ class suite @@ -599,31 +602,32 @@ run(runner& r) } } -#ifndef BEAST_EXPECT +#ifndef BOOST_BEAST_EXPECT /** Check a precondition. If the condition is false, the file and line number are reported. */ -#define BEAST_EXPECT(cond) expect(cond, __FILE__, __LINE__) +#define BOOST_BEAST_EXPECT(cond) expect(cond, __FILE__, __LINE__) #endif -#ifndef BEAST_EXPECTS +#ifndef BOOST_BEAST_EXPECTS /** Check a precondition. If the condition is false, the file and line number are reported. */ -#define BEAST_EXPECTS(cond, reason) ((cond) ? (pass(), true) : \ +#define BOOST_BEAST_EXPECTS(cond, reason) ((cond) ? (pass(), true) : \ (fail((reason), __FILE__, __LINE__), false)) #endif } // unit_test } // beast +} // boost //------------------------------------------------------------------------------ // detail: // This inserts the suite with the given manual flag -#define BEAST_DEFINE_TESTSUITE_INSERT(Class,Module,Library,manual) \ +#define BOOST_BEAST_DEFINE_TESTSUITE_INSERT(Class,Module,Library,manual) \ static beast::unit_test::detail::insert_suite \ Library ## Module ## Class ## _test_instance( \ #Class, #Module, #Library, manual) @@ -635,15 +639,15 @@ run(runner& r) // If this is already defined, don't redefine it. This allows // programs to provide custom behavior for testsuite definitions // -#ifndef BEAST_DEFINE_TESTSUITE +#ifndef BOOST_BEAST_DEFINE_TESTSUITE /** Enables insertion of test suites into the global container. The default is to insert all test suite definitions into the global - container. If BEAST_DEFINE_TESTSUITE is user defined, this macro + container. If BOOST_BEAST_DEFINE_TESTSUITE is user defined, this macro has no effect. */ -#ifndef BEAST_NO_UNIT_TEST_INLINE -#define BEAST_NO_UNIT_TEST_INLINE 0 +#ifndef BOOST_BEAST_NO_UNIT_TEST_INLINE +#define BOOST_BEAST_NO_UNIT_TEST_INLINE 0 #endif /** Define a unit test suite. @@ -668,15 +672,15 @@ run(runner& r) The macro invocation must appear in the same namespace as the test class. */ -#if BEAST_NO_UNIT_TEST_INLINE -#define BEAST_DEFINE_TESTSUITE(Class,Module,Library) +#if BOOST_BEAST_NO_UNIT_TEST_INLINE +#define BOOST_BEAST_DEFINE_TESTSUITE(Class,Module,Library) #else -#include -#define BEAST_DEFINE_TESTSUITE(Class,Module,Library) \ - BEAST_DEFINE_TESTSUITE_INSERT(Class,Module,Library,false) -#define BEAST_DEFINE_TESTSUITE_MANUAL(Class,Module,Library) \ - BEAST_DEFINE_TESTSUITE_INSERT(Class,Module,Library,true) +#include +#define BOOST_BEAST_DEFINE_TESTSUITE(Class,Module,Library) \ + BOOST_BEAST_DEFINE_TESTSUITE_INSERT(Class,Module,Library,false) +#define BOOST_BEAST_DEFINE_TESTSUITE_MANUAL(Class,Module,Library) \ + BOOST_BEAST_DEFINE_TESTSUITE_INSERT(Class,Module,Library,true) #endif diff --git a/extras/beast/unit_test/suite_info.hpp b/extras/boost/beast/unit_test/suite_info.hpp similarity index 92% rename from extras/beast/unit_test/suite_info.hpp rename to extras/boost/beast/unit_test/suite_info.hpp index 6baf2c47..43d4bb0c 100644 --- a/extras/beast/unit_test/suite_info.hpp +++ b/extras/boost/beast/unit_test/suite_info.hpp @@ -4,15 +4,18 @@ // 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 BEAST_UNIT_TEST_SUITE_INFO_HPP -#define BEAST_UNIT_TEST_SUITE_INFO_HPP +#ifndef BOOST_BEAST_UNIT_TEST_SUITE_INFO_HPP +#define BOOST_BEAST_UNIT_TEST_SUITE_INFO_HPP #include #include #include #include +namespace boost { namespace beast { namespace unit_test { @@ -118,5 +121,6 @@ make_suite_info( } // unit_test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/suite_list.hpp b/extras/boost/beast/unit_test/suite_list.hpp similarity index 84% rename from extras/beast/unit_test/suite_list.hpp rename to extras/boost/beast/unit_test/suite_list.hpp index e2281770..d8503955 100644 --- a/extras/beast/unit_test/suite_list.hpp +++ b/extras/boost/beast/unit_test/suite_list.hpp @@ -4,17 +4,20 @@ // 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 BEAST_UNIT_TEST_SUITE_LIST_HPP -#define BEAST_UNIT_TEST_SUITE_LIST_HPP +#ifndef BOOST_BEAST_UNIT_TEST_SUITE_LIST_HPP +#define BOOST_BEAST_UNIT_TEST_SUITE_LIST_HPP -#include -#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace unit_test { @@ -72,6 +75,7 @@ suite_list::insert( } // unit_test } // beast +} // boost #endif diff --git a/extras/beast/unit_test/thread.hpp b/extras/boost/beast/unit_test/thread.hpp similarity index 91% rename from extras/beast/unit_test/thread.hpp rename to extras/boost/beast/unit_test/thread.hpp index 8f3263af..68afcba3 100644 --- a/extras/beast/unit_test/thread.hpp +++ b/extras/boost/beast/unit_test/thread.hpp @@ -4,15 +4,18 @@ // 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 BEAST_UNIT_TEST_THREAD_HPP -#define BEAST_UNIT_TEST_THREAD_HPP +#ifndef BOOST_BEAST_UNIT_TEST_THREAD_HPP +#define BOOST_BEAST_UNIT_TEST_THREAD_HPP -#include +#include #include #include #include +namespace boost { namespace beast { namespace unit_test { @@ -120,5 +123,6 @@ private: } // unit_test } // beast +} // boost #endif diff --git a/include/beast.hpp b/include/beast.hpp deleted file mode 100644 index fe5add2c..00000000 --- a/include/beast.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// -// Copyright (c) 2013-2017 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) -// - -#ifndef BEAST_HPP -#define BEAST_HPP - -#include - -#include -#include -#include -#include -#include - -#endif diff --git a/include/beast/core.hpp b/include/beast/core.hpp deleted file mode 100644 index 7b898c45..00000000 --- a/include/beast/core.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright (c) 2013-2017 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) -// - -#ifndef BEAST_CORE_HPP -#define BEAST_CORE_HPP - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/include/beast/http.hpp b/include/beast/http.hpp deleted file mode 100644 index a458b725..00000000 --- a/include/beast/http.hpp +++ /dev/null @@ -1,36 +0,0 @@ -// -// Copyright (c) 2013-2017 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) -// - -#ifndef BEAST_HTTP_HPP -#define BEAST_HTTP_HPP - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/include/beast/version.hpp b/include/beast/version.hpp deleted file mode 100644 index 9f1d6831..00000000 --- a/include/beast/version.hpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// Copyright (c) 2013-2017 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) -// - -#ifndef BEAST_VERSION_HPP -#define BEAST_VERSION_HPP - -#include -#include - -/** @def BEAST_API_VERSION - - Identifies the API version of Beast. - - This is a simple integer that is incremented by one every time - a set of code changes is merged to the master or develop branch. -*/ -#define BEAST_VERSION 85 - -#define BEAST_VERSION_STRING "Beast/" BOOST_STRINGIZE(BEAST_VERSION) - -#endif - diff --git a/include/beast/websocket.hpp b/include/beast/websocket.hpp deleted file mode 100644 index 1cec37cd..00000000 --- a/include/beast/websocket.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// -// Copyright (c) 2013-2017 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) -// - -#ifndef BEAST_WEBSOCKET_HPP -#define BEAST_WEBSOCKET_HPP - -#include - -#include -#include -#include -#include -#include - -#endif diff --git a/include/beast/zlib.hpp b/include/beast/zlib.hpp deleted file mode 100644 index 8fb12d57..00000000 --- a/include/beast/zlib.hpp +++ /dev/null @@ -1,18 +0,0 @@ -// -// Copyright (c) 2013-2017 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) -// - -#ifndef BEAST_ZLIB_HPP -#define BEAST_ZLIB_HPP - -#include - -#include -#include -#include -#include - -#endif diff --git a/include/boost/beast.hpp b/include/boost/beast.hpp new file mode 100644 index 00000000..4202eb89 --- /dev/null +++ b/include/boost/beast.hpp @@ -0,0 +1,21 @@ +// +// Copyright (c) 2013-2017 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_HPP +#define BOOST_BEAST_HPP + +#include // must come first + +#include +#include +#include +#include +#include + +#endif diff --git a/include/beast/config.hpp b/include/boost/beast/config.hpp similarity index 86% rename from include/beast/config.hpp rename to include/boost/beast/config.hpp index 9c92df04..80469936 100644 --- a/include/beast/config.hpp +++ b/include/boost/beast/config.hpp @@ -4,9 +4,11 @@ // 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 BEAST_CONFIG_HPP -#define BEAST_CONFIG_HPP +#ifndef BOOST_BEAST_CONFIG_HPP +#define BOOST_BEAST_CONFIG_HPP #include diff --git a/include/boost/beast/core.hpp b/include/boost/beast/core.hpp new file mode 100644 index 00000000..76284df9 --- /dev/null +++ b/include/boost/beast/core.hpp @@ -0,0 +1,42 @@ +// +// Copyright (c) 2013-2017 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_CORE_HPP +#define BOOST_BEAST_CORE_HPP + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/beast/core/async_result.hpp b/include/boost/beast/core/async_result.hpp similarity index 96% rename from include/beast/core/async_result.hpp rename to include/boost/beast/core/async_result.hpp index 8465ba0b..ac42d948 100644 --- a/include/beast/core/async_result.hpp +++ b/include/boost/beast/core/async_result.hpp @@ -4,17 +4,20 @@ // 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 BEAST_ASYNC_COMPLETION_HPP -#define BEAST_ASYNC_COMPLETION_HPP +#ifndef BOOST_BEAST_ASYNC_COMPLETION_HPP +#define BOOST_BEAST_ASYNC_COMPLETION_HPP -#include -#include +#include +#include #include #include #include #include +namespace boost { namespace beast { /** An interface for customising the behaviour of an asynchronous initiation function. @@ -201,5 +204,6 @@ using async_return_type = typename beast::async_result< Signature>::return_type; } // beast +} // boost #endif diff --git a/include/beast/core/bind_handler.hpp b/include/boost/beast/core/bind_handler.hpp similarity index 87% rename from include/beast/core/bind_handler.hpp rename to include/boost/beast/core/bind_handler.hpp index b884c980..5a526db8 100644 --- a/include/beast/core/bind_handler.hpp +++ b/include/boost/beast/core/bind_handler.hpp @@ -4,16 +4,19 @@ // 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 BEAST_BIND_HANDLER_HPP -#define BEAST_BIND_HANDLER_HPP +#ifndef BOOST_BEAST_BIND_HANDLER_HPP +#define BOOST_BEAST_BIND_HANDLER_HPP -#include -#include -#include +#include +#include +#include #include #include +namespace boost { namespace beast { /** Bind parameters to a completion handler, creating a new handler. @@ -52,7 +55,7 @@ namespace beast { arguments are forwarded into the returned object. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN implementation_defined #else detail::bound_handler< @@ -71,5 +74,6 @@ bind_handler(Handler&& handler, Args&&... args) } } // beast +} // boost #endif diff --git a/include/beast/core/buffer_cat.hpp b/include/boost/beast/core/buffer_cat.hpp similarity index 90% rename from include/beast/core/buffer_cat.hpp rename to include/boost/beast/core/buffer_cat.hpp index f12eefca..7cdec13a 100644 --- a/include/beast/core/buffer_cat.hpp +++ b/include/boost/beast/core/buffer_cat.hpp @@ -4,14 +4,17 @@ // 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 BEAST_BUFFER_CAT_HPP -#define BEAST_BUFFER_CAT_HPP +#ifndef BOOST_BEAST_BUFFER_CAT_HPP +#define BOOST_BEAST_BUFFER_CAT_HPP -#include -#include +#include +#include #include +namespace boost { namespace beast { /** A buffer sequence representing a concatenation of buffer sequences. @@ -30,7 +33,7 @@ public: then `value_type` will be `boost::asio::mutable_buffer`. Otherwise, `value_type` will be `boost::asio::const_buffer`. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using value_type = implementation_defined; #else using value_type = typename @@ -91,7 +94,7 @@ public: @see @ref buffer_cat_view */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template buffer_cat_view buffer_cat(BufferSequence const&... buffers) @@ -109,7 +112,8 @@ buffer_cat(B1 const& b1, B2 const& b2, Bn const&... bn) } } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/buffer_prefix.hpp b/include/boost/beast/core/buffer_prefix.hpp similarity index 94% rename from include/beast/core/buffer_prefix.hpp rename to include/boost/beast/core/buffer_prefix.hpp index a28054be..2ad91022 100644 --- a/include/beast/core/buffer_prefix.hpp +++ b/include/boost/beast/core/buffer_prefix.hpp @@ -4,17 +4,20 @@ // 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 BEAST_BUFFER_PREFIX_HPP -#define BEAST_BUFFER_PREFIX_HPP +#ifndef BOOST_BEAST_BUFFER_PREFIX_HPP +#define BOOST_BEAST_BUFFER_PREFIX_HPP -#include -#include -#include +#include +#include +#include #include #include #include +namespace boost { namespace beast { /** A buffer sequence adapter that shortens the sequence size. @@ -59,7 +62,7 @@ public: boost::asio::mutable_buffer, boost::asio::const_buffer>::type; -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN /// A bidirectional iterator type that may be used to read elements. using const_iterator = implementation_defined; @@ -186,7 +189,7 @@ buffer_prefix(std::size_t size, not transferred. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN buffer_prefix_view #else inline @@ -230,7 +233,8 @@ buffer_front(BufferSequence const& buffers) } } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/buffered_read_stream.hpp b/include/boost/beast/core/buffered_read_stream.hpp similarity index 95% rename from include/beast/core/buffered_read_stream.hpp rename to include/boost/beast/core/buffered_read_stream.hpp index a365babe..60ef310d 100644 --- a/include/beast/core/buffered_read_stream.hpp +++ b/include/boost/beast/core/buffered_read_stream.hpp @@ -4,20 +4,23 @@ // 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 BEAST_BUFFERED_READ_STREAM_HPP -#define BEAST_BUFFERED_READ_STREAM_HPP +#ifndef BOOST_BEAST_BUFFERED_READ_STREAM_HPP +#define BOOST_BEAST_BUFFERED_READ_STREAM_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { /** A @b Stream with attached @b DynamicBuffer to buffer reads. @@ -265,7 +268,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type @@ -340,7 +343,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type @@ -350,7 +353,8 @@ public: }; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/buffers_adapter.hpp b/include/boost/beast/core/buffers_adapter.hpp similarity index 93% rename from include/beast/core/buffers_adapter.hpp rename to include/boost/beast/core/buffers_adapter.hpp index 6cff9923..4f733138 100644 --- a/include/beast/core/buffers_adapter.hpp +++ b/include/boost/beast/core/buffers_adapter.hpp @@ -4,15 +4,18 @@ // 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 BEAST_BUFFERS_ADAPTER_HPP -#define BEAST_BUFFERS_ADAPTER_HPP +#ifndef BOOST_BEAST_BUFFERS_ADAPTER_HPP +#define BOOST_BEAST_BUFFERS_ADAPTER_HPP -#include -#include +#include +#include #include #include +namespace boost { namespace beast { /** Adapts a @b MutableBufferSequence into a @b DynamicBuffer. @@ -64,7 +67,7 @@ class buffers_adapter } public: -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN /// The type used to represent the input sequence as a list of buffers. using const_buffers_type = implementation_defined; @@ -152,7 +155,8 @@ public: }; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/consuming_buffers.hpp b/include/boost/beast/core/consuming_buffers.hpp similarity index 91% rename from include/beast/core/consuming_buffers.hpp rename to include/boost/beast/core/consuming_buffers.hpp index 7472c894..24f02ce7 100644 --- a/include/beast/core/consuming_buffers.hpp +++ b/include/boost/beast/core/consuming_buffers.hpp @@ -4,12 +4,14 @@ // 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 BEAST_CONSUMING_BUFFERS_HPP -#define BEAST_CONSUMING_BUFFERS_HPP +#ifndef BOOST_BEAST_CONSUMING_BUFFERS_HPP +#define BOOST_BEAST_CONSUMING_BUFFERS_HPP -#include -#include +#include +#include #include #include #include @@ -17,6 +19,7 @@ #include #include +namespace boost { namespace beast { /** Adapter to trim the front of a `BufferSequence`. @@ -62,7 +65,7 @@ public: `boost::asio::mutable_buffer`, else this type will be `boost::asio::const_buffer`. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using value_type = implementation_defined; #else using value_type = typename std::conditional< @@ -73,7 +76,7 @@ public: boost::asio::const_buffer>::type; #endif -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN /// A bidirectional iterator type that may be used to read elements. using const_iterator = implementation_defined; @@ -141,7 +144,8 @@ public: }; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/detail/base64.hpp b/include/boost/beast/core/detail/base64.hpp similarity index 97% rename from include/beast/core/detail/base64.hpp rename to include/boost/beast/core/detail/base64.hpp index 31b426a6..491eb41b 100644 --- a/include/beast/core/detail/base64.hpp +++ b/include/boost/beast/core/detail/base64.hpp @@ -4,6 +4,8 @@ // 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 +// /* Portions from http://www.adp-gmbh.ch/cpp/common/base64.html @@ -35,13 +37,14 @@ */ -#ifndef BEAST_DETAIL_BASE64_HPP -#define BEAST_DETAIL_BASE64_HPP +#ifndef BOOST_BEAST_DETAIL_BASE64_HPP +#define BOOST_BEAST_DETAIL_BASE64_HPP #include #include #include +namespace boost { namespace beast { namespace detail { @@ -243,5 +246,6 @@ base64_decode(std::string const& data) } // detail } // beast +} // boost #endif diff --git a/include/beast/core/detail/bind_handler.hpp b/include/boost/beast/core/detail/bind_handler.hpp similarity index 93% rename from include/beast/core/detail/bind_handler.hpp rename to include/boost/beast/core/detail/bind_handler.hpp index 3afa47eb..536c53b8 100644 --- a/include/beast/core/detail/bind_handler.hpp +++ b/include/boost/beast/core/detail/bind_handler.hpp @@ -4,11 +4,13 @@ // 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 BEAST_BIND_DETAIL_HANDLER_HPP -#define BEAST_BIND_DETAIL_HANDLER_HPP +#ifndef BOOST_BEAST_BIND_DETAIL_HANDLER_HPP +#define BOOST_BEAST_BIND_DETAIL_HANDLER_HPP -#include +#include #include #include #include @@ -16,6 +18,7 @@ #include #include +namespace boost { namespace beast { namespace detail { @@ -170,11 +173,12 @@ public: } // detail } // beast +} // boost namespace std { template void -bind(beast::detail::bound_handler< +bind(boost::beast::detail::bound_handler< Handler, Args...>, ...) = delete; } // std diff --git a/include/beast/core/detail/buffers_ref.hpp b/include/boost/beast/core/detail/buffers_ref.hpp similarity index 84% rename from include/beast/core/detail/buffers_ref.hpp rename to include/boost/beast/core/detail/buffers_ref.hpp index 741a5634..5505f0ab 100644 --- a/include/beast/core/detail/buffers_ref.hpp +++ b/include/boost/beast/core/detail/buffers_ref.hpp @@ -4,12 +4,15 @@ // 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 BEAST_DETAIL_BUFFERS_REF_HPP -#define BEAST_DETAIL_BUFFERS_REF_HPP +#ifndef BOOST_BEAST_DETAIL_BUFFERS_REF_HPP +#define BOOST_BEAST_DETAIL_BUFFERS_REF_HPP -#include +#include +namespace boost { namespace beast { namespace detail { @@ -58,5 +61,6 @@ make_buffers_ref(BufferSequence const& buffers) } // detail } // beast +} // boost #endif diff --git a/include/beast/core/detail/clamp.hpp b/include/boost/beast/core/detail/clamp.hpp similarity index 85% rename from include/beast/core/detail/clamp.hpp rename to include/boost/beast/core/detail/clamp.hpp index 6d3a9ed5..cda23a6f 100644 --- a/include/beast/core/detail/clamp.hpp +++ b/include/boost/beast/core/detail/clamp.hpp @@ -4,14 +4,17 @@ // 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 BEAST_CORE_DETAIL_CLAMP_HPP -#define BEAST_CORE_DETAIL_CLAMP_HPP +#ifndef BOOST_BEAST_CORE_DETAIL_CLAMP_HPP +#define BOOST_BEAST_CORE_DETAIL_CLAMP_HPP #include #include #include +namespace boost { namespace beast { namespace detail { @@ -51,5 +54,6 @@ sum_exceeds(U1 x, U2 y, U3 z) } // detail } // beast +} // boost #endif diff --git a/include/beast/core/detail/config.hpp b/include/boost/beast/core/detail/config.hpp similarity index 60% rename from include/beast/core/detail/config.hpp rename to include/boost/beast/core/detail/config.hpp index 461ca38b..d7b71c38 100644 --- a/include/beast/core/detail/config.hpp +++ b/include/boost/beast/core/detail/config.hpp @@ -4,17 +4,19 @@ // 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 BEAST_CORE_DETAIL_CONFIG_HPP -#define BEAST_CORE_DETAIL_CONFIG_HPP +#ifndef BOOST_BEAST_CORE_DETAIL_CONFIG_HPP +#define BOOST_BEAST_CORE_DETAIL_CONFIG_HPP #include #include #if BOOST_VERSION >= 106500 || ! defined(BOOST_GCC) || BOOST_GCC < 70000 -# define BEAST_FALLTHROUGH BOOST_FALLTHROUGH +# define BOOST_BEAST_FALLTHROUGH BOOST_FALLTHROUGH #else -# define BEAST_FALLTHROUGH __attribute__((fallthrough)) +# define BOOST_BEAST_FALLTHROUGH __attribute__((fallthrough)) #endif #endif diff --git a/include/beast/core/detail/cpu_info.hpp b/include/boost/beast/core/detail/cpu_info.hpp similarity index 82% rename from include/beast/core/detail/cpu_info.hpp rename to include/boost/beast/core/detail/cpu_info.hpp index 3a1e24cb..579589fa 100644 --- a/include/beast/core/detail/cpu_info.hpp +++ b/include/boost/beast/core/detail/cpu_info.hpp @@ -4,21 +4,23 @@ // 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 BEAST_DETAIL_CPU_INFO_HPP -#define BEAST_DETAIL_CPU_INFO_HPP +#ifndef BOOST_BEAST_DETAIL_CPU_INFO_HPP +#define BOOST_BEAST_DETAIL_CPU_INFO_HPP #include -#ifndef BEAST_NO_INTRINSICS +#ifndef BOOST_BEAST_NO_INTRINSICS # if defined(BOOST_MSVC) || ((defined(BOOST_GCC) || defined(BOOST_CLANG)) && defined(__SSE4_2__)) -# define BEAST_NO_INTRINSICS 0 +# define BOOST_BEAST_NO_INTRINSICS 0 # else -# define BEAST_NO_INTRINSICS 1 +# define BOOST_BEAST_NO_INTRINSICS 1 # endif #endif -#if ! BEAST_NO_INTRINSICS +#if ! BOOST_BEAST_NO_INTRINSICS #ifdef BOOST_MSVC #include // __cpuid @@ -26,6 +28,7 @@ #include // __get_cpuid #endif +namespace boost { namespace beast { namespace detail { @@ -89,6 +92,7 @@ get_cpu_info() } // detail } // beast +} // boost #endif diff --git a/include/beast/core/detail/empty_base_optimization.hpp b/include/boost/beast/core/detail/empty_base_optimization.hpp similarity index 88% rename from include/beast/core/detail/empty_base_optimization.hpp rename to include/boost/beast/core/detail/empty_base_optimization.hpp index 0640cb3a..ea9c9d2e 100644 --- a/include/beast/core/detail/empty_base_optimization.hpp +++ b/include/boost/beast/core/detail/empty_base_optimization.hpp @@ -4,14 +4,17 @@ // 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 BEAST_DETAIL_EMPTY_BASE_OPTIMIZATION_HPP -#define BEAST_DETAIL_EMPTY_BASE_OPTIMIZATION_HPP +#ifndef BOOST_BEAST_DETAIL_EMPTY_BASE_OPTIMIZATION_HPP +#define BOOST_BEAST_DETAIL_EMPTY_BASE_OPTIMIZATION_HPP #include #include #include +namespace boost { namespace beast { namespace detail { @@ -88,5 +91,6 @@ private: } // detail } // beast +} // boost #endif diff --git a/include/beast/core/detail/in_place_init.hpp b/include/boost/beast/core/detail/in_place_init.hpp similarity index 84% rename from include/beast/core/detail/in_place_init.hpp rename to include/boost/beast/core/detail/in_place_init.hpp index 2a0ab615..f4df4dfc 100644 --- a/include/beast/core/detail/in_place_init.hpp +++ b/include/boost/beast/core/detail/in_place_init.hpp @@ -4,9 +4,11 @@ // 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 BEAST_DETAIL_IN_PLACE_INIT_HPP -#define BEAST_DETAIL_IN_PLACE_INIT_HPP +#ifndef BOOST_BEAST_DETAIL_IN_PLACE_INIT_HPP +#define BOOST_BEAST_DETAIL_IN_PLACE_INIT_HPP #include #include diff --git a/include/beast/core/detail/integer_sequence.hpp b/include/boost/beast/core/detail/integer_sequence.hpp similarity index 94% rename from include/beast/core/detail/integer_sequence.hpp rename to include/boost/beast/core/detail/integer_sequence.hpp index 6d0cc8a7..60a6ddaa 100644 --- a/include/beast/core/detail/integer_sequence.hpp +++ b/include/boost/beast/core/detail/integer_sequence.hpp @@ -4,15 +4,18 @@ // 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 BEAST_DETAIL_INTEGER_SEQUENCE_HPP -#define BEAST_DETAIL_INTEGER_SEQUENCE_HPP +#ifndef BOOST_BEAST_DETAIL_INTEGER_SEQUENCE_HPP +#define BOOST_BEAST_DETAIL_INTEGER_SEQUENCE_HPP #include #include #include #include +namespace boost { namespace beast { namespace detail { @@ -135,5 +138,6 @@ using index_sequence_for = } // detail } // beast +} // boost #endif diff --git a/include/beast/core/detail/ostream.hpp b/include/boost/beast/core/detail/ostream.hpp similarity index 97% rename from include/beast/core/detail/ostream.hpp rename to include/boost/beast/core/detail/ostream.hpp index c0221124..91573aaa 100644 --- a/include/beast/core/detail/ostream.hpp +++ b/include/boost/beast/core/detail/ostream.hpp @@ -4,18 +4,21 @@ // 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 BEAST_DETAIL_OSTREAM_HPP -#define BEAST_DETAIL_OSTREAM_HPP +#ifndef BOOST_BEAST_DETAIL_OSTREAM_HPP +#define BOOST_BEAST_DETAIL_OSTREAM_HPP #include -#include +#include #include #include #include #include #include +namespace boost { namespace beast { namespace detail { @@ -314,5 +317,6 @@ public: } // detail } // beast +} // boost #endif diff --git a/include/beast/core/detail/sha1.hpp b/include/boost/beast/core/detail/sha1.hpp similarity index 98% rename from include/beast/core/detail/sha1.hpp rename to include/boost/beast/core/detail/sha1.hpp index 7e8e6383..e5a22488 100644 --- a/include/beast/core/detail/sha1.hpp +++ b/include/boost/beast/core/detail/sha1.hpp @@ -4,9 +4,11 @@ // 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 BEAST_DETAIL_SHA1_HPP -#define BEAST_DETAIL_SHA1_HPP +#ifndef BOOST_BEAST_DETAIL_SHA1_HPP +#define BOOST_BEAST_DETAIL_SHA1_HPP #include #include @@ -22,6 +24,7 @@ Vincent Falco (beast adaptation) */ +namespace boost { namespace beast { namespace detail { @@ -305,5 +308,6 @@ finish(sha1_context& ctx, void* digest) noexcept } // detail } // beast +} // boost #endif diff --git a/include/beast/core/detail/static_ostream.hpp b/include/boost/beast/core/detail/static_ostream.hpp similarity index 93% rename from include/beast/core/detail/static_ostream.hpp rename to include/boost/beast/core/detail/static_ostream.hpp index 99f4282d..868062e3 100644 --- a/include/beast/core/detail/static_ostream.hpp +++ b/include/boost/beast/core/detail/static_ostream.hpp @@ -4,14 +4,17 @@ // 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 BEAST_DETAIL_STATIC_OSTREAM_HPP -#define BEAST_DETAIL_STATIC_OSTREAM_HPP +#ifndef BOOST_BEAST_DETAIL_STATIC_OSTREAM_HPP +#define BOOST_BEAST_DETAIL_STATIC_OSTREAM_HPP #include #include #include +namespace boost { namespace beast { namespace detail { @@ -134,5 +137,6 @@ public: } // detail } // beast +} // boost #endif diff --git a/include/beast/core/detail/static_string.hpp b/include/boost/beast/core/detail/static_string.hpp similarity index 92% rename from include/beast/core/detail/static_string.hpp rename to include/boost/beast/core/detail/static_string.hpp index 7ded7fff..780f7281 100644 --- a/include/beast/core/detail/static_string.hpp +++ b/include/boost/beast/core/detail/static_string.hpp @@ -4,15 +4,18 @@ // 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 BEAST_DETAIL_STATIC_STRING_HPP -#define BEAST_DETAIL_STATIC_STRING_HPP +#ifndef BOOST_BEAST_DETAIL_STATIC_STRING_HPP +#define BOOST_BEAST_DETAIL_STATIC_STRING_HPP -#include +#include #include #include #include +namespace boost { namespace beast { namespace detail { @@ -127,5 +130,6 @@ raw_to_string(CharT* last, std::size_t size, Integer i) } // detail } // beast +} // boost #endif diff --git a/include/beast/core/detail/type_traits.hpp b/include/boost/beast/core/detail/type_traits.hpp similarity index 96% rename from include/beast/core/detail/type_traits.hpp rename to include/boost/beast/core/detail/type_traits.hpp index 5432bf8a..b0369d4e 100644 --- a/include/beast/core/detail/type_traits.hpp +++ b/include/boost/beast/core/detail/type_traits.hpp @@ -4,11 +4,13 @@ // 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 BEAST_DETAIL_TYPE_TRAITS_HPP -#define BEAST_DETAIL_TYPE_TRAITS_HPP +#ifndef BOOST_BEAST_DETAIL_TYPE_TRAITS_HPP +#define BOOST_BEAST_DETAIL_TYPE_TRAITS_HPP -#include +#include #include #include #include @@ -42,6 +44,7 @@ class consuming_buffers; //------------------------------------------------------------------------------ +namespace boost { namespace beast { namespace detail { @@ -261,5 +264,6 @@ using WriteHandler = StreamHandler; } // detail } // beast +} // boost #endif diff --git a/include/beast/core/detail/varint.hpp b/include/boost/beast/core/detail/varint.hpp similarity index 90% rename from include/beast/core/detail/varint.hpp rename to include/boost/beast/core/detail/varint.hpp index 4f5b02f0..37f0b9d1 100644 --- a/include/beast/core/detail/varint.hpp +++ b/include/boost/beast/core/detail/varint.hpp @@ -4,15 +4,18 @@ // 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 BEAST_DETAIL_VARINT_HPP -#define BEAST_DETAIL_VARINT_HPP +#ifndef BOOST_BEAST_DETAIL_VARINT_HPP +#define BOOST_BEAST_DETAIL_VARINT_HPP #include #include #include #include +namespace boost { namespace beast { namespace detail { @@ -71,5 +74,6 @@ varint_write(FwdIt& first, std::size_t value) } // detail } // beast +} // boost #endif diff --git a/include/beast/core/drain_buffer.hpp b/include/boost/beast/core/drain_buffer.hpp similarity index 93% rename from include/beast/core/drain_buffer.hpp rename to include/boost/beast/core/drain_buffer.hpp index bafa0624..88bb8caf 100644 --- a/include/beast/core/drain_buffer.hpp +++ b/include/boost/beast/core/drain_buffer.hpp @@ -4,14 +4,17 @@ // 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 BEAST_DRAIN_BUFFER_HPP -#define BEAST_DRAIN_BUFFER_HPP +#ifndef BOOST_BEAST_DRAIN_BUFFER_HPP +#define BOOST_BEAST_DRAIN_BUFFER_HPP -#include +#include #include #include +namespace boost { namespace beast { /** A @b DynamicBuffer which does not retain its input sequence. @@ -117,6 +120,8 @@ public: { } }; + } // beast +} // boost #endif diff --git a/include/beast/core/error.hpp b/include/boost/beast/core/error.hpp similarity index 82% rename from include/beast/core/error.hpp rename to include/boost/beast/core/error.hpp index f98f6d7a..011b21aa 100644 --- a/include/beast/core/error.hpp +++ b/include/boost/beast/core/error.hpp @@ -4,14 +4,17 @@ // 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 BEAST_ERROR_HPP -#define BEAST_ERROR_HPP +#ifndef BOOST_BEAST_ERROR_HPP +#define BOOST_BEAST_ERROR_HPP -#include +#include #include #include +namespace boost { namespace beast { /// The type of error code used by the library @@ -24,7 +27,7 @@ using system_error = boost::system::system_error; using error_category = boost::system::error_category; /// A function to return the generic error category used by the library -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN error_category const& generic_category(); #else @@ -32,7 +35,7 @@ using boost::system::generic_category; #endif /// A function to return the system error category used by the library -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN error_category const& system_category(); #else @@ -43,11 +46,13 @@ using boost::system::system_category; using error_condition = boost::system::error_condition; /// The set of constants used for cross-platform error codes -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN enum errc{}; #else namespace errc = boost::system::errc; #endif + } // beast +} // boost #endif diff --git a/include/beast/core/file.hpp b/include/boost/beast/core/file.hpp similarity index 56% rename from include/beast/core/file.hpp rename to include/boost/beast/core/file.hpp index 8b3eecc8..10a8a036 100644 --- a/include/beast/core/file.hpp +++ b/include/boost/beast/core/file.hpp @@ -4,17 +4,20 @@ // 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 BEAST_CORE_FILE_HPP -#define BEAST_CORE_FILE_HPP +#ifndef BOOST_BEAST_CORE_FILE_HPP +#define BOOST_BEAST_CORE_FILE_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include +namespace boost { namespace beast { /** An implementation of File. @@ -22,14 +25,14 @@ namespace beast { This alias is set to the best available implementation of @b File given the platform and build settings. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN struct file : file_stdio { }; #else -#if BEAST_USE_WIN32_FILE +#if BOOST_BEAST_USE_WIN32_FILE using file = file_win32; -#elif BEAST_USE_POSIX_FILE +#elif BOOST_BEAST_USE_POSIX_FILE using file = file_posix; #else using file = file_stdio; @@ -37,5 +40,6 @@ using file = file_stdio; #endif } // beast +} // boost #endif diff --git a/include/beast/core/file_base.hpp b/include/boost/beast/core/file_base.hpp similarity index 87% rename from include/beast/core/file_base.hpp rename to include/boost/beast/core/file_base.hpp index c787ed8c..38df3f1b 100644 --- a/include/beast/core/file_base.hpp +++ b/include/boost/beast/core/file_base.hpp @@ -4,13 +4,16 @@ // 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 BEAST_CORE_FILE_BASE_HPP -#define BEAST_CORE_FILE_BASE_HPP +#ifndef BOOST_BEAST_CORE_FILE_BASE_HPP +#define BOOST_BEAST_CORE_FILE_BASE_HPP -#include -#include +#include +#include +namespace boost { namespace beast { /** File open modes @@ -81,5 +84,6 @@ enum class file_mode }; } // beast +} // boost #endif diff --git a/include/beast/core/file_posix.hpp b/include/boost/beast/core/file_posix.hpp similarity index 85% rename from include/beast/core/file_posix.hpp rename to include/boost/beast/core/file_posix.hpp index 7e675f24..65bac206 100644 --- a/include/beast/core/file_posix.hpp +++ b/include/boost/beast/core/file_posix.hpp @@ -4,32 +4,35 @@ // 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 BEAST_CORE_FILE_POSIX_HPP -#define BEAST_CORE_FILE_POSIX_HPP +#ifndef BOOST_BEAST_CORE_FILE_POSIX_HPP +#define BOOST_BEAST_CORE_FILE_POSIX_HPP #include -#if ! defined(BEAST_NO_POSIX_FILE) +#if ! defined(BOOST_BEAST_NO_POSIX_FILE) # if ! defined(__APPLE__) && ! defined(__linux__) -# define BEAST_NO_POSIX_FILE +# define BOOST_BEAST_NO_POSIX_FILE # endif #endif -#if ! defined(BEAST_USE_POSIX_FILE) -# if ! defined(BEAST_NO_POSIX_FILE) -# define BEAST_USE_POSIX_FILE 1 +#if ! defined(BOOST_BEAST_USE_POSIX_FILE) +# if ! defined(BOOST_BEAST_NO_POSIX_FILE) +# define BOOST_BEAST_USE_POSIX_FILE 1 # else -# define BEAST_USE_POSIX_FILE 0 +# define BOOST_BEAST_USE_POSIX_FILE 0 # endif #endif -#if BEAST_USE_POSIX_FILE +#if BOOST_BEAST_USE_POSIX_FILE -#include -#include +#include +#include #include +namespace boost { namespace beast { /** An implementation of File for POSIX systems. @@ -163,8 +166,9 @@ public: }; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/file_stdio.hpp b/include/boost/beast/core/file_stdio.hpp similarity index 90% rename from include/beast/core/file_stdio.hpp rename to include/boost/beast/core/file_stdio.hpp index 5b8753c6..81deac40 100644 --- a/include/beast/core/file_stdio.hpp +++ b/include/boost/beast/core/file_stdio.hpp @@ -4,16 +4,19 @@ // 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 BEAST_CORE_FILE_STDIO_HPP -#define BEAST_CORE_FILE_STDIO_HPP +#ifndef BOOST_BEAST_CORE_FILE_STDIO_HPP +#define BOOST_BEAST_CORE_FILE_STDIO_HPP -#include -#include -#include +#include +#include +#include #include #include +namespace boost { namespace beast { /** An implementation of File which uses cstdio. @@ -148,7 +151,8 @@ public: }; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/file_win32.hpp b/include/boost/beast/core/file_win32.hpp similarity index 88% rename from include/beast/core/file_win32.hpp rename to include/boost/beast/core/file_win32.hpp index 8aafd345..13a863b9 100644 --- a/include/beast/core/file_win32.hpp +++ b/include/boost/beast/core/file_win32.hpp @@ -4,29 +4,32 @@ // 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 BEAST_CORE_FILE_WIN32_HPP -#define BEAST_CORE_FILE_WIN32_HPP +#ifndef BOOST_BEAST_CORE_FILE_WIN32_HPP +#define BOOST_BEAST_CORE_FILE_WIN32_HPP #include -#if ! defined(BEAST_USE_WIN32_FILE) +#if ! defined(BOOST_BEAST_USE_WIN32_FILE) # ifdef BOOST_MSVC -# define BEAST_USE_WIN32_FILE 1 +# define BOOST_BEAST_USE_WIN32_FILE 1 # else -# define BEAST_USE_WIN32_FILE 0 +# define BOOST_BEAST_USE_WIN32_FILE 0 # endif #endif -#if BEAST_USE_WIN32_FILE +#if BOOST_BEAST_USE_WIN32_FILE -#include -#include +#include +#include #include #include #include #include +namespace boost { namespace beast { /** An implementation of File for Win32. @@ -43,7 +46,7 @@ public: This is platform-specific. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using native_handle_type = HANDLE; #else using native_handle_type = boost::detail::winapi::HANDLE_; @@ -165,8 +168,9 @@ public: }; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/flat_buffer.hpp b/include/boost/beast/core/flat_buffer.hpp similarity index 95% rename from include/beast/core/flat_buffer.hpp rename to include/boost/beast/core/flat_buffer.hpp index bab65161..b1eebc32 100644 --- a/include/beast/core/flat_buffer.hpp +++ b/include/boost/beast/core/flat_buffer.hpp @@ -4,16 +4,19 @@ // 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 BEAST_FLAT_BUFFER_HPP -#define BEAST_FLAT_BUFFER_HPP +#ifndef BOOST_BEAST_FLAT_BUFFER_HPP +#define BOOST_BEAST_FLAT_BUFFER_HPP -#include -#include +#include +#include #include #include #include +namespace boost { namespace beast { /** A linear dynamic buffer. @@ -39,14 +42,14 @@ namespace beast { */ template class basic_flat_buffer -#if ! BEAST_DOXYGEN +#if ! BOOST_BEAST_DOXYGEN : private detail::empty_base_optimization< typename std::allocator_traits:: template rebind_alloc> #endif { public: -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN /// The type of allocator used. using allocator_type = Allocator; #else @@ -335,7 +338,8 @@ using flat_buffer = basic_flat_buffer>; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/flat_static_buffer.hpp b/include/boost/beast/core/flat_static_buffer.hpp similarity index 95% rename from include/beast/core/flat_static_buffer.hpp rename to include/boost/beast/core/flat_static_buffer.hpp index b15c0e45..5a4c779c 100644 --- a/include/beast/core/flat_static_buffer.hpp +++ b/include/boost/beast/core/flat_static_buffer.hpp @@ -4,16 +4,19 @@ // 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 BEAST_FLAT_STATIC_BUFFER_HPP -#define BEAST_FLAT_STATIC_BUFFER_HPP +#ifndef BOOST_BEAST_FLAT_STATIC_BUFFER_HPP +#define BOOST_BEAST_FLAT_STATIC_BUFFER_HPP -#include +#include #include #include #include #include +namespace boost { namespace beast { /** A flat @b DynamicBuffer with a fixed size internal buffer. @@ -235,7 +238,8 @@ public: }; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/handler_alloc.hpp b/include/boost/beast/core/handler_alloc.hpp similarity index 94% rename from include/beast/core/handler_alloc.hpp rename to include/boost/beast/core/handler_alloc.hpp index b7656a88..9b34cbf4 100644 --- a/include/beast/core/handler_alloc.hpp +++ b/include/boost/beast/core/handler_alloc.hpp @@ -4,11 +4,13 @@ // 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 BEAST_HANDLER_ALLOC_HPP -#define BEAST_HANDLER_ALLOC_HPP +#ifndef BOOST_BEAST_HANDLER_ALLOC_HPP +#define BOOST_BEAST_HANDLER_ALLOC_HPP -#include +#include #include #include #include @@ -17,6 +19,7 @@ #include #include +namespace boost { namespace beast { // Guidance from @@ -37,7 +40,7 @@ namespace beast { the handler is invoked or undefined behavior results. This behavior is described as the "deallocate before invocation" Asio guarantee. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template class handler_alloc; #else @@ -154,5 +157,6 @@ public: #endif } // beast +} // boost #endif diff --git a/include/beast/core/handler_ptr.hpp b/include/boost/beast/core/handler_ptr.hpp similarity index 95% rename from include/beast/core/handler_ptr.hpp rename to include/boost/beast/core/handler_ptr.hpp index c288c4d1..8679781e 100644 --- a/include/beast/core/handler_ptr.hpp +++ b/include/boost/beast/core/handler_ptr.hpp @@ -4,17 +4,20 @@ // 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 BEAST_HANDLER_PTR_HPP -#define BEAST_HANDLER_PTR_HPP +#ifndef BOOST_BEAST_HANDLER_PTR_HPP +#define BOOST_BEAST_HANDLER_PTR_HPP -#include -#include +#include +#include #include #include #include #include +namespace boost { namespace beast { /** A smart pointer container with associated completion handler. @@ -203,7 +206,8 @@ public: }; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/impl/buffer_cat.ipp b/include/boost/beast/core/impl/buffer_cat.ipp similarity index 97% rename from include/beast/core/impl/buffer_cat.ipp rename to include/boost/beast/core/impl/buffer_cat.ipp index f0f9d45e..a07caac2 100644 --- a/include/beast/core/impl/buffer_cat.ipp +++ b/include/boost/beast/core/impl/buffer_cat.ipp @@ -4,11 +4,13 @@ // 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 BEAST_IMPL_BUFFER_CAT_IPP -#define BEAST_IMPL_BUFFER_CAT_IPP +#ifndef BOOST_BEAST_IMPL_BUFFER_CAT_IPP +#define BOOST_BEAST_IMPL_BUFFER_CAT_IPP -#include +#include #include #include #include @@ -19,17 +21,12 @@ #include #include +namespace boost { namespace beast { template class buffer_cat_view::const_iterator { -#if 0 - static_assert( - detail::is_all_const_buffer_sequence::value, - "BufferSequence requirements not met"); -#endif - std::size_t n_; std::tuple const* bn_; std::array::end() const -> } } // beast +} // boost #endif diff --git a/include/beast/core/impl/buffer_prefix.ipp b/include/boost/beast/core/impl/buffer_prefix.ipp similarity index 96% rename from include/beast/core/impl/buffer_prefix.ipp rename to include/boost/beast/core/impl/buffer_prefix.ipp index ef6f5347..b7701018 100644 --- a/include/beast/core/impl/buffer_prefix.ipp +++ b/include/boost/beast/core/impl/buffer_prefix.ipp @@ -4,9 +4,11 @@ // 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 BEAST_IMPL_BUFFER_PREFIX_IPP -#define BEAST_IMPL_BUFFER_PREFIX_IPP +#ifndef BOOST_BEAST_IMPL_BUFFER_PREFIX_IPP +#define BOOST_BEAST_IMPL_BUFFER_PREFIX_IPP #include #include @@ -15,6 +17,7 @@ #include #include +namespace boost { namespace beast { namespace detail { @@ -246,5 +249,6 @@ buffer_prefix_view::end() const -> } } // beast +} // boost #endif diff --git a/include/beast/core/impl/buffered_read_stream.ipp b/include/boost/beast/core/impl/buffered_read_stream.ipp similarity index 93% rename from include/beast/core/impl/buffered_read_stream.ipp rename to include/boost/beast/core/impl/buffered_read_stream.ipp index d78c1361..23a3b0d4 100644 --- a/include/beast/core/impl/buffered_read_stream.ipp +++ b/include/boost/beast/core/impl/buffered_read_stream.ipp @@ -4,20 +4,23 @@ // 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 BEAST_IMPL_BUFFERED_READ_STREAM_IPP -#define BEAST_IMPL_BUFFERED_READ_STREAM_IPP +#ifndef BOOST_BEAST_IMPL_BUFFERED_READ_STREAM_IPP +#define BOOST_BEAST_IMPL_BUFFERED_READ_STREAM_IPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { template @@ -121,7 +124,7 @@ read_some_op::operator()( case 2: s_.sb_.commit(bytes_transferred); - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; case 3: bytes_transferred = @@ -237,5 +240,6 @@ async_read_some(MutableBufferSequence const& buffers, } } // beast +} // boost #endif diff --git a/include/beast/core/impl/buffers_adapter.ipp b/include/boost/beast/core/impl/buffers_adapter.ipp similarity index 98% rename from include/beast/core/impl/buffers_adapter.ipp rename to include/boost/beast/core/impl/buffers_adapter.ipp index 3216667f..65c73af7 100644 --- a/include/beast/core/impl/buffers_adapter.ipp +++ b/include/boost/beast/core/impl/buffers_adapter.ipp @@ -4,11 +4,13 @@ // 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 BEAST_IMPL_BUFFERS_ADAPTER_IPP -#define BEAST_IMPL_BUFFERS_ADAPTER_IPP +#ifndef BOOST_BEAST_IMPL_BUFFERS_ADAPTER_IPP +#define BOOST_BEAST_IMPL_BUFFERS_ADAPTER_IPP -#include +#include #include #include #include @@ -17,6 +19,7 @@ #include #include +namespace boost { namespace beast { template @@ -501,5 +504,6 @@ buffers_adapter::consume(std::size_t n) } } // beast +} // boost #endif diff --git a/include/beast/core/impl/consuming_buffers.ipp b/include/boost/beast/core/impl/consuming_buffers.ipp similarity index 95% rename from include/beast/core/impl/consuming_buffers.ipp rename to include/boost/beast/core/impl/consuming_buffers.ipp index 83d67903..98ca1465 100644 --- a/include/beast/core/impl/consuming_buffers.ipp +++ b/include/boost/beast/core/impl/consuming_buffers.ipp @@ -4,17 +4,20 @@ // 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 BEAST_IMPL_CONSUMING_BUFFERS_IPP -#define BEAST_IMPL_CONSUMING_BUFFERS_IPP +#ifndef BOOST_BEAST_IMPL_CONSUMING_BUFFERS_IPP +#define BOOST_BEAST_IMPL_CONSUMING_BUFFERS_IPP -#include +#include #include #include #include #include #include +namespace boost { namespace beast { template @@ -231,5 +234,6 @@ consume(std::size_t amount) } } // beast +} // boost #endif diff --git a/include/beast/core/impl/file_posix.ipp b/include/boost/beast/core/impl/file_posix.ipp similarity index 97% rename from include/beast/core/impl/file_posix.ipp rename to include/boost/beast/core/impl/file_posix.ipp index f0a7279b..73a93c37 100644 --- a/include/beast/core/impl/file_posix.ipp +++ b/include/boost/beast/core/impl/file_posix.ipp @@ -4,9 +4,11 @@ // 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 BEAST_CORE_IMPL_FILE_POSIX_IPP -#define BEAST_CORE_IMPL_FILE_POSIX_IPP +#ifndef BOOST_BEAST_CORE_IMPL_FILE_POSIX_IPP +#define BOOST_BEAST_CORE_IMPL_FILE_POSIX_IPP #include #include @@ -16,6 +18,7 @@ #include #include +namespace boost { namespace beast { namespace detail { @@ -327,5 +330,6 @@ write(void const* buffer, std::size_t n, error_code& ec) } } // beast +} // boost #endif diff --git a/include/beast/core/impl/file_stdio.ipp b/include/boost/beast/core/impl/file_stdio.ipp similarity index 95% rename from include/beast/core/impl/file_stdio.ipp rename to include/boost/beast/core/impl/file_stdio.ipp index 1738e48d..0a975a88 100644 --- a/include/beast/core/impl/file_stdio.ipp +++ b/include/boost/beast/core/impl/file_stdio.ipp @@ -4,12 +4,15 @@ // 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 BEAST_CORE_IMPL_FILE_STDIO_IPP -#define BEAST_CORE_IMPL_FILE_STDIO_IPP +#ifndef BOOST_BEAST_CORE_IMPL_FILE_STDIO_IPP +#define BOOST_BEAST_CORE_IMPL_FILE_STDIO_IPP #include +namespace boost { namespace beast { inline @@ -221,5 +224,6 @@ write(void const* buffer, std::size_t n, error_code& ec) } } // beast +} // boost #endif diff --git a/include/beast/core/impl/file_win32.ipp b/include/boost/beast/core/impl/file_win32.ipp similarity index 98% rename from include/beast/core/impl/file_win32.ipp rename to include/boost/beast/core/impl/file_win32.ipp index 5b7a1647..4e807e81 100644 --- a/include/beast/core/impl/file_win32.ipp +++ b/include/boost/beast/core/impl/file_win32.ipp @@ -4,9 +4,11 @@ // 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 BEAST_CORE_IMPL_FILE_WIN32_IPP -#define BEAST_CORE_IMPL_FILE_WIN32_IPP +#ifndef BOOST_BEAST_CORE_IMPL_FILE_WIN32_IPP +#define BOOST_BEAST_CORE_IMPL_FILE_WIN32_IPP #include #include @@ -15,6 +17,7 @@ #include #include +namespace boost { namespace beast { namespace detail { @@ -352,5 +355,6 @@ write(void const* buffer, std::size_t n, error_code& ec) } } // beast +} // boost #endif diff --git a/include/beast/core/impl/flat_buffer.ipp b/include/boost/beast/core/impl/flat_buffer.ipp similarity index 98% rename from include/beast/core/impl/flat_buffer.ipp rename to include/boost/beast/core/impl/flat_buffer.ipp index b7a938ed..5a1e7622 100644 --- a/include/beast/core/impl/flat_buffer.ipp +++ b/include/boost/beast/core/impl/flat_buffer.ipp @@ -4,14 +4,17 @@ // 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 BEAST_IMPL_FLAT_BUFFER_HPP -#define BEAST_IMPL_FLAT_BUFFER_HPP +#ifndef BOOST_BEAST_IMPL_FLAT_BUFFER_HPP +#define BOOST_BEAST_IMPL_FLAT_BUFFER_HPP #include #include #include +namespace boost { namespace beast { /* Memory is laid out thusly: @@ -467,5 +470,6 @@ swap( } } // beast +} // boost #endif diff --git a/include/beast/core/impl/flat_static_buffer.ipp b/include/boost/beast/core/impl/flat_static_buffer.ipp similarity index 91% rename from include/beast/core/impl/flat_static_buffer.ipp rename to include/boost/beast/core/impl/flat_static_buffer.ipp index 7b23e94d..781fa3a5 100644 --- a/include/beast/core/impl/flat_static_buffer.ipp +++ b/include/boost/beast/core/impl/flat_static_buffer.ipp @@ -4,11 +4,13 @@ // 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 BEAST_IMPL_FLAT_STATIC_BUFFER_IPP -#define BEAST_IMPL_FLAT_STATIC_BUFFER_IPP +#ifndef BOOST_BEAST_IMPL_FLAT_STATIC_BUFFER_IPP +#define BOOST_BEAST_IMPL_FLAT_STATIC_BUFFER_IPP -#include +#include #include #include #include @@ -16,6 +18,7 @@ #include #include +namespace boost { namespace beast { /* Memory is laid out thusly: @@ -134,5 +137,6 @@ operator=(flat_static_buffer const& other) -> } } // beast +} // boost #endif diff --git a/include/beast/core/impl/handler_ptr.ipp b/include/boost/beast/core/impl/handler_ptr.ipp similarity index 94% rename from include/beast/core/impl/handler_ptr.ipp rename to include/boost/beast/core/impl/handler_ptr.ipp index a882acf9..87c5e36c 100644 --- a/include/beast/core/impl/handler_ptr.ipp +++ b/include/boost/beast/core/impl/handler_ptr.ipp @@ -4,9 +4,11 @@ // 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 BEAST_IMPL_HANDLER_PTR_HPP -#define BEAST_IMPL_HANDLER_PTR_HPP +#ifndef BOOST_BEAST_IMPL_HANDLER_PTR_HPP +#define BOOST_BEAST_IMPL_HANDLER_PTR_HPP #include #include @@ -14,6 +16,7 @@ #include #include +namespace boost { namespace beast { template @@ -129,5 +132,6 @@ invoke(Args&&... args) } } // beast +} // boost #endif diff --git a/include/beast/core/impl/multi_buffer.ipp b/include/boost/beast/core/impl/multi_buffer.ipp similarity index 97% rename from include/beast/core/impl/multi_buffer.ipp rename to include/boost/beast/core/impl/multi_buffer.ipp index 9c5edd20..7e4ddbc3 100644 --- a/include/beast/core/impl/multi_buffer.ipp +++ b/include/boost/beast/core/impl/multi_buffer.ipp @@ -4,11 +4,13 @@ // 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 BEAST_IMPL_MULTI_BUFFER_IPP -#define BEAST_IMPL_MULTI_BUFFER_IPP +#ifndef BOOST_BEAST_IMPL_MULTI_BUFFER_IPP +#define BOOST_BEAST_IMPL_MULTI_BUFFER_IPP -#include +#include #include #include #include @@ -17,6 +19,7 @@ #include #include +namespace boost { namespace beast { /* These diagrams illustrate the layout and state variables. @@ -634,7 +637,7 @@ prepare(size_type n) -> out_end_ = out_->size(); reuse.splice(reuse.end(), list_, std::next(out_), list_.end()); - #if BEAST_MULTI_BUFFER_DEBUG_CHECK + #if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK debug_check(); #endif } @@ -649,7 +652,7 @@ prepare(size_type n) -> out_end_ = out_pos_ + n; n = 0; } - #if BEAST_MULTI_BUFFER_DEBUG_CHECK + #if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK debug_check(); #endif } @@ -670,7 +673,7 @@ prepare(size_type n) -> out_end_ = n; n = 0; } - #if BEAST_MULTI_BUFFER_DEBUG_CHECK + #if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK debug_check(); #endif } @@ -700,7 +703,7 @@ prepare(size_type n) -> if(out_ == list_.end()) out_ = list_.iterator_to(e); out_end_ = n; - #if BEAST_MULTI_BUFFER_DEBUG_CHECK + #if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK debug_check(); #endif } @@ -726,7 +729,7 @@ commit(size_type n) { out_pos_ += n; in_size_ += n; - #if BEAST_MULTI_BUFFER_DEBUG_CHECK + #if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK debug_check(); #endif return; @@ -735,7 +738,7 @@ commit(size_type n) n -= avail; out_pos_ = 0; in_size_ += avail; - #if BEAST_MULTI_BUFFER_DEBUG_CHECK + #if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK debug_check(); #endif } @@ -749,7 +752,7 @@ commit(size_type n) out_pos_ = 0; out_end_ = 0; } -#if BEAST_MULTI_BUFFER_DEBUG_CHECK +#if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK debug_check(); #endif } @@ -771,7 +774,7 @@ consume(size_type n) { in_size_ -= n; in_pos_ += n; - #if BEAST_MULTI_BUFFER_DEBUG_CHECK + #if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK debug_check(); #endif break; @@ -782,7 +785,7 @@ consume(size_type n) auto& e = list_.front(); list_.erase(list_.iterator_to(e)); delete_element(e); - #if BEAST_MULTI_BUFFER_DEBUG_CHECK + #if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK debug_check(); #endif } @@ -811,7 +814,7 @@ consume(size_type n) out_end_ = 0; } } - #if BEAST_MULTI_BUFFER_DEBUG_CHECK + #if BOOST_BEAST_MULTI_BUFFER_DEBUG_CHECK debug_check(); #endif break; @@ -1045,5 +1048,6 @@ debug_check() const } } // beast +} // boost #endif diff --git a/include/beast/core/impl/read_size.ipp b/include/boost/beast/core/impl/read_size.ipp similarity index 91% rename from include/beast/core/impl/read_size.ipp rename to include/boost/beast/core/impl/read_size.ipp index 56bc81c7..7e8816a7 100644 --- a/include/beast/core/impl/read_size.ipp +++ b/include/boost/beast/core/impl/read_size.ipp @@ -4,10 +4,13 @@ // 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 BEAST_IMPL_READ_SIZE_IPP -#define BEAST_IMPL_READ_SIZE_IPP +#ifndef BOOST_BEAST_IMPL_READ_SIZE_IPP +#define BOOST_BEAST_IMPL_READ_SIZE_IPP +namespace boost { namespace beast { namespace detail { @@ -71,5 +74,6 @@ read_size_or_throw( } } // beast +} // boost #endif diff --git a/include/beast/core/impl/static_buffer.ipp b/include/boost/beast/core/impl/static_buffer.ipp similarity index 96% rename from include/beast/core/impl/static_buffer.ipp rename to include/boost/beast/core/impl/static_buffer.ipp index da1546dd..5107d752 100644 --- a/include/beast/core/impl/static_buffer.ipp +++ b/include/boost/beast/core/impl/static_buffer.ipp @@ -4,11 +4,13 @@ // 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 BEAST_IMPL_STATIC_BUFFER_IPP -#define BEAST_IMPL_STATIC_BUFFER_IPP +#ifndef BOOST_BEAST_IMPL_STATIC_BUFFER_IPP +#define BOOST_BEAST_IMPL_STATIC_BUFFER_IPP -#include +#include #include #include #include @@ -16,6 +18,7 @@ #include #include +namespace boost { namespace beast { template @@ -313,5 +316,6 @@ operator=(static_buffer const& other) -> } } // beast +} // boost #endif diff --git a/include/beast/core/impl/static_string.ipp b/include/boost/beast/core/impl/static_string.ipp similarity index 98% rename from include/beast/core/impl/static_string.ipp rename to include/boost/beast/core/impl/static_string.ipp index 6bab53b5..3f758c55 100644 --- a/include/beast/core/impl/static_string.ipp +++ b/include/boost/beast/core/impl/static_string.ipp @@ -4,14 +4,17 @@ // 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 BEAST_IMPL_STATIC_STRING_IPP -#define BEAST_IMPL_STATIC_STRING_IPP +#ifndef BOOST_BEAST_IMPL_STATIC_STRING_IPP +#define BOOST_BEAST_IMPL_STATIC_STRING_IPP -#include -#include +#include +#include #include +namespace boost { namespace beast { // @@ -610,5 +613,6 @@ to_static_string(Integer x) } } // beast +} // boost #endif diff --git a/include/beast/core/impl/string_param.ipp b/include/boost/beast/core/impl/string_param.ipp similarity index 91% rename from include/beast/core/impl/string_param.ipp rename to include/boost/beast/core/impl/string_param.ipp index 46332ec4..30342d53 100644 --- a/include/beast/core/impl/string_param.ipp +++ b/include/boost/beast/core/impl/string_param.ipp @@ -4,10 +4,13 @@ // 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 BEAST_IMPL_STRING_PARAM_IPP -#define BEAST_IMPL_STRING_PARAM_IPP +#ifndef BOOST_BEAST_IMPL_STRING_PARAM_IPP +#define BOOST_BEAST_IMPL_STRING_PARAM_IPP +namespace boost { namespace beast { template @@ -100,5 +103,6 @@ string_param(Args const&... args) } } // beast +} // boost #endif diff --git a/include/beast/core/multi_buffer.hpp b/include/boost/beast/core/multi_buffer.hpp similarity index 96% rename from include/beast/core/multi_buffer.hpp rename to include/boost/beast/core/multi_buffer.hpp index 2a27df0d..fd92f105 100644 --- a/include/beast/core/multi_buffer.hpp +++ b/include/boost/beast/core/multi_buffer.hpp @@ -4,11 +4,13 @@ // 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 BEAST_MULTI_BUFFER_HPP -#define BEAST_MULTI_BUFFER_HPP +#ifndef BOOST_BEAST_MULTI_BUFFER_HPP +#define BOOST_BEAST_MULTI_BUFFER_HPP -#include +#include #include #include #include @@ -16,6 +18,7 @@ #include #include +namespace boost { namespace beast { /** A @b DynamicBuffer that uses multiple buffers internally. @@ -33,7 +36,7 @@ template class basic_multi_buffer { public: -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN /// The type of allocator used. using allocator_type = Allocator; #else @@ -77,7 +80,7 @@ private: allocator_type alloc_; // the allocator public: -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN /// The type used to represent the input sequence as a list of buffers. using const_buffers_type = implementation_defined; @@ -313,7 +316,8 @@ private: using multi_buffer = basic_multi_buffer>; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/ostream.hpp b/include/boost/beast/core/ostream.hpp similarity index 89% rename from include/beast/core/ostream.hpp rename to include/boost/beast/core/ostream.hpp index 49cbd69a..51ad99cb 100644 --- a/include/beast/core/ostream.hpp +++ b/include/boost/beast/core/ostream.hpp @@ -4,17 +4,20 @@ // 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 BEAST_WRITE_OSTREAM_HPP -#define BEAST_WRITE_OSTREAM_HPP +#ifndef BOOST_BEAST_WRITE_OSTREAM_HPP +#define BOOST_BEAST_WRITE_OSTREAM_HPP -#include -#include -#include +#include +#include +#include #include #include #include +namespace boost { namespace beast { /** Return an object representing a @b ConstBufferSequence. @@ -39,7 +42,7 @@ namespace beast { is still responsible for managing its lifetime. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN implementation_defined #else detail::buffers_helper @@ -78,7 +81,7 @@ buffers(ConstBufferSequence const& b) lifetime of the output stream. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN implementation_defined #else detail::ostream_helper< @@ -95,5 +98,6 @@ ostream(DynamicBuffer& buffer) } } // beast +} // boost #endif diff --git a/include/beast/core/read_size.hpp b/include/boost/beast/core/read_size.hpp similarity index 84% rename from include/beast/core/read_size.hpp rename to include/boost/beast/core/read_size.hpp index 326877f4..940a462e 100644 --- a/include/beast/core/read_size.hpp +++ b/include/boost/beast/core/read_size.hpp @@ -4,14 +4,17 @@ // 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 BEAST_READ_SIZE_HELPER_HPP -#define BEAST_READ_SIZE_HELPER_HPP +#ifndef BOOST_BEAST_READ_SIZE_HELPER_HPP +#define BOOST_BEAST_READ_SIZE_HELPER_HPP -#include -#include +#include +#include #include +namespace boost { namespace beast { /** Returns a natural read size. @@ -54,7 +57,8 @@ read_size_or_throw(DynamicBuffer& buffer, std::size_t max_size); } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/span.hpp b/include/boost/beast/core/span.hpp similarity index 92% rename from include/beast/core/span.hpp rename to include/boost/beast/core/span.hpp index 1d465ce4..43b7505d 100644 --- a/include/beast/core/span.hpp +++ b/include/boost/beast/core/span.hpp @@ -4,17 +4,20 @@ // 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 BEAST_CORE_SPAN_HPP -#define BEAST_CORE_SPAN_HPP +#ifndef BOOST_BEAST_CORE_SPAN_HPP +#define BOOST_BEAST_CORE_SPAN_HPP -#include -#include +#include +#include #include #include #include #include +namespace boost { namespace beast { /** A range of bytes expressed as a ContiguousContainer @@ -84,7 +87,7 @@ public: @param container The container to construct from */ template::value>::type @@ -97,7 +100,7 @@ public: { } -#if ! BEAST_DOXYGEN +#if ! BOOST_BEAST_DOXYGEN template explicit span(std::basic_string& s) @@ -120,7 +123,7 @@ public: @param container The container to assign from */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN span& #else typename std::enable_if span& operator=(std::basic_string< @@ -207,5 +210,6 @@ public: }; } // beast +} // boost #endif diff --git a/include/beast/core/static_buffer.hpp b/include/boost/beast/core/static_buffer.hpp similarity index 94% rename from include/beast/core/static_buffer.hpp rename to include/boost/beast/core/static_buffer.hpp index 7addd784..b69ce0fe 100644 --- a/include/beast/core/static_buffer.hpp +++ b/include/boost/beast/core/static_buffer.hpp @@ -4,16 +4,19 @@ // 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 BEAST_STATIC_BUFFER_HPP -#define BEAST_STATIC_BUFFER_HPP +#ifndef BOOST_BEAST_STATIC_BUFFER_HPP +#define BOOST_BEAST_STATIC_BUFFER_HPP -#include +#include #include #include #include #include +namespace boost { namespace beast { /** A circular @b DynamicBuffer with a fixed size internal buffer. @@ -50,7 +53,7 @@ class static_buffer_base public: /// The type used to represent the input sequence as a list of buffers. -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using const_buffers_type = implementation_defined; #else using const_buffers_type = @@ -58,7 +61,7 @@ public: #endif /// The type used to represent the mutable input sequence as a list of buffers. -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using mutable_data_type = implementation_defined; #else using mutable_data_type = @@ -66,7 +69,7 @@ public: #endif /// The type used to represent the output sequence as a list of buffers. -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using mutable_buffers_type = implementation_defined; #else using mutable_buffers_type = @@ -216,7 +219,8 @@ public: }; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/static_string.hpp b/include/boost/beast/core/static_string.hpp similarity index 97% rename from include/beast/core/static_string.hpp rename to include/boost/beast/core/static_string.hpp index 0d0dc8f2..ca7673ac 100644 --- a/include/beast/core/static_string.hpp +++ b/include/boost/beast/core/static_string.hpp @@ -4,13 +4,15 @@ // 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 BEAST_STATIC_STRING_HPP -#define BEAST_STATIC_STRING_HPP +#ifndef BOOST_BEAST_STATIC_STRING_HPP +#define BOOST_BEAST_STATIC_STRING_HPP -#include -#include -#include +#include +#include +#include #include #include #include @@ -20,6 +22,7 @@ #include #include +namespace boost { namespace beast { /** A modifiable string with a fixed-size storage area. @@ -74,7 +77,7 @@ public: /// The type of `string_view` returned by the interface using string_view_type = - beast::basic_string_view; + basic_string_view; // // Constants @@ -139,7 +142,7 @@ public: obtained by converting `t` to `string_view_type`, and used to construct the string. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template #else template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN static_string& #else typename std::enable_if -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN iterator #else typename std::enable_if< @@ -559,7 +562,7 @@ public: } template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN static_string& #else typename std::enable_if< @@ -623,7 +626,7 @@ public: } template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN static_string& #else typename std::enable_if< @@ -759,7 +762,7 @@ public: } template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN int #else typename std::enable_if< @@ -1102,7 +1105,8 @@ static_string to_static_string(Integer x); } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/string.hpp b/include/boost/beast/core/string.hpp similarity index 88% rename from include/beast/core/string.hpp rename to include/boost/beast/core/string.hpp index bf788bc5..eca77aec 100644 --- a/include/beast/core/string.hpp +++ b/include/boost/beast/core/string.hpp @@ -4,21 +4,23 @@ // 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 BEAST_STRING_HPP -#define BEAST_STRING_HPP +#ifndef BOOST_BEAST_STRING_HPP +#define BOOST_BEAST_STRING_HPP -#include +#include #include -#ifndef BEAST_NO_BOOST_STRING_VIEW +#ifndef BOOST_BEAST_NO_BOOST_STRING_VIEW # if BOOST_VERSION >= 106400 -# define BEAST_NO_BOOST_STRING_VIEW 0 +# define BOOST_BEAST_NO_BOOST_STRING_VIEW 0 # else -# define BEAST_NO_BOOST_STRING_VIEW 1 +# define BOOST_BEAST_NO_BOOST_STRING_VIEW 1 # endif #endif -#if BEAST_NO_BOOST_STRING_VIEW +#if BOOST_BEAST_NO_BOOST_STRING_VIEW #include #else #include @@ -26,9 +28,10 @@ #include +namespace boost { namespace beast { -#if BEAST_NO_BOOST_STRING_VIEW +#if BOOST_BEAST_NO_BOOST_STRING_VIEW /// The type of string view used by the library using string_view = boost::string_ref; @@ -147,5 +150,6 @@ struct iequal }; } // beast +} // boost #endif diff --git a/include/beast/core/string_param.hpp b/include/boost/beast/core/string_param.hpp similarity index 86% rename from include/beast/core/string_param.hpp rename to include/boost/beast/core/string_param.hpp index f3b33e0a..d2dd4a08 100644 --- a/include/beast/core/string_param.hpp +++ b/include/boost/beast/core/string_param.hpp @@ -4,17 +4,20 @@ // 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 BEAST_STRING_PARAM_HPP -#define BEAST_STRING_PARAM_HPP +#ifndef BOOST_BEAST_STRING_PARAM_HPP +#define BOOST_BEAST_STRING_PARAM_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include +namespace boost { namespace beast { /** A function parameter which efficiently converts to string. @@ -120,7 +123,8 @@ public: }; } // beast +} // boost -#include +#include #endif diff --git a/include/beast/core/type_traits.hpp b/include/boost/beast/core/type_traits.hpp similarity index 96% rename from include/beast/core/type_traits.hpp rename to include/boost/beast/core/type_traits.hpp index 2624ee66..5a46216b 100644 --- a/include/beast/core/type_traits.hpp +++ b/include/boost/beast/core/type_traits.hpp @@ -4,16 +4,19 @@ // 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 BEAST_TYPE_TRAITS_HPP -#define BEAST_TYPE_TRAITS_HPP +#ifndef BOOST_BEAST_TYPE_TRAITS_HPP +#define BOOST_BEAST_TYPE_TRAITS_HPP -#include -#include -#include +#include +#include +#include #include #include +namespace boost { namespace beast { //------------------------------------------------------------------------------ @@ -50,7 +53,7 @@ namespace beast { @endcode */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN struct is_const_buffer_sequence : std::integral_constant #else struct is_const_buffer_sequence : @@ -87,7 +90,7 @@ struct is_const_buffer_sequence : @endcode */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN struct is_mutable_buffer_sequence : std::integral_constant #else struct is_mutable_buffer_sequence : @@ -123,7 +126,7 @@ struct is_mutable_buffer_sequence : f(DynamicBuffer const& buffer); @endcode */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template struct is_dynamic_buffer : std::integral_constant {}; #else @@ -192,7 +195,7 @@ struct is_dynamic_buffer< @endcode */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using is_completion_handler = std::integral_constant; #else using is_completion_handler = std::integral_constant struct has_get_io_service : std::integral_constant{}; #else @@ -289,7 +292,7 @@ struct has_get_io_service::type>::value> {}; @endcode */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template struct get_lowest_layer; #else @@ -334,7 +337,7 @@ struct get_lowest_layer struct is_async_read_stream : std::integral_constant{}; #else @@ -378,7 +381,7 @@ struct is_async_read_stream struct is_async_write_stream : std::integral_constant{}; #else @@ -422,7 +425,7 @@ struct is_async_write_stream struct is_sync_read_stream : std::integral_constant{}; #else @@ -468,7 +471,7 @@ struct is_sync_read_stream struct is_sync_write_stream : std::integral_constant{}; #else @@ -514,7 +517,7 @@ struct is_sync_write_stream struct is_async_stream : std::integral_constant{}; #else @@ -550,7 +553,7 @@ using is_async_stream = std::integral_constant struct is_sync_stream : std::integral_constant{}; #else @@ -592,7 +595,7 @@ using is_sync_stream = std::integral_constant struct is_file : std::integral_constant{}; #else @@ -629,5 +632,6 @@ struct is_file + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/include/beast/http/basic_dynamic_body.hpp b/include/boost/beast/http/basic_dynamic_body.hpp similarity index 90% rename from include/beast/http/basic_dynamic_body.hpp rename to include/boost/beast/http/basic_dynamic_body.hpp index acc049dc..e56b2e4c 100644 --- a/include/beast/http/basic_dynamic_body.hpp +++ b/include/boost/beast/http/basic_dynamic_body.hpp @@ -4,19 +4,22 @@ // 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 BEAST_HTTP_BASIC_DYNAMIC_BODY_HPP -#define BEAST_HTTP_BASIC_DYNAMIC_BODY_HPP +#ifndef BOOST_BEAST_HTTP_BASIC_DYNAMIC_BODY_HPP +#define BOOST_BEAST_HTTP_BASIC_DYNAMIC_BODY_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace http { @@ -56,7 +59,7 @@ struct basic_dynamic_body Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using reader = implementation_defined; #else class reader @@ -94,7 +97,7 @@ struct basic_dynamic_body Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using writer = implementation_defined; #else class writer @@ -160,5 +163,6 @@ struct basic_dynamic_body } // http } // beast +} // boost #endif diff --git a/include/beast/http/basic_file_body.hpp b/include/boost/beast/http/basic_file_body.hpp similarity index 97% rename from include/beast/http/basic_file_body.hpp rename to include/boost/beast/http/basic_file_body.hpp index 8fcc2916..4881b8c4 100644 --- a/include/beast/http/basic_file_body.hpp +++ b/include/boost/beast/http/basic_file_body.hpp @@ -4,15 +4,17 @@ // 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 BEAST_HTTP_BASIC_FILE_BODY_HPP -#define BEAST_HTTP_BASIC_FILE_BODY_HPP +#ifndef BOOST_BEAST_HTTP_BASIC_FILE_BODY_HPP +#define BOOST_BEAST_HTTP_BASIC_FILE_BODY_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include @@ -20,6 +22,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -514,7 +517,7 @@ finish(error_code& ec) //] -#if ! BEAST_DOXYGEN +#if ! BOOST_BEAST_DOXYGEN // operator<< is not supported for file_body template std::ostream& @@ -524,5 +527,6 @@ operator<<(std::ostream& os, message< } // http } // beast +} // boost #endif diff --git a/include/beast/http/basic_parser.hpp b/include/boost/beast/http/basic_parser.hpp similarity index 97% rename from include/beast/http/basic_parser.hpp rename to include/boost/beast/http/basic_parser.hpp index 7decdc20..640f413b 100644 --- a/include/beast/http/basic_parser.hpp +++ b/include/boost/beast/http/basic_parser.hpp @@ -4,16 +4,18 @@ // 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 BEAST_HTTP_BASIC_PARSER_HPP -#define BEAST_HTTP_BASIC_PARSER_HPP +#ifndef BOOST_BEAST_HTTP_BASIC_PARSER_HPP +#define BOOST_BEAST_HTTP_BASIC_PARSER_HPP -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -22,6 +24,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -511,7 +514,7 @@ public: std::size_t put(ConstBufferSequence const& buffers, error_code& ec); -#if ! BEAST_DOXYGEN +#if ! BOOST_BEAST_DOXYGEN std::size_t put(boost::asio::const_buffers_1 const& buffer, error_code& ec); @@ -601,7 +604,8 @@ private: } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/buffer_body.hpp b/include/boost/beast/http/buffer_body.hpp similarity index 93% rename from include/beast/http/buffer_body.hpp rename to include/boost/beast/http/buffer_body.hpp index 61a99f17..d9928f52 100644 --- a/include/beast/http/buffer_body.hpp +++ b/include/boost/beast/http/buffer_body.hpp @@ -4,18 +4,21 @@ // 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 BEAST_HTTP_BUFFER_BODY_HPP -#define BEAST_HTTP_BUFFER_BODY_HPP +#ifndef BOOST_BEAST_HTTP_BUFFER_BODY_HPP +#define BOOST_BEAST_HTTP_BUFFER_BODY_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include +namespace boost { namespace beast { namespace http { @@ -92,7 +95,7 @@ struct buffer_body Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using reader = implementation_defined; #else class reader @@ -155,7 +158,7 @@ struct buffer_body Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using writer = implementation_defined; #else class writer @@ -210,7 +213,7 @@ struct buffer_body #endif }; -#if ! BEAST_DOXYGEN +#if ! BOOST_BEAST_DOXYGEN // operator<< is not supported for buffer_body template std::ostream& @@ -220,5 +223,6 @@ operator<<(std::ostream& os, message -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include +namespace boost { namespace beast { namespace http { @@ -42,7 +45,7 @@ struct chunk_crlf //----- /// Required for @b ConstBufferSequence -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using value_type = implementation_defined; #else using value_type = detail::chunk_crlf_iter::value_type; @@ -175,7 +178,7 @@ public: @see https://tools.ietf.org/html/rfc7230#section-4.1 */ template::value>::type @@ -211,7 +214,7 @@ public: @see https://tools.ietf.org/html/rfc7230#section-4.1 */ template::value>::type @@ -225,14 +228,14 @@ public: //----- /// Required for @b ConstBufferSequence -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using value_type = implementation_defined; #else using value_type = typename view_type::value_type; #endif /// Required for @b ConstBufferSequence -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using const_iterator = implementation_defined; #else using const_iterator = typename view_type::const_iterator; @@ -366,7 +369,7 @@ public: @see https://tools.ietf.org/html/rfc7230#section-4.1 */ template::type, string_view>::value>::type @@ -405,7 +408,7 @@ public: @see https://tools.ietf.org/html/rfc7230#section-4.1 */ template::type, string_view>::value>::type @@ -419,14 +422,14 @@ public: //----- /// Required for @b ConstBufferSequence -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using value_type = implementation_defined; #else using value_type = typename view_type::value_type; #endif /// Required for @b ConstBufferSequence -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using const_iterator = implementation_defined; #else using const_iterator = typename view_type::const_iterator; @@ -507,7 +510,7 @@ public: @param allocator The allocator to use for storing temporary data associated with the serialized trailer buffers. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template chunk_last(Trailer const& trailer, Allocator const& allocator); #else @@ -524,7 +527,7 @@ public: chunk_last(chunk_last const&) = default; /// Required for @b ConstBufferSequence -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using value_type = implementation_defined; #else using value_type = @@ -532,7 +535,7 @@ public: #endif /// Required for @b ConstBufferSequence -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using const_iterator = implementation_defined; #else using const_iterator = @@ -726,7 +729,8 @@ make_chunk_last( } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/detail/basic_parsed_list.hpp b/include/boost/beast/http/detail/basic_parsed_list.hpp similarity index 92% rename from include/beast/http/detail/basic_parsed_list.hpp rename to include/boost/beast/http/detail/basic_parsed_list.hpp index 98f9acae..79897874 100644 --- a/include/beast/http/detail/basic_parsed_list.hpp +++ b/include/boost/beast/http/detail/basic_parsed_list.hpp @@ -4,15 +4,18 @@ // 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 BEAST_HTTP_DETAIL_BASIC_PARSED_LIST_HPP -#define BEAST_HTTP_DETAIL_BASIC_PARSED_LIST_HPP +#ifndef BOOST_BEAST_HTTP_DETAIL_BASIC_PARSED_LIST_HPP +#define BOOST_BEAST_HTTP_DETAIL_BASIC_PARSED_LIST_HPP -#include -#include +#include +#include #include #include +namespace boost { namespace beast { namespace http { namespace detail { @@ -32,7 +35,7 @@ public: using value_type = typename Policy::value_type; /// A constant iterator to a list element. -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using const_iterator = implementation_defined; #else class const_iterator; @@ -189,6 +192,7 @@ cend() const -> } // detail } // http } // beast +} // boost #endif diff --git a/include/beast/http/detail/basic_parser.hpp b/include/boost/beast/http/detail/basic_parser.hpp similarity index 98% rename from include/beast/http/detail/basic_parser.hpp rename to include/boost/beast/http/detail/basic_parser.hpp index f64f69e7..1b1eb941 100644 --- a/include/beast/http/detail/basic_parser.hpp +++ b/include/boost/beast/http/detail/basic_parser.hpp @@ -4,21 +4,24 @@ // 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 BEAST_HTTP_DETAIL_BASIC_PARSER_HPP -#define BEAST_HTTP_DETAIL_BASIC_PARSER_HPP +#ifndef BOOST_BEAST_HTTP_DETAIL_BASIC_PARSER_HPP +#define BOOST_BEAST_HTTP_DETAIL_BASIC_PARSER_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include #include #include +namespace boost { namespace beast { namespace http { namespace detail { @@ -888,5 +891,6 @@ protected: } // detail } // http } // beast +} // boost #endif diff --git a/include/beast/http/detail/chunk_encode.hpp b/include/boost/beast/http/detail/chunk_encode.hpp similarity index 94% rename from include/beast/http/detail/chunk_encode.hpp rename to include/boost/beast/http/detail/chunk_encode.hpp index 7556f0f7..a4923c03 100644 --- a/include/beast/http/detail/chunk_encode.hpp +++ b/include/boost/beast/http/detail/chunk_encode.hpp @@ -4,17 +4,20 @@ // 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 BEAST_HTTP_DETAIL_CHUNK_ENCODE_HPP -#define BEAST_HTTP_DETAIL_CHUNK_ENCODE_HPP +#ifndef BOOST_BEAST_HTTP_DETAIL_CHUNK_ENCODE_HPP +#define BOOST_BEAST_HTTP_DETAIL_CHUNK_ENCODE_HPP -#include -#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace http { namespace detail { @@ -254,5 +257,6 @@ struct buffers_or_fields } // detail } // http } // beast +} // boost #endif diff --git a/include/beast/http/detail/rfc7230.hpp b/include/boost/beast/http/detail/rfc7230.hpp similarity index 98% rename from include/beast/http/detail/rfc7230.hpp rename to include/boost/beast/http/detail/rfc7230.hpp index bfdb74c7..85c73155 100644 --- a/include/beast/http/detail/rfc7230.hpp +++ b/include/boost/beast/http/detail/rfc7230.hpp @@ -4,14 +4,17 @@ // 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 BEAST_HTTP_DETAIL_RFC7230_HPP -#define BEAST_HTTP_DETAIL_RFC7230_HPP +#ifndef BOOST_BEAST_HTTP_DETAIL_RFC7230_HPP +#define BOOST_BEAST_HTTP_DETAIL_RFC7230_HPP -#include +#include #include #include +namespace boost { namespace beast { namespace http { namespace detail { @@ -464,6 +467,7 @@ struct opt_token_list_policy } // detail } // http } // beast +} // boost #endif diff --git a/include/beast/http/detail/type_traits.hpp b/include/boost/beast/http/detail/type_traits.hpp similarity index 95% rename from include/beast/http/detail/type_traits.hpp rename to include/boost/beast/http/detail/type_traits.hpp index bb10a2d7..58361b25 100644 --- a/include/beast/http/detail/type_traits.hpp +++ b/include/boost/beast/http/detail/type_traits.hpp @@ -4,14 +4,17 @@ // 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 BEAST_HTTP_DETAIL_TYPE_TRAITS_HPP -#define BEAST_HTTP_DETAIL_TYPE_TRAITS_HPP +#ifndef BOOST_BEAST_HTTP_DETAIL_TYPE_TRAITS_HPP +#define BOOST_BEAST_HTTP_DETAIL_TYPE_TRAITS_HPP -#include +#include #include #include +namespace boost { namespace beast { namespace http { @@ -184,5 +187,6 @@ struct is_fields_helper : T } // detail } // http } // beast +} // boost #endif diff --git a/include/beast/http/dynamic_body.hpp b/include/boost/beast/http/dynamic_body.hpp similarity index 63% rename from include/beast/http/dynamic_body.hpp rename to include/boost/beast/http/dynamic_body.hpp index 892b2699..3faf60e9 100644 --- a/include/beast/http/dynamic_body.hpp +++ b/include/boost/beast/http/dynamic_body.hpp @@ -4,13 +4,16 @@ // 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 BEAST_HTTP_DYNAMIC_BODY_HPP -#define BEAST_HTTP_DYNAMIC_BODY_HPP +#ifndef BOOST_BEAST_HTTP_DYNAMIC_BODY_HPP +#define BOOST_BEAST_HTTP_DYNAMIC_BODY_HPP -#include -#include +#include +#include +namespace boost { namespace beast { namespace http { @@ -22,5 +25,6 @@ using dynamic_body = basic_dynamic_body; } // http } // beast +} // boost #endif diff --git a/include/beast/http/empty_body.hpp b/include/boost/beast/http/empty_body.hpp similarity index 89% rename from include/beast/http/empty_body.hpp rename to include/boost/beast/http/empty_body.hpp index 2db58a01..8081a2ab 100644 --- a/include/beast/http/empty_body.hpp +++ b/include/boost/beast/http/empty_body.hpp @@ -4,15 +4,18 @@ // 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 BEAST_HTTP_EMPTY_BODY_HPP -#define BEAST_HTTP_EMPTY_BODY_HPP +#ifndef BOOST_BEAST_HTTP_EMPTY_BODY_HPP +#define BOOST_BEAST_HTTP_EMPTY_BODY_HPP -#include -#include -#include +#include +#include +#include #include +namespace boost { namespace beast { namespace http { @@ -53,7 +56,7 @@ struct empty_body Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using reader = implementation_defined; #else struct reader @@ -87,7 +90,7 @@ struct empty_body Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using writer = implementation_defined; #else struct writer @@ -124,5 +127,6 @@ struct empty_body } // http } // beast +} // boost #endif diff --git a/include/beast/http/error.hpp b/include/boost/beast/http/error.hpp similarity index 93% rename from include/beast/http/error.hpp rename to include/boost/beast/http/error.hpp index dbe76051..978d6c29 100644 --- a/include/beast/http/error.hpp +++ b/include/boost/beast/http/error.hpp @@ -4,13 +4,16 @@ // 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 BEAST_HTTP_ERROR_HPP -#define BEAST_HTTP_ERROR_HPP +#ifndef BOOST_BEAST_HTTP_ERROR_HPP +#define BOOST_BEAST_HTTP_ERROR_HPP -#include -#include +#include +#include +namespace boost { namespace beast { namespace http { @@ -151,7 +154,8 @@ enum class error } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/field.hpp b/include/boost/beast/http/field.hpp similarity index 96% rename from include/beast/http/field.hpp rename to include/boost/beast/http/field.hpp index 62d6a3f7..fe30c2cc 100644 --- a/include/beast/http/field.hpp +++ b/include/boost/beast/http/field.hpp @@ -4,14 +4,17 @@ // 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 BEAST_HTTP_FIELD_HPP -#define BEAST_HTTP_FIELD_HPP +#ifndef BOOST_BEAST_HTTP_FIELD_HPP +#define BOOST_BEAST_HTTP_FIELD_HPP -#include -#include +#include +#include #include +namespace boost { namespace beast { namespace http { @@ -399,7 +402,8 @@ operator<<(std::ostream& os, field f) } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/fields.hpp b/include/boost/beast/http/fields.hpp similarity index 97% rename from include/beast/http/fields.hpp rename to include/boost/beast/http/fields.hpp index 3f95b154..b2354b8d 100644 --- a/include/beast/http/fields.hpp +++ b/include/boost/beast/http/fields.hpp @@ -4,14 +4,16 @@ // 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 BEAST_HTTP_FIELDS_HPP -#define BEAST_HTTP_FIELDS_HPP +#ifndef BOOST_BEAST_HTTP_FIELDS_HPP +#define BOOST_BEAST_HTTP_FIELDS_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -24,6 +26,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -138,7 +141,7 @@ public: }; /// The algorithm used to serialize the header -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using reader = implementation_defined; #else class reader; @@ -231,7 +234,7 @@ public: public: /// A constant iterator to the field sequence. -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using const_iterator = implementation_defined; #else using const_iterator = typename list_t::const_iterator; @@ -727,7 +730,8 @@ using fields = basic_fields>; } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/file_body.hpp b/include/boost/beast/http/file_body.hpp similarity index 64% rename from include/beast/http/file_body.hpp rename to include/boost/beast/http/file_body.hpp index 7e98643d..ca937cbb 100644 --- a/include/beast/http/file_body.hpp +++ b/include/boost/beast/http/file_body.hpp @@ -4,12 +4,14 @@ // 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 BEAST_HTTP_FILE_BODY_HPP -#define BEAST_HTTP_FILE_BODY_HPP +#ifndef BOOST_BEAST_HTTP_FILE_BODY_HPP +#define BOOST_BEAST_HTTP_FILE_BODY_HPP -#include -#include +#include +#include #include #include #include @@ -17,6 +19,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -25,7 +28,8 @@ using file_body = basic_file_body; } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/impl/basic_parser.ipp b/include/boost/beast/http/impl/basic_parser.ipp similarity index 97% rename from include/beast/http/impl/basic_parser.ipp rename to include/boost/beast/http/impl/basic_parser.ipp index e49226c6..79cf919e 100644 --- a/include/beast/http/impl/basic_parser.ipp +++ b/include/boost/beast/http/impl/basic_parser.ipp @@ -4,21 +4,24 @@ // 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 BEAST_HTTP_IMPL_BASIC_PARSER_IPP -#define BEAST_HTTP_IMPL_BASIC_PARSER_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_BASIC_PARSER_IPP +#define BOOST_BEAST_HTTP_IMPL_BASIC_PARSER_IPP -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace http { @@ -161,7 +164,7 @@ loop: return 0; } state_ = state::start_line; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; case state::start_line: { @@ -192,7 +195,7 @@ loop: ec = error::need_more; goto done; } - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; } case state::fields: @@ -225,7 +228,7 @@ loop: if(ec) goto done; state_ = state::body; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; case state::body: BOOST_ASSERT(! skip_); @@ -240,7 +243,7 @@ loop: if(ec) goto done; state_ = state::body_to_eof; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; case state::body_to_eof: BOOST_ASSERT(! skip_); @@ -254,7 +257,7 @@ loop: if(ec) goto done; state_ = state::chunk_header; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; case state::chunk_header: parse_chunk_header(p, n, ec); @@ -931,5 +934,6 @@ do_field(field f, } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/chunk_encode.ipp b/include/boost/beast/http/impl/chunk_encode.ipp similarity index 98% rename from include/beast/http/impl/chunk_encode.ipp rename to include/boost/beast/http/impl/chunk_encode.ipp index ea2ff2a8..05dc9f20 100644 --- a/include/beast/http/impl/chunk_encode.ipp +++ b/include/boost/beast/http/impl/chunk_encode.ipp @@ -4,15 +4,18 @@ // 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 BEAST_HTTP_IMPL_CHUNK_ENCODE_IPP -#define BEAST_HTTP_IMPL_CHUNK_ENCODE_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_CHUNK_ENCODE_IPP +#define BOOST_BEAST_HTTP_IMPL_CHUNK_ENCODE_IPP -#include -#include -#include +#include +#include +#include #include +namespace boost { namespace beast { namespace http { @@ -699,5 +702,6 @@ end() const -> } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/error.ipp b/include/boost/beast/http/impl/error.ipp similarity index 94% rename from include/beast/http/impl/error.ipp rename to include/boost/beast/http/impl/error.ipp index 954292f7..c51e4f2a 100644 --- a/include/beast/http/impl/error.ipp +++ b/include/boost/beast/http/impl/error.ipp @@ -4,9 +4,11 @@ // 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 BEAST_HTTP_IMPL_ERROR_IPP -#define BEAST_HTTP_IMPL_ERROR_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_ERROR_IPP +#define BOOST_BEAST_HTTP_IMPL_ERROR_IPP #include @@ -20,6 +22,7 @@ struct is_error_code_enum } // system } // boost +namespace boost { namespace beast { namespace http { namespace detail { @@ -113,5 +116,6 @@ make_error_code(error ev) } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/field.ipp b/include/boost/beast/http/impl/field.ipp similarity index 98% rename from include/beast/http/impl/field.ipp rename to include/boost/beast/http/impl/field.ipp index ba4a5ac0..a60bf99c 100644 --- a/include/beast/http/impl/field.ipp +++ b/include/boost/beast/http/impl/field.ipp @@ -4,17 +4,20 @@ // 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 BEAST_HTTP_IMPL_FIELD_IPP -#define BEAST_HTTP_IMPL_FIELD_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_FIELD_IPP +#define BOOST_BEAST_HTTP_IMPL_FIELD_IPP -#include +#include #include #include #include #include #include +namespace boost { namespace beast { namespace http { @@ -553,5 +556,6 @@ string_to_field(string_view s) } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/fields.ipp b/include/boost/beast/http/impl/fields.ipp similarity index 97% rename from include/beast/http/impl/fields.ipp rename to include/boost/beast/http/impl/fields.ipp index 1cee2ba0..0fe83523 100644 --- a/include/beast/http/impl/fields.ipp +++ b/include/boost/beast/http/impl/fields.ipp @@ -4,29 +4,32 @@ // 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 BEAST_HTTP_IMPL_FIELDS_IPP -#define BEAST_HTTP_IMPL_FIELDS_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_FIELDS_IPP +#define BOOST_BEAST_HTTP_IMPL_FIELDS_IPP -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #if defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 60000 // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56437 -#ifndef BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR -#define BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR +#ifndef BOOST_BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR +#define BOOST_BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR #endif #endif +namespace boost { namespace beast { namespace http { @@ -999,7 +1002,7 @@ set_chunked_impl(bool value) } else { - #ifdef BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR + #ifdef BOOST_BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56437 std::string s; #else @@ -1036,7 +1039,7 @@ set_chunked_impl(bool value) } catch(std::length_error const&) { - #ifdef BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR + #ifdef BOOST_BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56437 std::string s; #else @@ -1093,7 +1096,7 @@ set_keep_alive_impl( } catch(std::length_error const&) { - #ifdef BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR + #ifdef BOOST_BEAST_HTTP_NO_FIELDS_BASIC_STRING_ALLOCATOR // Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56437 std::string s; #else @@ -1364,5 +1367,6 @@ swap(basic_fields& other, std::false_type) } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/file_body_win32.ipp b/include/boost/beast/http/impl/file_body_win32.ipp similarity index 96% rename from include/beast/http/impl/file_body_win32.ipp rename to include/boost/beast/http/impl/file_body_win32.ipp index c1b1bfcb..e243f951 100644 --- a/include/beast/http/impl/file_body_win32.ipp +++ b/include/boost/beast/http/impl/file_body_win32.ipp @@ -4,17 +4,19 @@ // 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 BEAST_HTTP_IMPL_FILE_BODY_WIN32_IPP -#define BEAST_HTTP_IMPL_FILE_BODY_WIN32_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_FILE_BODY_WIN32_IPP +#define BOOST_BEAST_HTTP_IMPL_FILE_BODY_WIN32_IPP -#if BEAST_USE_WIN32_FILE +#if BOOST_BEAST_USE_WIN32_FILE -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include @@ -26,6 +28,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -575,6 +578,7 @@ async_write_some( } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/message.ipp b/include/boost/beast/http/impl/message.ipp similarity index 97% rename from include/beast/http/impl/message.ipp rename to include/boost/beast/http/impl/message.ipp index 68af2345..2b95a0b4 100644 --- a/include/beast/http/impl/message.ipp +++ b/include/boost/beast/http/impl/message.ipp @@ -4,16 +4,19 @@ // 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 BEAST_HTTP_IMPL_MESSAGE_IPP -#define BEAST_HTTP_IMPL_MESSAGE_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_MESSAGE_IPP +#define BOOST_BEAST_HTTP_IMPL_MESSAGE_IPP -#include -#include +#include +#include #include #include #include +namespace boost { namespace beast { namespace http { @@ -411,5 +414,6 @@ swap( } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/parser.ipp b/include/boost/beast/http/impl/parser.ipp similarity index 87% rename from include/beast/http/impl/parser.ipp rename to include/boost/beast/http/impl/parser.ipp index 1e40a277..834b61cd 100644 --- a/include/beast/http/impl/parser.ipp +++ b/include/boost/beast/http/impl/parser.ipp @@ -4,13 +4,16 @@ // 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 BEAST_HTTP_IMPL_PARSER_IPP -#define BEAST_HTTP_IMPL_PARSER_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_PARSER_IPP +#define BOOST_BEAST_HTTP_IMPL_PARSER_IPP #include #include +namespace boost { namespace beast { namespace http { @@ -47,5 +50,6 @@ parser(parser&& other, } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/read.ipp b/include/boost/beast/http/impl/read.ipp similarity index 97% rename from include/beast/http/impl/read.ipp rename to include/boost/beast/http/impl/read.ipp index 9201b593..da6ccaa9 100644 --- a/include/beast/http/impl/read.ipp +++ b/include/boost/beast/http/impl/read.ipp @@ -4,18 +4,20 @@ // 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 BEAST_HTTP_IMPL_READ_IPP_HPP -#define BEAST_HTTP_IMPL_READ_IPP_HPP +#ifndef BOOST_BEAST_HTTP_IMPL_READ_IPP_HPP +#define BOOST_BEAST_HTTP_IMPL_READ_IPP_HPP -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -24,6 +26,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -788,5 +791,6 @@ async_read( } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/rfc7230.ipp b/include/boost/beast/http/impl/rfc7230.ipp similarity index 97% rename from include/beast/http/impl/rfc7230.ipp rename to include/boost/beast/http/impl/rfc7230.ipp index 12113b58..145716b4 100644 --- a/include/beast/http/impl/rfc7230.ipp +++ b/include/boost/beast/http/impl/rfc7230.ipp @@ -4,13 +4,16 @@ // 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 BEAST_HTTP_IMPL_RFC7230_IPP -#define BEAST_HTTP_IMPL_RFC7230_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_RFC7230_IPP +#define BOOST_BEAST_HTTP_IMPL_RFC7230_IPP -#include +#include #include +namespace boost { namespace beast { namespace http { @@ -563,6 +566,7 @@ validate_list(detail::basic_parsed_list< } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/serializer.ipp b/include/boost/beast/http/impl/serializer.ipp similarity index 92% rename from include/beast/http/impl/serializer.ipp rename to include/boost/beast/http/impl/serializer.ipp index d533e3c5..2d963a0c 100644 --- a/include/beast/http/impl/serializer.ipp +++ b/include/boost/beast/http/impl/serializer.ipp @@ -4,17 +4,20 @@ // 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 BEAST_HTTP_IMPL_SERIALIZER_IPP -#define BEAST_HTTP_IMPL_SERIALIZER_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_SERIALIZER_IPP +#define BOOST_BEAST_HTTP_IMPL_SERIALIZER_IPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include +namespace boost { namespace beast { namespace http { @@ -83,7 +86,7 @@ next(error_code& ec, Visit&& visit) if(chunked_) goto go_init_c; s_ = do_init; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; } case do_init: @@ -106,7 +109,7 @@ next(error_code& ec, Visit&& visit) frd_->get(), result->first}; s_ = do_header; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; } case do_header: @@ -122,7 +125,7 @@ next(error_code& ec, Visit&& visit) case do_body: s_ = do_body + 1; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; case do_body + 1: { @@ -134,7 +137,7 @@ next(error_code& ec, Visit&& visit) more_ = result->second; v_ = cb3_t{result->first}; s_ = do_body + 2; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; } case do_body + 2: @@ -160,7 +163,7 @@ next(error_code& ec, Visit&& visit) if(! result) goto go_header_only_c; more_ = result->second; - #ifndef BEAST_NO_BIG_VARIANTS + #ifndef BOOST_BEAST_NO_BIG_VARIANTS if(! more_) { // do it all in one buffer @@ -187,7 +190,7 @@ next(error_code& ec, Visit&& visit) result->first, chunk_crlf{}}; s_ = do_header_c; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; } case do_header_c: @@ -203,7 +206,7 @@ next(error_code& ec, Visit&& visit) case do_body_c: s_ = do_body_c + 1; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; case do_body_c + 1: { @@ -213,7 +216,7 @@ next(error_code& ec, Visit&& visit) if(! result) goto go_final_c; more_ = result->second; - #ifndef BEAST_NO_BIG_VARIANTS + #ifndef BOOST_BEAST_NO_BIG_VARIANTS if(! more_) { // do it all in one buffer @@ -238,14 +241,14 @@ next(error_code& ec, Visit&& visit) result->first, chunk_crlf{}}; s_ = do_body_c + 2; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; } case do_body_c + 2: do_visit(ec, visit); break; -#ifndef BEAST_NO_BIG_VARIANTS +#ifndef BOOST_BEAST_NO_BIG_VARIANTS go_body_final_c: s_ = do_body_final_c; case do_body_final_c: @@ -267,7 +270,7 @@ next(error_code& ec, Visit&& visit) boost::asio::const_buffers_1{nullptr, 0}, chunk_crlf{}}; s_ = do_final_c + 1; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; case do_final_c + 1: do_visit(ec, visit); @@ -382,7 +385,7 @@ consume(std::size_t n) s_ = do_final_c; break; -#ifndef BEAST_NO_BIG_VARIANTS +#ifndef BOOST_BEAST_NO_BIG_VARIANTS case do_body_final_c: { auto& b = boost::get(v_); @@ -433,5 +436,6 @@ consume(std::size_t n) } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/status.ipp b/include/boost/beast/http/impl/status.ipp similarity index 96% rename from include/beast/http/impl/status.ipp rename to include/boost/beast/http/impl/status.ipp index 671547c9..a6a4ea11 100644 --- a/include/beast/http/impl/status.ipp +++ b/include/boost/beast/http/impl/status.ipp @@ -4,13 +4,16 @@ // 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 BEAST_HTTP_IMPL_STATUS_IPP -#define BEAST_HTTP_IMPL_STATUS_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_STATUS_IPP +#define BOOST_BEAST_HTTP_IMPL_STATUS_IPP -#include +#include #include +namespace boost { namespace beast { namespace http { namespace detail { @@ -25,7 +28,7 @@ int_to_status(unsigned v) case status::continue_: case status::switching_protocols: case status::processing: - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; // 2xx case status::ok: @@ -38,7 +41,7 @@ int_to_status(unsigned v) case status::multi_status: case status::already_reported: case status::im_used: - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; // 3xx case status::multiple_choices: @@ -49,7 +52,7 @@ int_to_status(unsigned v) case status::use_proxy: case status::temporary_redirect: case status::permanent_redirect: - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; // 4xx case status::bad_request: @@ -81,7 +84,7 @@ int_to_status(unsigned v) case status::connection_closed_without_response: case status::unavailable_for_legal_reasons: case status::client_closed_request: - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; // 5xx case status::internal_server_error: @@ -244,5 +247,6 @@ operator<<(std::ostream& os, status v) } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/verb.ipp b/include/boost/beast/http/impl/verb.ipp similarity index 95% rename from include/beast/http/impl/verb.ipp rename to include/boost/beast/http/impl/verb.ipp index ad0f1b5c..c6fef5e4 100644 --- a/include/beast/http/impl/verb.ipp +++ b/include/boost/beast/http/impl/verb.ipp @@ -4,14 +4,17 @@ // 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 BEAST_HTTP_IMPL_VERB_IPP -#define BEAST_HTTP_IMPL_VERB_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_VERB_IPP +#define BOOST_BEAST_HTTP_IMPL_VERB_IPP -#include +#include #include #include +namespace boost { namespace beast { namespace http { @@ -156,7 +159,7 @@ string_to_verb(string_view v) return verb::connect; if(eq(v, "PY")) return verb::copy; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; default: break; @@ -217,7 +220,7 @@ string_to_verb(string_view v) case 'O': if(eq(v, "VE")) return verb::move; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; default: break; @@ -261,7 +264,7 @@ string_to_verb(string_view v) return verb::purge; if(eq(v, "T")) return verb::put; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; default: break; @@ -329,5 +332,6 @@ string_to_verb(string_view s) } // http } // beast +} // boost #endif diff --git a/include/beast/http/impl/write.ipp b/include/boost/beast/http/impl/write.ipp similarity index 97% rename from include/beast/http/impl/write.ipp rename to include/boost/beast/http/impl/write.ipp index d6eb38a9..959f916b 100644 --- a/include/beast/http/impl/write.ipp +++ b/include/boost/beast/http/impl/write.ipp @@ -4,17 +4,19 @@ // 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 BEAST_HTTP_IMPL_WRITE_IPP -#define BEAST_HTTP_IMPL_WRITE_IPP +#ifndef BOOST_BEAST_HTTP_IMPL_WRITE_IPP +#define BOOST_BEAST_HTTP_IMPL_WRITE_IPP -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -24,6 +26,7 @@ #include #include +namespace boost { namespace beast { namespace http { namespace detail { @@ -289,7 +292,7 @@ operator()(error_code ec) case 2: state_ = 3; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; case 3: { @@ -882,5 +885,6 @@ operator<<(std::ostream& os, } // http } // beast +} // boost #endif diff --git a/include/beast/http/message.hpp b/include/boost/beast/http/message.hpp similarity index 96% rename from include/beast/http/message.hpp rename to include/boost/beast/http/message.hpp index 4c3fd644..372165e6 100644 --- a/include/beast/http/message.hpp +++ b/include/boost/beast/http/message.hpp @@ -4,17 +4,19 @@ // 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 BEAST_HTTP_MESSAGE_HPP -#define BEAST_HTTP_MESSAGE_HPP +#ifndef BOOST_BEAST_HTTP_MESSAGE_HPP +#define BOOST_BEAST_HTTP_MESSAGE_HPP -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -23,6 +25,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -40,7 +43,7 @@ namespace http { A `header` includes the start-line and header-fields. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template struct header : Fields @@ -56,7 +59,7 @@ struct header : Fields "Fields requirements not met"); /// Indicates if the header is a request or response. -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using is_request = std::integral_constant; #else using is_request = std::true_type; @@ -171,7 +174,7 @@ struct header : Fields not convertible to @ref header, @ref verb, or @ref status. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template explicit header(Args&&... args); @@ -356,7 +359,7 @@ struct header : Fields reason(string_view s); private: -#if ! BEAST_DOXYGEN +#if ! BOOST_BEAST_DOXYGEN template friend struct message; @@ -479,7 +482,7 @@ struct message : header @note This function is only available when `isRequest == true`. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN message(verb method, string_view target, unsigned version); #else template @note This function is only available when `isRequest == true`. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template message(verb method, string_view target, unsigned version, BodyArg&& body_arg); @@ -526,7 +529,7 @@ struct message : header @note This function is only available when `isRequest == true`. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template message(verb method, string_view target, unsigned version, BodyArg&& body_arg, FieldsArg&& fields_arg); @@ -546,7 +549,7 @@ struct message : header @note This member is only available when `isRequest == false`. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN message(status result, unsigned version); #else template @note This member is only available when `isRequest == false`. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template message(status result, unsigned version, BodyArg&& body_arg); #else @@ -587,7 +590,7 @@ struct message : header @note This member is only available when `isRequest == false`. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template message(status result, unsigned version, BodyArg&& body_arg, FieldsArg&& fields_arg); @@ -809,7 +812,7 @@ using response = message; //------------------------------------------------------------------------------ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN /** Swap two header objects. @par Requirements @@ -835,7 +838,8 @@ swap( } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/parser.hpp b/include/boost/beast/http/parser.hpp similarity index 96% rename from include/beast/http/parser.hpp rename to include/boost/beast/http/parser.hpp index fff3c00f..eef3664f 100644 --- a/include/beast/http/parser.hpp +++ b/include/boost/beast/http/parser.hpp @@ -4,14 +4,16 @@ // 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 BEAST_HTTP_PARSER_HPP -#define BEAST_HTTP_PARSER_HPP +#ifndef BOOST_BEAST_HTTP_PARSER_HPP +#define BOOST_BEAST_HTTP_PARSER_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -19,6 +21,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -106,7 +109,7 @@ public: resolution only if the first argument is not a @ref parser. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template explicit parser(Args&&... args); @@ -150,7 +153,7 @@ public: @note This function participates in overload resolution only if the other parser uses a different body type. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template #else template; } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/read.hpp b/include/boost/beast/http/read.hpp similarity index 98% rename from include/beast/http/read.hpp rename to include/boost/beast/http/read.hpp index e5cabc63..67e8b669 100644 --- a/include/beast/http/read.hpp +++ b/include/boost/beast/http/read.hpp @@ -4,16 +4,19 @@ // 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 BEAST_HTTP_READ_HPP -#define BEAST_HTTP_READ_HPP +#ifndef BOOST_BEAST_HTTP_READ_HPP +#define BOOST_BEAST_HTTP_READ_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +namespace boost { namespace beast { namespace http { @@ -194,7 +197,7 @@ template< class DynamicBuffer, bool isRequest, class Derived, class ReadHandler> -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -377,7 +380,7 @@ template< class DynamicBuffer, bool isRequest, class Derived, class ReadHandler> -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -560,7 +563,7 @@ template< class DynamicBuffer, bool isRequest, class Derived, class ReadHandler> -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -742,7 +745,7 @@ template< class DynamicBuffer, bool isRequest, class Body, class Allocator, class ReadHandler> -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -756,7 +759,8 @@ async_read( } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/rfc7230.hpp b/include/boost/beast/http/rfc7230.hpp similarity index 95% rename from include/beast/http/rfc7230.hpp rename to include/boost/beast/http/rfc7230.hpp index e2d3f3fb..205b44e7 100644 --- a/include/beast/http/rfc7230.hpp +++ b/include/boost/beast/http/rfc7230.hpp @@ -4,14 +4,17 @@ // 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 BEAST_HTTP_RFC7230_HPP -#define BEAST_HTTP_RFC7230_HPP +#ifndef BOOST_BEAST_HTTP_RFC7230_HPP +#define BOOST_BEAST_HTTP_RFC7230_HPP -#include -#include -#include +#include +#include +#include +namespace boost { namespace beast { namespace http { @@ -62,7 +65,7 @@ public: std::pair; /// A constant iterator to the list -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using const_iterator = implementation_defined; #else class const_iterator; @@ -151,7 +154,7 @@ public: using value_type = std::pair; /// A constant iterator to the list -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using const_iterator = implementation_defined; #else class const_iterator; @@ -239,7 +242,7 @@ public: using value_type = string_view; /// A constant iterator to the list -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using const_iterator = implementation_defined; #else class const_iterator; @@ -319,7 +322,8 @@ validate_list(detail::basic_parsed_list< } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/serializer.hpp b/include/boost/beast/http/serializer.hpp similarity index 94% rename from include/beast/http/serializer.hpp rename to include/boost/beast/http/serializer.hpp index f05a0ed6..3b0e6f25 100644 --- a/include/beast/http/serializer.hpp +++ b/include/boost/beast/http/serializer.hpp @@ -4,28 +4,31 @@ // 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 BEAST_HTTP_SERIALIZER_HPP -#define BEAST_HTTP_SERIALIZER_HPP +#ifndef BOOST_BEAST_HTTP_SERIALIZER_HPP +#define BOOST_BEAST_HTTP_SERIALIZER_HPP -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include -#ifndef BEAST_NO_BIG_VARIANTS -# if defined(BOOST_GCC) && BOOST_GCC < 50000 && BOOST_VERSION < 106400 -# define BEAST_NO_BIG_VARIANTS +#ifndef BOOST_BEAST_NO_BIG_VARIANTS +# if defined(BOOST_GCC) && BOOST_GCC < 50000 && BOOST_VERSION < 106600 +# define BOOST_BEAST_NO_BIG_VARIANTS # endif #endif +namespace boost { namespace beast { namespace http { @@ -74,7 +77,7 @@ public: This may be const or non-const depending on the implementation of the corresponding @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using value_type = implementation_defined; #else using value_type = @@ -102,7 +105,7 @@ private: do_header_c = 70, do_body_c = 80, do_final_c = 90, - #ifndef BEAST_NO_BIG_VARIANTS + #ifndef BOOST_BEAST_NO_BIG_VARIANTS do_body_final_c = 100, do_all_c = 110, #endif @@ -149,7 +152,7 @@ private: chunk_crlf>>; // crlf using pcb5_t = buffer_prefix_view; -#ifndef BEAST_NO_BIG_VARIANTS +#ifndef BOOST_BEAST_NO_BIG_VARIANTS using cb6_t = consuming_buffers frd_; boost::variant v_; boost::variant pv_; @@ -405,7 +408,8 @@ using response_serializer = serializer; } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/span_body.hpp b/include/boost/beast/http/span_body.hpp similarity index 91% rename from include/beast/http/span_body.hpp rename to include/boost/beast/http/span_body.hpp index 8e83cde2..39b6d88b 100644 --- a/include/beast/http/span_body.hpp +++ b/include/boost/beast/http/span_body.hpp @@ -4,16 +4,19 @@ // 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 BEAST_HTTP_SPAN_BODY_HPP -#define BEAST_HTTP_SPAN_BODY_HPP +#ifndef BOOST_BEAST_HTTP_SPAN_BODY_HPP +#define BOOST_BEAST_HTTP_SPAN_BODY_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include +namespace boost { namespace beast { namespace http { @@ -60,7 +63,7 @@ public: Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using reader = implementation_defined; #else class reader @@ -102,7 +105,7 @@ public: Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using writer = implementation_defined; #else class writer @@ -163,5 +166,6 @@ public: } // http } // beast +} // boost #endif diff --git a/include/beast/http/status.hpp b/include/boost/beast/http/status.hpp similarity index 94% rename from include/beast/http/status.hpp rename to include/boost/beast/http/status.hpp index b202aa7b..fbef6d8c 100644 --- a/include/beast/http/status.hpp +++ b/include/boost/beast/http/status.hpp @@ -4,14 +4,17 @@ // 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 BEAST_HTTP_STATUS_HPP -#define BEAST_HTTP_STATUS_HPP +#ifndef BOOST_BEAST_HTTP_STATUS_HPP +#define BOOST_BEAST_HTTP_STATUS_HPP -#include -#include +#include +#include #include +namespace boost { namespace beast { namespace http { @@ -157,7 +160,8 @@ operator<<(std::ostream&, status); } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/string_body.hpp b/include/boost/beast/http/string_body.hpp similarity index 92% rename from include/beast/http/string_body.hpp rename to include/boost/beast/http/string_body.hpp index 0104f5f1..92e65fbe 100644 --- a/include/beast/http/string_body.hpp +++ b/include/boost/beast/http/string_body.hpp @@ -4,14 +4,16 @@ // 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 BEAST_HTTP_STRING_BODY_HPP -#define BEAST_HTTP_STRING_BODY_HPP +#ifndef BOOST_BEAST_HTTP_STRING_BODY_HPP +#define BOOST_BEAST_HTTP_STRING_BODY_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -21,6 +23,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -68,7 +71,7 @@ public: Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using reader = implementation_defined; #else class reader @@ -107,7 +110,7 @@ public: Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using writer = implementation_defined; #else class writer @@ -194,5 +197,6 @@ using string_body = basic_string_body; } // http } // beast +} // boost #endif diff --git a/include/beast/http/type_traits.hpp b/include/boost/beast/http/type_traits.hpp similarity index 90% rename from include/beast/http/type_traits.hpp rename to include/boost/beast/http/type_traits.hpp index 46f5674a..bb8fd832 100644 --- a/include/beast/http/type_traits.hpp +++ b/include/boost/beast/http/type_traits.hpp @@ -4,20 +4,23 @@ // 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 BEAST_HTTP_TYPE_TRAITS_HPP -#define BEAST_HTTP_TYPE_TRAITS_HPP +#ifndef BOOST_BEAST_HTTP_TYPE_TRAITS_HPP +#define BOOST_BEAST_HTTP_TYPE_TRAITS_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace http { @@ -42,7 +45,7 @@ struct message; @endcode */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN struct is_body : std::integral_constant{}; #else using is_body = detail::has_value_type; @@ -68,7 +71,7 @@ using is_body = detail::has_value_type; } @endcode */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template struct is_body_reader : std::integral_constant {}; #else @@ -114,7 +117,7 @@ struct is_body_reader struct is_body_writer : std::integral_constant {}; #else @@ -167,7 +170,7 @@ struct is_body_writer const&); @endcode */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN template struct is_fields : std::integral_constant {}; #else @@ -177,5 +180,6 @@ using is_fields = typename detail::is_fields_helper::type; } // http } // beast +} // boost #endif diff --git a/include/beast/http/vector_body.hpp b/include/boost/beast/http/vector_body.hpp similarity index 91% rename from include/beast/http/vector_body.hpp rename to include/boost/beast/http/vector_body.hpp index 36a19c42..7413948e 100644 --- a/include/beast/http/vector_body.hpp +++ b/include/boost/beast/http/vector_body.hpp @@ -4,14 +4,16 @@ // 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 BEAST_HTTP_VECTOR_BODY_HPP -#define BEAST_HTTP_VECTOR_BODY_HPP +#ifndef BOOST_BEAST_HTTP_VECTOR_BODY_HPP +#define BOOST_BEAST_HTTP_VECTOR_BODY_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -21,6 +23,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -63,7 +66,7 @@ public: Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using reader = implementation_defined; #else class reader @@ -102,7 +105,7 @@ public: Meets the requirements of @b BodyReader. */ -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN using writer = implementation_defined; #else class writer @@ -178,5 +181,6 @@ public: } // http } // beast +} // boost #endif diff --git a/include/beast/http/verb.hpp b/include/boost/beast/http/verb.hpp similarity index 92% rename from include/beast/http/verb.hpp rename to include/boost/beast/http/verb.hpp index 679af1a6..5b0224d9 100644 --- a/include/beast/http/verb.hpp +++ b/include/boost/beast/http/verb.hpp @@ -4,14 +4,17 @@ // 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 BEAST_HTTP_VERB_HPP -#define BEAST_HTTP_VERB_HPP +#ifndef BOOST_BEAST_HTTP_VERB_HPP +#define BOOST_BEAST_HTTP_VERB_HPP -#include -#include +#include +#include #include +namespace boost { namespace beast { namespace http { @@ -147,7 +150,8 @@ operator<<(std::ostream& os, verb v) } // http } // beast +} // boost -#include +#include #endif diff --git a/include/beast/http/write.hpp b/include/boost/beast/http/write.hpp similarity index 96% rename from include/beast/http/write.hpp rename to include/boost/beast/http/write.hpp index 1b3009ed..9d6b15c1 100644 --- a/include/beast/http/write.hpp +++ b/include/boost/beast/http/write.hpp @@ -4,20 +4,22 @@ // 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 BEAST_HTTP_WRITE_HPP -#define BEAST_HTTP_WRITE_HPP +#ifndef BOOST_BEAST_HTTP_WRITE_HPP +#define BOOST_BEAST_HTTP_WRITE_HPP -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -25,6 +27,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -159,7 +162,7 @@ template< class AsyncWriteStream, bool isRequest, class Body, class Fields, class WriteHandler> -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type @@ -281,7 +284,7 @@ template< class AsyncWriteStream, bool isRequest, class Body, class Fields, class WriteHandler> -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type @@ -394,7 +397,7 @@ template< class AsyncWriteStream, bool isRequest, class Body, class Fields, class WriteHandler> -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type @@ -555,7 +558,8 @@ operator<<(std::ostream& os, } // http } // beast +} // boost -#include +#include #endif diff --git a/include/boost/beast/version.hpp b/include/boost/beast/version.hpp new file mode 100644 index 00000000..551016dc --- /dev/null +++ b/include/boost/beast/version.hpp @@ -0,0 +1,28 @@ +// +// Copyright (c) 2013-2017 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_VERSION_HPP +#define BOOST_BEAST_VERSION_HPP + +#include +#include + +/** @def BOOST_BEAST_API_VERSION + + Identifies the API version of Beast. + + This is a simple integer that is incremented by one every + time a set of code changes is merged to the develop branch. +*/ +#define BOOST_BEAST_VERSION 85 + +#define BOOST_BEAST_VERSION_STRING "Boost.Beast/" BOOST_STRINGIZE(BOOST_BEAST_VERSION) + +#endif + diff --git a/include/boost/beast/websocket.hpp b/include/boost/beast/websocket.hpp new file mode 100644 index 00000000..5be44490 --- /dev/null +++ b/include/boost/beast/websocket.hpp @@ -0,0 +1,21 @@ +// +// Copyright (c) 2013-2017 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_WEBSOCKET_HPP +#define BOOST_BEAST_WEBSOCKET_HPP + +#include + +#include +#include +#include +#include +#include + +#endif diff --git a/include/beast/websocket/detail/frame.hpp b/include/boost/beast/websocket/detail/frame.hpp similarity index 93% rename from include/beast/websocket/detail/frame.hpp rename to include/boost/beast/websocket/detail/frame.hpp index 3cc1b3e7..6488b6f8 100644 --- a/include/beast/websocket/detail/frame.hpp +++ b/include/boost/beast/websocket/detail/frame.hpp @@ -4,20 +4,23 @@ // 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 BEAST_WEBSOCKET_DETAIL_FRAME_HPP -#define BEAST_WEBSOCKET_DETAIL_FRAME_HPP +#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_FRAME_HPP +#define BOOST_BEAST_WEBSOCKET_DETAIL_FRAME_HPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace websocket { namespace detail { @@ -296,5 +299,6 @@ read_close(close_reason& cr, } // detail } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/detail/hybi13.hpp b/include/boost/beast/websocket/detail/hybi13.hpp similarity index 82% rename from include/beast/websocket/detail/hybi13.hpp rename to include/boost/beast/websocket/detail/hybi13.hpp index ccfd8854..c71ced40 100644 --- a/include/beast/websocket/detail/hybi13.hpp +++ b/include/boost/beast/websocket/detail/hybi13.hpp @@ -4,20 +4,23 @@ // 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 BEAST_WEBSOCKET_DETAIL_HYBI13_HPP -#define BEAST_WEBSOCKET_DETAIL_HYBI13_HPP +#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_HYBI13_HPP +#define BOOST_BEAST_WEBSOCKET_DETAIL_HYBI13_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include #include +namespace boost { namespace beast { namespace websocket { namespace detail { @@ -67,5 +70,6 @@ make_sec_ws_accept(sec_ws_accept_type& accept, } // detail } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/detail/mask.hpp b/include/boost/beast/websocket/detail/mask.hpp similarity index 97% rename from include/beast/websocket/detail/mask.hpp rename to include/boost/beast/websocket/detail/mask.hpp index 27a3a155..b9c825e4 100644 --- a/include/beast/websocket/detail/mask.hpp +++ b/include/boost/beast/websocket/detail/mask.hpp @@ -4,9 +4,11 @@ // 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 BEAST_WEBSOCKET_DETAIL_MASK_HPP -#define BEAST_WEBSOCKET_DETAIL_MASK_HPP +#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_MASK_HPP +#define BOOST_BEAST_WEBSOCKET_DETAIL_MASK_HPP #include #include @@ -15,6 +17,7 @@ #include #include +namespace boost { namespace beast { namespace websocket { namespace detail { @@ -261,5 +264,6 @@ mask_inplace( } // detail } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/detail/pausation.hpp b/include/boost/beast/websocket/detail/pausation.hpp similarity index 94% rename from include/beast/websocket/detail/pausation.hpp rename to include/boost/beast/websocket/detail/pausation.hpp index 8fd1d2a6..0c94f900 100644 --- a/include/beast/websocket/detail/pausation.hpp +++ b/include/boost/beast/websocket/detail/pausation.hpp @@ -4,17 +4,20 @@ // 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 BEAST_WEBSOCKET_DETAIL_PAUSATION_HPP -#define BEAST_WEBSOCKET_DETAIL_PAUSATION_HPP +#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_PAUSATION_HPP +#define BOOST_BEAST_WEBSOCKET_DETAIL_PAUSATION_HPP -#include +#include #include #include #include #include #include +namespace boost { namespace beast { namespace websocket { namespace detail { @@ -218,5 +221,6 @@ pausation::save(F&& f) } // detail } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/detail/pmd_extension.hpp b/include/boost/beast/websocket/detail/pmd_extension.hpp similarity index 96% rename from include/beast/websocket/detail/pmd_extension.hpp rename to include/boost/beast/websocket/detail/pmd_extension.hpp index ac1a5a91..d8eeea2e 100644 --- a/include/beast/websocket/detail/pmd_extension.hpp +++ b/include/boost/beast/websocket/detail/pmd_extension.hpp @@ -4,20 +4,23 @@ // 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 BEAST_WEBSOCKET_DETAIL_PMD_EXTENSION_HPP -#define BEAST_WEBSOCKET_DETAIL_PMD_EXTENSION_HPP +#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_PMD_EXTENSION_HPP +#define BOOST_BEAST_WEBSOCKET_DETAIL_PMD_EXTENSION_HPP -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include +namespace boost { namespace beast { namespace websocket { namespace detail { @@ -470,5 +473,6 @@ deflate( } // detail } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/detail/type_traits.hpp b/include/boost/beast/websocket/detail/type_traits.hpp similarity index 67% rename from include/beast/websocket/detail/type_traits.hpp rename to include/boost/beast/websocket/detail/type_traits.hpp index 7f3481f1..ba39cd24 100644 --- a/include/beast/websocket/detail/type_traits.hpp +++ b/include/boost/beast/websocket/detail/type_traits.hpp @@ -4,13 +4,16 @@ // 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 BEAST_WEBSOCKET_DETAIL_TYPE_TRAITS_HPP -#define BEAST_WEBSOCKET_DETAIL_TYPE_TRAITS_HPP +#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_TYPE_TRAITS_HPP +#define BOOST_BEAST_WEBSOCKET_DETAIL_TYPE_TRAITS_HPP -#include -#include +#include +#include +namespace boost { namespace beast { namespace websocket { namespace detail { @@ -28,5 +31,6 @@ using is_ResponseDecorator = } // detail } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/detail/utf8_checker.hpp b/include/boost/beast/websocket/detail/utf8_checker.hpp similarity index 96% rename from include/beast/websocket/detail/utf8_checker.hpp rename to include/boost/beast/websocket/detail/utf8_checker.hpp index e8f3d7b5..822957ff 100644 --- a/include/beast/websocket/detail/utf8_checker.hpp +++ b/include/boost/beast/websocket/detail/utf8_checker.hpp @@ -4,16 +4,19 @@ // 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 BEAST_WEBSOCKET_DETAIL_UTF8_CHECKER_HPP -#define BEAST_WEBSOCKET_DETAIL_UTF8_CHECKER_HPP +#ifndef BOOST_BEAST_WEBSOCKET_DETAIL_UTF8_CHECKER_HPP +#define BOOST_BEAST_WEBSOCKET_DETAIL_UTF8_CHECKER_HPP -#include +#include #include #include #include #include +namespace boost { namespace beast { namespace websocket { namespace detail { @@ -299,5 +302,6 @@ check_utf8(char const* p, std::size_t n) } // detail } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/error.hpp b/include/boost/beast/websocket/error.hpp similarity index 68% rename from include/beast/websocket/error.hpp rename to include/boost/beast/websocket/error.hpp index 6511d280..0bdda3c1 100644 --- a/include/beast/websocket/error.hpp +++ b/include/boost/beast/websocket/error.hpp @@ -4,13 +4,16 @@ // 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 BEAST_WEBSOCKET_ERROR_HPP -#define BEAST_WEBSOCKET_ERROR_HPP +#ifndef BOOST_BEAST_WEBSOCKET_ERROR_HPP +#define BOOST_BEAST_WEBSOCKET_ERROR_HPP -#include -#include +#include +#include +namespace boost { namespace beast { namespace websocket { @@ -32,7 +35,8 @@ enum class error } // websocket } // beast +} // boost -#include +#include #endif diff --git a/include/beast/websocket/impl/accept.ipp b/include/boost/beast/websocket/impl/accept.ipp similarity index 97% rename from include/beast/websocket/impl/accept.ipp rename to include/boost/beast/websocket/impl/accept.ipp index 658df55f..0121c8f4 100644 --- a/include/beast/websocket/impl/accept.ipp +++ b/include/boost/beast/websocket/impl/accept.ipp @@ -4,19 +4,21 @@ // 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 BEAST_WEBSOCKET_IMPL_ACCEPT_IPP -#define BEAST_WEBSOCKET_IMPL_ACCEPT_IPP +#ifndef BOOST_BEAST_WEBSOCKET_IMPL_ACCEPT_IPP +#define BOOST_BEAST_WEBSOCKET_IMPL_ACCEPT_IPP -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -25,6 +27,7 @@ #include #include +namespace boost { namespace beast { namespace websocket { @@ -808,5 +811,6 @@ async_accept_ex(http::request -#include -#include -#include +#include +#include +#include +#include #include #include #include #include #include +namespace boost { namespace beast { namespace websocket { @@ -243,5 +246,6 @@ async_close(close_reason const& cr, CloseHandler&& handler) } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/impl/error.ipp b/include/boost/beast/websocket/impl/error.ipp similarity index 91% rename from include/beast/websocket/impl/error.ipp rename to include/boost/beast/websocket/impl/error.ipp index bd6856fe..0c7f6406 100644 --- a/include/beast/websocket/impl/error.ipp +++ b/include/boost/beast/websocket/impl/error.ipp @@ -4,9 +4,11 @@ // 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 BEAST_WEBSOCKET_IMPL_ERROR_IPP -#define BEAST_WEBSOCKET_IMPL_ERROR_IPP +#ifndef BOOST_BEAST_WEBSOCKET_IMPL_ERROR_IPP +#define BOOST_BEAST_WEBSOCKET_IMPL_ERROR_IPP namespace boost { namespace system { @@ -18,6 +20,7 @@ struct is_error_code_enum } // system } // boost +namespace boost { namespace beast { namespace websocket { namespace detail { @@ -90,5 +93,6 @@ make_error_code(error e) } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/impl/fail.ipp b/include/boost/beast/websocket/impl/fail.ipp similarity index 93% rename from include/beast/websocket/impl/fail.ipp rename to include/boost/beast/websocket/impl/fail.ipp index 23ff297f..f2855371 100644 --- a/include/beast/websocket/impl/fail.ipp +++ b/include/boost/beast/websocket/impl/fail.ipp @@ -4,15 +4,17 @@ // 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 BEAST_WEBSOCKET_IMPL_FAIL_IPP -#define BEAST_WEBSOCKET_IMPL_FAIL_IPP +#ifndef BOOST_BEAST_WEBSOCKET_IMPL_FAIL_IPP +#define BOOST_BEAST_WEBSOCKET_IMPL_FAIL_IPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include @@ -23,6 +25,7 @@ #include #include +namespace boost { namespace beast { namespace websocket { @@ -229,5 +232,6 @@ operator()(error_code ec, std::size_t) } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/impl/handshake.ipp b/include/boost/beast/websocket/impl/handshake.ipp similarity index 95% rename from include/beast/websocket/impl/handshake.ipp rename to include/boost/beast/websocket/impl/handshake.ipp index 1231b4a8..941ed121 100644 --- a/include/beast/websocket/impl/handshake.ipp +++ b/include/boost/beast/websocket/impl/handshake.ipp @@ -4,17 +4,19 @@ // 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 BEAST_WEBSOCKET_IMPL_HANDSHAKE_IPP -#define BEAST_WEBSOCKET_IMPL_HANDSHAKE_IPP +#ifndef BOOST_BEAST_WEBSOCKET_IMPL_HANDSHAKE_IPP +#define BOOST_BEAST_WEBSOCKET_IMPL_HANDSHAKE_IPP -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -22,6 +24,7 @@ #include #include +namespace boost { namespace beast { namespace websocket { @@ -390,5 +393,6 @@ handshake_ex(response_type& res, } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/impl/ping.ipp b/include/boost/beast/websocket/impl/ping.ipp similarity index 94% rename from include/beast/websocket/impl/ping.ipp rename to include/boost/beast/websocket/impl/ping.ipp index 3b4d0426..59f36b33 100644 --- a/include/beast/websocket/impl/ping.ipp +++ b/include/boost/beast/websocket/impl/ping.ipp @@ -4,21 +4,24 @@ // 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 BEAST_WEBSOCKET_IMPL_PING_IPP -#define BEAST_WEBSOCKET_IMPL_PING_IPP +#ifndef BOOST_BEAST_WEBSOCKET_IMPL_PING_IPP +#define BOOST_BEAST_WEBSOCKET_IMPL_PING_IPP -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include #include #include +namespace boost { namespace beast { namespace websocket { @@ -267,5 +270,6 @@ pong(ping_data const& payload, error_code& ec) } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/impl/read.ipp b/include/boost/beast/websocket/impl/read.ipp similarity index 98% rename from include/beast/websocket/impl/read.ipp rename to include/boost/beast/websocket/impl/read.ipp index d174815b..c5404e59 100644 --- a/include/beast/websocket/impl/read.ipp +++ b/include/boost/beast/websocket/impl/read.ipp @@ -4,18 +4,20 @@ // 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 BEAST_WEBSOCKET_IMPL_READ_IPP -#define BEAST_WEBSOCKET_IMPL_READ_IPP +#ifndef BOOST_BEAST_WEBSOCKET_IMPL_READ_IPP +#define BOOST_BEAST_WEBSOCKET_IMPL_READ_IPP -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -27,6 +29,7 @@ #include #include +namespace boost { namespace beast { namespace websocket { @@ -1353,5 +1356,6 @@ async_read_some( } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/impl/rfc6455.ipp b/include/boost/beast/websocket/impl/rfc6455.ipp similarity index 75% rename from include/beast/websocket/impl/rfc6455.ipp rename to include/boost/beast/websocket/impl/rfc6455.ipp index e06b152c..b8e9cf2d 100644 --- a/include/beast/websocket/impl/rfc6455.ipp +++ b/include/boost/beast/websocket/impl/rfc6455.ipp @@ -4,13 +4,16 @@ // 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 BEAST_WEBSOCKET_IMPL_RFC6455_IPP -#define BEAST_WEBSOCKET_IMPL_RFC6455_IPP +#ifndef BOOST_BEAST_WEBSOCKET_IMPL_RFC6455_IPP +#define BOOST_BEAST_WEBSOCKET_IMPL_RFC6455_IPP -#include -#include +#include +#include +namespace boost { namespace beast { namespace websocket { @@ -34,5 +37,6 @@ is_upgrade(http::header +namespace boost { namespace beast { namespace websocket { @@ -48,5 +51,6 @@ async_teardown(teardown_tag, } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/impl/stream.ipp b/include/boost/beast/websocket/impl/stream.ipp similarity index 95% rename from include/beast/websocket/impl/stream.ipp rename to include/boost/beast/websocket/impl/stream.ipp index 65e494dc..b421e1b2 100644 --- a/include/beast/websocket/impl/stream.ipp +++ b/include/boost/beast/websocket/impl/stream.ipp @@ -4,25 +4,27 @@ // 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 BEAST_WEBSOCKET_IMPL_STREAM_IPP -#define BEAST_WEBSOCKET_IMPL_STREAM_IPP +#ifndef BOOST_BEAST_WEBSOCKET_IMPL_STREAM_IPP +#define BOOST_BEAST_WEBSOCKET_IMPL_STREAM_IPP -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -34,6 +36,7 @@ #include +namespace boost { namespace beast { namespace websocket { @@ -727,7 +730,7 @@ build_request(detail::sec_ws_key_type& key, decorator(req); if(! req.count(http::field::user_agent)) req.set(http::field::user_agent, - BEAST_VERSION_STRING); + BOOST_BEAST_VERSION_STRING); return req; } @@ -745,8 +748,8 @@ build_response(http::request s(BEAST_VERSION_STRING); + BOOST_STATIC_ASSERT(sizeof(BOOST_BEAST_VERSION_STRING) < 20); + static_string<20> s(BOOST_BEAST_VERSION_STRING); res.set(http::field::server, s); } }; @@ -924,5 +927,6 @@ do_response(response_type const& res, } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/impl/teardown.ipp b/include/boost/beast/websocket/impl/teardown.ipp similarity index 92% rename from include/beast/websocket/impl/teardown.ipp rename to include/boost/beast/websocket/impl/teardown.ipp index f29a517b..0b2add27 100644 --- a/include/beast/websocket/impl/teardown.ipp +++ b/include/boost/beast/websocket/impl/teardown.ipp @@ -4,18 +4,21 @@ // 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 BEAST_WEBSOCKET_IMPL_TEARDOWN_IPP -#define BEAST_WEBSOCKET_IMPL_TEARDOWN_IPP +#ifndef BOOST_BEAST_WEBSOCKET_IMPL_TEARDOWN_IPP +#define BOOST_BEAST_WEBSOCKET_IMPL_TEARDOWN_IPP -#include -#include -#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace websocket { @@ -167,5 +170,6 @@ async_teardown(teardown_tag, } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/impl/write.ipp b/include/boost/beast/websocket/impl/write.ipp similarity index 97% rename from include/beast/websocket/impl/write.ipp rename to include/boost/beast/websocket/impl/write.ipp index cef0a334..3f2858e4 100644 --- a/include/beast/websocket/impl/write.ipp +++ b/include/boost/beast/websocket/impl/write.ipp @@ -4,20 +4,22 @@ // 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 BEAST_WEBSOCKET_IMPL_WRITE_IPP -#define BEAST_WEBSOCKET_IMPL_WRITE_IPP +#ifndef BOOST_BEAST_WEBSOCKET_IMPL_WRITE_IPP +#define BOOST_BEAST_WEBSOCKET_IMPL_WRITE_IPP -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -27,6 +29,7 @@ #include #include +namespace boost { namespace beast { namespace websocket { @@ -595,7 +598,7 @@ operator()(error_code ec) { case 2: d.step = 3; - BEAST_FALLTHROUGH; + BOOST_BEAST_FALLTHROUGH; case 3: case 0: { @@ -922,5 +925,6 @@ async_write( } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/option.hpp b/include/boost/beast/websocket/option.hpp similarity index 83% rename from include/beast/websocket/option.hpp rename to include/boost/beast/websocket/option.hpp index 258f5565..df81c722 100644 --- a/include/beast/websocket/option.hpp +++ b/include/boost/beast/websocket/option.hpp @@ -4,13 +4,15 @@ // 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 BEAST_WEBSOCKET_OPTION_HPP -#define BEAST_WEBSOCKET_OPTION_HPP +#ifndef BOOST_BEAST_WEBSOCKET_OPTION_HPP +#define BOOST_BEAST_WEBSOCKET_OPTION_HPP -#include -#include -#include +#include +#include +#include #include #include #include @@ -19,6 +21,7 @@ #include #include +namespace boost { namespace beast { namespace websocket { @@ -65,5 +68,6 @@ struct permessage_deflate } // websocket } // beast +} // boost #endif diff --git a/include/beast/websocket/rfc6455.hpp b/include/boost/beast/websocket/rfc6455.hpp similarity index 94% rename from include/beast/websocket/rfc6455.hpp rename to include/boost/beast/websocket/rfc6455.hpp index bb819c87..e84e42da 100644 --- a/include/beast/websocket/rfc6455.hpp +++ b/include/boost/beast/websocket/rfc6455.hpp @@ -4,17 +4,20 @@ // 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 BEAST_WEBSOCKET_RFC6455_HPP -#define BEAST_WEBSOCKET_RFC6455_HPP +#ifndef BOOST_BEAST_WEBSOCKET_RFC6455_HPP +#define BOOST_BEAST_WEBSOCKET_RFC6455_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include +namespace boost { namespace beast { namespace websocket { @@ -205,7 +208,8 @@ struct close_reason } // websocket } // beast +} // boost -#include +#include #endif diff --git a/include/beast/websocket/ssl.hpp b/include/boost/beast/websocket/ssl.hpp similarity index 88% rename from include/beast/websocket/ssl.hpp rename to include/boost/beast/websocket/ssl.hpp index ca4f039c..13412c8a 100644 --- a/include/beast/websocket/ssl.hpp +++ b/include/boost/beast/websocket/ssl.hpp @@ -4,15 +4,18 @@ // 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 BEAST_WEBSOCKET_SSL_HPP -#define BEAST_WEBSOCKET_SSL_HPP +#ifndef BOOST_BEAST_WEBSOCKET_SSL_HPP +#define BOOST_BEAST_WEBSOCKET_SSL_HPP -#include -#include +#include +#include #include #include +namespace boost { namespace beast { namespace websocket { @@ -68,7 +71,8 @@ async_teardown(teardown_tag, } // websocket } // beast +} // boost -#include +#include #endif diff --git a/include/beast/websocket/stream.hpp b/include/boost/beast/websocket/stream.hpp similarity index 98% rename from include/beast/websocket/stream.hpp rename to include/boost/beast/websocket/stream.hpp index dd59339e..e6f10ddf 100644 --- a/include/beast/websocket/stream.hpp +++ b/include/boost/beast/websocket/stream.hpp @@ -4,38 +4,41 @@ // 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 BEAST_WEBSOCKET_STREAM_HPP -#define BEAST_WEBSOCKET_STREAM_HPP +#ifndef BOOST_BEAST_WEBSOCKET_STREAM_HPP +#define BOOST_BEAST_WEBSOCKET_STREAM_HPP -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include #include +namespace boost { namespace beast { namespace websocket { @@ -469,7 +472,7 @@ public: state of the current frame, if any. */ template::value>::type #endif @@ -877,7 +880,7 @@ public: @throws system_error Thrown on failure. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void #else typename std::enable_if -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void #else typename std::enable_if -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void #else typename std::enable_if -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void #else typename std::enable_if -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -1459,7 +1462,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -1516,7 +1519,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else typename std::enable_if< @@ -1584,7 +1587,7 @@ public: */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else typename std::enable_if< @@ -1642,7 +1645,7 @@ public: */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -1708,7 +1711,7 @@ public: */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -1773,7 +1776,7 @@ public: */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -1850,7 +1853,7 @@ public: class ConstBufferSequence, class ResponseDecorator, class AcceptHandler> -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -2334,7 +2337,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -2390,7 +2393,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -2452,7 +2455,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -2518,7 +2521,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -2639,7 +2642,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -2721,7 +2724,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -2818,7 +2821,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -2886,7 +2889,7 @@ public: manner equivalent to using boost::asio::io_service::post(). */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type @@ -3032,7 +3035,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -3194,7 +3197,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -3373,7 +3376,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type @@ -3505,7 +3508,7 @@ public: manner equivalent to using `boost::asio::io_service::post`. */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -3621,7 +3624,7 @@ public: ); @endcode */ template -#if BEAST_DOXYGEN +#if BOOST_BEAST_DOXYGEN void_or_deduced #else async_return_type< @@ -3722,14 +3725,15 @@ private: } // websocket } // beast +} // boost -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #endif diff --git a/include/beast/websocket/teardown.hpp b/include/boost/beast/websocket/teardown.hpp similarity index 93% rename from include/beast/websocket/teardown.hpp rename to include/boost/beast/websocket/teardown.hpp index a4227976..a8165f63 100644 --- a/include/beast/websocket/teardown.hpp +++ b/include/boost/beast/websocket/teardown.hpp @@ -4,15 +4,18 @@ // 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 BEAST_WEBSOCKET_TEARDOWN_HPP -#define BEAST_WEBSOCKET_TEARDOWN_HPP +#ifndef BOOST_BEAST_WEBSOCKET_TEARDOWN_HPP +#define BOOST_BEAST_WEBSOCKET_TEARDOWN_HPP -#include -#include +#include +#include #include #include +namespace boost { namespace beast { namespace websocket { @@ -44,7 +47,7 @@ teardown(teardown_tag, Socket& socket, error_code& ec) { /* If you are trying to use OpenSSL and this goes off, you need to - add an include for . + add an include for . If you are creating an instance of beast::websocket::stream with your own user defined type, you must provide an overload of teardown with @@ -85,7 +88,7 @@ async_teardown(teardown_tag, Socket& socket, TeardownHandler&& handler) { /* If you are trying to use OpenSSL and this goes off, you need to - add an include for . + add an include for . If you are creating an instance of beast::websocket::stream with your own user defined type, you must provide an overload of teardown with @@ -180,7 +183,8 @@ async_teardown(teardown_tag, } // websocket } // beast +} // boost -#include +#include #endif diff --git a/include/boost/beast/zlib.hpp b/include/boost/beast/zlib.hpp new file mode 100644 index 00000000..3f7c6171 --- /dev/null +++ b/include/boost/beast/zlib.hpp @@ -0,0 +1,20 @@ +// +// Copyright (c) 2013-2017 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_ZLIB_HPP +#define BOOST_BEAST_ZLIB_HPP + +#include + +#include +#include +#include +#include + +#endif diff --git a/include/beast/zlib/deflate_stream.hpp b/include/boost/beast/zlib/deflate_stream.hpp similarity index 97% rename from include/beast/zlib/deflate_stream.hpp rename to include/boost/beast/zlib/deflate_stream.hpp index b94e9e35..f7107823 100644 --- a/include/beast/zlib/deflate_stream.hpp +++ b/include/boost/beast/zlib/deflate_stream.hpp @@ -4,20 +4,23 @@ // 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 BEAST_ZLIB_DEFLATE_STREAM_HPP -#define BEAST_ZLIB_DEFLATE_STREAM_HPP +#ifndef BOOST_BEAST_ZLIB_DEFLATE_STREAM_HPP +#define BOOST_BEAST_ZLIB_DEFLATE_STREAM_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include #include +namespace boost { namespace beast { namespace zlib { @@ -396,5 +399,6 @@ deflate_upper_bound(std::size_t bytes) } // zlib } // beast +} // boost #endif diff --git a/include/beast/zlib/detail/bitstream.hpp b/include/boost/beast/zlib/detail/bitstream.hpp similarity index 95% rename from include/beast/zlib/detail/bitstream.hpp rename to include/boost/beast/zlib/detail/bitstream.hpp index c7ae1a94..f19f8c02 100644 --- a/include/beast/zlib/detail/bitstream.hpp +++ b/include/boost/beast/zlib/detail/bitstream.hpp @@ -4,6 +4,8 @@ // 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 +// // This is a derivative work based on Zlib, copyright below: /* Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -32,13 +34,14 @@ (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ -#ifndef BEAST_ZLIB_DETAIL_BITSTREAM_HPP -#define BEAST_ZLIB_DETAIL_BITSTREAM_HPP +#ifndef BOOST_BEAST_ZLIB_DETAIL_BITSTREAM_HPP +#define BOOST_BEAST_ZLIB_DETAIL_BITSTREAM_HPP #include #include #include +namespace boost { namespace beast { namespace zlib { namespace detail { @@ -199,5 +202,6 @@ rewind(BidirIt& it) } // detail } // zlib } // beast +} // boost #endif diff --git a/include/beast/zlib/detail/deflate_stream.hpp b/include/boost/beast/zlib/detail/deflate_stream.hpp similarity index 99% rename from include/beast/zlib/detail/deflate_stream.hpp rename to include/boost/beast/zlib/detail/deflate_stream.hpp index e0574c98..cba650a4 100644 --- a/include/beast/zlib/detail/deflate_stream.hpp +++ b/include/boost/beast/zlib/detail/deflate_stream.hpp @@ -4,6 +4,8 @@ // 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 +// // This is a derivative work based on Zlib, copyright below: /* Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -32,12 +34,12 @@ (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ -#ifndef BEAST_ZLIB_DETAIL_DEFLATE_STREAM_HPP -#define BEAST_ZLIB_DETAIL_DEFLATE_STREAM_HPP +#ifndef BOOST_BEAST_ZLIB_DETAIL_DEFLATE_STREAM_HPP +#define BOOST_BEAST_ZLIB_DETAIL_DEFLATE_STREAM_HPP -#include -#include -#include +#include +#include +#include #include #include #include @@ -50,6 +52,7 @@ #include #include +namespace boost { namespace beast { namespace zlib { namespace detail { @@ -2998,5 +3001,6 @@ f_huff(z_params& zs, Flush flush) -> } // detail } // zlib } // beast +} // boost #endif diff --git a/include/beast/zlib/detail/inflate_stream.hpp b/include/boost/beast/zlib/detail/inflate_stream.hpp similarity index 98% rename from include/beast/zlib/detail/inflate_stream.hpp rename to include/boost/beast/zlib/detail/inflate_stream.hpp index 33372786..fb79754e 100644 --- a/include/beast/zlib/detail/inflate_stream.hpp +++ b/include/boost/beast/zlib/detail/inflate_stream.hpp @@ -4,6 +4,8 @@ // 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 +// // This is a derivative work based on Zlib, copyright below: /* Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -32,15 +34,15 @@ (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ -#ifndef BEAST_ZLIB_DETAIL_INFLATE_STREAM_HPP -#define BEAST_ZLIB_DETAIL_INFLATE_STREAM_HPP +#ifndef BOOST_BEAST_ZLIB_DETAIL_INFLATE_STREAM_HPP +#define BOOST_BEAST_ZLIB_DETAIL_INFLATE_STREAM_HPP -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -48,6 +50,7 @@ #include #include +namespace boost { namespace beast { namespace zlib { namespace detail { @@ -1302,5 +1305,6 @@ inflate_fast(ranges& r, error_code& ec) } // detail } // zlib } // beast +} // boost #endif diff --git a/include/beast/zlib/detail/ranges.hpp b/include/boost/beast/zlib/detail/ranges.hpp similarity index 93% rename from include/beast/zlib/detail/ranges.hpp rename to include/boost/beast/zlib/detail/ranges.hpp index 094bd456..7b598978 100644 --- a/include/beast/zlib/detail/ranges.hpp +++ b/include/boost/beast/zlib/detail/ranges.hpp @@ -4,6 +4,8 @@ // 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 +// // This is a derivative work based on Zlib, copyright below: /* Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -32,12 +34,13 @@ (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ -#ifndef BEAST_ZLIB_DETAIL_RANGES_HPP -#define BEAST_ZLIB_DETAIL_RANGES_HPP +#ifndef BOOST_BEAST_ZLIB_DETAIL_RANGES_HPP +#define BOOST_BEAST_ZLIB_DETAIL_RANGES_HPP #include #include +namespace boost { namespace beast { namespace zlib { namespace detail { @@ -96,5 +99,6 @@ clamp(U u, V v) } // detail } // zlib } // beast +} // boost #endif diff --git a/include/beast/zlib/detail/window.hpp b/include/boost/beast/zlib/detail/window.hpp similarity index 95% rename from include/beast/zlib/detail/window.hpp rename to include/boost/beast/zlib/detail/window.hpp index a671b234..3a8539d1 100644 --- a/include/beast/zlib/detail/window.hpp +++ b/include/boost/beast/zlib/detail/window.hpp @@ -4,6 +4,8 @@ // 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 +// // This is a derivative work based on Zlib, copyright below: /* Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -32,8 +34,8 @@ (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ -#ifndef BEAST_ZLIB_DETAIL_WINDOW_HPP -#define BEAST_ZLIB_DETAIL_WINDOW_HPP +#ifndef BOOST_BEAST_ZLIB_DETAIL_WINDOW_HPP +#define BOOST_BEAST_ZLIB_DETAIL_WINDOW_HPP #include #include @@ -41,6 +43,7 @@ #include #include +namespace boost { namespace beast { namespace zlib { namespace detail { @@ -159,5 +162,6 @@ write(std::uint8_t const* in, std::size_t n) } // detail } // zlib } // beast +} // boost #endif diff --git a/include/beast/zlib/error.hpp b/include/boost/beast/zlib/error.hpp similarity index 92% rename from include/beast/zlib/error.hpp rename to include/boost/beast/zlib/error.hpp index 7ab17953..376a003a 100644 --- a/include/beast/zlib/error.hpp +++ b/include/boost/beast/zlib/error.hpp @@ -4,13 +4,16 @@ // 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 BEAST_ZLIB_ERROR_HPP -#define BEAST_ZLIB_ERROR_HPP +#ifndef BOOST_BEAST_ZLIB_ERROR_HPP +#define BOOST_BEAST_ZLIB_ERROR_HPP -#include -#include +#include +#include +namespace boost { namespace beast { namespace zlib { @@ -128,8 +131,9 @@ enum class error } // zlib } // beast +} // boost -#include +#include #endif diff --git a/include/beast/zlib/impl/error.ipp b/include/boost/beast/zlib/impl/error.ipp similarity index 95% rename from include/beast/zlib/impl/error.ipp rename to include/boost/beast/zlib/impl/error.ipp index 50b28423..86bb4337 100644 --- a/include/beast/zlib/impl/error.ipp +++ b/include/boost/beast/zlib/impl/error.ipp @@ -4,6 +4,8 @@ // 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 +// // This is a derivative work based on Zlib, copyright below: /* Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler @@ -32,10 +34,10 @@ (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ -#ifndef BEAST_ZLIB_IMPL_ERROR_IPP -#define BEAST_ZLIB_IMPL_ERROR_IPP +#ifndef BOOST_BEAST_ZLIB_IMPL_ERROR_IPP +#define BOOST_BEAST_ZLIB_IMPL_ERROR_IPP -#include +#include #include namespace boost { @@ -48,6 +50,7 @@ struct is_error_code_enum } // system } // boost +namespace boost { namespace beast { namespace zlib { namespace detail { @@ -133,5 +136,6 @@ make_error_code(error ev) } // zlib } // beast +} // boost #endif diff --git a/include/beast/zlib/inflate_stream.hpp b/include/boost/beast/zlib/inflate_stream.hpp similarity index 97% rename from include/beast/zlib/inflate_stream.hpp rename to include/boost/beast/zlib/inflate_stream.hpp index dd4df6bb..c89e5d91 100644 --- a/include/beast/zlib/inflate_stream.hpp +++ b/include/boost/beast/zlib/inflate_stream.hpp @@ -4,12 +4,14 @@ // 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 BEAST_ZLIB_INFLATE_STREAM_HPP -#define BEAST_ZLIB_INFLATE_STREAM_HPP +#ifndef BOOST_BEAST_ZLIB_INFLATE_STREAM_HPP +#define BOOST_BEAST_ZLIB_INFLATE_STREAM_HPP -#include -#include +#include +#include // This is a derivative work based on Zlib, copyright below: /* @@ -39,6 +41,7 @@ (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ +namespace boost { namespace beast { namespace zlib { @@ -212,5 +215,6 @@ public: } // zlib } // beast +} // boost #endif diff --git a/include/beast/zlib/zlib.hpp b/include/boost/beast/zlib/zlib.hpp similarity index 96% rename from include/beast/zlib/zlib.hpp rename to include/boost/beast/zlib/zlib.hpp index 217bb191..5e0a29a6 100644 --- a/include/beast/zlib/zlib.hpp +++ b/include/boost/beast/zlib/zlib.hpp @@ -4,11 +4,13 @@ // 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 BEAST_ZLIB_ZLIB_HPP -#define BEAST_ZLIB_ZLIB_HPP +#ifndef BOOST_BEAST_ZLIB_ZLIB_HPP +#define BOOST_BEAST_ZLIB_ZLIB_HPP -#include +#include #include #include @@ -40,6 +42,7 @@ (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). */ +namespace boost { namespace beast { namespace zlib { @@ -175,6 +178,7 @@ enum class Strategy } // zlib } // beast +} // boost #endif diff --git a/scripts/build-and-test.sh b/scripts/build-and-test.sh index c09f13d0..d8783244 100755 --- a/scripts/build-and-test.sh +++ b/scripts/build-and-test.sh @@ -2,6 +2,11 @@ # We use set -e to bail on first non zero exit code of any processes launched # and -x to exit upon any unbound variable. -x will output command lines used # (with variable expansion) + +BIN_DIR="$BOOST_ROOT/bin.v2/libs/beast/test" +LIB_DIR="$BOOST_ROOT/libs/beast" +INC_DIR="$BOOST_ROOT/boost/beast" + set -eux # brew install bash (4) to get this working on OSX! @@ -50,7 +55,7 @@ elif [[ $(uname -s) == "Linux" ]]; then #fi fi -echo "using toolset: $CC" +echo "using toolset: $TOOLSET" echo "using variant: $VARIANT" echo "using address-model: $ADDRESS_MODEL" echo "using PATH: $PATH" @@ -60,37 +65,35 @@ echo "using BOOST_ROOT: $BOOST_ROOT" #################################### HELPERS ################################### function run_tests_with_debugger { - for x in bin/**/$VARIANT/**/*-tests; do - scripts/run-with-debugger.sh "$x" + for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/*-tests; do + "$LIB_DIR/scripts/run-with-debugger.sh" "$x" done } function run_tests { - for x in bin/**/$VARIANT/**/*-tests; do + for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/*-tests; do $x done } function run_tests_with_valgrind { - for x in bin/**/$VARIANT/**/*-tests; do + for x in $BOOST_ROOT/bin.v2/libs/beast/test/**/$VARIANT/**/*-tests; do if [[ $(basename $x) == "bench-tests" ]]; then $x else # TODO --max-stackframe=8388608 # see: https://travis-ci.org/vinniefalco/Beast/jobs/132486245 - valgrind --suppressions=./scripts/valgrind.supp --error-exitcode=1 "$x" + valgrind --suppressions=$BOOST_ROOT/libs/beast/scripts/valgrind.supp --error-exitcode=1 "$x" fi done } -function build_beast { - $BOOST_ROOT/bjam toolset=$CC \ - variant=$VARIANT \ - address-model=$ADDRESS_MODEL \ - -j${num_jobs} +function build_bjam { + bjam libs/beast/test toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs} + bjam libs/beast/example toolset=$TOOLSET variant=$VARIANT address-model=$ADDRESS_MODEL -j${num_jobs} } -function build_beast_cmake { +function build_cmake { mkdir -p build pushd build > /dev/null cmake -DVARIANT=${VARIANT} .. @@ -128,47 +131,56 @@ function run_autobahn_test_suite { ##################################### BUILD #################################### if [[ ${BUILD_SYSTEM:-} == cmake ]]; then - build_beast_cmake + build_cmake else - build_beast + build_bjam fi ##################################### TESTS #################################### +# for lcov to work effectively, the paths and includes +# passed to the compiler should not contain "." or "..". + +# (this runs in $BOOST_ROOT) if [[ $VARIANT == "coverage" ]]; then - find . -name "*.gcda" | xargs rm -f - rm *.info -f + # Remove old files from a previous retry + find "$BOOST_ROOT" -name "*.gcda" | xargs rm -f + rm -f "$BOOST_ROOT/*.info" + # Create baseline coverage data file - lcov --no-external -c -i -d . -o baseline.info > /dev/null + lcov --no-external -c -i -d "$BOOST_ROOT" -o baseline.info > /dev/null # Perform test if [[ $MAIN_BRANCH == "1" && "$DO_VALGRIND" = true ]]; then run_tests_with_valgrind - # skip slow autobahn tests - #run_autobahn_test_suite + #run_autobahn_test_suite # skip slow autobahn tests else echo "skipping autobahn/valgrind tests for feature branch build" run_tests fi - # Create test coverage data file - lcov --no-external -c -d . -o testrun.info > /dev/null - - # Combine baseline and test coverage data + # Create test coverage data file, combine with the + # baseline result and filter out things we don't want. + # + #lcov --no-external -c -d "$BIN_DIR" -d "$LIB_DIR" -o testrun.info > /dev/null + lcov --no-external -c -d "$BOOST_ROOT" -o testrun.info > /dev/null lcov -a baseline.info -a testrun.info -o lcov-all.info > /dev/null + lcov -e "lcov-all.info" "$INC_DIR/*" -o lcov.info > /dev/null - # Extract only include/beast, and don\'t report on examples/test - lcov -e "lcov-all.info" "$PWD/include/beast/*" -o lcov.info > /dev/null + # Upload to codecov + ~/.local/bin/codecov -X gcov -f lcov.info - ~/.local/bin/codecov -X gcov + # Upload to coveralls #cat lcov.info | node_modules/.bin/coveralls # Clean up these stragglers so BOOST_ROOT cache is clean - find $BOOST_ROOT/bin.v2 -name "*.gcda" | xargs rm -f + find "$BOOST_ROOT" -name "*.gcda" | xargs rm -f + else if [[ $MAIN_BRANCH == "1" && "$DO_VALGRIND" = true ]]; then run_tests_with_valgrind else run_tests_with_debugger fi + fi diff --git a/scripts/install-boost.sh b/scripts/install-boost.sh deleted file mode 100755 index fcee32d5..00000000 --- a/scripts/install-boost.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash -# Assumptions: -# 1) BOOST_ROOT and BOOST_URL are already defined, -# and contain valid values. -# 2) The last namepart of BOOST_ROOT matches the -# folder name internal to boost's .tar.gz -# When testing you can force a boost build by clearing travis caches: -# https://travis-ci.org/ripple/rippled/caches -set -eu -#if [ ! -d "$BOOST_ROOT" ] -#then - wget $BOOST_URL -O /tmp/boost.tar.gz - cd `dirname $BOOST_ROOT` - rm -fr ${BOOST_ROOT} - tar xzf /tmp/boost.tar.gz - - params="define=_GLIBCXX_USE_CXX11_ABI=0 \ - address-model=$ADDRESS_MODEL --with-program_options \ - --with-system --with-coroutine --with-filesystem" - cd $BOOST_ROOT && \ - ./bootstrap.sh --prefix=$BOOST_ROOT && \ - ./b2 -d1 $params && \ - ./b2 -d0 $params install -#else -# echo "Using cached boost at $BOOST_ROOT" -#fi - diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index 6ea90bbd..a5ce3703 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -58,7 +58,7 @@ pip install --user requests==2.13.0 pip install --user https://github.com/codecov/codecov-python/archive/master.zip pip install --user autobahntestsuite -bash scripts/install-boost.sh +#bash scripts/install-boost.sh bash scripts/install-valgrind.sh # Install lcov diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4d72a9ad..d87c8d79 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,11 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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 +# add_subdirectory (core) add_subdirectory (http) @@ -13,15 +20,16 @@ if ((NOT "${VARIANT}" STREQUAL "coverage") AND add_subdirectory (common) add_subdirectory (server) - GroupSources(extras/beast extras) - GroupSources(include/beast beast) + GroupSources(extras/boost/beast extras) + GroupSources(include/boost/beast beast) GroupSources(test "/") add_executable (lib-tests - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${EXTRAS_INCLUDES} - ../extras/beast/unit_test/main.cpp + Jamfile + ../extras/boost/beast/unit_test/main.cpp config.cpp core.cpp exemplars.cpp diff --git a/test/Jamfile b/test/Jamfile index 9aba4abf..57a7c5a9 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -4,6 +4,8 @@ # 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 +# import os ; diff --git a/test/benchmarks/CMakeLists.txt b/test/benchmarks/CMakeLists.txt index f6c0afcb..6f847bcd 100644 --- a/test/benchmarks/CMakeLists.txt +++ b/test/benchmarks/CMakeLists.txt @@ -1,15 +1,23 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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(extras/beast extras) -GroupSources(include/beast beast) +GroupSources(extras/boost/beast extras) +GroupSources(include/boost/beast beast) GroupSources(test/benchmarks "/") GroupSources(test/http "/") add_executable (benchmarks - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${EXTRAS_INCLUDES} - ../../extras/beast/unit_test/main.cpp + Jamfile + ../../extras/boost/beast/unit_test/main.cpp ../http/message_fuzz.hpp nodejs_parser.hpp buffers.cpp diff --git a/test/benchmarks/Jamfile b/test/benchmarks/Jamfile index a3ff3bd6..d23f10cd 100644 --- a/test/benchmarks/Jamfile +++ b/test/benchmarks/Jamfile @@ -4,13 +4,15 @@ # 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 +# unit-test benchmarks : - ../../extras/beast/unit_test/main.cpp + ../../extras/boost/beast/unit_test/main.cpp buffers.cpp nodejs_parser.cpp parser.cpp - utf8_checker.cpp + #utf8_checker.cpp # causes unnecessary dependencies : coverage:no ubasan:no diff --git a/test/benchmarks/buffers.cpp b/test/benchmarks/buffers.cpp index 5cc99e65..26d5440f 100644 --- a/test/benchmarks/buffers.cpp +++ b/test/benchmarks/buffers.cpp @@ -4,12 +4,14 @@ // 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 +// -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include @@ -18,6 +20,7 @@ #include #include +namespace boost { namespace beast { class buffers_test : public beast::unit_test::suite @@ -233,6 +236,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(buffers,benchmarks,beast); +BOOST_BEAST_DEFINE_TESTSUITE(buffers,benchmarks,beast); } // beast +} // boost diff --git a/test/benchmarks/nodejs_parser.cpp b/test/benchmarks/nodejs_parser.cpp index 39bef454..379fb1b2 100644 --- a/test/benchmarks/nodejs_parser.cpp +++ b/test/benchmarks/nodejs_parser.cpp @@ -4,6 +4,8 @@ // 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 defined(__GNUC__) && (__GNUC__ >= 7) #pragma GCC diagnostic push diff --git a/test/benchmarks/nodejs_parser.hpp b/test/benchmarks/nodejs_parser.hpp index 043c5834..fb8b1e55 100644 --- a/test/benchmarks/nodejs_parser.hpp +++ b/test/benchmarks/nodejs_parser.hpp @@ -4,16 +4,18 @@ // 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 BEAST_HTTP_NODEJS_PARSER_HPP -#define BEAST_HTTP_NODEJS_PARSER_HPP +#ifndef BOOST_BEAST_HTTP_NODEJS_PARSER_HPP +#define BOOST_BEAST_HTTP_NODEJS_PARSER_HPP #include "nodejs-parser/http_parser.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -22,6 +24,7 @@ #include #include +namespace boost { namespace beast { namespace http { @@ -634,5 +637,6 @@ private: } // http } // beast +} // boost #endif diff --git a/test/benchmarks/parser.cpp b/test/benchmarks/parser.cpp index 175b88e8..1071c129 100644 --- a/test/benchmarks/parser.cpp +++ b/test/benchmarks/parser.cpp @@ -4,21 +4,24 @@ // 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 +// #include "nodejs_parser.hpp" #include "../http/message_fuzz.hpp" -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace http { @@ -53,7 +56,7 @@ public: { mg.request(v[i]); size_ += v[i].size(); - BEAST_EXPECT(v[i].size() > 0); + BOOST_BEAST_EXPECT(v[i].size() > 0); } return v; } @@ -68,7 +71,7 @@ public: { mg.response(v[i]); size_ += v[i].size(); - BEAST_EXPECT(v[i].size() > 0); + BOOST_BEAST_EXPECT(v[i].size() > 0); } return v; } @@ -113,7 +116,7 @@ public: Parser p; error_code ec; p.write(b.data(), ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) log << to_string(b.data()) << std::endl; } } @@ -129,7 +132,7 @@ public: p.header_limit((std::numeric_limits::max)()); error_code ec; feed(b.data(), p, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) log << to_string(b.data()) << std::endl; } } @@ -291,8 +294,9 @@ public: } }; -BEAST_DEFINE_TESTSUITE(parser,benchmarks,beast); +BOOST_BEAST_DEFINE_TESTSUITE(parser,benchmarks,beast); } // http } // beast +} // boost diff --git a/test/benchmarks/utf8_checker.cpp b/test/benchmarks/utf8_checker.cpp index 9ca893b8..fbe820a3 100644 --- a/test/benchmarks/utf8_checker.cpp +++ b/test/benchmarks/utf8_checker.cpp @@ -4,13 +4,16 @@ // 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 +// -#include -#include +#include +#include #include #include #include +namespace boost { namespace beast { class utf8_checker_test : public beast::unit_test::suite @@ -136,7 +139,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(utf8_checker,benchmarks,beast); +BOOST_BEAST_DEFINE_TESTSUITE(utf8_checker,benchmarks,beast); } // beast +} // boost diff --git a/test/common/CMakeLists.txt b/test/common/CMakeLists.txt index d9fb4d02..0551bf94 100644 --- a/test/common/CMakeLists.txt +++ b/test/common/CMakeLists.txt @@ -1,13 +1,21 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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(example/common common) -GroupSources(extras/beast extras) -GroupSources(include/beast beast) +GroupSources(extras/boost/beast extras) +GroupSources(include/boost/beast beast) GroupSources(test/common "/") add_executable (common-test - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${COMMON_INCLUDES} + Jamfile detect_ssl.cpp mime_types.cpp rfc7231.cpp diff --git a/test/common/Jamfile b/test/common/Jamfile index 3668a464..d0d39c73 100644 --- a/test/common/Jamfile +++ b/test/common/Jamfile @@ -4,6 +4,8 @@ # 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 +# exe common-test : detect_ssl.cpp diff --git a/test/common/detect_ssl.cpp b/test/common/detect_ssl.cpp index 00fced9f..79329db4 100644 --- a/test/common/detect_ssl.cpp +++ b/test/common/detect_ssl.cpp @@ -4,7 +4,9 @@ // 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 "../../example/common/detect_ssl.hpp" +#include "example/common/detect_ssl.hpp" diff --git a/test/common/main.cpp b/test/common/main.cpp index 6335cbf2..7ca61a15 100644 --- a/test/common/main.cpp +++ b/test/common/main.cpp @@ -4,6 +4,8 @@ // 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 +// int main() { diff --git a/test/common/mime_types.cpp b/test/common/mime_types.cpp index a681a902..4cfa94b3 100644 --- a/test/common/mime_types.cpp +++ b/test/common/mime_types.cpp @@ -4,7 +4,9 @@ // 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 "../../example/common/mime_types.hpp" +#include "example/common/mime_types.hpp" diff --git a/test/common/rfc7231.cpp b/test/common/rfc7231.cpp index 8c5c017c..547c40e7 100644 --- a/test/common/rfc7231.cpp +++ b/test/common/rfc7231.cpp @@ -4,7 +4,9 @@ // 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 "../../example/common/rfc7231.hpp" +#include "example/common/rfc7231.hpp" diff --git a/test/common/session_alloc.cpp b/test/common/session_alloc.cpp index 4ff359d5..8b3531b8 100644 --- a/test/common/session_alloc.cpp +++ b/test/common/session_alloc.cpp @@ -4,6 +4,8 @@ // 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 "example/common/session_alloc.hpp" diff --git a/test/common/ssl_stream.cpp b/test/common/ssl_stream.cpp index 6a54bdbd..e3ba8616 100644 --- a/test/common/ssl_stream.cpp +++ b/test/common/ssl_stream.cpp @@ -4,10 +4,12 @@ // 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 BEAST_USE_OPENSSL +#if BOOST_BEAST_USE_OPENSSL // Test that header file is self-contained. -#include "../../example/common/ssl_stream.hpp" +#include "example/common/ssl_stream.hpp" #endif diff --git a/test/common/write_msg.cpp b/test/common/write_msg.cpp index 80d62d68..863c07d3 100644 --- a/test/common/write_msg.cpp +++ b/test/common/write_msg.cpp @@ -4,7 +4,9 @@ // 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 "../../example/common/write_msg.hpp" +#include "example/common/write_msg.hpp" diff --git a/test/config.cpp b/test/config.cpp index 7b9efac2..ef96eed4 100644 --- a/test/config.cpp +++ b/test/config.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/core.cpp b/test/core.cpp index ea704e03..129348ef 100644 --- a/test/core.cpp +++ b/test/core.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index 4a11943f..2f034bcb 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -1,16 +1,24 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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(example example) -GroupSources(extras/beast extras) -GroupSources(include/beast beast) +GroupSources(extras/boost/beast extras) +GroupSources(include/boost/beast beast) GroupSources(test/core "/") add_executable (core-tests - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${EXAMPLE_INCLUDES} ${EXTRAS_INCLUDES} - ../../extras/beast/unit_test/main.cpp + Jamfile + ../../extras/boost/beast/unit_test/main.cpp buffer_test.hpp file_test.hpp async_result.cpp diff --git a/test/core/Jamfile b/test/core/Jamfile index 659e6b8f..40ac9d7d 100644 --- a/test/core/Jamfile +++ b/test/core/Jamfile @@ -4,9 +4,11 @@ # 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 +# unit-test core-tests : - ../../extras/beast/unit_test/main.cpp + ../../extras/boost/beast/unit_test/main.cpp async_result.cpp bind_handler.cpp buffer_cat.cpp diff --git a/test/core/async_result.cpp b/test/core/async_result.cpp index 1aca1cbe..aa09afe0 100644 --- a/test/core/async_result.cpp +++ b/test/core/async_result.cpp @@ -4,14 +4,17 @@ // 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 +#include -#include -#include +#include +#include #include +namespace boost { namespace beast { namespace { @@ -36,3 +39,4 @@ static_assert(std::is_constructible< } // (anon-ns) } // beast +} // boost diff --git a/test/core/base64.cpp b/test/core/base64.cpp index e33f65d6..a9e15bf6 100644 --- a/test/core/base64.cpp +++ b/test/core/base64.cpp @@ -4,12 +4,15 @@ // 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 +#include -#include +#include +namespace boost { namespace beast { namespace detail { @@ -20,8 +23,8 @@ public: check (std::string const& in, std::string const& out) { auto const encoded = base64_encode (in); - BEAST_EXPECT(encoded == out); - BEAST_EXPECT(base64_decode (encoded) == in); + BOOST_BEAST_EXPECT(encoded == out); + BOOST_BEAST_EXPECT(base64_decode (encoded) == in); } void @@ -50,8 +53,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(base64,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(base64,core,beast); } // detail } // beast - +} // boost diff --git a/test/core/bind_handler.cpp b/test/core/bind_handler.cpp index 05e9ac0c..bf251987 100644 --- a/test/core/bind_handler.cpp +++ b/test/core/bind_handler.cpp @@ -4,14 +4,17 @@ // 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 +#include -#include -#include +#include +#include #include +namespace boost { namespace beast { class bind_handler_test : public unit_test::suite @@ -38,7 +41,7 @@ public: void callback(int v) { - BEAST_EXPECT(v == 42); + BOOST_BEAST_EXPECT(v == 42); } void @@ -64,6 +67,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(bind_handler,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(bind_handler,core,beast); } // beast +} // boost diff --git a/test/core/buffer_cat.cpp b/test/core/buffer_cat.cpp index 88005dc5..70ac0f9c 100644 --- a/test/core/buffer_cat.cpp +++ b/test/core/buffer_cat.cpp @@ -4,11 +4,13 @@ // 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 +#include -#include +#include #include #include #include @@ -16,6 +18,7 @@ #include #include +namespace boost { namespace beast { class buffer_cat_test : public unit_test::suite @@ -99,34 +102,34 @@ public: std::list b6; auto bs = buffer_cat( b1, b2, b3, b4, b5, b6); - BEAST_EXPECT(buffer_size(bs) == 10); - BEAST_EXPECT(bsize1(bs) == 10); - BEAST_EXPECT(bsize2(bs) == 10); - BEAST_EXPECT(bsize3(bs) == 10); - BEAST_EXPECT(bsize4(bs) == 10); + BOOST_BEAST_EXPECT(buffer_size(bs) == 10); + BOOST_BEAST_EXPECT(bsize1(bs) == 10); + BOOST_BEAST_EXPECT(bsize2(bs) == 10); + BOOST_BEAST_EXPECT(bsize3(bs) == 10); + BOOST_BEAST_EXPECT(bsize4(bs) == 10); std::vector v; for(auto iter = make_reverse_iterator(bs.end()); iter != make_reverse_iterator(bs.begin()); ++iter) v.emplace_back(*iter); - BEAST_EXPECT(buffer_size(bs) == 10); + BOOST_BEAST_EXPECT(buffer_size(bs) == 10); decltype(bs) bs2(bs); auto bs3(std::move(bs)); { boost::asio::streambuf sb1, sb2; - BEAST_EXPECT(buffer_size(buffer_cat( + BOOST_BEAST_EXPECT(buffer_size(buffer_cat( sb1.prepare(5), sb2.prepare(7))) == 12); sb1.commit(5); sb2.commit(7); - BEAST_EXPECT(buffer_size(buffer_cat( + BOOST_BEAST_EXPECT(buffer_size(buffer_cat( sb1.data(), sb2.data())) == 12); } for(auto it = bs.begin(); it != bs.end(); ++it) { decltype(bs)::const_iterator copy; copy = it; - BEAST_EXPECT(copy == it); + BOOST_BEAST_EXPECT(copy == it); copy = copy; - BEAST_EXPECT(copy == it); + BOOST_BEAST_EXPECT(copy == it); } } @@ -179,7 +182,7 @@ public: std::size_t n = 0; for(auto it = rbegin; it != rend; ++it) n += buffer_size(*it); - BEAST_EXPECT(n == 9); + BOOST_BEAST_EXPECT(n == 9); } #endif @@ -205,11 +208,11 @@ public: pass(); } auto bs2 = bs; - BEAST_EXPECT(bs.begin() != bs2.begin()); - BEAST_EXPECT(bs.end() != bs2.end()); + BOOST_BEAST_EXPECT(bs.begin() != bs2.begin()); + BOOST_BEAST_EXPECT(bs.end() != bs2.end()); decltype(bs)::const_iterator it; decltype(bs2)::const_iterator it2; - BEAST_EXPECT(it == it2); + BOOST_BEAST_EXPECT(it == it2); } void run() override @@ -261,6 +264,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(buffer_cat,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(buffer_cat,core,beast); } // beast +} // boost diff --git a/test/core/buffer_prefix.cpp b/test/core/buffer_prefix.cpp index 9ae2ceb2..da31a736 100644 --- a/test/core/buffer_prefix.cpp +++ b/test/core/buffer_prefix.cpp @@ -4,16 +4,19 @@ // 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 +#include -#include -#include -#include +#include +#include +#include #include #include +namespace boost { namespace beast { BOOST_STATIC_ASSERT( @@ -109,7 +112,7 @@ public: { using boost::asio::buffer_size; std::string s = "Hello, world"; - BEAST_EXPECT(s.size() == 12); + BOOST_BEAST_EXPECT(s.size() == 12); for(std::size_t x = 1; x < 4; ++x) { for(std::size_t y = 1; y < 4; ++y) { std::size_t z = s.size() - (x + y); @@ -121,14 +124,14 @@ public: for(std::size_t i = 0; i <= s.size() + 1; ++i) { auto pb = buffer_prefix(i, bs); - BEAST_EXPECT(to_string(pb) == s.substr(0, i)); + BOOST_BEAST_EXPECT(to_string(pb) == s.substr(0, i)); auto pb2 = pb; - BEAST_EXPECT(to_string(pb2) == to_string(pb)); + BOOST_BEAST_EXPECT(to_string(pb2) == to_string(pb)); pb = buffer_prefix(0, bs); pb2 = pb; - BEAST_EXPECT(buffer_size(pb2) == 0); + BOOST_BEAST_EXPECT(buffer_size(pb2) == 0); pb2 = buffer_prefix(i, bs); - BEAST_EXPECT(to_string(pb2) == s.substr(0, i)); + BOOST_BEAST_EXPECT(to_string(pb2) == s.substr(0, i)); } } }} @@ -140,22 +143,22 @@ public: using boost::asio::buffer_size; using boost::asio::null_buffers; auto pb0 = buffer_prefix(0, null_buffers{}); - BEAST_EXPECT(buffer_size(pb0) == 0); + BOOST_BEAST_EXPECT(buffer_size(pb0) == 0); auto pb1 = buffer_prefix(1, null_buffers{}); - BEAST_EXPECT(buffer_size(pb1) == 0); - BEAST_EXPECT(buffer_copy(pb0, pb1) == 0); + BOOST_BEAST_EXPECT(buffer_size(pb1) == 0); + BOOST_BEAST_EXPECT(buffer_copy(pb0, pb1) == 0); using pb_type = decltype(pb0); consuming_buffers cb(pb0); - BEAST_EXPECT(buffer_size(cb) == 0); - BEAST_EXPECT(buffer_copy(cb, pb1) == 0); + BOOST_BEAST_EXPECT(buffer_size(cb) == 0); + BOOST_BEAST_EXPECT(buffer_copy(cb, pb1) == 0); cb.consume(1); - BEAST_EXPECT(buffer_size(cb) == 0); - BEAST_EXPECT(buffer_copy(cb, pb1) == 0); + BOOST_BEAST_EXPECT(buffer_size(cb) == 0); + BOOST_BEAST_EXPECT(buffer_copy(cb, pb1) == 0); auto pbc = buffer_prefix(2, cb); - BEAST_EXPECT(buffer_size(pbc) == 0); - BEAST_EXPECT(buffer_copy(pbc, cb) == 0); + BOOST_BEAST_EXPECT(buffer_size(pbc) == 0); + BOOST_BEAST_EXPECT(buffer_copy(pbc, cb) == 0); } void testIterator() @@ -168,10 +171,10 @@ public: const_buffer{&b[1], 1}, const_buffer{&b[2], 1}}}; auto pb = buffer_prefix(2, bs); - BEAST_EXPECT(bsize1(pb) == 2); - BEAST_EXPECT(bsize2(pb) == 2); - BEAST_EXPECT(bsize3(pb) == 2); - BEAST_EXPECT(bsize4(pb) == 2); + BOOST_BEAST_EXPECT(bsize1(pb) == 2); + BOOST_BEAST_EXPECT(bsize2(pb) == 2); + BOOST_BEAST_EXPECT(bsize3(pb) == 2); + BOOST_BEAST_EXPECT(bsize4(pb) == 2); } void run() override @@ -183,6 +186,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(buffer_prefix,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(buffer_prefix,core,beast); } // beast +} // boost diff --git a/test/core/buffer_test.hpp b/test/core/buffer_test.hpp index 3a05b459..d567a9b8 100644 --- a/test/core/buffer_test.hpp +++ b/test/core/buffer_test.hpp @@ -4,19 +4,22 @@ // 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 BEAST_TEST_BUFFER_TEST_HPP -#define BEAST_TEST_BUFFER_TEST_HPP +#ifndef BOOST_BEAST_TEST_BUFFER_TEST_HPP +#define BOOST_BEAST_TEST_BUFFER_TEST_HPP -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { namespace test { @@ -114,5 +117,6 @@ size_rev_post(ConstBufferSequence const& buffers) } // test } // beast +} // boost #endif diff --git a/test/core/buffered_read_stream.cpp b/test/core/buffered_read_stream.cpp index 81536e1e..d594cac4 100644 --- a/test/core/buffered_read_stream.cpp +++ b/test/core/buffered_read_stream.cpp @@ -4,17 +4,20 @@ // 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 +#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include +namespace boost { namespace beast { class buffered_read_stream_test @@ -32,8 +35,8 @@ public: buffered_read_stream srs(ios); buffered_read_stream srs2(std::move(srs)); srs = std::move(srs2); - BEAST_EXPECT(&srs.get_io_service() == &ios); - BEAST_EXPECT(&srs.get_io_service() == &srs2.get_io_service()); + BOOST_BEAST_EXPECT(&srs.get_io_service() == &ios); + BOOST_BEAST_EXPECT(&srs.get_io_service() == &srs2.get_io_service()); } { socket_type sock(ios); @@ -63,11 +66,11 @@ public: boost::asio::read(srs, buffer(&s[0], s.size()), ec); if(! ec) { - BEAST_EXPECT(s == "Hello, world!"); + BOOST_BEAST_EXPECT(s == "Hello, world!"); break; } } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { @@ -82,11 +85,11 @@ public: boost::asio::read(srs, buffer(&s[0], s.size()), ec); if(! ec) { - BEAST_EXPECT(s == "Hello, world!"); + BOOST_BEAST_EXPECT(s == "Hello, world!"); break; } } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { @@ -101,11 +104,11 @@ public: srs, buffer(&s[0], s.size()), do_yield[ec]); if(! ec) { - BEAST_EXPECT(s == "Hello, world!"); + BOOST_BEAST_EXPECT(s == "Hello, world!"); break; } } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { @@ -121,11 +124,11 @@ public: srs, buffer(&s[0], s.size()), do_yield[ec]); if(! ec) { - BEAST_EXPECT(s == "Hello, world!"); + BOOST_BEAST_EXPECT(s == "Hello, world!"); break; } } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); } void run() override @@ -137,7 +140,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(buffered_read_stream,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(buffered_read_stream,core,beast); } // beast - +} // boost diff --git a/test/core/buffers_adapter.cpp b/test/core/buffers_adapter.cpp index eff1f223..3df7794b 100644 --- a/test/core/buffers_adapter.cpp +++ b/test/core/buffers_adapter.cpp @@ -4,19 +4,22 @@ // 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 +#include #include "buffer_test.hpp" -#include -#include -#include +#include +#include +#include #include #include #include #include +namespace boost { namespace beast { class buffers_adapter_test : public unit_test::suite @@ -40,7 +43,7 @@ public: using boost::asio::mutable_buffer; char buf[12]; std::string const s = "Hello, world"; - BEAST_EXPECT(s.size() == sizeof(buf)); + BOOST_BEAST_EXPECT(s.size() == sizeof(buf)); for(std::size_t i = 1; i < 4; ++i) { for(std::size_t j = 1; j < 4; ++j) { for(std::size_t x = 1; x < 4; ++x) { @@ -57,83 +60,83 @@ public: mutable_buffer{&buf[i], j}, mutable_buffer{&buf[i+j], k}}}; buffers_adapter ba(std::move(bs)); - BEAST_EXPECT(ba.max_size() == sizeof(buf)); + BOOST_BEAST_EXPECT(ba.max_size() == sizeof(buf)); { auto d = ba.prepare(z); - BEAST_EXPECT(buffer_size(d) == z); + BOOST_BEAST_EXPECT(buffer_size(d) == z); } { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { auto d = ba.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); } { auto d = ba.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); ba.commit(buffer_copy(d, buffer(s.data(), x))); } - BEAST_EXPECT(ba.size() == x); - BEAST_EXPECT(ba.max_size() == sizeof(buf) - x); - BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); + BOOST_BEAST_EXPECT(ba.size() == x); + BOOST_BEAST_EXPECT(ba.max_size() == sizeof(buf) - x); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); { auto d = ba.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); } { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { auto d = ba.prepare(z); - BEAST_EXPECT(buffer_size(d) == z); + BOOST_BEAST_EXPECT(buffer_size(d) == z); } { auto d = ba.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); ba.commit(buffer_copy(d, buffer(s.data()+x, y))); } ba.commit(1); - BEAST_EXPECT(ba.size() == x + y); - BEAST_EXPECT(ba.max_size() == sizeof(buf) - (x + y)); - BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); + BOOST_BEAST_EXPECT(ba.size() == x + y); + BOOST_BEAST_EXPECT(ba.max_size() == sizeof(buf) - (x + y)); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); { auto d = ba.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); } { auto d = ba.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); } { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { - auto d = ba.prepare(z); BEAST_EXPECT(buffer_size(d) == z); + auto d = ba.prepare(z); BOOST_BEAST_EXPECT(buffer_size(d) == z); ba.commit(buffer_copy(d, buffer(s.data()+x+y, z))); } ba.commit(2); - BEAST_EXPECT(ba.size() == x + y + z); - BEAST_EXPECT(ba.max_size() == 0); - BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); - BEAST_EXPECT(to_string(ba.data()) == s); + BOOST_BEAST_EXPECT(ba.size() == x + y + z); + BOOST_BEAST_EXPECT(ba.max_size() == 0); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); + BOOST_BEAST_EXPECT(to_string(ba.data()) == s); ba.consume(t); { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } - BEAST_EXPECT(to_string(ba.data()) == s.substr(t, std::string::npos)); + BOOST_BEAST_EXPECT(to_string(ba.data()) == s.substr(t, std::string::npos)); ba.consume(u); - BEAST_EXPECT(to_string(ba.data()) == s.substr(t + u, std::string::npos)); + BOOST_BEAST_EXPECT(to_string(ba.data()) == s.substr(t + u, std::string::npos)); ba.consume(v); - BEAST_EXPECT(to_string(ba.data()) == ""); + BOOST_BEAST_EXPECT(to_string(ba.data()) == ""); ba.consume(1); { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } try { @@ -155,9 +158,9 @@ public: sb_type b; buffers_adapter< sb_type::mutable_buffers_type> ba(b.prepare(3)); - BEAST_EXPECT(buffer_size(ba.prepare(3)) == 3); + BOOST_BEAST_EXPECT(buffer_size(ba.prepare(3)) == 3); ba.commit(2); - BEAST_EXPECT(buffer_size(ba.data()) == 2); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == 2); } { using sb_type = beast::multi_buffer; @@ -165,13 +168,13 @@ public: b.prepare(3); buffers_adapter< sb_type::mutable_buffers_type> ba(b.prepare(8)); - BEAST_EXPECT(buffer_size(ba.prepare(8)) == 8); + BOOST_BEAST_EXPECT(buffer_size(ba.prepare(8)) == 8); ba.commit(2); - BEAST_EXPECT(buffer_size(ba.data()) == 2); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == 2); ba.consume(1); ba.commit(6); ba.consume(2); - BEAST_EXPECT(buffer_size(ba.data()) == 5); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == 5); ba.consume(5); } } @@ -194,6 +197,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(buffers_adapter,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(buffers_adapter,core,beast); } // beast +} // boost diff --git a/test/core/clamp.cpp b/test/core/clamp.cpp index 24fd20a6..8cbfaa0b 100644 --- a/test/core/clamp.cpp +++ b/test/core/clamp.cpp @@ -4,13 +4,16 @@ // 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 +#include -#include +#include #include +namespace boost { namespace beast { namespace detail { @@ -19,7 +22,7 @@ class clamp_test : public beast::unit_test::suite public: void testClamp() { - BEAST_EXPECT(clamp( + BOOST_BEAST_EXPECT(clamp( (std::numeric_limits::max)()) == (std::numeric_limits::max)()); } @@ -30,8 +33,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(clamp,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(clamp,core,beast); } // detail } // beast - +} // boost diff --git a/test/core/consuming_buffers.cpp b/test/core/consuming_buffers.cpp index 64a96770..1567bbdb 100644 --- a/test/core/consuming_buffers.cpp +++ b/test/core/consuming_buffers.cpp @@ -4,18 +4,21 @@ // 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 +#include #include "buffer_test.hpp" -#include -#include -#include +#include +#include +#include #include #include +namespace boost { namespace beast { class consuming_buffers_test : public beast::unit_test::suite @@ -44,10 +47,10 @@ public: void expect_size(std::size_t n, ConstBufferSequence const& buffers) { - BEAST_EXPECT(test::size_pre(buffers) == n); - BEAST_EXPECT(test::size_post(buffers) == n); - BEAST_EXPECT(test::size_rev_pre(buffers) == n); - BEAST_EXPECT(test::size_rev_post(buffers) == n); + BOOST_BEAST_EXPECT(test::size_pre(buffers) == n); + BOOST_BEAST_EXPECT(test::size_post(buffers) == n); + BOOST_BEAST_EXPECT(test::size_rev_pre(buffers) == n); + BOOST_BEAST_EXPECT(test::size_rev_post(buffers) == n); } void @@ -72,9 +75,9 @@ public: using boost::asio::const_buffer; char buf[12]; std::string const s = "Hello, world"; - BEAST_EXPECT(s.size() == sizeof(buf)); + BOOST_BEAST_EXPECT(s.size() == sizeof(buf)); buffer_copy(buffer(buf), buffer(s)); - BEAST_EXPECT(to_string(buffer(buf)) == s); + BOOST_BEAST_EXPECT(to_string(buffer(buf)) == s); for(std::size_t i = 1; i < 4; ++i) { for(std::size_t j = 1; j < 4; ++j) { for(std::size_t x = 1; x < 4; ++x) { @@ -87,24 +90,24 @@ public: const_buffer{&buf[i], j}, const_buffer{&buf[i+j], k}}}; consuming_buffers cb(bs); - BEAST_EXPECT(to_string(cb) == s); + BOOST_BEAST_EXPECT(to_string(cb) == s); expect_size(s.size(), cb); cb.consume(0); - BEAST_EXPECT(eq(cb, consumed_buffers(bs, 0))); - BEAST_EXPECT(to_string(cb) == s); + BOOST_BEAST_EXPECT(eq(cb, consumed_buffers(bs, 0))); + BOOST_BEAST_EXPECT(to_string(cb) == s); expect_size(s.size(), cb); cb.consume(x); - BEAST_EXPECT(to_string(cb) == s.substr(x)); - BEAST_EXPECT(eq(cb, consumed_buffers(bs, x))); + BOOST_BEAST_EXPECT(to_string(cb) == s.substr(x)); + BOOST_BEAST_EXPECT(eq(cb, consumed_buffers(bs, x))); cb.consume(y); - BEAST_EXPECT(to_string(cb) == s.substr(x+y)); - BEAST_EXPECT(eq(cb, consumed_buffers(bs, x+y))); + BOOST_BEAST_EXPECT(to_string(cb) == s.substr(x+y)); + BOOST_BEAST_EXPECT(eq(cb, consumed_buffers(bs, x+y))); cb.consume(z); - BEAST_EXPECT(to_string(cb) == ""); - BEAST_EXPECT(eq(cb, consumed_buffers(bs, x+y+z))); + BOOST_BEAST_EXPECT(to_string(cb) == ""); + BOOST_BEAST_EXPECT(eq(cb, consumed_buffers(bs, x+y+z))); cb.consume(1); - BEAST_EXPECT(to_string(cb) == ""); - BEAST_EXPECT(eq(cb, consumed_buffers(bs, x+y+z))); + BOOST_BEAST_EXPECT(to_string(cb) == ""); + BOOST_BEAST_EXPECT(eq(cb, consumed_buffers(bs, x+y+z))); } }}}} } @@ -123,7 +126,7 @@ public: }; consuming_buffers cb; - BEAST_EXPECT(to_string(cb) == "\r\n"); + BOOST_BEAST_EXPECT(to_string(cb) == "\r\n"); } void @@ -136,7 +139,7 @@ public: boost::in_place_init, boost::asio::const_buffers_1("\r", 1), boost::asio::const_buffers_1("\n", 1)); - BEAST_EXPECT(to_string(cb) == "\r\n"); + BOOST_BEAST_EXPECT(to_string(cb) == "\r\n"); } void @@ -147,10 +150,10 @@ public: using boost::asio::null_buffers; consuming_buffers cb( null_buffers{}); - BEAST_EXPECT(buffer_size(cb) == 0); + BOOST_BEAST_EXPECT(buffer_size(cb) == 0); consuming_buffers cb2( null_buffers{}); - BEAST_EXPECT(buffer_copy(cb2, cb) == 0); + BOOST_BEAST_EXPECT(buffer_copy(cb2, cb) == 0); } void @@ -162,7 +165,7 @@ public: std::size_t n = 0; for(auto it = cb.end(); it != cb.begin(); --it) ++n; - BEAST_EXPECT(n == 3); + BOOST_BEAST_EXPECT(n == 3); } void run() override @@ -176,6 +179,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(consuming_buffers,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(consuming_buffers,core,beast); } // beast +} // boost diff --git a/test/core/detail/varint.cpp b/test/core/detail/varint.cpp index f6da8dce..351ea1b3 100644 --- a/test/core/detail/varint.cpp +++ b/test/core/detail/varint.cpp @@ -6,11 +6,13 @@ // // Test that header file is self-contained. -#include +#include -#include +#include +namespace boost { namespace beast { +namespace detail { class varint_test : public beast::unit_test::suite { @@ -18,9 +20,6 @@ public: void testVarint() { - using beast::detail::varint_read; - using beast::detail::varint_size; - using beast::detail::varint_write; std::size_t n0 = 0; std::size_t n1 = 1; for(;;) @@ -31,7 +30,7 @@ public: varint_write(it, n0); it = &buf[0]; auto n = varint_read(it); - BEAST_EXPECT(n == n0); + BOOST_BEAST_EXPECT(n == n0); n = n0 + n1; if(n < n1) break; @@ -47,6 +46,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(varint,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(varint,core,beast); +} // detail } // beast +} // boost diff --git a/test/core/doc_examples.cpp b/test/core/doc_examples.cpp index ff4d2e4b..22f72545 100644 --- a/test/core/doc_examples.cpp +++ b/test/core/doc_examples.cpp @@ -4,15 +4,18 @@ // 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 +// #include "example/common/detect_ssl.hpp" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +namespace boost { namespace beast { namespace http { @@ -29,18 +32,18 @@ public: buf[1] = 0; buf[2] = 0; buf[3] = 0; - BEAST_EXPECT(boost::indeterminate(is_ssl_handshake( + BOOST_BEAST_EXPECT(boost::indeterminate(is_ssl_handshake( boost::asio::buffer(buf, 0)))); - BEAST_EXPECT(boost::indeterminate(is_ssl_handshake( + BOOST_BEAST_EXPECT(boost::indeterminate(is_ssl_handshake( boost::asio::buffer(buf, 1)))); - BEAST_EXPECT(boost::indeterminate(is_ssl_handshake( + BOOST_BEAST_EXPECT(boost::indeterminate(is_ssl_handshake( boost::asio::buffer(buf, 2)))); - BEAST_EXPECT(boost::indeterminate(is_ssl_handshake( + BOOST_BEAST_EXPECT(boost::indeterminate(is_ssl_handshake( boost::asio::buffer(buf, 3)))); - BEAST_EXPECT(is_ssl_handshake( + BOOST_BEAST_EXPECT(is_ssl_handshake( boost::asio::buffer(buf, 4))); buf[0] = 0; - BEAST_EXPECT(! is_ssl_handshake( + BOOST_BEAST_EXPECT(! is_ssl_handshake( boost::asio::buffer(buf, 1))); } @@ -54,8 +57,8 @@ public: error_code ec; flat_buffer b; auto const result = detect_ssl(p.server, b, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(result); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(result); } yield_to( [&](yield_context yield) @@ -66,8 +69,8 @@ public: error_code ec; flat_buffer b; auto const result = async_detect_ssl(p.server, b, yield[ec]); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(result); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(result); }); } @@ -79,7 +82,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(doc_core_samples,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(doc_core_samples,core,beast); } // http } // beast +} // boost diff --git a/test/core/doc_snippets.cpp b/test/core/doc_snippets.cpp index 0fa3e97c..6f044030 100644 --- a/test/core/doc_snippets.cpp +++ b/test/core/doc_snippets.cpp @@ -4,17 +4,19 @@ // 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 +// //[snippet_core_1a -#include +#include #include #include #include //] -using namespace beast; +using namespace boost::beast; namespace doc_core_snippets { @@ -23,7 +25,7 @@ void fxx() //[snippet_core_1b // -using namespace beast; +using namespace boost::beast; boost::asio::io_service ios; boost::asio::io_service::work work{ios}; diff --git a/test/core/drain_buffer.cpp b/test/core/drain_buffer.cpp index 5e7e35e7..44d1cbdb 100644 --- a/test/core/drain_buffer.cpp +++ b/test/core/drain_buffer.cpp @@ -4,13 +4,16 @@ // 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 +#include -#include -#include +#include +#include +namespace boost { namespace beast { static_assert(is_dynamic_buffer::value, @@ -24,8 +27,8 @@ public: { using boost::asio::buffer_size; drain_buffer b; - BEAST_EXPECT(buffer_size(b.prepare(0)) == 0); - BEAST_EXPECT(buffer_size(b.prepare(100)) == 100); + BOOST_BEAST_EXPECT(buffer_size(b.prepare(0)) == 0); + BOOST_BEAST_EXPECT(buffer_size(b.prepare(100)) == 100); try { b.prepare(b.max_size() + 1); @@ -36,16 +39,17 @@ public: pass(); } b.prepare(10); - BEAST_EXPECT(b.size() == 0); + BOOST_BEAST_EXPECT(b.size() == 0); b.commit(10); - BEAST_EXPECT(b.size() == 0); + BOOST_BEAST_EXPECT(b.size() == 0); b.consume(10); - BEAST_EXPECT(b.size() == 0); + BOOST_BEAST_EXPECT(b.size() == 0); b.consume(1000); - BEAST_EXPECT(b.size() == 0); + BOOST_BEAST_EXPECT(b.size() == 0); } }; -BEAST_DEFINE_TESTSUITE(drain_buffer,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(drain_buffer,core,beast); } // beast +} // boost diff --git a/test/core/empty_base_optimization.cpp b/test/core/empty_base_optimization.cpp index e6270085..b80a4512 100644 --- a/test/core/empty_base_optimization.cpp +++ b/test/core/empty_base_optimization.cpp @@ -4,12 +4,15 @@ // 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 +#include -#include +#include +namespace boost { namespace beast { namespace detail { @@ -82,13 +85,14 @@ public: void run() { - BEAST_EXPECT(test_one()); - BEAST_EXPECT(test_two()); + BOOST_BEAST_EXPECT(test_one()); + BOOST_BEAST_EXPECT(test_two()); pass(); } }; -BEAST_DEFINE_TESTSUITE(empty_base_optimization,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(empty_base_optimization,core,beast); } // detail } // beast +} // boost diff --git a/test/core/error.cpp b/test/core/error.cpp index 266f5990..be4455d2 100644 --- a/test/core/error.cpp +++ b/test/core/error.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/core/file.cpp b/test/core/file.cpp index f483142b..e813e5d0 100644 --- a/test/core/file.cpp +++ b/test/core/file.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/core/file_posix.cpp b/test/core/file_posix.cpp index 347be757..3e41d575 100644 --- a/test/core/file_posix.cpp +++ b/test/core/file_posix.cpp @@ -4,17 +4,20 @@ // 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 +#include -#if BEAST_USE_POSIX_FILE +#if BOOST_BEAST_USE_POSIX_FILE #include "file_test.hpp" -#include -#include +#include +#include +namespace boost { namespace beast { BOOST_STATIC_ASSERT(! std::is_copy_constructible::value); @@ -30,8 +33,9 @@ public: } }; -BEAST_DEFINE_TESTSUITE(file_posix,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(file_posix,core,beast); } // beast +} // boost #endif diff --git a/test/core/file_stdio.cpp b/test/core/file_stdio.cpp index 95e35212..115925dd 100644 --- a/test/core/file_stdio.cpp +++ b/test/core/file_stdio.cpp @@ -4,15 +4,18 @@ // 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 +#include #include "file_test.hpp" -#include -#include +#include +#include +namespace boost { namespace beast { BOOST_STATIC_ASSERT(! std::is_copy_constructible::value); @@ -28,6 +31,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(file_stdio,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(file_stdio,core,beast); } // beast +} // boost diff --git a/test/core/file_test.hpp b/test/core/file_test.hpp index 2249a4c0..872551a5 100644 --- a/test/core/file_test.hpp +++ b/test/core/file_test.hpp @@ -4,16 +4,19 @@ // 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 BEAST_TEST_CORE_FILE_TEST_HPP -#define BEAST_TEST_CORE_FILE_TEST_HPP +#ifndef BOOST_BEAST_TEST_CORE_FILE_TEST_HPP +#define BOOST_BEAST_TEST_CORE_FILE_TEST_HPP -#include -#include +#include +#include #include #include #include +namespace boost { namespace beast { template @@ -28,95 +31,96 @@ doTestFile(beast::unit_test::suite& test) { { File f1; - test.BEAST_EXPECT(! f1.is_open()); + test.BOOST_BEAST_EXPECT(! f1.is_open()); f1.open(temp.string().c_str(), file_mode::write, ec); - test.BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(! ec); File f2{std::move(f1)}; - test.BEAST_EXPECT(! f1.is_open()); - test.BEAST_EXPECT(f2.is_open()); + test.BOOST_BEAST_EXPECT(! f1.is_open()); + test.BOOST_BEAST_EXPECT(f2.is_open()); File f3; f3 = std::move(f2); - test.BEAST_EXPECT(! f2.is_open()); - test.BEAST_EXPECT(f3.is_open()); + test.BOOST_BEAST_EXPECT(! f2.is_open()); + test.BOOST_BEAST_EXPECT(f3.is_open()); f1.close(ec); - test.BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(! ec); auto const temp2 = boost::filesystem::unique_path(); f3.open(temp2.string().c_str(), file_mode::read, ec); - test.BEAST_EXPECT(ec); + test.BOOST_BEAST_EXPECT(ec); ec.assign(0, ec.category()); } boost::filesystem::remove(temp, ec); - test.BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(! ec); } File f; - test.BEAST_EXPECT(! f.is_open()); + test.BOOST_BEAST_EXPECT(! f.is_open()); f.size(ec); - test.BEAST_EXPECT(ec == errc::invalid_argument); + test.BOOST_BEAST_EXPECT(ec == errc::invalid_argument); ec.assign(0, ec.category()); f.pos(ec); - test.BEAST_EXPECT(ec == errc::invalid_argument); + test.BOOST_BEAST_EXPECT(ec == errc::invalid_argument); ec.assign(0, ec.category()); f.seek(0, ec); - test.BEAST_EXPECT(ec == errc::invalid_argument); + test.BOOST_BEAST_EXPECT(ec == errc::invalid_argument); ec.assign(0, ec.category()); f.read(nullptr, 0, ec); - test.BEAST_EXPECT(ec == errc::invalid_argument); + test.BOOST_BEAST_EXPECT(ec == errc::invalid_argument); ec.assign(0, ec.category()); f.write(nullptr, 0, ec); - test.BEAST_EXPECT(ec == errc::invalid_argument); + test.BOOST_BEAST_EXPECT(ec == errc::invalid_argument); ec.assign(0, ec.category()); f.open(temp.string().c_str(), file_mode::write, ec); - test.BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(! ec); std::string const s = "Hello, world!"; f.write(s.data(), s.size(), ec); - test.BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(! ec); auto size = f.size(ec); - test.BEAST_EXPECT(! ec); - test.BEAST_EXPECT(size == s.size()); + test.BOOST_BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(size == s.size()); auto pos = f.pos(ec); - test.BEAST_EXPECT(! ec); - test.BEAST_EXPECT(pos == size); + test.BOOST_BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(pos == size); f.close(ec); - test.BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(! ec); f.open(temp.string().c_str(), file_mode::read, ec); - test.BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(! ec); std::string buf; buf.resize(s.size()); f.read(&buf[0], buf.size(), ec); - test.BEAST_EXPECT(! ec); - test.BEAST_EXPECT(buf == s); + test.BOOST_BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(buf == s); f.seek(1, ec); - test.BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(! ec); buf.resize(3); f.read(&buf[0], buf.size(), ec); - test.BEAST_EXPECT(! ec); - test.BEAST_EXPECT(buf == "ell"); + test.BOOST_BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(buf == "ell"); pos = f.pos(ec); - test.BEAST_EXPECT(! ec); - test.BEAST_EXPECT(pos == 4); + test.BOOST_BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(pos == 4); f.close(ec); - test.BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(! ec); boost::filesystem::remove(temp, ec); - test.BEAST_EXPECT(! ec); + test.BOOST_BEAST_EXPECT(! ec); } } // beast +} // boost #endif diff --git a/test/core/file_win32.cpp b/test/core/file_win32.cpp index e2c3263d..623e7ece 100644 --- a/test/core/file_win32.cpp +++ b/test/core/file_win32.cpp @@ -4,17 +4,20 @@ // 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 +#include -#if BEAST_USE_WIN32_FILE +#if BOOST_BEAST_USE_WIN32_FILE #include "file_test.hpp" -#include -#include +#include +#include +namespace boost { namespace beast { BOOST_STATIC_ASSERT(! std::is_copy_constructible::value); @@ -30,8 +33,9 @@ public: } }; -BEAST_DEFINE_TESTSUITE(file_win32,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(file_win32,core,beast); } // beast +} // boost #endif diff --git a/test/core/flat_buffer.cpp b/test/core/flat_buffer.cpp index fda65623..572e0b4a 100644 --- a/test/core/flat_buffer.cpp +++ b/test/core/flat_buffer.cpp @@ -4,20 +4,23 @@ // 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 +#include #include "buffer_test.hpp" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include +namespace boost { namespace beast { static_assert(is_dynamic_buffer::value, @@ -42,25 +45,25 @@ public: { { flat_buffer b; - BEAST_EXPECT(b.capacity() == 0); + BOOST_BEAST_EXPECT(b.capacity() == 0); } { flat_buffer b{500}; - BEAST_EXPECT(b.capacity() == 0); - BEAST_EXPECT(b.max_size() == 500); + BOOST_BEAST_EXPECT(b.capacity() == 0); + BOOST_BEAST_EXPECT(b.max_size() == 500); } { a_neq_t a1; basic_flat_buffer b{a1}; - BEAST_EXPECT(b.get_allocator() == a1); + BOOST_BEAST_EXPECT(b.get_allocator() == a1); a_neq_t a2; - BEAST_EXPECT(b.get_allocator() != a2); + BOOST_BEAST_EXPECT(b.get_allocator() != a2); } { a_neq_t a; basic_flat_buffer b{500, a}; - BEAST_EXPECT(b.capacity() == 0); - BEAST_EXPECT(b.max_size() == 500); + BOOST_BEAST_EXPECT(b.capacity() == 0); + BOOST_BEAST_EXPECT(b.max_size() == 500); } } @@ -68,34 +71,34 @@ public: { { basic_flat_buffer b1{30}; - BEAST_EXPECT(b1.get_allocator()->nmove == 0); + BOOST_BEAST_EXPECT(b1.get_allocator()->nmove == 0); ostream(b1) << "Hello"; basic_flat_buffer b2{std::move(b1)}; - BEAST_EXPECT(b2.get_allocator()->nmove == 1); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); - BEAST_EXPECT(b1.max_size() == b2.max_size()); + BOOST_BEAST_EXPECT(b2.get_allocator()->nmove == 1); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.max_size() == b2.max_size()); } { basic_flat_buffer b1{30}; ostream(b1) << "Hello"; a_t a; basic_flat_buffer b2{std::move(b1), a}; - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); - BEAST_EXPECT(b1.max_size() == b2.max_size()); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.max_size() == b2.max_size()); } { basic_flat_buffer b1{30}; ostream(b1) << "Hello"; a_neq_t a; basic_flat_buffer b2{std::move(b1), a}; - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); - BEAST_EXPECT(b1.max_size() == b2.max_size()); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.max_size() == b2.max_size()); } } @@ -104,34 +107,34 @@ public: basic_flat_buffer b1; ostream(b1) << "Hello"; basic_flat_buffer b2(b1); - BEAST_EXPECT(b1.get_allocator() == b2.get_allocator()); - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.get_allocator() == b2.get_allocator()); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { basic_flat_buffer b1; ostream(b1) << "Hello"; a_neq_t a; basic_flat_buffer b2(b1, a); - BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { basic_flat_buffer b1; ostream(b1) << "Hello"; basic_flat_buffer b2(b1); - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { basic_flat_buffer b1; ostream(b1) << "Hello"; a_t a; basic_flat_buffer b2(b1, a); - BEAST_EXPECT(b2.get_allocator() == a); - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b2.get_allocator() == a); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } // move assignment @@ -141,9 +144,9 @@ public: ostream(b1) << "Hello"; flat_buffer b2; b2 = std::move(b1); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { using na_t = test::test_allocator b2; b2 = std::move(b1); - BEAST_EXPECT(b1.get_allocator() == b2.get_allocator()); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.get_allocator() == b2.get_allocator()); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { using na_t = test::test_allocator b2; b2 = std::move(b1); - BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { // propagate_on_container_move_assignment : true @@ -177,8 +180,8 @@ public: ostream(b1) << "Hello"; basic_flat_buffer b2; b2 = std::move(b1); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { // propagate_on_container_move_assignment : false @@ -188,8 +191,8 @@ public: ostream(b1) << "Hello"; basic_flat_buffer b2; b2 = std::move(b1); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } } @@ -200,11 +203,11 @@ public: ostream(b1) << "Hello"; flat_buffer b2; b2 = b1; - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); basic_flat_buffer b3; b3 = b2; - BEAST_EXPECT(to_string(b3.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b3.data()) == "Hello"); } { // propagate_on_container_copy_assignment : true @@ -214,7 +217,7 @@ public: ostream(b1) << "Hello"; basic_flat_buffer b2; b2 = b1; - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { // propagate_on_container_copy_assignment : false @@ -224,7 +227,7 @@ public: ostream(b1) << "Hello"; basic_flat_buffer b2; b2 = b1; - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } } @@ -232,23 +235,23 @@ public: { string_view const s = "Hello, world!"; flat_buffer b1{64}; - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.max_size() == 64); - BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.max_size() == 64); + BOOST_BEAST_EXPECT(b1.capacity() == 0); ostream(b1) << s; - BEAST_EXPECT(to_string(b1.data()) == s); + BOOST_BEAST_EXPECT(to_string(b1.data()) == s); { flat_buffer b2{b1}; - BEAST_EXPECT(to_string(b2.data()) == s); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s); b2.consume(7); - BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); } { flat_buffer b2{64}; b2 = b1; - BEAST_EXPECT(to_string(b2.data()) == s); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s); b2.consume(7); - BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); } } @@ -258,21 +261,21 @@ public: ostream(b) << "12345"; b.consume(3); ostream(b) << "67890123"; - BEAST_EXPECT(to_string(b.data()) == "4567890123"); + BOOST_BEAST_EXPECT(to_string(b.data()) == "4567890123"); } // read_size { flat_buffer b{10}; - BEAST_EXPECT(read_size(b, 512) == 10); + BOOST_BEAST_EXPECT(read_size(b, 512) == 10); b.prepare(4); b.commit(4); - BEAST_EXPECT(read_size(b, 512) == 6); + BOOST_BEAST_EXPECT(read_size(b, 512) == 6); b.consume(2); - BEAST_EXPECT(read_size(b, 512) == 8); + BOOST_BEAST_EXPECT(read_size(b, 512) == 8); b.prepare(8); b.commit(8); - BEAST_EXPECT(read_size(b, 512) == 0); + BOOST_BEAST_EXPECT(read_size(b, 512) == 0); } // swap @@ -281,12 +284,12 @@ public: basic_flat_buffer b1; ostream(b1) << "Hello"; basic_flat_buffer b2; - BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); + BOOST_BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); swap(b1, b2); - BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { using na_t = test::test_allocator b2{a2}; - BEAST_EXPECT(b1.get_allocator() == a1); - BEAST_EXPECT(b2.get_allocator() == a2); + BOOST_BEAST_EXPECT(b1.get_allocator() == a1); + BOOST_BEAST_EXPECT(b2.get_allocator() == a2); swap(b1, b2); - BEAST_EXPECT(b1.get_allocator() == b2.get_allocator()); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.get_allocator() == b2.get_allocator()); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } } @@ -312,7 +315,7 @@ public: b.prepare(10); b.commit(10); b.prepare(5); - BEAST_EXPECT(b.capacity() >= 5); + BOOST_BEAST_EXPECT(b.capacity() >= 5); try { b.prepare(1000); @@ -327,15 +330,15 @@ public: // shrink to fit { flat_buffer b; - BEAST_EXPECT(b.capacity() == 0); + BOOST_BEAST_EXPECT(b.capacity() == 0); b.prepare(50); - BEAST_EXPECT(b.capacity() == 50); + BOOST_BEAST_EXPECT(b.capacity() == 50); b.commit(50); - BEAST_EXPECT(b.capacity() == 50); + BOOST_BEAST_EXPECT(b.capacity() == 50); b.prepare(75); - BEAST_EXPECT(b.capacity() >= 125); + BOOST_BEAST_EXPECT(b.capacity() >= 125); b.shrink_to_fit(); - BEAST_EXPECT(b.capacity() == b.size()); + BOOST_BEAST_EXPECT(b.capacity() == b.size()); } } @@ -347,6 +350,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(flat_buffer,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(flat_buffer,core,beast); } // beast +} // boost diff --git a/test/core/flat_static_buffer.cpp b/test/core/flat_static_buffer.cpp index 286b3cff..4912bc61 100644 --- a/test/core/flat_static_buffer.cpp +++ b/test/core/flat_static_buffer.cpp @@ -4,17 +4,20 @@ // 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 +#include #include "buffer_test.hpp" -#include -#include -#include +#include +#include +#include #include +namespace boost { namespace beast { static_assert( @@ -33,7 +36,7 @@ public: using boost::asio::buffer_size; char buf[12]; std::string const s = "Hello, world"; - BEAST_EXPECT(s.size() == sizeof(buf)); + BOOST_BEAST_EXPECT(s.size() == sizeof(buf)); for(std::size_t i = 1; i < 4; ++i) { for(std::size_t j = 1; j < 4; ++j) { for(std::size_t x = 1; x < 4; ++x) { @@ -47,79 +50,79 @@ public: flat_static_buffer ba; { auto d = ba.prepare(z); - BEAST_EXPECT(buffer_size(d) == z); + BOOST_BEAST_EXPECT(buffer_size(d) == z); } { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { auto d = ba.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); } { auto d = ba.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); ba.commit(buffer_copy(d, buffer(s.data(), x))); } - BEAST_EXPECT(ba.size() == x); - BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); + BOOST_BEAST_EXPECT(ba.size() == x); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); { auto d = ba.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); } { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { auto d = ba.prepare(z); - BEAST_EXPECT(buffer_size(d) == z); + BOOST_BEAST_EXPECT(buffer_size(d) == z); } { auto d = ba.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); ba.commit(buffer_copy(d, buffer(s.data()+x, y))); } ba.commit(1); - BEAST_EXPECT(ba.size() == x + y); - BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); + BOOST_BEAST_EXPECT(ba.size() == x + y); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); { auto d = ba.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); } { auto d = ba.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); } { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { auto d = ba.prepare(z); - BEAST_EXPECT(buffer_size(d) == z); + BOOST_BEAST_EXPECT(buffer_size(d) == z); ba.commit(buffer_copy(d, buffer(s.data()+x+y, z))); } ba.commit(2); - BEAST_EXPECT(buffer_size(ba.data()) == buffer_size(ba.mutable_data())); - BEAST_EXPECT(ba.size() == x + y + z); - BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); - BEAST_EXPECT(to_string(ba.data()) == s); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == buffer_size(ba.mutable_data())); + BOOST_BEAST_EXPECT(ba.size() == x + y + z); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); + BOOST_BEAST_EXPECT(to_string(ba.data()) == s); ba.consume(t); { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } - BEAST_EXPECT(to_string(ba.data()) == s.substr(t, std::string::npos)); + BOOST_BEAST_EXPECT(to_string(ba.data()) == s.substr(t, std::string::npos)); ba.consume(u); - BEAST_EXPECT(to_string(ba.data()) == s.substr(t + u, std::string::npos)); + BOOST_BEAST_EXPECT(to_string(ba.data()) == s.substr(t + u, std::string::npos)); ba.consume(v); - BEAST_EXPECT(to_string(ba.data()) == ""); + BOOST_BEAST_EXPECT(to_string(ba.data()) == ""); ba.consume(1); { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } try { @@ -145,31 +148,31 @@ public: char buf[64]; flat_static_buffer_base b{buf, sizeof(buf)}; ostream(b) << s; - BEAST_EXPECT(to_string(b.data()) == s); + BOOST_BEAST_EXPECT(to_string(b.data()) == s); b.consume(b.size()); - BEAST_EXPECT(to_string(b.data()) == ""); + BOOST_BEAST_EXPECT(to_string(b.data()) == ""); } // flat_static_buffer { flat_static_buffer<64> b1; - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.max_size() == 64); - BEAST_EXPECT(b1.capacity() == 64); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.max_size() == 64); + BOOST_BEAST_EXPECT(b1.capacity() == 64); ostream(b1) << s; - BEAST_EXPECT(to_string(b1.data()) == s); + BOOST_BEAST_EXPECT(to_string(b1.data()) == s); { flat_static_buffer<64> b2{b1}; - BEAST_EXPECT(to_string(b2.data()) == s); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s); b2.consume(7); - BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); } { flat_static_buffer<64> b2; b2 = b1; - BEAST_EXPECT(to_string(b2.data()) == s); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s); b2.consume(7); - BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); } } @@ -179,7 +182,7 @@ public: write_buffer(b, "12345"); b.consume(3); write_buffer(b, "67890123"); - BEAST_EXPECT(to_string(b.data()) == "4567890123"); + BOOST_BEAST_EXPECT(to_string(b.data()) == "4567890123"); try { b.prepare(1); @@ -194,15 +197,15 @@ public: // read_size { flat_static_buffer<10> b; - BEAST_EXPECT(read_size(b, 512) == 10); + BOOST_BEAST_EXPECT(read_size(b, 512) == 10); b.prepare(4); b.commit(4); - BEAST_EXPECT(read_size(b, 512) == 6); + BOOST_BEAST_EXPECT(read_size(b, 512) == 6); b.consume(2); - BEAST_EXPECT(read_size(b, 512) == 8); + BOOST_BEAST_EXPECT(read_size(b, 512) == 8); b.prepare(8); b.commit(8); - BEAST_EXPECT(read_size(b, 512) == 0); + BOOST_BEAST_EXPECT(read_size(b, 512) == 0); } // base @@ -210,13 +213,13 @@ public: flat_static_buffer<10> b; [&](flat_static_buffer_base& base) { - BEAST_EXPECT(base.max_size() == b.capacity()); + BOOST_BEAST_EXPECT(base.max_size() == b.capacity()); } (b.base()); [&](flat_static_buffer_base const& base) { - BEAST_EXPECT(base.max_size() == b.capacity()); + BOOST_BEAST_EXPECT(base.max_size() == b.capacity()); } (b.base()); } @@ -229,6 +232,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(flat_static_buffer,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(flat_static_buffer,core,beast); } // beast +} // boost diff --git a/test/core/handler_alloc.cpp b/test/core/handler_alloc.cpp index 64acc074..e8727849 100644 --- a/test/core/handler_alloc.cpp +++ b/test/core/handler_alloc.cpp @@ -4,14 +4,17 @@ // 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 +#include -#include +#include #include #include +namespace boost { namespace beast { class handler_alloc_test : public beast::unit_test::suite @@ -46,9 +49,9 @@ public: handler h2; handler_alloc a1{h}; handler_alloc a2{h2}; - BEAST_EXPECT(a2 == a1); + BOOST_BEAST_EXPECT(a2 == a1); auto a3 = a1; - BEAST_EXPECT(a3 == a1); + BOOST_BEAST_EXPECT(a3 == a1); { std::vector> v(a1); @@ -58,7 +61,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(handler_alloc,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(handler_alloc,core,beast); } // beast - +} // boost diff --git a/test/core/handler_ptr.cpp b/test/core/handler_ptr.cpp index f40bc158..b0f5c7f9 100644 --- a/test/core/handler_ptr.cpp +++ b/test/core/handler_ptr.cpp @@ -4,14 +4,17 @@ // 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 +#include -#include +#include #include #include +namespace boost { namespace beast { class handler_ptr_test : public beast::unit_test::suite @@ -70,11 +73,11 @@ public: handler_ptr p4{std::move(h)}; bool b = false; p4.invoke(std::ref(b)); - BEAST_EXPECT(b); + BOOST_BEAST_EXPECT(b); } }; -BEAST_DEFINE_TESTSUITE(handler_ptr,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(handler_ptr,core,beast); } // beast - +} // boost diff --git a/test/core/multi_buffer.cpp b/test/core/multi_buffer.cpp index f2e3dbf3..75245d15 100644 --- a/test/core/multi_buffer.cpp +++ b/test/core/multi_buffer.cpp @@ -4,23 +4,26 @@ // 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 +#include #include "buffer_test.hpp" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include #include #include +namespace boost { namespace beast { BOOST_STATIC_ASSERT(is_dynamic_buffer::value); @@ -42,10 +45,10 @@ public: void expect_size(std::size_t n, ConstBufferSequence const& buffers) { - BEAST_EXPECT(test::size_pre(buffers) == n); - BEAST_EXPECT(test::size_post(buffers) == n); - BEAST_EXPECT(test::size_rev_pre(buffers) == n); - BEAST_EXPECT(test::size_rev_post(buffers) == n); + BOOST_BEAST_EXPECT(test::size_pre(buffers) == n); + BOOST_BEAST_EXPECT(test::size_post(buffers) == n); + BOOST_BEAST_EXPECT(test::size_rev_pre(buffers) == n); + BOOST_BEAST_EXPECT(test::size_rev_post(buffers) == n); } template @@ -62,7 +65,7 @@ public: using namespace test; using boost::asio::buffer; std::string const s = "Hello, world"; - BEAST_EXPECT(s.size() == 12); + BOOST_BEAST_EXPECT(s.size() == 12); for(std::size_t i = 1; i < 12; ++i) { for(std::size_t x = 1; x < 4; ++x) { for(std::size_t y = 1; y < 4; ++y) { @@ -72,28 +75,28 @@ public: b.commit(buffer_copy(b.prepare(x), buffer(s.data(), x))); b.commit(buffer_copy(b.prepare(y), buffer(s.data()+x, y))); b.commit(buffer_copy(b.prepare(z), buffer(s.data()+x+y, z))); - BEAST_EXPECT(to_string(b.data()) == s); + BOOST_BEAST_EXPECT(to_string(b.data()) == s); { multi_buffer mb2{b}; - BEAST_EXPECT(eq(b, mb2)); + BOOST_BEAST_EXPECT(eq(b, mb2)); } { multi_buffer mb2; mb2 = b; - BEAST_EXPECT(eq(b, mb2)); + BOOST_BEAST_EXPECT(eq(b, mb2)); } { multi_buffer mb2{std::move(b)}; - BEAST_EXPECT(to_string(mb2.data()) == s); + BOOST_BEAST_EXPECT(to_string(mb2.data()) == s); expect_size(0, b.data()); b = std::move(mb2); - BEAST_EXPECT(to_string(b.data()) == s); + BOOST_BEAST_EXPECT(to_string(b.data()) == s); expect_size(0, mb2.data()); } self_assign(b, b); - BEAST_EXPECT(to_string(b.data()) == s); + BOOST_BEAST_EXPECT(to_string(b.data()) == s); self_assign(b, std::move(b)); - BEAST_EXPECT(to_string(b.data()) == s); + BOOST_BEAST_EXPECT(to_string(b.data()) == s); } }}} } @@ -105,7 +108,7 @@ public: using boost::asio::buffer; using boost::asio::buffer_size; std::string const s = "Hello, world"; - BEAST_EXPECT(s.size() == 12); + BOOST_BEAST_EXPECT(s.size() == 12); for(std::size_t i = 1; i < 12; ++i) { for(std::size_t x = 1; x < 4; ++x) { for(std::size_t y = 1; y < 4; ++y) { @@ -117,78 +120,78 @@ public: multi_buffer b; { auto d = b.prepare(z); - BEAST_EXPECT(buffer_size(d) == z); + BOOST_BEAST_EXPECT(buffer_size(d) == z); } { auto d = b.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { auto d = b.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); } { auto d = b.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); b.commit(buffer_copy(d, buffer(s.data(), x))); } - BEAST_EXPECT(b.size() == x); - BEAST_EXPECT(buffer_size(b.data()) == b.size()); + BOOST_BEAST_EXPECT(b.size() == x); + BOOST_BEAST_EXPECT(buffer_size(b.data()) == b.size()); { auto d = b.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); } { auto d = b.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { auto d = b.prepare(z); - BEAST_EXPECT(buffer_size(d) == z); + BOOST_BEAST_EXPECT(buffer_size(d) == z); } { auto d = b.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); b.commit(buffer_copy(d, buffer(s.data()+x, y))); } b.commit(1); - BEAST_EXPECT(b.size() == x + y); - BEAST_EXPECT(buffer_size(b.data()) == b.size()); + BOOST_BEAST_EXPECT(b.size() == x + y); + BOOST_BEAST_EXPECT(buffer_size(b.data()) == b.size()); { auto d = b.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); } { auto d = b.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); } { auto d = b.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { auto d = b.prepare(z); - BEAST_EXPECT(buffer_size(d) == z); + BOOST_BEAST_EXPECT(buffer_size(d) == z); b.commit(buffer_copy(d, buffer(s.data()+x+y, z))); } b.commit(2); - BEAST_EXPECT(b.size() == x + y + z); - BEAST_EXPECT(buffer_size(b.data()) == b.size()); - BEAST_EXPECT(to_string(b.data()) == s); + BOOST_BEAST_EXPECT(b.size() == x + y + z); + BOOST_BEAST_EXPECT(buffer_size(b.data()) == b.size()); + BOOST_BEAST_EXPECT(to_string(b.data()) == s); b.consume(t); { auto d = b.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } - BEAST_EXPECT(to_string(b.data()) == s.substr(t, std::string::npos)); + BOOST_BEAST_EXPECT(to_string(b.data()) == s.substr(t, std::string::npos)); b.consume(u); - BEAST_EXPECT(to_string(b.data()) == s.substr(t + u, std::string::npos)); + BOOST_BEAST_EXPECT(to_string(b.data()) == s.substr(t + u, std::string::npos)); b.consume(v); - BEAST_EXPECT(to_string(b.data()) == ""); + BOOST_BEAST_EXPECT(to_string(b.data()) == ""); b.consume(1); { auto d = b.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } } }}}}} @@ -226,18 +229,18 @@ public: { { multi_buffer b; - BEAST_EXPECT(b.capacity() == 0); + BOOST_BEAST_EXPECT(b.capacity() == 0); } { multi_buffer b{500}; - BEAST_EXPECT(b.capacity() == 0); - BEAST_EXPECT(b.max_size() == 500); + BOOST_BEAST_EXPECT(b.capacity() == 0); + BOOST_BEAST_EXPECT(b.max_size() == 500); } { unequal_t a1; basic_multi_buffer b{a1}; - BEAST_EXPECT(b.get_allocator() == a1); - BEAST_EXPECT(b.get_allocator() != unequal_t{}); + BOOST_BEAST_EXPECT(b.get_allocator() == a1); + BOOST_BEAST_EXPECT(b.get_allocator() != unequal_t{}); } } @@ -245,14 +248,14 @@ public: { { basic_multi_buffer b1{30}; - BEAST_EXPECT(b1.get_allocator()->nmove == 0); + BOOST_BEAST_EXPECT(b1.get_allocator()->nmove == 0); ostream(b1) << "Hello"; basic_multi_buffer b2{std::move(b1)}; - BEAST_EXPECT(b2.get_allocator()->nmove == 1); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); - BEAST_EXPECT(b1.max_size() == b2.max_size()); + BOOST_BEAST_EXPECT(b2.get_allocator()->nmove == 1); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.max_size() == b2.max_size()); } // allocators equal { @@ -260,10 +263,10 @@ public: ostream(b1) << "Hello"; equal_t a; basic_multi_buffer b2{std::move(b1), a}; - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); - BEAST_EXPECT(b1.max_size() == b2.max_size()); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.max_size() == b2.max_size()); } { // allocators unequal @@ -271,10 +274,10 @@ public: ostream(b1) << "Hello"; unequal_t a; basic_multi_buffer b2{std::move(b1), a}; - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); - BEAST_EXPECT(b1.max_size() == b2.max_size()); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.max_size() == b2.max_size()); } } @@ -284,34 +287,34 @@ public: basic_multi_buffer b1; ostream(b1) << "Hello"; basic_multi_buffer b2{b1}; - BEAST_EXPECT(b1.get_allocator() == b2.get_allocator()); - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.get_allocator() == b2.get_allocator()); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { basic_multi_buffer b1; ostream(b1) << "Hello"; unequal_t a; basic_multi_buffer b2(b1, a); - BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.get_allocator() != b2.get_allocator()); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { basic_multi_buffer b1; ostream(b1) << "Hello"; basic_multi_buffer b2(b1); - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { basic_multi_buffer b1; ostream(b1) << "Hello"; equal_t a; basic_multi_buffer b2(b1, a); - BEAST_EXPECT(b2.get_allocator() == a); - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b2.get_allocator() == a); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } } @@ -322,9 +325,9 @@ public: ostream(b1) << "Hello"; multi_buffer b2; b2 = std::move(b1); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.capacity() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { // propagate_on_container_move_assignment : true @@ -334,8 +337,8 @@ public: ostream(b1) << "Hello"; basic_multi_buffer b2; b2 = std::move(b1); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { // propagate_on_container_move_assignment : false @@ -345,8 +348,8 @@ public: ostream(b1) << "Hello"; basic_multi_buffer b2; b2 = std::move(b1); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } } @@ -357,11 +360,11 @@ public: ostream(b1) << "Hello"; multi_buffer b2; b2 = b1; - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); basic_multi_buffer b3; b3 = b2; - BEAST_EXPECT(to_string(b3.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b3.data()) == "Hello"); } { // propagate_on_container_copy_assignment : true @@ -371,7 +374,7 @@ public: ostream(b1) << "Hello"; basic_multi_buffer b2; b2 = b1; - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } { // propagate_on_container_copy_assignment : false @@ -381,7 +384,7 @@ public: ostream(b1) << "Hello"; basic_multi_buffer b2; b2 = b1; - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); } } @@ -402,60 +405,60 @@ public: { string_view const s = "Hello, world!"; multi_buffer b1{64}; - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.max_size() == 64); - BEAST_EXPECT(b1.capacity() == 0); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.max_size() == 64); + BOOST_BEAST_EXPECT(b1.capacity() == 0); ostream(b1) << s; - BEAST_EXPECT(to_string(b1.data()) == s); + BOOST_BEAST_EXPECT(to_string(b1.data()) == s); { multi_buffer b2{b1}; - BEAST_EXPECT(to_string(b2.data()) == s); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s); b2.consume(7); - BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); } { multi_buffer b2{64}; b2 = b1; - BEAST_EXPECT(to_string(b2.data()) == s); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s); b2.consume(7); - BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); } } { multi_buffer b; b.prepare(1000); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.commit(1); - BEAST_EXPECT(b.size() == 1); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.size() == 1); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.prepare(1000); - BEAST_EXPECT(b.size() == 1); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.size() == 1); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.prepare(1500); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); } { multi_buffer b; b.prepare(1000); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.commit(1); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.prepare(1000); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.prepare(2000); - BEAST_EXPECT(b.capacity() >= 2000); + BOOST_BEAST_EXPECT(b.capacity() >= 2000); b.commit(2); } { multi_buffer b; b.prepare(1000); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.prepare(2000); - BEAST_EXPECT(b.capacity() >= 2000); + BOOST_BEAST_EXPECT(b.capacity() >= 2000); b.prepare(4000); - BEAST_EXPECT(b.capacity() >= 4000); + BOOST_BEAST_EXPECT(b.capacity() >= 4000); b.prepare(50); - BEAST_EXPECT(b.capacity() >= 50); + BOOST_BEAST_EXPECT(b.capacity() >= 50); } } @@ -463,24 +466,24 @@ public: { multi_buffer b; b.prepare(1000); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.commit(1000); - BEAST_EXPECT(b.size() == 1000); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.size() == 1000); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.consume(1000); - BEAST_EXPECT(b.size() == 0); - BEAST_EXPECT(b.capacity() == 0); + BOOST_BEAST_EXPECT(b.size() == 0); + BOOST_BEAST_EXPECT(b.capacity() == 0); b.prepare(1000); b.commit(650); - BEAST_EXPECT(b.size() == 650); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.size() == 650); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.prepare(1000); - BEAST_EXPECT(b.capacity() >= 1650); + BOOST_BEAST_EXPECT(b.capacity() >= 1650); b.commit(100); - BEAST_EXPECT(b.size() == 750); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.size() == 750); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.prepare(1000); - BEAST_EXPECT(b.capacity() >= 2000); + BOOST_BEAST_EXPECT(b.capacity() >= 2000); b.commit(500); } @@ -488,29 +491,29 @@ public: { multi_buffer b; b.prepare(1000); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.commit(1000); - BEAST_EXPECT(b.size() == 1000); - BEAST_EXPECT(b.capacity() >= 1000); + BOOST_BEAST_EXPECT(b.size() == 1000); + BOOST_BEAST_EXPECT(b.capacity() >= 1000); b.prepare(1000); - BEAST_EXPECT(b.capacity() >= 2000); + BOOST_BEAST_EXPECT(b.capacity() >= 2000); b.commit(750); - BEAST_EXPECT(b.size() == 1750); + BOOST_BEAST_EXPECT(b.size() == 1750); b.consume(500); - BEAST_EXPECT(b.size() == 1250); + BOOST_BEAST_EXPECT(b.size() == 1250); b.consume(500); - BEAST_EXPECT(b.size() == 750); + BOOST_BEAST_EXPECT(b.size() == 750); b.prepare(250); b.consume(750); - BEAST_EXPECT(b.size() == 0); + BOOST_BEAST_EXPECT(b.size() == 0); b.prepare(1000); b.commit(800); - BEAST_EXPECT(b.size() == 800); + BOOST_BEAST_EXPECT(b.size() == 800); b.prepare(1000); b.commit(600); - BEAST_EXPECT(b.size() == 1400); + BOOST_BEAST_EXPECT(b.size() == 1400); b.consume(1400); - BEAST_EXPECT(b.size() == 0); + BOOST_BEAST_EXPECT(b.size() == 0); } // swap @@ -520,60 +523,60 @@ public: using pocs_t = test::test_allocator; pocs_t a1, a2; - BEAST_EXPECT(a1 != a2); + BOOST_BEAST_EXPECT(a1 != a2); basic_multi_buffer b1{a1}; ostream(b1) << "Hello"; basic_multi_buffer b2{a2}; - BEAST_EXPECT(b1.get_allocator() == a1); - BEAST_EXPECT(b2.get_allocator() == a2); + BOOST_BEAST_EXPECT(b1.get_allocator() == a1); + BOOST_BEAST_EXPECT(b2.get_allocator() == a2); swap(b1, b2); - BEAST_EXPECT(b1.get_allocator() == a2); - BEAST_EXPECT(b2.get_allocator() == a1); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.get_allocator() == a2); + BOOST_BEAST_EXPECT(b2.get_allocator() == a1); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); swap(b1, b2); - BEAST_EXPECT(b1.get_allocator() == a1); - BEAST_EXPECT(b2.get_allocator() == a2); - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(b2.size() == 0); + BOOST_BEAST_EXPECT(b1.get_allocator() == a1); + BOOST_BEAST_EXPECT(b2.get_allocator() == a2); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(b2.size() == 0); } { // propagate_on_container_swap : false using pocs_t = test::test_allocator; pocs_t a1, a2; - BEAST_EXPECT(a1 == a2); - BEAST_EXPECT(a1.id() != a2.id()); + BOOST_BEAST_EXPECT(a1 == a2); + BOOST_BEAST_EXPECT(a1.id() != a2.id()); basic_multi_buffer b1{a1}; ostream(b1) << "Hello"; basic_multi_buffer b2{a2}; - BEAST_EXPECT(b1.get_allocator() == a1); - BEAST_EXPECT(b2.get_allocator() == a2); + BOOST_BEAST_EXPECT(b1.get_allocator() == a1); + BOOST_BEAST_EXPECT(b2.get_allocator() == a2); swap(b1, b2); - BEAST_EXPECT(b1.get_allocator().id() == a1.id()); - BEAST_EXPECT(b2.get_allocator().id() == a2.id()); - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(to_string(b2.data()) == "Hello"); + BOOST_BEAST_EXPECT(b1.get_allocator().id() == a1.id()); + BOOST_BEAST_EXPECT(b2.get_allocator().id() == a2.id()); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(to_string(b2.data()) == "Hello"); swap(b1, b2); - BEAST_EXPECT(b1.get_allocator().id() == a1.id()); - BEAST_EXPECT(b2.get_allocator().id() == a2.id()); - BEAST_EXPECT(to_string(b1.data()) == "Hello"); - BEAST_EXPECT(b2.size() == 0); + BOOST_BEAST_EXPECT(b1.get_allocator().id() == a1.id()); + BOOST_BEAST_EXPECT(b2.get_allocator().id() == a2.id()); + BOOST_BEAST_EXPECT(to_string(b1.data()) == "Hello"); + BOOST_BEAST_EXPECT(b2.size() == 0); } } // read_size { multi_buffer b{10}; - BEAST_EXPECT(read_size(b, 512) == 10); + BOOST_BEAST_EXPECT(read_size(b, 512) == 10); b.prepare(4); b.commit(4); - BEAST_EXPECT(read_size(b, 512) == 6); + BOOST_BEAST_EXPECT(read_size(b, 512) == 6); b.consume(2); - BEAST_EXPECT(read_size(b, 512) == 8); + BOOST_BEAST_EXPECT(read_size(b, 512) == 8); b.prepare(8); b.commit(8); - BEAST_EXPECT(read_size(b, 512) == 0); + BOOST_BEAST_EXPECT(read_size(b, 512) == 0); } } @@ -587,6 +590,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(multi_buffer,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(multi_buffer,core,beast); } // beast +} // boost diff --git a/test/core/ostream.cpp b/test/core/ostream.cpp index 25b805ec..67be0992 100644 --- a/test/core/ostream.cpp +++ b/test/core/ostream.cpp @@ -4,15 +4,18 @@ // 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 +#include -#include -#include +#include +#include #include #include +namespace boost { namespace beast { class ostream_test : public beast::unit_test::suite @@ -26,7 +29,7 @@ public: auto os = ostream(b); os << "Hello, world!\n"; os.flush(); - BEAST_EXPECT(boost::lexical_cast( + BOOST_BEAST_EXPECT(boost::lexical_cast( buffers(b.data())) == "Hello, world!\n"); auto os2 = std::move(os); } @@ -42,12 +45,13 @@ public: "0123456789abcdef" "0123456789abcdef" "0123456789abcdef" "0123456789abcdef"; multi_buffer b; ostream(b) << s; - BEAST_EXPECT(boost::lexical_cast( + BOOST_BEAST_EXPECT(boost::lexical_cast( buffers(b.data())) == s); } } }; -BEAST_DEFINE_TESTSUITE(ostream,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(ostream,core,beast); } // beast +} // boost diff --git a/test/core/prepare_buffers.cpp b/test/core/prepare_buffers.cpp index f7db3840..3a9902de 100644 --- a/test/core/prepare_buffers.cpp +++ b/test/core/prepare_buffers.cpp @@ -4,6 +4,8 @@ // 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/core/read_size.cpp b/test/core/read_size.cpp index 40a01c0c..5f818997 100644 --- a/test/core/read_size.cpp +++ b/test/core/read_size.cpp @@ -4,17 +4,20 @@ // 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 +#include -#include -#include -#include -#include +#include +#include +#include +#include #include +namespace boost { namespace beast { class read_size_test : public beast::unit_test::suite @@ -39,6 +42,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(read_size,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(read_size,core,beast); } // beast +} // boost diff --git a/test/core/sha1.cpp b/test/core/sha1.cpp index d85b2e2c..d59f5173 100644 --- a/test/core/sha1.cpp +++ b/test/core/sha1.cpp @@ -4,11 +4,14 @@ // 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 +// -#include -#include +#include +#include #include +namespace boost { namespace beast { namespace detail { @@ -54,7 +57,7 @@ public: init(ctx); update(ctx, message.data(), message.size()); finish(ctx, &result[0]); - BEAST_EXPECT(result == digest); + BOOST_BEAST_EXPECT(result == digest); } void @@ -73,8 +76,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(sha1,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(sha1,core,beast); } // test } // beast - +} // boost diff --git a/test/core/span.cpp b/test/core/span.cpp index ec8c7d3e..090744f4 100644 --- a/test/core/span.cpp +++ b/test/core/span.cpp @@ -4,13 +4,16 @@ // 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 +#include -#include -#include +#include +#include +namespace boost { namespace beast { class span_test : public beast::unit_test::suite @@ -39,7 +42,7 @@ public: testSpan() { span sp{"hello", 5}; - BEAST_EXPECT(sp.size() == 5); + BOOST_BEAST_EXPECT(sp.size() == 5); std::string s("world"); sp = s; } @@ -51,6 +54,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(span,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(span,core,beast); } // beast +} // boost diff --git a/test/core/static_buffer.cpp b/test/core/static_buffer.cpp index d9f309f7..5c27fdb0 100644 --- a/test/core/static_buffer.cpp +++ b/test/core/static_buffer.cpp @@ -4,17 +4,20 @@ // 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 +#include #include "buffer_test.hpp" -#include -#include -#include +#include +#include +#include #include +namespace boost { namespace beast { static_assert( @@ -33,7 +36,7 @@ public: using boost::asio::buffer_size; char buf[12]; std::string const s = "Hello, world"; - BEAST_EXPECT(s.size() == sizeof(buf)); + BOOST_BEAST_EXPECT(s.size() == sizeof(buf)); for(std::size_t i = 1; i < 4; ++i) { for(std::size_t j = 1; j < 4; ++j) { for(std::size_t x = 1; x < 4; ++x) { @@ -47,79 +50,79 @@ public: static_buffer ba; { auto d = ba.prepare(z); - BEAST_EXPECT(buffer_size(d) == z); + BOOST_BEAST_EXPECT(buffer_size(d) == z); } { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { auto d = ba.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); } { auto d = ba.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); ba.commit(buffer_copy(d, buffer(s.data(), x))); } - BEAST_EXPECT(ba.size() == x); - BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); + BOOST_BEAST_EXPECT(ba.size() == x); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); { auto d = ba.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); } { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { auto d = ba.prepare(z); - BEAST_EXPECT(buffer_size(d) == z); + BOOST_BEAST_EXPECT(buffer_size(d) == z); } { auto d = ba.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); ba.commit(buffer_copy(d, buffer(s.data()+x, y))); } ba.commit(1); - BEAST_EXPECT(ba.size() == x + y); - BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); + BOOST_BEAST_EXPECT(ba.size() == x + y); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); { auto d = ba.prepare(x); - BEAST_EXPECT(buffer_size(d) == x); + BOOST_BEAST_EXPECT(buffer_size(d) == x); } { auto d = ba.prepare(y); - BEAST_EXPECT(buffer_size(d) == y); + BOOST_BEAST_EXPECT(buffer_size(d) == y); } { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } { auto d = ba.prepare(z); - BEAST_EXPECT(buffer_size(d) == z); + BOOST_BEAST_EXPECT(buffer_size(d) == z); ba.commit(buffer_copy(d, buffer(s.data()+x+y, z))); } ba.commit(2); - BEAST_EXPECT(buffer_size(ba.data()) == buffer_size(ba.mutable_data())); - BEAST_EXPECT(ba.size() == x + y + z); - BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); - BEAST_EXPECT(to_string(ba.data()) == s); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == buffer_size(ba.mutable_data())); + BOOST_BEAST_EXPECT(ba.size() == x + y + z); + BOOST_BEAST_EXPECT(buffer_size(ba.data()) == ba.size()); + BOOST_BEAST_EXPECT(to_string(ba.data()) == s); ba.consume(t); { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } - BEAST_EXPECT(to_string(ba.data()) == s.substr(t, std::string::npos)); + BOOST_BEAST_EXPECT(to_string(ba.data()) == s.substr(t, std::string::npos)); ba.consume(u); - BEAST_EXPECT(to_string(ba.data()) == s.substr(t + u, std::string::npos)); + BOOST_BEAST_EXPECT(to_string(ba.data()) == s.substr(t + u, std::string::npos)); ba.consume(v); - BEAST_EXPECT(to_string(ba.data()) == ""); + BOOST_BEAST_EXPECT(to_string(ba.data()) == ""); ba.consume(1); { auto d = ba.prepare(0); - BEAST_EXPECT(buffer_size(d) == 0); + BOOST_BEAST_EXPECT(buffer_size(d) == 0); } try { @@ -145,31 +148,31 @@ public: char buf[64]; static_buffer_base b{buf, sizeof(buf)}; ostream(b) << s; - BEAST_EXPECT(to_string(b.data()) == s); + BOOST_BEAST_EXPECT(to_string(b.data()) == s); b.consume(b.size()); - BEAST_EXPECT(to_string(b.data()) == ""); + BOOST_BEAST_EXPECT(to_string(b.data()) == ""); } // static_buffer { static_buffer<64> b1; - BEAST_EXPECT(b1.size() == 0); - BEAST_EXPECT(b1.max_size() == 64); - BEAST_EXPECT(b1.capacity() == 64); + BOOST_BEAST_EXPECT(b1.size() == 0); + BOOST_BEAST_EXPECT(b1.max_size() == 64); + BOOST_BEAST_EXPECT(b1.capacity() == 64); ostream(b1) << s; - BEAST_EXPECT(to_string(b1.data()) == s); + BOOST_BEAST_EXPECT(to_string(b1.data()) == s); { static_buffer<64> b2{b1}; - BEAST_EXPECT(to_string(b2.data()) == s); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s); b2.consume(7); - BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); } { static_buffer<64> b2; b2 = b1; - BEAST_EXPECT(to_string(b2.data()) == s); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s); b2.consume(7); - BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); + BOOST_BEAST_EXPECT(to_string(b2.data()) == s.substr(7)); } } @@ -179,7 +182,7 @@ public: write_buffer(b, "12345"); b.consume(3); write_buffer(b, "67890123"); - BEAST_EXPECT(to_string(b.data()) == "4567890123"); + BOOST_BEAST_EXPECT(to_string(b.data()) == "4567890123"); try { b.prepare(1); @@ -194,15 +197,15 @@ public: // read_size { static_buffer<10> b; - BEAST_EXPECT(read_size(b, 512) == 10); + BOOST_BEAST_EXPECT(read_size(b, 512) == 10); b.prepare(4); b.commit(4); - BEAST_EXPECT(read_size(b, 512) == 6); + BOOST_BEAST_EXPECT(read_size(b, 512) == 6); b.consume(2); - BEAST_EXPECT(read_size(b, 512) == 8); + BOOST_BEAST_EXPECT(read_size(b, 512) == 8); b.prepare(8); b.commit(8); - BEAST_EXPECT(read_size(b, 512) == 0); + BOOST_BEAST_EXPECT(read_size(b, 512) == 0); } // base @@ -210,13 +213,13 @@ public: static_buffer<10> b; [&](static_buffer_base& base) { - BEAST_EXPECT(base.max_size() == b.capacity()); + BOOST_BEAST_EXPECT(base.max_size() == b.capacity()); } (b.base()); [&](static_buffer_base const& base) { - BEAST_EXPECT(base.max_size() == b.capacity()); + BOOST_BEAST_EXPECT(base.max_size() == b.capacity()); } (b.base()); } @@ -229,6 +232,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(static_buffer,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(static_buffer,core,beast); } // beast +} // boost diff --git a/test/core/static_string.cpp b/test/core/static_string.cpp index 227b2e72..be82d7e4 100644 --- a/test/core/static_string.cpp +++ b/test/core/static_string.cpp @@ -4,12 +4,15 @@ // 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 +#include -#include +#include +namespace boost { namespace beast { class static_string_test : public beast::unit_test::suite @@ -20,17 +23,17 @@ public: { { static_string<1> s; - BEAST_EXPECT(s.empty()); - BEAST_EXPECT(s.size() == 0); - BEAST_EXPECT(s == ""); - BEAST_EXPECT(*s.end() == 0); + BOOST_BEAST_EXPECT(s.empty()); + BOOST_BEAST_EXPECT(s.size() == 0); + BOOST_BEAST_EXPECT(s == ""); + BOOST_BEAST_EXPECT(*s.end() == 0); } { static_string<4> s1(3, 'x'); - BEAST_EXPECT(! s1.empty()); - BEAST_EXPECT(s1.size() == 3); - BEAST_EXPECT(s1 == "xxx"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(! s1.empty()); + BOOST_BEAST_EXPECT(s1.size() == 3); + BOOST_BEAST_EXPECT(s1 == "xxx"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<2> s2(3, 'x'); @@ -43,24 +46,24 @@ public: } { static_string<5> s1("12345"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(*s1.end() == 0); static_string<3> s2(s1, 2); - BEAST_EXPECT(s2 == "345"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "345"); + BOOST_BEAST_EXPECT(*s2.end() == 0); static_string<0> s3(s1, 5); - BEAST_EXPECT(s3.empty()); - BEAST_EXPECT(s3.front() == 0); - BEAST_EXPECT(*s3.end() == 0); + BOOST_BEAST_EXPECT(s3.empty()); + BOOST_BEAST_EXPECT(s3.front() == 0); + BOOST_BEAST_EXPECT(*s3.end() == 0); } { static_string<5> s1("12345"); static_string<2> s2(s1, 1, 2); - BEAST_EXPECT(s2 == "23"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "23"); + BOOST_BEAST_EXPECT(*s2.end() == 0); static_string<0> s3(s1, 5, 1); - BEAST_EXPECT(s3.empty()); - BEAST_EXPECT(s3.front() == 0); - BEAST_EXPECT(*s3.end() == 0); + BOOST_BEAST_EXPECT(s3.empty()); + BOOST_BEAST_EXPECT(s3.front() == 0); + BOOST_BEAST_EXPECT(*s3.end() == 0); try { static_string<5> s4(s1, 6); @@ -73,28 +76,28 @@ public: } { static_string<5> s1("UVXYZ", 3); - BEAST_EXPECT(s1 == "UVX"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "UVX"); + BOOST_BEAST_EXPECT(*s1.end() == 0); static_string<5> s2("X\0""Y\0""Z", 3); - BEAST_EXPECT(std::memcmp( + BOOST_BEAST_EXPECT(std::memcmp( s2.data(), "X\0""Y", 3) == 0); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(*s2.end() == 0); } { static_string<5> s1("12345"); static_string<3> s2( s1.begin() + 1, s1.begin() + 3); - BEAST_EXPECT(s2 == "23"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "23"); + BOOST_BEAST_EXPECT(*s2.end() == 0); } { static_string<5> s1("12345"); static_string<5> s2(s1); - BEAST_EXPECT(s2 == "12345"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "12345"); + BOOST_BEAST_EXPECT(*s2.end() == 0); static_string<6> s3(s1); - BEAST_EXPECT(s3 == "12345"); - BEAST_EXPECT(*s3.end() == 0); + BOOST_BEAST_EXPECT(s3 == "12345"); + BOOST_BEAST_EXPECT(*s3.end() == 0); try { static_string<4> s4(s1); @@ -107,9 +110,9 @@ public: } { static_string<3> s1({'1', '2', '3'}); - BEAST_EXPECT(s1 == "123"); - BEAST_EXPECT(*s1.end() == 0); - BEAST_EXPECT( + BOOST_BEAST_EXPECT(s1 == "123"); + BOOST_BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT( static_string<0>({}) == static_string<0>()); try { @@ -124,8 +127,8 @@ public: { static_string<3> s1( string_view("123")); - BEAST_EXPECT(s1 == "123"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "123"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<2> s2( @@ -140,8 +143,8 @@ public: { static_string<5> s1( std::string("12345"), 2, 2); - BEAST_EXPECT(s1 == "34"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "34"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<2> s2( @@ -162,15 +165,15 @@ public: static_string<3> s1("123"); static_string<3> s2; s2 = s1; - BEAST_EXPECT(s2 == "123"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "123"); + BOOST_BEAST_EXPECT(*s2.end() == 0); } { static_string<3> s1("123"); static_string<5> s2; s2 = s1; - BEAST_EXPECT(s2 == "123"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "123"); + BOOST_BEAST_EXPECT(*s2.end() == 0); try { static_string<1> s3; @@ -185,8 +188,8 @@ public: { static_string<3> s1; s1 = "123"; - BEAST_EXPECT(s1 == "123"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "123"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<1> s2; @@ -201,8 +204,8 @@ public: { static_string<1> s1; s1 = 'x'; - BEAST_EXPECT(s1 == "x"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "x"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<0> s2; @@ -217,8 +220,8 @@ public: { static_string<3> s1; s1 = {'1', '2', '3'}; - BEAST_EXPECT(s1 == "123"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "123"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<1> s2; @@ -233,8 +236,8 @@ public: { static_string<3> s1; s1 = string_view("123"); - BEAST_EXPECT(s1 == "123"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "123"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<1> s2; @@ -250,8 +253,8 @@ public: { static_string<4> s1; s1.assign(3, 'x'); - BEAST_EXPECT(s1 == "xxx"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "xxx"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<2> s2; @@ -265,19 +268,19 @@ public: } { static_string<5> s1("12345"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(*s1.end() == 0); static_string<5> s2; s2.assign(s1); - BEAST_EXPECT(s2 == "12345"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "12345"); + BOOST_BEAST_EXPECT(*s2.end() == 0); } { static_string<5> s1("12345"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(*s1.end() == 0); static_string<7> s2; s2.assign(s1); - BEAST_EXPECT(s2 == "12345"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "12345"); + BOOST_BEAST_EXPECT(*s2.end() == 0); try { static_string<3> s3; @@ -293,14 +296,14 @@ public: static_string<5> s1("12345"); static_string<5> s2; s2.assign(s1, 1); - BEAST_EXPECT(s2 == "2345"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "2345"); + BOOST_BEAST_EXPECT(*s2.end() == 0); s2.assign(s1, 1, 2); - BEAST_EXPECT(s2 == "23"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "23"); + BOOST_BEAST_EXPECT(*s2.end() == 0); s2.assign(s1, 1, 100); - BEAST_EXPECT(s2 == "2345"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "2345"); + BOOST_BEAST_EXPECT(*s2.end() == 0); try { s2.assign(s1, 6); @@ -324,24 +327,24 @@ public: { static_string<5> s1; s1.assign("12"); - BEAST_EXPECT(s1 == "12"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12"); + BOOST_BEAST_EXPECT(*s1.end() == 0); s1.assign("12345"); - BEAST_EXPECT(s1 == "12345"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12345"); + BOOST_BEAST_EXPECT(*s1.end() == 0); } { static_string<5> s1; s1.assign("12345", 3); - BEAST_EXPECT(s1 == "123"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "123"); + BOOST_BEAST_EXPECT(*s1.end() == 0); } { static_string<5> s1("12345"); static_string<3> s2; s2.assign(s1.begin(), s1.begin() + 2); - BEAST_EXPECT(s2 == "12"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "12"); + BOOST_BEAST_EXPECT(*s2.end() == 0); try { s2.assign(s1.begin(), s1.end()); @@ -355,8 +358,8 @@ public: { static_string<5> s1; s1.assign({'1', '2', '3'}); - BEAST_EXPECT(s1 == "123"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "123"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<1> s2; @@ -371,11 +374,11 @@ public: { static_string<5> s1; s1.assign(string_view("123")); - BEAST_EXPECT(s1 == "123"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "123"); + BOOST_BEAST_EXPECT(*s1.end() == 0); s1.assign(string_view("12345")); - BEAST_EXPECT(s1 == "12345"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12345"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { s1.assign(string_view("1234567")); @@ -389,11 +392,11 @@ public: { static_string<5> s1; s1.assign(std::string("12345"), 2, 2); - BEAST_EXPECT(s1 == "34"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "34"); + BOOST_BEAST_EXPECT(*s1.end() == 0); s1.assign(std::string("12345"), 3); - BEAST_EXPECT(s1 == "45"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "45"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<2> s2; @@ -413,11 +416,11 @@ public: { { static_string<5> s("12345"); - BEAST_EXPECT(s.at(1) == '2'); - BEAST_EXPECT(s.at(4) == '5'); + BOOST_BEAST_EXPECT(s.at(1) == '2'); + BOOST_BEAST_EXPECT(s.at(4) == '5'); try { - BEAST_EXPECT(s.at(5) == 0); + BOOST_BEAST_EXPECT(s.at(5) == 0); fail("", __FILE__, __LINE__); } catch(std::out_of_range const&) @@ -427,11 +430,11 @@ public: } { static_string<5> const s("12345"); - BEAST_EXPECT(s.at(1) == '2'); - BEAST_EXPECT(s.at(4) == '5'); + BOOST_BEAST_EXPECT(s.at(1) == '2'); + BOOST_BEAST_EXPECT(s.at(4) == '5'); try { - BEAST_EXPECT(s.at(5) == 0); + BOOST_BEAST_EXPECT(s.at(5) == 0); fail("", __FILE__, __LINE__); } catch(std::out_of_range const&) @@ -441,50 +444,50 @@ public: } { static_string<5> s("12345"); - BEAST_EXPECT(s[1] == '2'); - BEAST_EXPECT(s[4] == '5'); + BOOST_BEAST_EXPECT(s[1] == '2'); + BOOST_BEAST_EXPECT(s[4] == '5'); s[1] = '_'; - BEAST_EXPECT(s == "1_345"); + BOOST_BEAST_EXPECT(s == "1_345"); } { static_string<5> const s("12345"); - BEAST_EXPECT(s[1] == '2'); - BEAST_EXPECT(s[4] == '5'); - BEAST_EXPECT(s[5] == 0); + BOOST_BEAST_EXPECT(s[1] == '2'); + BOOST_BEAST_EXPECT(s[4] == '5'); + BOOST_BEAST_EXPECT(s[5] == 0); } { static_string<3> s("123"); - BEAST_EXPECT(s.front() == '1'); - BEAST_EXPECT(s.back() == '3'); + BOOST_BEAST_EXPECT(s.front() == '1'); + BOOST_BEAST_EXPECT(s.back() == '3'); s.front() = '_'; - BEAST_EXPECT(s == "_23"); + BOOST_BEAST_EXPECT(s == "_23"); s.back() = '_'; - BEAST_EXPECT(s == "_2_"); + BOOST_BEAST_EXPECT(s == "_2_"); } { static_string<3> const s("123"); - BEAST_EXPECT(s.front() == '1'); - BEAST_EXPECT(s.back() == '3'); + BOOST_BEAST_EXPECT(s.front() == '1'); + BOOST_BEAST_EXPECT(s.back() == '3'); } { static_string<3> s("123"); - BEAST_EXPECT(std::memcmp( + BOOST_BEAST_EXPECT(std::memcmp( s.data(), "123", 3) == 0); } { static_string<3> const s("123"); - BEAST_EXPECT(std::memcmp( + BOOST_BEAST_EXPECT(std::memcmp( s.data(), "123", 3) == 0); } { static_string<3> s("123"); - BEAST_EXPECT(std::memcmp( + BOOST_BEAST_EXPECT(std::memcmp( s.c_str(), "123\0", 4) == 0); } { static_string<3> s("123"); string_view sv = s; - BEAST_EXPECT(static_string<5>(sv) == "123"); + BOOST_BEAST_EXPECT(static_string<5>(sv) == "123"); } } @@ -493,25 +496,25 @@ public: { { static_string<3> s; - BEAST_EXPECT(std::distance( + BOOST_BEAST_EXPECT(std::distance( s.begin(), s.end()) == 0); - BEAST_EXPECT(std::distance( + BOOST_BEAST_EXPECT(std::distance( s.rbegin(), s.rend()) == 0); s = "123"; - BEAST_EXPECT(std::distance( + BOOST_BEAST_EXPECT(std::distance( s.begin(), s.end()) == 3); - BEAST_EXPECT(std::distance( + BOOST_BEAST_EXPECT(std::distance( s.rbegin(), s.rend()) == 3); } { static_string<3> const s("123"); - BEAST_EXPECT(std::distance( + BOOST_BEAST_EXPECT(std::distance( s.begin(), s.end()) == 3); - BEAST_EXPECT(std::distance( + BOOST_BEAST_EXPECT(std::distance( s.cbegin(), s.cend()) == 3); - BEAST_EXPECT(std::distance( + BOOST_BEAST_EXPECT(std::distance( s.rbegin(), s.rend()) == 3); - BEAST_EXPECT(std::distance( + BOOST_BEAST_EXPECT(std::distance( s.crbegin(), s.crend()) == 3); } } @@ -520,15 +523,15 @@ public: testCapacity() { static_string<3> s; - BEAST_EXPECT(s.empty()); - BEAST_EXPECT(s.size() == 0); - BEAST_EXPECT(s.length() == 0); - BEAST_EXPECT(s.max_size() == 3); - BEAST_EXPECT(s.capacity() == 3); + BOOST_BEAST_EXPECT(s.empty()); + BOOST_BEAST_EXPECT(s.size() == 0); + BOOST_BEAST_EXPECT(s.length() == 0); + BOOST_BEAST_EXPECT(s.max_size() == 3); + BOOST_BEAST_EXPECT(s.capacity() == 3); s = "123"; - BEAST_EXPECT(! s.empty()); - BEAST_EXPECT(s.size() == 3); - BEAST_EXPECT(s.length() == 3); + BOOST_BEAST_EXPECT(! s.empty()); + BOOST_BEAST_EXPECT(s.size() == 3); + BOOST_BEAST_EXPECT(s.length() == 3); s.reserve(0); s.reserve(3); try @@ -541,10 +544,10 @@ public: pass(); } s.shrink_to_fit(); - BEAST_EXPECT(! s.empty()); - BEAST_EXPECT(s.size() == 3); - BEAST_EXPECT(s.length() == 3); - BEAST_EXPECT(*s.end() == 0); + BOOST_BEAST_EXPECT(! s.empty()); + BOOST_BEAST_EXPECT(s.size() == 3); + BOOST_BEAST_EXPECT(s.length() == 3); + BOOST_BEAST_EXPECT(*s.end() == 0); } void @@ -557,8 +560,8 @@ public: { static_string<3> s("123"); s.clear(); - BEAST_EXPECT(s.empty()); - BEAST_EXPECT(*s.end() == 0); + BOOST_BEAST_EXPECT(s.empty()); + BOOST_BEAST_EXPECT(*s.end() == 0); } // @@ -568,8 +571,8 @@ public: { static_string<7> s1("12345"); s1.insert(2, 2, '_'); - BEAST_EXPECT(s1 == "12__345"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12__345"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<6> s2("12345"); @@ -594,8 +597,8 @@ public: { static_string<7> s1("12345"); s1.insert(2, "__"); - BEAST_EXPECT(s1 == "12__345"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12__345"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<6> s2("12345"); @@ -620,8 +623,8 @@ public: { static_string<7> s1("12345"); s1.insert(2, "TUV", 2); - BEAST_EXPECT(s1 == "12TU345"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12TU345"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<6> s2("12345"); @@ -646,8 +649,8 @@ public: { static_string<7> s1("12345"); s1.insert(2, static_string<3>("TU")); - BEAST_EXPECT(s1 == "12TU345"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12TU345"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<6> s2("12345"); @@ -672,12 +675,12 @@ public: { static_string<7> s1("12345"); s1.insert(2, static_string<3>("TUV"), 1); - BEAST_EXPECT(s1 == "12UV345"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12UV345"); + BOOST_BEAST_EXPECT(*s1.end() == 0); s1 = "12345"; s1.insert(2, static_string<3>("TUV"), 1, 1); - BEAST_EXPECT(s1 == "12U345"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12U345"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<6> s2("12345"); @@ -702,8 +705,8 @@ public: { static_string<4> s1("123"); s1.insert(s1.begin() + 1, '_'); - BEAST_EXPECT(s1 == "1_23"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "1_23"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<3> s2("123"); @@ -718,8 +721,8 @@ public: { static_string<4> s1("12"); s1.insert(s1.begin() + 1, 2, '_'); - BEAST_EXPECT(s1 == "1__2"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "1__2"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<4> s2("123"); @@ -735,8 +738,8 @@ public: static_string<3> s1("123"); static_string<5> s2("UV"); s2.insert(s2.begin() + 1, s1.begin(), s1.end()); - BEAST_EXPECT(s2 == "U123V"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "U123V"); + BOOST_BEAST_EXPECT(*s2.end() == 0); try { static_string<4> s3("UV"); @@ -751,8 +754,8 @@ public: { static_string<5> s1("123"); s1.insert(1, string_view("UV")); - BEAST_EXPECT(s1 == "1UV23"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "1UV23"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<4> s2("123"); @@ -777,8 +780,8 @@ public: { static_string<5> s1("123"); s1.insert(1, std::string("UV")); - BEAST_EXPECT(s1 == "1UV23"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "1UV23"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { s1.insert(1, std::string("UV")); @@ -792,11 +795,11 @@ public: { static_string<6> s1("123"); s1.insert(1, std::string("UVX"), 1); - BEAST_EXPECT(s1 == "1VX23"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "1VX23"); + BOOST_BEAST_EXPECT(*s1.end() == 0); s1.insert(4, std::string("PQR"), 1, 1); - BEAST_EXPECT(s1 == "1VX2Q3"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "1VX2Q3"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { s1.insert(4, std::string("PQR"), 1, 1); @@ -814,12 +817,12 @@ public: { static_string<9> s1("123456789"); - BEAST_EXPECT(s1.erase(1, 1) == "13456789"); - BEAST_EXPECT(s1 == "13456789"); - BEAST_EXPECT(*s1.end() == 0); - BEAST_EXPECT(s1.erase(5) == "13456"); - BEAST_EXPECT(s1 == "13456"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1.erase(1, 1) == "13456789"); + BOOST_BEAST_EXPECT(s1 == "13456789"); + BOOST_BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1.erase(5) == "13456"); + BOOST_BEAST_EXPECT(s1 == "13456"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { s1.erase(7); @@ -832,16 +835,16 @@ public: } { static_string<9> s1("123456789"); - BEAST_EXPECT(*s1.erase(s1.begin() + 5) == '7'); - BEAST_EXPECT(s1 == "12345789"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(*s1.erase(s1.begin() + 5) == '7'); + BOOST_BEAST_EXPECT(s1 == "12345789"); + BOOST_BEAST_EXPECT(*s1.end() == 0); } { static_string<9> s1("123456789"); - BEAST_EXPECT(*s1.erase( + BOOST_BEAST_EXPECT(*s1.erase( s1.begin() + 5, s1.begin() + 7) == '8'); - BEAST_EXPECT(s1 == "1234589"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "1234589"); + BOOST_BEAST_EXPECT(*s1.end() == 0); } // @@ -851,7 +854,7 @@ public: { static_string<3> s1("12"); s1.push_back('3'); - BEAST_EXPECT(s1 == "123"); + BOOST_BEAST_EXPECT(s1 == "123"); try { s1.push_back('4'); @@ -880,14 +883,14 @@ public: { static_string<3> s1("123"); s1.pop_back(); - BEAST_EXPECT(s1 == "12"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12"); + BOOST_BEAST_EXPECT(*s1.end() == 0); s1.pop_back(); - BEAST_EXPECT(s1 == "1"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "1"); + BOOST_BEAST_EXPECT(*s1.end() == 0); s1.pop_back(); - BEAST_EXPECT(s1.empty()); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1.empty()); + BOOST_BEAST_EXPECT(*s1.end() == 0); } // @@ -897,8 +900,8 @@ public: { static_string<3> s1("1"); s1.append(2, '_'); - BEAST_EXPECT(s1 == "1__"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "1__"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<2> s2("1"); @@ -914,8 +917,8 @@ public: static_string<2> s1("__"); static_string<3> s2("1"); s2.append(s1); - BEAST_EXPECT(s2 == "1__"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "1__"); + BOOST_BEAST_EXPECT(*s2.end() == 0); try { static_string<2> s3("1"); @@ -931,12 +934,12 @@ public: static_string<3> s1("XYZ"); static_string<4> s2("12"); s2.append(s1, 1); - BEAST_EXPECT(s2 == "12YZ"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "12YZ"); + BOOST_BEAST_EXPECT(*s2.end() == 0); static_string<3> s3("12"); s3.append(s1, 1, 1); - BEAST_EXPECT(s3 == "12Y"); - BEAST_EXPECT(*s3.end() == 0); + BOOST_BEAST_EXPECT(s3 == "12Y"); + BOOST_BEAST_EXPECT(*s3.end() == 0); try { static_string<3> s4("12"); @@ -961,8 +964,8 @@ public: { static_string<4> s1("12"); s1.append("XYZ", 2); - BEAST_EXPECT(s1 == "12XY"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12XY"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<3> s3("12"); @@ -977,8 +980,8 @@ public: { static_string<5> s1("12"); s1.append("XYZ"); - BEAST_EXPECT(s1 == "12XYZ"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "12XYZ"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<4> s2("12"); @@ -994,8 +997,8 @@ public: static_string<3> s1("XYZ"); static_string<5> s2("12"); s2.append(s1.begin(), s1.end()); - BEAST_EXPECT(s2 == "12XYZ"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "12XYZ"); + BOOST_BEAST_EXPECT(*s2.end() == 0); try { static_string<4> s3("12"); @@ -1010,8 +1013,8 @@ public: { static_string<5> s1("123"); s1.append({'X', 'Y'}); - BEAST_EXPECT(s1 == "123XY"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "123XY"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<4> s2("123"); @@ -1027,8 +1030,8 @@ public: string_view s1("XYZ"); static_string<5> s2("12"); s2.append(s1); - BEAST_EXPECT(s2 == "12XYZ"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "12XYZ"); + BOOST_BEAST_EXPECT(*s2.end() == 0); try { static_string<4> s3("12"); @@ -1043,11 +1046,11 @@ public: { static_string<6> s1("123"); s1.append(std::string("UVX"), 1); - BEAST_EXPECT(s1 == "123VX"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "123VX"); + BOOST_BEAST_EXPECT(*s1.end() == 0); s1.append(std::string("PQR"), 1, 1); - BEAST_EXPECT(s1 == "123VXQ"); - BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s1 == "123VXQ"); + BOOST_BEAST_EXPECT(*s1.end() == 0); try { static_string<3> s2("123"); @@ -1068,8 +1071,8 @@ public: static_string<2> s1("__"); static_string<3> s2("1"); s2 += s1; - BEAST_EXPECT(s2 == "1__"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s2 == "1__"); + BOOST_BEAST_EXPECT(*s2.end() == 0); try { static_string<2> s3("1"); @@ -1084,7 +1087,7 @@ public: { static_string<3> s1("12"); s1 += '3'; - BEAST_EXPECT(s1 == "123"); + BOOST_BEAST_EXPECT(s1 == "123"); try { s1 += '4'; @@ -1098,7 +1101,7 @@ public: { static_string<4> s1("12"); s1 += "34"; - BEAST_EXPECT(s1 == "1234"); + BOOST_BEAST_EXPECT(s1 == "1234"); try { s1 += "5"; @@ -1112,7 +1115,7 @@ public: { static_string<4> s1("12"); s1 += {'3', '4'}; - BEAST_EXPECT(s1 == "1234"); + BOOST_BEAST_EXPECT(s1 == "1234"); try { s1 += {'5'}; @@ -1127,7 +1130,7 @@ public: string_view s1("34"); static_string<4> s2("12"); s2 += s1; - BEAST_EXPECT(s2 == "1234"); + BOOST_BEAST_EXPECT(s2 == "1234"); try { s2 += s1; @@ -1150,87 +1153,87 @@ public: str2 s2; s1 = "1"; s2 = "22"; - BEAST_EXPECT(s1.compare(s2) < 0); - BEAST_EXPECT(s2.compare(s1) > 0); - BEAST_EXPECT(s1 < "10"); - BEAST_EXPECT(s2 > "1"); - BEAST_EXPECT("10" > s1); - BEAST_EXPECT("1" < s2); - BEAST_EXPECT(s1 < "20"); - BEAST_EXPECT(s2 > "1"); - BEAST_EXPECT(s2 > "2"); + BOOST_BEAST_EXPECT(s1.compare(s2) < 0); + BOOST_BEAST_EXPECT(s2.compare(s1) > 0); + BOOST_BEAST_EXPECT(s1 < "10"); + BOOST_BEAST_EXPECT(s2 > "1"); + BOOST_BEAST_EXPECT("10" > s1); + BOOST_BEAST_EXPECT("1" < s2); + BOOST_BEAST_EXPECT(s1 < "20"); + BOOST_BEAST_EXPECT(s2 > "1"); + BOOST_BEAST_EXPECT(s2 > "2"); } { str2 s1("x"); str2 s2("x"); - BEAST_EXPECT(s1 == s2); - BEAST_EXPECT(s1 <= s2); - BEAST_EXPECT(s1 >= s2); - BEAST_EXPECT(! (s1 < s2)); - BEAST_EXPECT(! (s1 > s2)); - BEAST_EXPECT(! (s1 != s2)); + BOOST_BEAST_EXPECT(s1 == s2); + BOOST_BEAST_EXPECT(s1 <= s2); + BOOST_BEAST_EXPECT(s1 >= s2); + BOOST_BEAST_EXPECT(! (s1 < s2)); + BOOST_BEAST_EXPECT(! (s1 > s2)); + BOOST_BEAST_EXPECT(! (s1 != s2)); } { str1 s1("x"); str2 s2("x"); - BEAST_EXPECT(s1 == s2); - BEAST_EXPECT(s1 <= s2); - BEAST_EXPECT(s1 >= s2); - BEAST_EXPECT(! (s1 < s2)); - BEAST_EXPECT(! (s1 > s2)); - BEAST_EXPECT(! (s1 != s2)); + BOOST_BEAST_EXPECT(s1 == s2); + BOOST_BEAST_EXPECT(s1 <= s2); + BOOST_BEAST_EXPECT(s1 >= s2); + BOOST_BEAST_EXPECT(! (s1 < s2)); + BOOST_BEAST_EXPECT(! (s1 > s2)); + BOOST_BEAST_EXPECT(! (s1 != s2)); } { str2 s("x"); - BEAST_EXPECT(s == "x"); - BEAST_EXPECT(s <= "x"); - BEAST_EXPECT(s >= "x"); - BEAST_EXPECT(! (s < "x")); - BEAST_EXPECT(! (s > "x")); - BEAST_EXPECT(! (s != "x")); - BEAST_EXPECT("x" == s); - BEAST_EXPECT("x" <= s); - BEAST_EXPECT("x" >= s); - BEAST_EXPECT(! ("x" < s)); - BEAST_EXPECT(! ("x" > s)); - BEAST_EXPECT(! ("x" != s)); + BOOST_BEAST_EXPECT(s == "x"); + BOOST_BEAST_EXPECT(s <= "x"); + BOOST_BEAST_EXPECT(s >= "x"); + BOOST_BEAST_EXPECT(! (s < "x")); + BOOST_BEAST_EXPECT(! (s > "x")); + BOOST_BEAST_EXPECT(! (s != "x")); + BOOST_BEAST_EXPECT("x" == s); + BOOST_BEAST_EXPECT("x" <= s); + BOOST_BEAST_EXPECT("x" >= s); + BOOST_BEAST_EXPECT(! ("x" < s)); + BOOST_BEAST_EXPECT(! ("x" > s)); + BOOST_BEAST_EXPECT(! ("x" != s)); } { str2 s("x"); - BEAST_EXPECT(s <= "y"); - BEAST_EXPECT(s < "y"); - BEAST_EXPECT(s != "y"); - BEAST_EXPECT(! (s == "y")); - BEAST_EXPECT(! (s >= "y")); - BEAST_EXPECT(! (s > "x")); - BEAST_EXPECT("y" >= s); - BEAST_EXPECT("y" > s); - BEAST_EXPECT("y" != s); - BEAST_EXPECT(! ("y" == s)); - BEAST_EXPECT(! ("y" <= s)); - BEAST_EXPECT(! ("y" < s)); + BOOST_BEAST_EXPECT(s <= "y"); + BOOST_BEAST_EXPECT(s < "y"); + BOOST_BEAST_EXPECT(s != "y"); + BOOST_BEAST_EXPECT(! (s == "y")); + BOOST_BEAST_EXPECT(! (s >= "y")); + BOOST_BEAST_EXPECT(! (s > "x")); + BOOST_BEAST_EXPECT("y" >= s); + BOOST_BEAST_EXPECT("y" > s); + BOOST_BEAST_EXPECT("y" != s); + BOOST_BEAST_EXPECT(! ("y" == s)); + BOOST_BEAST_EXPECT(! ("y" <= s)); + BOOST_BEAST_EXPECT(! ("y" < s)); } { str1 s1("x"); str2 s2("y"); - BEAST_EXPECT(s1 <= s2); - BEAST_EXPECT(s1 < s2); - BEAST_EXPECT(s1 != s2); - BEAST_EXPECT(! (s1 == s2)); - BEAST_EXPECT(! (s1 >= s2)); - BEAST_EXPECT(! (s1 > s2)); + BOOST_BEAST_EXPECT(s1 <= s2); + BOOST_BEAST_EXPECT(s1 < s2); + BOOST_BEAST_EXPECT(s1 != s2); + BOOST_BEAST_EXPECT(! (s1 == s2)); + BOOST_BEAST_EXPECT(! (s1 >= s2)); + BOOST_BEAST_EXPECT(! (s1 > s2)); } { str1 s1("x"); str2 s2("xx"); - BEAST_EXPECT(s1 < s2); - BEAST_EXPECT(s2 > s1); + BOOST_BEAST_EXPECT(s1 < s2); + BOOST_BEAST_EXPECT(s2 > s1); } { str1 s1("x"); str2 s2("yy"); - BEAST_EXPECT(s1 < s2); - BEAST_EXPECT(s2 > s1); + BOOST_BEAST_EXPECT(s1 < s2); + BOOST_BEAST_EXPECT(s2 > s1); } } @@ -1241,31 +1244,31 @@ public: static_string<3> s1("123"); static_string<3> s2("XYZ"); swap(s1, s2); - BEAST_EXPECT(s1 == "XYZ"); - BEAST_EXPECT(*s1.end() == 0); - BEAST_EXPECT(s2 == "123"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s1 == "XYZ"); + BOOST_BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s2 == "123"); + BOOST_BEAST_EXPECT(*s2.end() == 0); static_string<3> s3("UV"); swap(s2, s3); - BEAST_EXPECT(s2 == "UV"); - BEAST_EXPECT(*s2.end() == 0); - BEAST_EXPECT(s3 == "123"); - BEAST_EXPECT(*s3.end() == 0); + BOOST_BEAST_EXPECT(s2 == "UV"); + BOOST_BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s3 == "123"); + BOOST_BEAST_EXPECT(*s3.end() == 0); } { static_string<5> s1("123"); static_string<7> s2("XYZ"); swap(s1, s2); - BEAST_EXPECT(s1 == "XYZ"); - BEAST_EXPECT(*s1.end() == 0); - BEAST_EXPECT(s2 == "123"); - BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s1 == "XYZ"); + BOOST_BEAST_EXPECT(*s1.end() == 0); + BOOST_BEAST_EXPECT(s2 == "123"); + BOOST_BEAST_EXPECT(*s2.end() == 0); static_string<3> s3("UV"); swap(s2, s3); - BEAST_EXPECT(s2 == "UV"); - BEAST_EXPECT(*s2.end() == 0); - BEAST_EXPECT(s3 == "123"); - BEAST_EXPECT(*s3.end() == 0); + BOOST_BEAST_EXPECT(s2 == "UV"); + BOOST_BEAST_EXPECT(*s2.end() == 0); + BOOST_BEAST_EXPECT(s3 == "123"); + BOOST_BEAST_EXPECT(*s3.end() == 0); try { static_string<5> s4("12345"); @@ -1298,105 +1301,105 @@ public: using str2 = static_string<2>; { str1 s1; - BEAST_EXPECT(s1 == ""); - BEAST_EXPECT(s1.empty()); - BEAST_EXPECT(s1.size() == 0); - BEAST_EXPECT(s1.max_size() == 1); - BEAST_EXPECT(s1.capacity() == 1); - BEAST_EXPECT(s1.begin() == s1.end()); - BEAST_EXPECT(s1.cbegin() == s1.cend()); - BEAST_EXPECT(s1.rbegin() == s1.rend()); - BEAST_EXPECT(s1.crbegin() == s1.crend()); + BOOST_BEAST_EXPECT(s1 == ""); + BOOST_BEAST_EXPECT(s1.empty()); + BOOST_BEAST_EXPECT(s1.size() == 0); + BOOST_BEAST_EXPECT(s1.max_size() == 1); + BOOST_BEAST_EXPECT(s1.capacity() == 1); + BOOST_BEAST_EXPECT(s1.begin() == s1.end()); + BOOST_BEAST_EXPECT(s1.cbegin() == s1.cend()); + BOOST_BEAST_EXPECT(s1.rbegin() == s1.rend()); + BOOST_BEAST_EXPECT(s1.crbegin() == s1.crend()); try { - BEAST_EXPECT(s1.at(0) == 0); + BOOST_BEAST_EXPECT(s1.at(0) == 0); fail(); } catch(std::exception const&) { pass(); } - BEAST_EXPECT(s1.data()[0] == 0); - BEAST_EXPECT(*s1.c_str() == 0); - BEAST_EXPECT(std::distance(s1.begin(), s1.end()) == 0); - BEAST_EXPECT(std::distance(s1.cbegin(), s1.cend()) == 0); - BEAST_EXPECT(std::distance(s1.rbegin(), s1.rend()) == 0); - BEAST_EXPECT(std::distance(s1.crbegin(), s1.crend()) == 0); - BEAST_EXPECT(s1.compare(s1) == 0); + BOOST_BEAST_EXPECT(s1.data()[0] == 0); + BOOST_BEAST_EXPECT(*s1.c_str() == 0); + BOOST_BEAST_EXPECT(std::distance(s1.begin(), s1.end()) == 0); + BOOST_BEAST_EXPECT(std::distance(s1.cbegin(), s1.cend()) == 0); + BOOST_BEAST_EXPECT(std::distance(s1.rbegin(), s1.rend()) == 0); + BOOST_BEAST_EXPECT(std::distance(s1.crbegin(), s1.crend()) == 0); + BOOST_BEAST_EXPECT(s1.compare(s1) == 0); } { str1 const s1; - BEAST_EXPECT(s1 == ""); - BEAST_EXPECT(s1.empty()); - BEAST_EXPECT(s1.size() == 0); - BEAST_EXPECT(s1.max_size() == 1); - BEAST_EXPECT(s1.capacity() == 1); - BEAST_EXPECT(s1.begin() == s1.end()); - BEAST_EXPECT(s1.cbegin() == s1.cend()); - BEAST_EXPECT(s1.rbegin() == s1.rend()); - BEAST_EXPECT(s1.crbegin() == s1.crend()); + BOOST_BEAST_EXPECT(s1 == ""); + BOOST_BEAST_EXPECT(s1.empty()); + BOOST_BEAST_EXPECT(s1.size() == 0); + BOOST_BEAST_EXPECT(s1.max_size() == 1); + BOOST_BEAST_EXPECT(s1.capacity() == 1); + BOOST_BEAST_EXPECT(s1.begin() == s1.end()); + BOOST_BEAST_EXPECT(s1.cbegin() == s1.cend()); + BOOST_BEAST_EXPECT(s1.rbegin() == s1.rend()); + BOOST_BEAST_EXPECT(s1.crbegin() == s1.crend()); try { - BEAST_EXPECT(s1.at(0) == 0); + BOOST_BEAST_EXPECT(s1.at(0) == 0); fail(); } catch(std::exception const&) { pass(); } - BEAST_EXPECT(s1.data()[0] == 0); - BEAST_EXPECT(*s1.c_str() == 0); - BEAST_EXPECT(std::distance(s1.begin(), s1.end()) == 0); - BEAST_EXPECT(std::distance(s1.cbegin(), s1.cend()) == 0); - BEAST_EXPECT(std::distance(s1.rbegin(), s1.rend()) == 0); - BEAST_EXPECT(std::distance(s1.crbegin(), s1.crend()) == 0); - BEAST_EXPECT(s1.compare(s1) == 0); + BOOST_BEAST_EXPECT(s1.data()[0] == 0); + BOOST_BEAST_EXPECT(*s1.c_str() == 0); + BOOST_BEAST_EXPECT(std::distance(s1.begin(), s1.end()) == 0); + BOOST_BEAST_EXPECT(std::distance(s1.cbegin(), s1.cend()) == 0); + BOOST_BEAST_EXPECT(std::distance(s1.rbegin(), s1.rend()) == 0); + BOOST_BEAST_EXPECT(std::distance(s1.crbegin(), s1.crend()) == 0); + BOOST_BEAST_EXPECT(s1.compare(s1) == 0); } { str1 s1; str1 s2("x"); - BEAST_EXPECT(s2 == "x"); - BEAST_EXPECT(s2[0] == 'x'); - BEAST_EXPECT(s2.at(0) == 'x'); - BEAST_EXPECT(s2.front() == 'x'); - BEAST_EXPECT(s2.back() == 'x'); + BOOST_BEAST_EXPECT(s2 == "x"); + BOOST_BEAST_EXPECT(s2[0] == 'x'); + BOOST_BEAST_EXPECT(s2.at(0) == 'x'); + BOOST_BEAST_EXPECT(s2.front() == 'x'); + BOOST_BEAST_EXPECT(s2.back() == 'x'); str1 const s3(s2); - BEAST_EXPECT(s3 == "x"); - BEAST_EXPECT(s3[0] == 'x'); - BEAST_EXPECT(s3.at(0) == 'x'); - BEAST_EXPECT(s3.front() == 'x'); - BEAST_EXPECT(s3.back() == 'x'); + BOOST_BEAST_EXPECT(s3 == "x"); + BOOST_BEAST_EXPECT(s3[0] == 'x'); + BOOST_BEAST_EXPECT(s3.at(0) == 'x'); + BOOST_BEAST_EXPECT(s3.front() == 'x'); + BOOST_BEAST_EXPECT(s3.back() == 'x'); s2 = "y"; - BEAST_EXPECT(s2 == "y"); - BEAST_EXPECT(s3 == "x"); + BOOST_BEAST_EXPECT(s2 == "y"); + BOOST_BEAST_EXPECT(s3 == "x"); s1 = s2; - BEAST_EXPECT(s1 == "y"); + BOOST_BEAST_EXPECT(s1 == "y"); s1.clear(); - BEAST_EXPECT(s1.empty()); - BEAST_EXPECT(s1.size() == 0); + BOOST_BEAST_EXPECT(s1.empty()); + BOOST_BEAST_EXPECT(s1.size() == 0); } { str2 s1("x"); str1 s2(s1); - BEAST_EXPECT(s2 == "x"); + BOOST_BEAST_EXPECT(s2 == "x"); str1 s3; s3 = s2; - BEAST_EXPECT(s3 == "x"); + BOOST_BEAST_EXPECT(s3 == "x"); s1 = "xy"; - BEAST_EXPECT(s1.size() == 2); - BEAST_EXPECT(s1[0] == 'x'); - BEAST_EXPECT(s1[1] == 'y'); - BEAST_EXPECT(s1.at(0) == 'x'); - BEAST_EXPECT(s1.at(1) == 'y'); - BEAST_EXPECT(s1.front() == 'x'); - BEAST_EXPECT(s1.back() == 'y'); + BOOST_BEAST_EXPECT(s1.size() == 2); + BOOST_BEAST_EXPECT(s1[0] == 'x'); + BOOST_BEAST_EXPECT(s1[1] == 'y'); + BOOST_BEAST_EXPECT(s1.at(0) == 'x'); + BOOST_BEAST_EXPECT(s1.at(1) == 'y'); + BOOST_BEAST_EXPECT(s1.front() == 'x'); + BOOST_BEAST_EXPECT(s1.back() == 'y'); auto const s4 = s1; - BEAST_EXPECT(s4[0] == 'x'); - BEAST_EXPECT(s4[1] == 'y'); - BEAST_EXPECT(s4.at(0) == 'x'); - BEAST_EXPECT(s4.at(1) == 'y'); - BEAST_EXPECT(s4.front() == 'x'); - BEAST_EXPECT(s4.back() == 'y'); + BOOST_BEAST_EXPECT(s4[0] == 'x'); + BOOST_BEAST_EXPECT(s4[1] == 'y'); + BOOST_BEAST_EXPECT(s4.at(0) == 'x'); + BOOST_BEAST_EXPECT(s4.at(1) == 'y'); + BOOST_BEAST_EXPECT(s4.front() == 'x'); + BOOST_BEAST_EXPECT(s4.back() == 'y'); try { s3 = s1; @@ -1436,22 +1439,22 @@ public: void testToStaticString() { - BEAST_EXPECT(to_static_string(0) == "0"); - BEAST_EXPECT(to_static_string(1) == "1"); - BEAST_EXPECT(to_static_string(0xffff) == "65535"); - BEAST_EXPECT(to_static_string(0x10000) == "65536"); - BEAST_EXPECT(to_static_string(0xffffffff) == "4294967295"); + BOOST_BEAST_EXPECT(to_static_string(0) == "0"); + BOOST_BEAST_EXPECT(to_static_string(1) == "1"); + BOOST_BEAST_EXPECT(to_static_string(0xffff) == "65535"); + BOOST_BEAST_EXPECT(to_static_string(0x10000) == "65536"); + BOOST_BEAST_EXPECT(to_static_string(0xffffffff) == "4294967295"); - BEAST_EXPECT(to_static_string(-1) == "-1"); - BEAST_EXPECT(to_static_string(-65535) == "-65535"); - BEAST_EXPECT(to_static_string(-65536) == "-65536"); - BEAST_EXPECT(to_static_string(-4294967295ll) == "-4294967295"); + BOOST_BEAST_EXPECT(to_static_string(-1) == "-1"); + BOOST_BEAST_EXPECT(to_static_string(-65535) == "-65535"); + BOOST_BEAST_EXPECT(to_static_string(-65536) == "-65536"); + BOOST_BEAST_EXPECT(to_static_string(-4294967295ll) == "-4294967295"); - BEAST_EXPECT(to_static_string(0) == "0"); - BEAST_EXPECT(to_static_string(1) == "1"); - BEAST_EXPECT(to_static_string(0xffff) == "65535"); - BEAST_EXPECT(to_static_string(0x10000) == "65536"); - BEAST_EXPECT(to_static_string(0xffffffff) == "4294967295"); + BOOST_BEAST_EXPECT(to_static_string(0) == "0"); + BOOST_BEAST_EXPECT(to_static_string(1) == "1"); + BOOST_BEAST_EXPECT(to_static_string(0xffff) == "65535"); + BOOST_BEAST_EXPECT(to_static_string(0x10000) == "65536"); + BOOST_BEAST_EXPECT(to_static_string(0xffffffff) == "4294967295"); } void @@ -1471,6 +1474,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(static_string,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(static_string,core,beast); } // beast +} // boost diff --git a/test/core/string.cpp b/test/core/string.cpp index c8afa23c..6328dcc3 100644 --- a/test/core/string.cpp +++ b/test/core/string.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/core/string_param.cpp b/test/core/string_param.cpp index 4ccfc9a0..7035926d 100644 --- a/test/core/string_param.cpp +++ b/test/core/string_param.cpp @@ -4,13 +4,16 @@ // 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 +#include -#include -#include +#include +#include +namespace boost { namespace beast { class string_param_test : public unit_test::suite @@ -21,7 +24,7 @@ public: void check(string_param const& v, string_view s) { - BEAST_EXPECT(static_cast(v) == s); + BOOST_BEAST_EXPECT(static_cast(v) == s); } class repeater @@ -74,6 +77,7 @@ public: } }; -BEAST_DEFINE_TESTSUITE(string_param,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(string_param,core,beast); } // beast +} // boost diff --git a/test/core/type_traits.cpp b/test/core/type_traits.cpp index 3aaae4a4..10c85322 100644 --- a/test/core/type_traits.cpp +++ b/test/core/type_traits.cpp @@ -4,15 +4,18 @@ // 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 +#include #include #include #include #include +namespace boost { namespace beast { namespace detail { @@ -160,3 +163,4 @@ BOOST_STATIC_ASSERT(! is_sync_write_stream::value); } // (anonymous) } // beast +} // boost diff --git a/test/core/zlib.cpp b/test/core/zlib.cpp index cb963dce..6662e61c 100644 --- a/test/core/zlib.cpp +++ b/test/core/zlib.cpp @@ -4,6 +4,8 @@ // 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 @@ -15,6 +17,7 @@ #include #include +namespace boost { namespace beast { namespace zlib { @@ -229,4 +232,4 @@ BEAST_DEFINE_TESTSUITE(zlib,core,beast); } // zlib } // beast - +} // boost diff --git a/test/exemplars.cpp b/test/exemplars.cpp index 401b6923..c7d99482 100644 --- a/test/exemplars.cpp +++ b/test/exemplars.cpp @@ -4,15 +4,18 @@ // 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 +// -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include +namespace boost { namespace beast { namespace http { @@ -343,3 +346,4 @@ struct File } // http } // beast +} // boost diff --git a/test/http.cpp b/test/http.cpp index 66854b43..315f2f42 100644 --- a/test/http.cpp +++ b/test/http.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/http/CMakeLists.txt b/test/http/CMakeLists.txt index 8f56ce3e..d1496bb9 100644 --- a/test/http/CMakeLists.txt +++ b/test/http/CMakeLists.txt @@ -1,18 +1,26 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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(example example) -GroupSources(extras/beast extras) -GroupSources(include/beast beast) +GroupSources(extras/boost/beast extras) +GroupSources(include/boost/beast beast) GroupSources(test/http "/") add_executable (http-tests - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${EXAMPLE_INCLUDES} ${EXTRAS_INCLUDES} + Jamfile message_fuzz.hpp test_parser.hpp - ../../extras/beast/unit_test/main.cpp + ../../extras/boost/beast/unit_test/main.cpp basic_dynamic_body.cpp basic_file_body.cpp basic_parser.cpp diff --git a/test/http/Jamfile b/test/http/Jamfile index 974275fe..c361f8e7 100644 --- a/test/http/Jamfile +++ b/test/http/Jamfile @@ -4,9 +4,11 @@ # 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 +# unit-test http-tests : - ../../extras/beast/unit_test/main.cpp + ../../extras/boost/beast/unit_test/main.cpp basic_dynamic_body.cpp basic_file_body.cpp basic_parser.cpp diff --git a/test/http/basic_dynamic_body.cpp b/test/http/basic_dynamic_body.cpp index c9249ea0..d64fc16d 100644 --- a/test/http/basic_dynamic_body.cpp +++ b/test/http/basic_dynamic_body.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/http/basic_file_body.cpp b/test/http/basic_file_body.cpp index c6047ffa..8c923cce 100644 --- a/test/http/basic_file_body.cpp +++ b/test/http/basic_file_body.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/http/basic_parser.cpp b/test/http/basic_parser.cpp index 0716044d..6c63ae0d 100644 --- a/test/http/basic_parser.cpp +++ b/test/http/basic_parser.cpp @@ -4,23 +4,26 @@ // 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 +#include #include "message_fuzz.hpp" #include "test_parser.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +namespace boost { namespace beast { namespace http { @@ -52,7 +55,7 @@ public: void operator()(Parser const& p) const { - s_.BEAST_EXPECT(p.version == version_); + s_.BOOST_BEAST_EXPECT(p.version == version_); } }; @@ -72,7 +75,7 @@ public: void operator()(Parser const& p) const { - s_.BEAST_EXPECT(p.status == status_); + s_.BOOST_BEAST_EXPECT(p.status == status_); } }; @@ -93,13 +96,13 @@ public: operator()(Parser const& p) const { if(flags_ & parse_flag::chunked) - s_.BEAST_EXPECT(p.is_chunked()); + s_.BOOST_BEAST_EXPECT(p.is_chunked()); if(flags_ & parse_flag::connection_keep_alive) - s_.BEAST_EXPECT(p.is_keep_alive()); + s_.BOOST_BEAST_EXPECT(p.is_keep_alive()); if(flags_ & parse_flag::connection_close) - s_.BEAST_EXPECT(! p.is_keep_alive()); + s_.BOOST_BEAST_EXPECT(! p.is_keep_alive()); if(flags_ & parse_flag::upgrade) - s_.BEAST_EXPECT(! p.is_upgrade()); + s_.BOOST_BEAST_EXPECT(! p.is_upgrade()); } }; @@ -119,7 +122,7 @@ public: void operator()(Parser const& p) const { - s_.BEAST_EXPECT(p.is_keep_alive() == v_); + s_.BOOST_BEAST_EXPECT(p.is_keep_alive() == v_); } }; @@ -141,7 +144,7 @@ public: void operator()(Parser const& p) const { - s_.BEAST_EXPECT(p.body == body_); + s_.BOOST_BEAST_EXPECT(p.body == body_); } }; @@ -162,24 +165,24 @@ public: error_code ec; consuming_buffers cb{buffers}; auto n = p.put(buffer_prefix(i, cb), ec); - if(! BEAST_EXPECTS(! ec || + if(! BOOST_BEAST_EXPECTS(! ec || ec == error::need_more, ec.message())) continue; - if(! BEAST_EXPECT(! p.is_done())) + if(! BOOST_BEAST_EXPECT(! p.is_done())) continue; cb.consume(n); n = p.put(cb, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) continue; - if(! BEAST_EXPECT(n == boost::asio::buffer_size(cb))) + if(! BOOST_BEAST_EXPECT(n == boost::asio::buffer_size(cb))) continue; if(p.need_eof()) { p.put_eof(ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) continue; } - if(! BEAST_EXPECT(p.is_done())) + if(! BOOST_BEAST_EXPECT(p.is_done())) continue; test(p); } @@ -192,14 +195,14 @@ public: cb.consume(i); auto n = p.put(buffer_cat( buffer_prefix(i, buffers), cb), ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) continue; - if(! BEAST_EXPECT(n == size)) + if(! BOOST_BEAST_EXPECT(n == size)) continue; if(p.need_eof()) { p.put_eof(ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) continue; } test(p); @@ -246,16 +249,16 @@ public: pass(); continue; } - if(! BEAST_EXPECTS( + if(! BOOST_BEAST_EXPECTS( ec == error::need_more, ec.message())) continue; - if(! BEAST_EXPECT(! p.is_done())) + if(! BOOST_BEAST_EXPECT(! p.is_done())) continue; cb.consume(n); n = p.put(cb, ec); if(! ec) p.put_eof(ec); - BEAST_EXPECTS(ec == result, ec.message()); + BOOST_BEAST_EXPECTS(ec == result, ec.message()); } for(std::size_t i = 1; i < msg.size() - 1; ++i) { @@ -268,7 +271,7 @@ public: msg.data() + i, msg.size() - i}), ec); if(! ec) p.put_eof(ec); - BEAST_EXPECTS(ec == result, ec.message()); + BOOST_BEAST_EXPECTS(ec == result, ec.message()); } } @@ -325,7 +328,7 @@ public: parsegrind>(m, [&](parser const& p) { - BEAST_EXPECT(p.get()["f"] == value); + BOOST_BEAST_EXPECT(p.get()["f"] == value); }); }; check("x", "x"); @@ -366,12 +369,12 @@ public: "*", [&](test_parser const& p) { - BEAST_EXPECT(p.got_on_begin == 1); - BEAST_EXPECT(p.got_on_field == 2); - BEAST_EXPECT(p.got_on_header == 1); - BEAST_EXPECT(p.got_on_body == 1); - BEAST_EXPECT(p.got_on_chunk == 0); - BEAST_EXPECT(p.got_on_complete == 1); + BOOST_BEAST_EXPECT(p.got_on_begin == 1); + BOOST_BEAST_EXPECT(p.got_on_field == 2); + BOOST_BEAST_EXPECT(p.got_on_header == 1); + BOOST_BEAST_EXPECT(p.got_on_body == 1); + BOOST_BEAST_EXPECT(p.got_on_chunk == 0); + BOOST_BEAST_EXPECT(p.got_on_complete == 1); }); parsegrind>( "HTTP/1.1 200 OK\r\n" @@ -381,12 +384,12 @@ public: "*", [&](test_parser const& p) { - BEAST_EXPECT(p.got_on_begin == 1); - BEAST_EXPECT(p.got_on_field == 2); - BEAST_EXPECT(p.got_on_header == 1); - BEAST_EXPECT(p.got_on_body == 1); - BEAST_EXPECT(p.got_on_chunk == 0); - BEAST_EXPECT(p.got_on_complete == 1); + BOOST_BEAST_EXPECT(p.got_on_begin == 1); + BOOST_BEAST_EXPECT(p.got_on_field == 2); + BOOST_BEAST_EXPECT(p.got_on_header == 1); + BOOST_BEAST_EXPECT(p.got_on_body == 1); + BOOST_BEAST_EXPECT(p.got_on_chunk == 0); + BOOST_BEAST_EXPECT(p.got_on_complete == 1); }); parsegrind>( "HTTP/1.1 200 OK\r\n" @@ -397,12 +400,12 @@ public: "0\r\n\r\n", [&](test_parser const& p) { - BEAST_EXPECT(p.got_on_begin == 1); - BEAST_EXPECT(p.got_on_field == 2); - BEAST_EXPECT(p.got_on_header == 1); - BEAST_EXPECT(p.got_on_body == 1); - BEAST_EXPECT(p.got_on_chunk == 2); - BEAST_EXPECT(p.got_on_complete == 1); + BOOST_BEAST_EXPECT(p.got_on_begin == 1); + BOOST_BEAST_EXPECT(p.got_on_field == 2); + BOOST_BEAST_EXPECT(p.got_on_header == 1); + BOOST_BEAST_EXPECT(p.got_on_body == 1); + BOOST_BEAST_EXPECT(p.got_on_chunk == 2); + BOOST_BEAST_EXPECT(p.got_on_complete == 1); }); parsegrind>( "HTTP/1.1 200 OK\r\n" @@ -413,12 +416,12 @@ public: "0\r\n\r\n", [&](test_parser const& p) { - BEAST_EXPECT(p.got_on_begin == 1); - BEAST_EXPECT(p.got_on_field == 2); - BEAST_EXPECT(p.got_on_header == 1); - BEAST_EXPECT(p.got_on_body == 1); - BEAST_EXPECT(p.got_on_chunk == 2); - BEAST_EXPECT(p.got_on_complete == 1); + BOOST_BEAST_EXPECT(p.got_on_begin == 1); + BOOST_BEAST_EXPECT(p.got_on_field == 2); + BOOST_BEAST_EXPECT(p.got_on_header == 1); + BOOST_BEAST_EXPECT(p.got_on_body == 1); + BOOST_BEAST_EXPECT(p.got_on_chunk == 2); + BOOST_BEAST_EXPECT(p.got_on_complete == 1); }); } @@ -670,8 +673,8 @@ public: parsegrind

(c(s), [&](P const& p) { - BEAST_EXPECT(p.content_length()); - BEAST_EXPECT(p.content_length() && *p.content_length() == v); + BOOST_BEAST_EXPECT(p.content_length()); + BOOST_BEAST_EXPECT(p.content_length() && *p.content_length() == v); }, true); }; @@ -781,7 +784,7 @@ public: "\r\n", [&](P const& p) { - BEAST_EXPECT(p.is_upgrade()); + BOOST_BEAST_EXPECT(p.is_upgrade()); }); } @@ -805,17 +808,17 @@ public: "\r\n", [&](test_parser const& p) { - BEAST_EXPECT(p.fields.size() == 10); - BEAST_EXPECT(p.fields.at("a") == "0"); - BEAST_EXPECT(p.fields.at("b") == "1"); - BEAST_EXPECT(p.fields.at("c") == "2"); - BEAST_EXPECT(p.fields.at("d") == "3"); - BEAST_EXPECT(p.fields.at("e") == "4"); - BEAST_EXPECT(p.fields.at("f") == "5"); - BEAST_EXPECT(p.fields.at("g") == "6"); - BEAST_EXPECT(p.fields.at("h") == "7"); - BEAST_EXPECT(p.fields.at("i") == "8"); - BEAST_EXPECT(p.fields.at("j") == "9"); + BOOST_BEAST_EXPECT(p.fields.size() == 10); + BOOST_BEAST_EXPECT(p.fields.at("a") == "0"); + BOOST_BEAST_EXPECT(p.fields.at("b") == "1"); + BOOST_BEAST_EXPECT(p.fields.at("c") == "2"); + BOOST_BEAST_EXPECT(p.fields.at("d") == "3"); + BOOST_BEAST_EXPECT(p.fields.at("e") == "4"); + BOOST_BEAST_EXPECT(p.fields.at("f") == "5"); + BOOST_BEAST_EXPECT(p.fields.at("g") == "6"); + BOOST_BEAST_EXPECT(p.fields.at("h") == "7"); + BOOST_BEAST_EXPECT(p.fields.at("i") == "8"); + BOOST_BEAST_EXPECT(p.fields.at("j") == "9"); }); } @@ -834,7 +837,7 @@ public: p.header_limit(10); p.eager(true); p.put(b.data(), ec); - BEAST_EXPECTS(ec == error::header_limit, ec.message()); + BOOST_BEAST_EXPECTS(ec == error::header_limit, ec.message()); } { multi_buffer b; @@ -848,7 +851,7 @@ public: p.body_limit(1); p.eager(true); p.put(b.data(), ec); - BEAST_EXPECTS(ec == error::body_limit, ec.message()); + BOOST_BEAST_EXPECTS(ec == error::body_limit, ec.message()); } { multi_buffer b; @@ -861,7 +864,7 @@ public: p.body_limit(1); p.eager(true); p.put(b.data(), ec); - BEAST_EXPECTS(ec == error::body_limit, ec.message()); + BOOST_BEAST_EXPECTS(ec == error::body_limit, ec.message()); } { multi_buffer b; @@ -877,7 +880,7 @@ public: p.body_limit(1); p.eager(true); p.put(b.data(), ec); - BEAST_EXPECTS(ec == error::body_limit, ec.message()); + BOOST_BEAST_EXPECTS(ec == error::body_limit, ec.message()); } } @@ -911,7 +914,7 @@ public: "0\r\n\r\n" ,[&](test_parser const& p) { - BEAST_EXPECT(p.body == "abcd"); + BOOST_BEAST_EXPECT(p.body == "abcd"); }); parsegrind>( "HTTP/1.1 200 OK\r\n" @@ -929,7 +932,7 @@ public: "\r\n" ,[&](test_parser const& p) { - BEAST_EXPECT(p.body == "*****--"); + BOOST_BEAST_EXPECT(p.body == "*****--"); }); parsegrind>( @@ -962,8 +965,8 @@ public: "GET / HTTP/1.0\r\n" "\r\n" ), p, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(p.is_done()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(p.is_done()); } { error_code ec; @@ -972,8 +975,8 @@ public: "GET / HTTP/1.1\r\n" "\r\n" ), p, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(p.is_done()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(p.is_done()); } // response without Content-Length or @@ -985,9 +988,9 @@ public: "HTTP/1.0 200 OK\r\n" "\r\n" ), p, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(! p.is_done()); - BEAST_EXPECT(p.need_eof()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(! p.is_done()); + BOOST_BEAST_EXPECT(p.need_eof()); } // 304 "Not Modified" response does not require eof @@ -998,8 +1001,8 @@ public: "HTTP/1.0 304 Not Modified\r\n" "\r\n" ), p, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(p.is_done()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(p.is_done()); } // Chunked response does not require eof @@ -1011,13 +1014,13 @@ public: "Transfer-Encoding: chunked\r\n" "\r\n" ), p, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(! p.is_done()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(! p.is_done()); feed(buf( "0\r\n\r\n" ), p, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(p.is_done()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(p.is_done()); } // restart: 1.0 assumes Connection: close @@ -1028,8 +1031,8 @@ public: "GET / HTTP/1.0\r\n" "\r\n" ), p, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(p.is_done()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(p.is_done()); } // restart: 1.1 assumes Connection: keep-alive @@ -1040,8 +1043,8 @@ public: "GET / HTTP/1.1\r\n" "\r\n" ), p, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(p.is_done()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(p.is_done()); } failgrind>( @@ -1079,9 +1082,9 @@ public: "die!"; p.put(boost::asio::buffer( s.data(), s.size()), ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(p.is_done()); + BOOST_BEAST_EXPECT(p.is_done()); } // https://github.com/vinniefalco/Beast/issues/496 @@ -1099,7 +1102,7 @@ public: "0\r\n\r\n" ,[&](P const& p) { - BEAST_EXPECT(p.body == "abcd"); + BOOST_BEAST_EXPECT(p.body == "abcd"); }); } @@ -1137,7 +1140,7 @@ public: p.eager(true); p.put(boost::asio::const_buffers_1{ msg.data(), msg.size()}, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); grind(msg); }; auto const bad = @@ -1154,7 +1157,7 @@ public: p.eager(true); p.put(boost::asio::const_buffers_1{ msg.data(), msg.size()}, ec); - BEAST_EXPECT(ec); + BOOST_BEAST_EXPECT(ec); grind(msg); }; chunkExtensionsTest(good, bad); @@ -1189,7 +1192,7 @@ public: error_code ec; test_parser p; feed(boost::asio::buffer(buf, sizeof(buf)), p, ec); - BEAST_EXPECT(ec); + BOOST_BEAST_EXPECT(ec); } //-------------------------------------------------------------------------- @@ -1218,7 +1221,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(basic_parser,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(basic_parser,http,beast); } // http } // beast +} // boost diff --git a/test/http/buffer_body.cpp b/test/http/buffer_body.cpp index 2526a3c0..6094358c 100644 --- a/test/http/buffer_body.cpp +++ b/test/http/buffer_body.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/http/chunk_encode.cpp b/test/http/chunk_encode.cpp index ea8ee094..72664def 100644 --- a/test/http/chunk_encode.cpp +++ b/test/http/chunk_encode.cpp @@ -4,19 +4,22 @@ // 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 +#include #include "message_fuzz.hpp" -#include -#include -#include -#include +#include +#include +#include +#include #include #include +namespace boost { namespace beast { namespace http { @@ -51,11 +54,11 @@ public: check(string_view match, Args&&... args) { T t{std::forward(args)...}; - BEAST_EXPECT(to_string(t) == match); + BOOST_BEAST_EXPECT(to_string(t) == match); T t2{t}; - BEAST_EXPECT(to_string(t2) == match); + BOOST_BEAST_EXPECT(to_string(t2) == match); T t3{std::move(t2)}; - BEAST_EXPECT(to_string(t3) == match); + BOOST_BEAST_EXPECT(to_string(t3) == match); } template @@ -63,11 +66,11 @@ public: check_fwd(string_view match, Args&&... args) { T t{std::forward(args)...}; - BEAST_EXPECT(to_string(t) == match); + BOOST_BEAST_EXPECT(to_string(t) == match); T t2{t}; - BEAST_EXPECT(to_string(t2) == match); + BOOST_BEAST_EXPECT(to_string(t2) == match); T t3{std::move(t2)}; - BEAST_EXPECT(to_string(t3) == match); + BOOST_BEAST_EXPECT(to_string(t3) == match); } using cb_t = boost::asio::const_buffers_1; @@ -217,20 +220,20 @@ public: }; chunk_extensions ce; ce.insert("x"); - BEAST_EXPECT(ce.str() == ";x"); - BEAST_EXPECT(str(ce) == "x,"); + BOOST_BEAST_EXPECT(ce.str() == ";x"); + BOOST_BEAST_EXPECT(str(ce) == "x,"); ce.insert("y", "z"); - BEAST_EXPECT(ce.str() == ";x;y=z"); - BEAST_EXPECT(str(ce) == "x,y,z,"); + BOOST_BEAST_EXPECT(ce.str() == ";x;y=z"); + BOOST_BEAST_EXPECT(str(ce) == "x,y,z,"); ce.insert("z", R"(")"); - BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"")"); - BEAST_EXPECT(str(ce) == R"(x,y,z,z,",)"); + BOOST_BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"")"); + BOOST_BEAST_EXPECT(str(ce) == R"(x,y,z,z,",)"); ce.insert("p", R"(\)"); - BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"";p="\\")"); - BEAST_EXPECT(str(ce) == R"(x,y,z,z,",p,\,)"); + BOOST_BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"";p="\\")"); + BOOST_BEAST_EXPECT(str(ce) == R"(x,y,z,z,",p,\,)"); ce.insert("q", R"(1"2\)"); - BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"";p="\\";q="1\"2\\")"); - BEAST_EXPECT(str(ce) == R"(x,y,z,z,",p,\,q,1"2\,)"); + BOOST_BEAST_EXPECT(ce.str() == R"(;x;y=z;z="\"";p="\\";q="1\"2\\")"); + BOOST_BEAST_EXPECT(str(ce) == R"(x,y,z,z,",p,\,q,1"2\,)"); } void @@ -256,7 +259,7 @@ public: } chunk_extensions c2; c2.parse(c1.str(), ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; chunk_extensions c3; for(auto const& v : c2) @@ -264,7 +267,7 @@ public: c3.insert(v.first); else c3.insert(v.first, v.second); - BEAST_EXPECTS(c2.str() == c3.str(), c3.str()); + BOOST_BEAST_EXPECTS(c2.str() == c3.str(), c3.str()); }); } }; @@ -274,7 +277,7 @@ public: error_code ec; chunk_extensions ce; ce.parse(s, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); grind(s); }; auto const bad = @@ -283,7 +286,7 @@ public: error_code ec; chunk_extensions ce; ce.parse(s, ec); - BEAST_EXPECT(ec); + BOOST_BEAST_EXPECT(ec); grind(s); }; chunkExtensionsTest(good, bad); @@ -301,8 +304,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(chunk_encode,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(chunk_encode,http,beast); } // http } // beast - +} // boost diff --git a/test/http/doc_examples.cpp b/test/http/doc_examples.cpp index f43fc7e2..1b6222cc 100644 --- a/test/http/doc_examples.cpp +++ b/test/http/doc_examples.cpp @@ -4,28 +4,31 @@ // 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 +// #include "example/doc/http_examples.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include #include +namespace boost { namespace beast { namespace http { @@ -71,7 +74,7 @@ public: flat_buffer buffer; receive_expect_100_continue( p.server, buffer, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); }, [&](yield_context) { @@ -87,7 +90,7 @@ public: error_code ec; send_expect_100_continue( p.client, buffer, req, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); }); } @@ -102,8 +105,8 @@ public: test::pipe p{ios_}; error_code ec; send_cgi_response(child.server, p.client, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(equal_body(p.server.str(), s)); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(equal_body(p.server.str(), s)); } void @@ -124,7 +127,7 @@ public: error_code ec; write(downstream.client, req); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); downstream.client.close(); flat_buffer buffer; @@ -135,8 +138,8 @@ public: h.erase("Content-Length"); h.set("Transfer-Encoding", "chunked"); }); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(equal_body( + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(equal_body( upstream.server.str(), req.body)); } @@ -153,8 +156,8 @@ public: flat_buffer buffer; response res; read_istream(is, buffer, res, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(boost::lexical_cast< + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(boost::lexical_cast< std::string>(res) == s); } @@ -169,8 +172,8 @@ public: req.insert(field::user_agent, "test"); error_code ec; write_ostream(os, req, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(boost::lexical_cast< + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(boost::lexical_cast< std::string>(req) == os.str()); } @@ -189,7 +192,7 @@ public: custom_parser p; p.put(boost::asio::buffer( s.data(), s.size()), ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); } { string_view s{ @@ -206,7 +209,7 @@ public: custom_parser p; p.put(boost::asio::buffer( s.data(), s.size()), ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); } } @@ -220,14 +223,14 @@ public: error_code ec; flat_buffer buffer; do_server_head(p.server, buffer, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); }, [&](yield_context) { error_code ec; flat_buffer buffer; auto res = do_head_request(p.client, buffer, "/", ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); }); } @@ -263,7 +266,7 @@ public: handler h; flat_buffer buffer; do_form_request(p.server, buffer, h); - BEAST_EXPECT(h.body == "Hello, world!"); + BOOST_BEAST_EXPECT(h.body == "Hello, world!"); } //-------------------------------------------------------------------------- @@ -283,8 +286,8 @@ public: flat_buffer b; std::stringstream ss; read_and_print_body(ss, c.server, b, ec); - if(BEAST_EXPECTS(! ec, ec.message())) - BEAST_EXPECT(ss.str() == s); + if(BOOST_BEAST_EXPECTS(! ec, ec.message())) + BOOST_BEAST_EXPECT(ss.str() == s); } //-------------------------------------------------------------------------- @@ -339,7 +342,7 @@ public: trailers, std::allocator{} ), ec); - BEAST_EXPECT( + BOOST_BEAST_EXPECT( boost::lexical_cast( buffers(p.server.buffer.data())) == "HTTP/1.1 200 OK\r\n" @@ -391,8 +394,8 @@ public: flat_buffer b; std::stringstream ss; print_chunked_body(ss, c.client, b, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(ss.str() == + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(ss.str() == "Chunk Body: First\n" "Extension: quality = 1.0\n" "Chunk Body: Hello, world!\n" @@ -425,7 +428,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(doc_examples,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(doc_examples,http,beast); } // http } // beast +} // boost diff --git a/test/http/doc_snippets.cpp b/test/http/doc_snippets.cpp index 20540927..b4b4efc2 100644 --- a/test/http/doc_snippets.cpp +++ b/test/http/doc_snippets.cpp @@ -4,19 +4,21 @@ // 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 +// -#include +#include #include #include #include #include -using namespace beast; +using namespace boost::beast; //[http_snippet_1 -#include -using namespace beast::http; +#include +using namespace boost::beast::http; //] diff --git a/test/http/dynamic_body.cpp b/test/http/dynamic_body.cpp index 37e3fb5d..4c5b1137 100644 --- a/test/http/dynamic_body.cpp +++ b/test/http/dynamic_body.cpp @@ -4,19 +4,22 @@ // 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 +#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include +namespace boost { namespace beast { namespace http { @@ -39,13 +42,14 @@ public: multi_buffer b; read(ss, b, p); auto const& m = p.get(); - BEAST_EXPECT(boost::lexical_cast( + BOOST_BEAST_EXPECT(boost::lexical_cast( buffers(m.body.data())) == "xyz"); - BEAST_EXPECT(boost::lexical_cast(m) == s); + BOOST_BEAST_EXPECT(boost::lexical_cast(m) == s); } }; -BEAST_DEFINE_TESTSUITE(dynamic_body,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(dynamic_body,http,beast); } // http } // beast +} // boost diff --git a/test/http/empty_body.cpp b/test/http/empty_body.cpp index a1fdfd5e..87fff149 100644 --- a/test/http/empty_body.cpp +++ b/test/http/empty_body.cpp @@ -4,10 +4,13 @@ // 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 +#include +namespace boost { namespace beast { namespace http { @@ -17,3 +20,4 @@ BOOST_STATIC_ASSERT(is_body_writer::value); } // http } // beast +} // boost diff --git a/test/http/error.cpp b/test/http/error.cpp index 7489b372..61e16f95 100644 --- a/test/http/error.cpp +++ b/test/http/error.cpp @@ -4,13 +4,16 @@ // 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 +#include -#include +#include #include +namespace boost { namespace beast { namespace http { @@ -21,15 +24,15 @@ public: check(char const* name, error ev) { auto const ec = make_error_code(ev); - BEAST_EXPECT(std::string(ec.category().name()) == name); - BEAST_EXPECT(! ec.message().empty()); - BEAST_EXPECT(std::addressof(ec.category()) == + BOOST_BEAST_EXPECT(std::string(ec.category().name()) == name); + BOOST_BEAST_EXPECT(! ec.message().empty()); + BOOST_BEAST_EXPECT(std::addressof(ec.category()) == std::addressof(detail::get_http_error_category())); - BEAST_EXPECT(detail::get_http_error_category().equivalent( + BOOST_BEAST_EXPECT(detail::get_http_error_category().equivalent( static_cast::type>(ev), ec.category().default_error_condition( static_cast::type>(ev)))); - BEAST_EXPECT(detail::get_http_error_category().equivalent( + BOOST_BEAST_EXPECT(detail::get_http_error_category().equivalent( ec, static_cast::type>(ev))); } @@ -62,7 +65,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(error,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(error,http,beast); } // http } // beast +} // boost diff --git a/test/http/field.cpp b/test/http/field.cpp index c44f48cc..c6a3aca6 100644 --- a/test/http/field.cpp +++ b/test/http/field.cpp @@ -4,12 +4,15 @@ // 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 +#include -#include +#include +namespace boost { namespace beast { namespace http { @@ -22,8 +25,8 @@ public: auto const match = [&](field f, string_view s) { - BEAST_EXPECT(iequals(to_string(f), s)); - BEAST_EXPECT(string_to_field(s) == f); + BOOST_BEAST_EXPECT(iequals(to_string(f), s)); + BOOST_BEAST_EXPECT(string_to_field(s) == f); }; match(field::accept, "accept"); @@ -386,7 +389,7 @@ public: auto const unknown = [&](string_view s) { - BEAST_EXPECT(string_to_field(s) == field::unknown); + BOOST_BEAST_EXPECT(string_to_field(s) == field::unknown); }; unknown(""); unknown("x"); @@ -399,7 +402,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(field,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(field,http,beast); } // http } // beast +} // boost diff --git a/test/http/fields.cpp b/test/http/fields.cpp index 0958952d..99fbd957 100644 --- a/test/http/fields.cpp +++ b/test/http/fields.cpp @@ -4,17 +4,20 @@ // 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 +#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include +namespace boost { namespace beast { namespace http { @@ -78,13 +81,13 @@ public: { { fields f; - BEAST_EXPECT(f.begin() == f.end()); + BOOST_BEAST_EXPECT(f.begin() == f.end()); } { unequal_t a1; basic_fields f{a1}; - BEAST_EXPECT(f.get_allocator() == a1); - BEAST_EXPECT(f.get_allocator() != unequal_t{}); + BOOST_BEAST_EXPECT(f.get_allocator() == a1); + BOOST_BEAST_EXPECT(f.get_allocator() != unequal_t{}); } } @@ -92,13 +95,13 @@ public: { { basic_fields f1; - BEAST_EXPECT(f1.get_allocator()->nmove == 0); + BOOST_BEAST_EXPECT(f1.get_allocator()->nmove == 0); f1.insert("1", "1"); - BEAST_EXPECT(f1["1"] == "1"); + BOOST_BEAST_EXPECT(f1["1"] == "1"); basic_fields f2{std::move(f1)}; - BEAST_EXPECT(f2.get_allocator()->nmove == 1); - BEAST_EXPECT(f2["1"] == "1"); - BEAST_EXPECT(f1["1"] == ""); + BOOST_BEAST_EXPECT(f2.get_allocator()->nmove == 1); + BOOST_BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f1["1"] == ""); } // allocators equal { @@ -106,8 +109,8 @@ public: f1.insert("1", "1"); equal_t a; basic_fields f2{std::move(f1), a}; - BEAST_EXPECT(f2["1"] == "1"); - BEAST_EXPECT(f1["1"] == ""); + BOOST_BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f1["1"] == ""); } { // allocators unequal @@ -115,7 +118,7 @@ public: f1.insert("1", "1"); unequal_t a; basic_fields f2{std::move(f1), a}; - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f2["1"] == "1"); } } @@ -125,34 +128,34 @@ public: basic_fields f1; f1.insert("1", "1"); basic_fields f2{f1}; - BEAST_EXPECT(f1.get_allocator() == f2.get_allocator()); - BEAST_EXPECT(f1["1"] == "1"); - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f1.get_allocator() == f2.get_allocator()); + BOOST_BEAST_EXPECT(f1["1"] == "1"); + BOOST_BEAST_EXPECT(f2["1"] == "1"); } { basic_fields f1; f1.insert("1", "1"); unequal_t a; basic_fields f2(f1, a); - BEAST_EXPECT(f1.get_allocator() != f2.get_allocator()); - BEAST_EXPECT(f1["1"] == "1"); - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f1.get_allocator() != f2.get_allocator()); + BOOST_BEAST_EXPECT(f1["1"] == "1"); + BOOST_BEAST_EXPECT(f2["1"] == "1"); } { basic_fields f1; f1.insert("1", "1"); basic_fields f2(f1); - BEAST_EXPECT(f1["1"] == "1"); - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f1["1"] == "1"); + BOOST_BEAST_EXPECT(f2["1"] == "1"); } { basic_fields f1; f1.insert("1", "1"); equal_t a; basic_fields f2(f1, a); - BEAST_EXPECT(f2.get_allocator() == a); - BEAST_EXPECT(f1["1"] == "1"); - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f2.get_allocator() == a); + BOOST_BEAST_EXPECT(f1["1"] == "1"); + BOOST_BEAST_EXPECT(f2["1"] == "1"); } } @@ -163,8 +166,8 @@ public: f1.insert("1", "1"); fields f2; f2 = std::move(f1); - BEAST_EXPECT(f1.begin() == f1.end()); - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f1.begin() == f1.end()); + BOOST_BEAST_EXPECT(f2["1"] == "1"); } { // propagate_on_container_move_assignment : true @@ -174,8 +177,8 @@ public: f1.insert("1", "1"); basic_fields f2; f2 = std::move(f1); - BEAST_EXPECT(f1.begin() == f1.end()); - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f1.begin() == f1.end()); + BOOST_BEAST_EXPECT(f2["1"] == "1"); } { // propagate_on_container_move_assignment : false @@ -185,8 +188,8 @@ public: f1.insert("1", "1"); basic_fields f2; f2 = std::move(f1); - BEAST_EXPECT(f1.begin() == f1.end()); - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f1.begin() == f1.end()); + BOOST_BEAST_EXPECT(f2["1"] == "1"); } } @@ -197,11 +200,11 @@ public: f1.insert("1", "1"); fields f2; f2 = f1; - BEAST_EXPECT(f1["1"] == "1"); - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f1["1"] == "1"); + BOOST_BEAST_EXPECT(f2["1"] == "1"); basic_fields f3; f3 = f2; - BEAST_EXPECT(f3["1"] == "1"); + BOOST_BEAST_EXPECT(f3["1"] == "1"); } { // propagate_on_container_copy_assignment : true @@ -211,7 +214,7 @@ public: f1.insert("1", "1"); basic_fields f2; f2 = f1; - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f2["1"] == "1"); } { // propagate_on_container_copy_assignment : false @@ -221,7 +224,7 @@ public: f1.insert("1", "1"); basic_fields f2; f2 = f1; - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f2["1"] == "1"); } } @@ -232,45 +235,45 @@ public: using pocs_t = test::test_allocator; pocs_t a1, a2; - BEAST_EXPECT(a1 != a2); + BOOST_BEAST_EXPECT(a1 != a2); basic_fields f1{a1}; f1.insert("1", "1"); basic_fields f2{a2}; - BEAST_EXPECT(f1.get_allocator() == a1); - BEAST_EXPECT(f2.get_allocator() == a2); + BOOST_BEAST_EXPECT(f1.get_allocator() == a1); + BOOST_BEAST_EXPECT(f2.get_allocator() == a2); swap(f1, f2); - BEAST_EXPECT(f1.get_allocator() == a2); - BEAST_EXPECT(f2.get_allocator() == a1); - BEAST_EXPECT(f1.begin() == f1.end()); - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f1.get_allocator() == a2); + BOOST_BEAST_EXPECT(f2.get_allocator() == a1); + BOOST_BEAST_EXPECT(f1.begin() == f1.end()); + BOOST_BEAST_EXPECT(f2["1"] == "1"); swap(f1, f2); - BEAST_EXPECT(f1.get_allocator() == a1); - BEAST_EXPECT(f2.get_allocator() == a2); - BEAST_EXPECT(f1["1"] == "1"); - BEAST_EXPECT(f2.begin() == f2.end()); + BOOST_BEAST_EXPECT(f1.get_allocator() == a1); + BOOST_BEAST_EXPECT(f2.get_allocator() == a2); + BOOST_BEAST_EXPECT(f1["1"] == "1"); + BOOST_BEAST_EXPECT(f2.begin() == f2.end()); } { // propagate_on_container_swap : false using pocs_t = test::test_allocator; pocs_t a1, a2; - BEAST_EXPECT(a1 == a2); - BEAST_EXPECT(a1.id() != a2.id()); + BOOST_BEAST_EXPECT(a1 == a2); + BOOST_BEAST_EXPECT(a1.id() != a2.id()); basic_fields f1{a1}; f1.insert("1", "1"); basic_fields f2{a2}; - BEAST_EXPECT(f1.get_allocator() == a1); - BEAST_EXPECT(f2.get_allocator() == a2); + BOOST_BEAST_EXPECT(f1.get_allocator() == a1); + BOOST_BEAST_EXPECT(f2.get_allocator() == a2); swap(f1, f2); - BEAST_EXPECT(f1.get_allocator().id() == a1.id()); - BEAST_EXPECT(f2.get_allocator().id() == a2.id()); - BEAST_EXPECT(f1.begin() == f1.end()); - BEAST_EXPECT(f2["1"] == "1"); + BOOST_BEAST_EXPECT(f1.get_allocator().id() == a1.id()); + BOOST_BEAST_EXPECT(f2.get_allocator().id() == a2.id()); + BOOST_BEAST_EXPECT(f1.begin() == f1.end()); + BOOST_BEAST_EXPECT(f2["1"] == "1"); swap(f1, f2); - BEAST_EXPECT(f1.get_allocator().id() == a1.id()); - BEAST_EXPECT(f2.get_allocator().id() == a2.id()); - BEAST_EXPECT(f1["1"] == "1"); - BEAST_EXPECT(f2.begin() == f2.end()); + BOOST_BEAST_EXPECT(f1.get_allocator().id() == a1.id()); + BOOST_BEAST_EXPECT(f2.get_allocator().id() == a2.id()); + BOOST_BEAST_EXPECT(f1["1"] == "1"); + BOOST_BEAST_EXPECT(f2.begin() == f2.end()); } } @@ -278,35 +281,35 @@ public: { fields f; f.insert(field::user_agent, "x"); - BEAST_EXPECT(f.count(field::user_agent)); - BEAST_EXPECT(f.count(to_string(field::user_agent))); - BEAST_EXPECT(f.count(field::user_agent) == 1); - BEAST_EXPECT(f.count(to_string(field::user_agent)) == 1); + BOOST_BEAST_EXPECT(f.count(field::user_agent)); + BOOST_BEAST_EXPECT(f.count(to_string(field::user_agent))); + BOOST_BEAST_EXPECT(f.count(field::user_agent) == 1); + BOOST_BEAST_EXPECT(f.count(to_string(field::user_agent)) == 1); f.insert(field::user_agent, "y"); - BEAST_EXPECT(f.count(field::user_agent) == 2); + BOOST_BEAST_EXPECT(f.count(field::user_agent) == 2); } } void testHeaders() { f_t f1; - BEAST_EXPECT(empty(f1)); + BOOST_BEAST_EXPECT(empty(f1)); fill(1, f1); - BEAST_EXPECT(size(f1) == 1); + BOOST_BEAST_EXPECT(size(f1) == 1); f_t f2; f2 = f1; - BEAST_EXPECT(size(f2) == 1); + BOOST_BEAST_EXPECT(size(f2) == 1); f2.insert("2", "2"); - BEAST_EXPECT(std::distance(f2.begin(), f2.end()) == 2); + BOOST_BEAST_EXPECT(std::distance(f2.begin(), f2.end()) == 2); f1 = std::move(f2); - BEAST_EXPECT(size(f1) == 2); - BEAST_EXPECT(size(f2) == 0); + BOOST_BEAST_EXPECT(size(f1) == 2); + BOOST_BEAST_EXPECT(size(f2) == 0); f_t f3(std::move(f1)); - BEAST_EXPECT(size(f3) == 2); - BEAST_EXPECT(size(f1) == 0); + BOOST_BEAST_EXPECT(size(f3) == 2); + BOOST_BEAST_EXPECT(size(f1) == 0); self_assign(f3, std::move(f3)); - BEAST_EXPECT(size(f3) == 2); - BEAST_EXPECT(f2.erase("Not-Present") == 0); + BOOST_BEAST_EXPECT(size(f3) == 2); + BOOST_BEAST_EXPECT(f2.erase("Not-Present") == 0); } void testRFC2616() @@ -316,7 +319,7 @@ public: f.insert("a", "x"); f.insert("aa", "y"); f.insert("f", "z"); - BEAST_EXPECT(f.count("a") == 2); + BOOST_BEAST_EXPECT(f.count("a") == 2); } void testErase() @@ -326,9 +329,9 @@ public: f.insert("a", "x"); f.insert("aa", "y"); f.insert("f", "z"); - BEAST_EXPECT(size(f) == 4); + BOOST_BEAST_EXPECT(size(f) == 4); f.erase("a"); - BEAST_EXPECT(size(f) == 2); + BOOST_BEAST_EXPECT(size(f) == 2); } void @@ -341,21 +344,21 @@ public: f.insert(field::body, 2); f.insert(field::close, 3); f.insert(field::body, 4); - BEAST_EXPECT(std::next(f.begin(), 0)->name() == field::age); - BEAST_EXPECT(std::next(f.begin(), 1)->name() == field::body); - BEAST_EXPECT(std::next(f.begin(), 2)->name() == field::body); - BEAST_EXPECT(std::next(f.begin(), 3)->name() == field::close); - BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "Age"); - BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "Body"); - BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "Body"); - BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "Close"); - BEAST_EXPECT(std::next(f.begin(), 0)->value() == "1"); - BEAST_EXPECT(std::next(f.begin(), 1)->value() == "2"); - BEAST_EXPECT(std::next(f.begin(), 2)->value() == "4"); - BEAST_EXPECT(std::next(f.begin(), 3)->value() == "3"); - BEAST_EXPECT(f.erase(field::body) == 2); - BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "Age"); - BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "Close"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name() == field::age); + BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name() == field::body); + BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->name() == field::body); + BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->name() == field::close); + BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "Age"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "Body"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "Body"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "Close"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->value() == "1"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->value() == "2"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->value() == "4"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->value() == "3"); + BOOST_BEAST_EXPECT(f.erase(field::body) == 2); + BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "Age"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "Close"); } { // group fields, case insensitive @@ -364,21 +367,21 @@ public: f.insert("ab", 2); f.insert("b", 3); f.insert("AB", 4); - BEAST_EXPECT(std::next(f.begin(), 0)->name() == field::unknown); - BEAST_EXPECT(std::next(f.begin(), 1)->name() == field::unknown); - BEAST_EXPECT(std::next(f.begin(), 2)->name() == field::unknown); - BEAST_EXPECT(std::next(f.begin(), 3)->name() == field::unknown); - BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "a"); - BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "ab"); - BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "AB"); - BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "b"); - BEAST_EXPECT(std::next(f.begin(), 0)->value() == "1"); - BEAST_EXPECT(std::next(f.begin(), 1)->value() == "2"); - BEAST_EXPECT(std::next(f.begin(), 2)->value() == "4"); - BEAST_EXPECT(std::next(f.begin(), 3)->value() == "3"); - BEAST_EXPECT(f.erase("Ab") == 2); - BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "a"); - BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "b"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name() == field::unknown); + BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name() == field::unknown); + BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->name() == field::unknown); + BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->name() == field::unknown); + BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "a"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "ab"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "AB"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "b"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->value() == "1"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->value() == "2"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->value() == "4"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->value() == "3"); + BOOST_BEAST_EXPECT(f.erase("Ab") == 2); + BOOST_BEAST_EXPECT(std::next(f.begin(), 0)->name_string() == "a"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "b"); } { // verify insertion orde @@ -391,14 +394,14 @@ public: f.insert("Dd", 6); f.insert("DD", 7); f.insert( "e", 8); - BEAST_EXPECT(f.count("dd") == 4); - BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "dd"); - BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "dD"); - BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "Dd"); - BEAST_EXPECT(std::next(f.begin(), 4)->name_string() == "DD"); + BOOST_BEAST_EXPECT(f.count("dd") == 4); + BOOST_BEAST_EXPECT(std::next(f.begin(), 1)->name_string() == "dd"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 2)->name_string() == "dD"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 3)->name_string() == "Dd"); + BOOST_BEAST_EXPECT(std::next(f.begin(), 4)->name_string() == "DD"); f.set("dd", "-"); - BEAST_EXPECT(f.count("dd") == 1); - BEAST_EXPECT(f["dd"] == "-"); + BOOST_BEAST_EXPECT(f.count("dd") == 1); + BOOST_BEAST_EXPECT(f["dd"] == "-"); } } @@ -429,25 +432,25 @@ public: req.method(verb::get); req.prepare_payload(); - BEAST_EXPECT(req.count(field::content_length) == 0); - BEAST_EXPECT(req.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(req.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0); req.set(field::content_length, "0"); req.set(field::transfer_encoding, "chunked"); req.prepare_payload(); - BEAST_EXPECT(req.count(field::content_length) == 0); - BEAST_EXPECT(req.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(req.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0); req.set(field::transfer_encoding, "deflate"); req.prepare_payload(); - BEAST_EXPECT(req.count(field::content_length) == 0); - BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); + BOOST_BEAST_EXPECT(req.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); req.set(field::transfer_encoding, "deflate, chunked"); req.prepare_payload(); - BEAST_EXPECT(req.count(field::content_length) == 0); - BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); + BOOST_BEAST_EXPECT(req.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); } // GET, sized @@ -458,19 +461,19 @@ public: req.body = 50; req.prepare_payload(); - BEAST_EXPECT(req[field::content_length] == "50"); - BEAST_EXPECT(req[field::transfer_encoding] == ""); + BOOST_BEAST_EXPECT(req[field::content_length] == "50"); + BOOST_BEAST_EXPECT(req[field::transfer_encoding] == ""); req.set(field::content_length, "0"); req.set(field::transfer_encoding, "chunked"); req.prepare_payload(); - BEAST_EXPECT(req[field::content_length] == "50"); - BEAST_EXPECT(req.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(req[field::content_length] == "50"); + BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0); req.set(field::transfer_encoding, "deflate, chunked"); req.prepare_payload(); - BEAST_EXPECT(req[field::content_length] == "50"); - BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); + BOOST_BEAST_EXPECT(req[field::content_length] == "50"); + BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); } // PUT, empty @@ -480,14 +483,14 @@ public: req.method(verb::put); req.prepare_payload(); - BEAST_EXPECT(req[field::content_length] == "0"); - BEAST_EXPECT(req.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(req[field::content_length] == "0"); + BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0); req.set(field::content_length, "50"); req.set(field::transfer_encoding, "deflate, chunked"); req.prepare_payload(); - BEAST_EXPECT(req[field::content_length] == "0"); - BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); + BOOST_BEAST_EXPECT(req[field::content_length] == "0"); + BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); } // PUT, sized @@ -498,14 +501,14 @@ public: req.body = 50; req.prepare_payload(); - BEAST_EXPECT(req[field::content_length] == "50"); - BEAST_EXPECT(req.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(req[field::content_length] == "50"); + BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0); req.set(field::content_length, "25"); req.set(field::transfer_encoding, "deflate, chunked"); req.prepare_payload(); - BEAST_EXPECT(req[field::content_length] == "50"); - BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); + BOOST_BEAST_EXPECT(req[field::content_length] == "50"); + BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); } // POST, unsized @@ -515,13 +518,13 @@ public: req.method(verb::post); req.prepare_payload(); - BEAST_EXPECT(req.count(field::content_length) == 0); - BEAST_EXPECT(req[field::transfer_encoding] == "chunked"); + BOOST_BEAST_EXPECT(req.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "chunked"); req.set(field::transfer_encoding, "deflate"); req.prepare_payload(); - BEAST_EXPECT(req.count(field::content_length) == 0); - BEAST_EXPECT(req[field::transfer_encoding] == "deflate, chunked"); + BOOST_BEAST_EXPECT(req.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate, chunked"); } // POST, unsized HTTP/1.0 @@ -531,13 +534,13 @@ public: req.method(verb::post); req.prepare_payload(); - BEAST_EXPECT(req.count(field::content_length) == 0); - BEAST_EXPECT(req.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(req.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(req.count(field::transfer_encoding) == 0); req.set(field::transfer_encoding, "deflate"); req.prepare_payload(); - BEAST_EXPECT(req.count(field::content_length) == 0); - BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); + BOOST_BEAST_EXPECT(req.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(req[field::transfer_encoding] == "deflate"); } // OK, empty @@ -546,14 +549,14 @@ public: res.version = 11; res.prepare_payload(); - BEAST_EXPECT(res[field::content_length] == "0"); - BEAST_EXPECT(res.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(res[field::content_length] == "0"); + BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0); res.erase(field::content_length); res.set(field::transfer_encoding, "chunked"); res.prepare_payload(); - BEAST_EXPECT(res[field::content_length] == "0"); - BEAST_EXPECT(res.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(res[field::content_length] == "0"); + BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0); } // OK, sized @@ -563,14 +566,14 @@ public: res.body = 50; res.prepare_payload(); - BEAST_EXPECT(res[field::content_length] == "50"); - BEAST_EXPECT(res.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(res[field::content_length] == "50"); + BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0); res.erase(field::content_length); res.set(field::transfer_encoding, "chunked"); res.prepare_payload(); - BEAST_EXPECT(res[field::content_length] == "50"); - BEAST_EXPECT(res.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(res[field::content_length] == "50"); + BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0); } // OK, unsized @@ -579,8 +582,8 @@ public: res.version = 11; res.prepare_payload(); - BEAST_EXPECT(res.count(field::content_length) == 0); - BEAST_EXPECT(res[field::transfer_encoding] == "chunked"); + BOOST_BEAST_EXPECT(res.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked"); } } @@ -592,7 +595,7 @@ public: [&](bool v) { res.keep_alive(v); - BEAST_EXPECT( + BOOST_BEAST_EXPECT( (res.keep_alive() && v) || (! res.keep_alive() && ! v)); }; @@ -605,70 +608,70 @@ public: res.erase(field::connection); keep_alive(false); - BEAST_EXPECT(res.count(field::connection) == 0); + BOOST_BEAST_EXPECT(res.count(field::connection) == 0); res.set(field::connection, "close"); keep_alive(false); - BEAST_EXPECT(res.count(field::connection) == 0); + BOOST_BEAST_EXPECT(res.count(field::connection) == 0); res.set(field::connection, "keep-alive"); keep_alive(false); - BEAST_EXPECT(res.count(field::connection) == 0); + BOOST_BEAST_EXPECT(res.count(field::connection) == 0); res.set(field::connection, "keep-alive, close"); keep_alive(false); - BEAST_EXPECT(res.count(field::connection) == 0); + BOOST_BEAST_EXPECT(res.count(field::connection) == 0); res.erase(field::connection); keep_alive(true); - BEAST_EXPECT(res[field::connection] == "keep-alive"); + BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive"); res.set(field::connection, "close"); keep_alive(true); - BEAST_EXPECT(res[field::connection] == "keep-alive"); + BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive"); res.set(field::connection, "keep-alive"); keep_alive(true); - BEAST_EXPECT(res[field::connection] == "keep-alive"); + BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive"); res.set(field::connection, "keep-alive, close"); keep_alive(true); - BEAST_EXPECT(res[field::connection] == "keep-alive"); + BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive"); auto const test10 = [&](std::string s) { res.set(field::connection, s); keep_alive(false); - BEAST_EXPECT(res[field::connection] == s); + BOOST_BEAST_EXPECT(res[field::connection] == s); res.set(field::connection, s + ", close"); keep_alive(false); - BEAST_EXPECT(res[field::connection] == s); + BOOST_BEAST_EXPECT(res[field::connection] == s); res.set(field::connection, "keep-alive, " + s); keep_alive(false); - BEAST_EXPECT(res[field::connection] == s); + BOOST_BEAST_EXPECT(res[field::connection] == s); res.set(field::connection, "keep-alive, " + s + ", close"); keep_alive(false); - BEAST_EXPECT(res[field::connection] == s); + BOOST_BEAST_EXPECT(res[field::connection] == s); res.set(field::connection, s); keep_alive(true); - BEAST_EXPECT(res[field::connection] == s + ", keep-alive"); + BOOST_BEAST_EXPECT(res[field::connection] == s + ", keep-alive"); res.set(field::connection, s + ", close"); keep_alive(true); - BEAST_EXPECT(res[field::connection] == s + ", keep-alive"); + BOOST_BEAST_EXPECT(res[field::connection] == s + ", keep-alive"); res.set(field::connection, "keep-alive, " + s); keep_alive(true); - BEAST_EXPECT(res[field::connection] == "keep-alive, " + s); + BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive, " + s); res.set(field::connection, "keep-alive, " + s+ ", close"); keep_alive(true); - BEAST_EXPECT(res[field::connection] == "keep-alive, " + s); + BOOST_BEAST_EXPECT(res[field::connection] == "keep-alive, " + s); }; test10("foo"); @@ -679,70 +682,70 @@ public: res.erase(field::connection); keep_alive(true); - BEAST_EXPECT(res.count(field::connection) == 0); + BOOST_BEAST_EXPECT(res.count(field::connection) == 0); res.set(field::connection, "close"); keep_alive(true); - BEAST_EXPECT(res.count(field::connection) == 0); + BOOST_BEAST_EXPECT(res.count(field::connection) == 0); res.set(field::connection, "keep-alive"); keep_alive(true); - BEAST_EXPECT(res.count(field::connection) == 0); + BOOST_BEAST_EXPECT(res.count(field::connection) == 0); res.set(field::connection, "keep-alive, close"); keep_alive(true); - BEAST_EXPECT(res.count(field::connection) == 0); + BOOST_BEAST_EXPECT(res.count(field::connection) == 0); res.erase(field::connection); keep_alive(false); - BEAST_EXPECT(res[field::connection] == "close"); + BOOST_BEAST_EXPECT(res[field::connection] == "close"); res.set(field::connection, "close"); keep_alive(false); - BEAST_EXPECT(res[field::connection] == "close"); + BOOST_BEAST_EXPECT(res[field::connection] == "close"); res.set(field::connection, "keep-alive"); keep_alive(false); - BEAST_EXPECT(res[field::connection] == "close"); + BOOST_BEAST_EXPECT(res[field::connection] == "close"); res.set(field::connection, "keep-alive, close"); keep_alive(false); - BEAST_EXPECT(res[field::connection] == "close"); + BOOST_BEAST_EXPECT(res[field::connection] == "close"); auto const test11 = [&](std::string s) { res.set(field::connection, s); keep_alive(true); - BEAST_EXPECT(res[field::connection] == s); + BOOST_BEAST_EXPECT(res[field::connection] == s); res.set(field::connection, s + ", close"); keep_alive(true); - BEAST_EXPECT(res[field::connection] == s); + BOOST_BEAST_EXPECT(res[field::connection] == s); res.set(field::connection, "keep-alive, " + s); keep_alive(true); - BEAST_EXPECT(res[field::connection] == s); + BOOST_BEAST_EXPECT(res[field::connection] == s); res.set(field::connection, "keep-alive, " + s + ", close"); keep_alive(true); - BEAST_EXPECT(res[field::connection] == s); + BOOST_BEAST_EXPECT(res[field::connection] == s); res.set(field::connection, s); keep_alive(false); - BEAST_EXPECT(res[field::connection] == s + ", close"); + BOOST_BEAST_EXPECT(res[field::connection] == s + ", close"); res.set(field::connection, "close, " + s); keep_alive(false); - BEAST_EXPECT(res[field::connection] == "close, " + s); + BOOST_BEAST_EXPECT(res[field::connection] == "close, " + s); res.set(field::connection, "keep-alive, " + s); keep_alive(false); - BEAST_EXPECT(res[field::connection] == s + ", close"); + BOOST_BEAST_EXPECT(res[field::connection] == s + ", close"); res.set(field::connection, "close, " + s + ", keep-alive"); keep_alive(false); - BEAST_EXPECT(res[field::connection] == "close, " + s); + BOOST_BEAST_EXPECT(res[field::connection] == "close, " + s); }; test11("foo"); @@ -753,79 +756,79 @@ public: testContentLength() { response res{status::ok, 11}; - BEAST_EXPECT(res.count(field::content_length) == 0); - BEAST_EXPECT(res.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(res.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0); res.content_length(0); - BEAST_EXPECT(res[field::content_length] == "0"); + BOOST_BEAST_EXPECT(res[field::content_length] == "0"); res.content_length(100); - BEAST_EXPECT(res[field::content_length] == "100"); + BOOST_BEAST_EXPECT(res[field::content_length] == "100"); res.content_length(boost::none); - BEAST_EXPECT(res.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(res.count(field::content_length) == 0); res.set(field::transfer_encoding, "chunked"); res.content_length(0); - BEAST_EXPECT(res[field::content_length] == "0"); - BEAST_EXPECT(res.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(res[field::content_length] == "0"); + BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0); res.set(field::transfer_encoding, "chunked"); res.content_length(100); - BEAST_EXPECT(res[field::content_length] == "100"); - BEAST_EXPECT(res.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(res[field::content_length] == "100"); + BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0); res.set(field::transfer_encoding, "chunked"); res.content_length(boost::none); - BEAST_EXPECT(res.count(field::content_length) == 0); - BEAST_EXPECT(res.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(res.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0); auto const check = [&](std::string s) { res.set(field::transfer_encoding, s); res.content_length(0); - BEAST_EXPECT(res[field::content_length] == "0"); - BEAST_EXPECT(res[field::transfer_encoding] == s); + BOOST_BEAST_EXPECT(res[field::content_length] == "0"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s); res.set(field::transfer_encoding, s); res.content_length(100); - BEAST_EXPECT(res[field::content_length] == "100"); - BEAST_EXPECT(res[field::transfer_encoding] == s); + BOOST_BEAST_EXPECT(res[field::content_length] == "100"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s); res.set(field::transfer_encoding, s); res.content_length(boost::none); - BEAST_EXPECT(res.count(field::content_length) == 0); - BEAST_EXPECT(res[field::transfer_encoding] == s); + BOOST_BEAST_EXPECT(res.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s); res.set(field::transfer_encoding, s + ", chunked"); res.content_length(0); - BEAST_EXPECT(res[field::content_length] == "0"); - BEAST_EXPECT(res[field::transfer_encoding] == s); + BOOST_BEAST_EXPECT(res[field::content_length] == "0"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s); res.set(field::transfer_encoding, s + ", chunked"); res.content_length(100); - BEAST_EXPECT(res[field::content_length] == "100"); - BEAST_EXPECT(res[field::transfer_encoding] == s); + BOOST_BEAST_EXPECT(res[field::content_length] == "100"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s); res.set(field::transfer_encoding, s + ", chunked"); res.content_length(boost::none); - BEAST_EXPECT(res.count(field::content_length) == 0); - BEAST_EXPECT(res[field::transfer_encoding] == s); + BOOST_BEAST_EXPECT(res.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == s); res.set(field::transfer_encoding, "chunked, " + s); res.content_length(0); - BEAST_EXPECT(res[field::content_length] == "0"); - BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s); + BOOST_BEAST_EXPECT(res[field::content_length] == "0"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s); res.set(field::transfer_encoding, "chunked, " + s); res.content_length(100); - BEAST_EXPECT(res[field::content_length] == "100"); - BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s); + BOOST_BEAST_EXPECT(res[field::content_length] == "100"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s); res.set(field::transfer_encoding, "chunked, " + s); res.content_length(boost::none); - BEAST_EXPECT(res.count(field::content_length) == 0); - BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s); + BOOST_BEAST_EXPECT(res.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, " + s); }; check("foo"); @@ -840,63 +843,63 @@ public: testChunked() { response res{status::ok, 11}; - BEAST_EXPECT(res.count(field::content_length) == 0); - BEAST_EXPECT(res.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(res.count(field::content_length) == 0); + BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0); auto const chunked = [&](bool v) { res.chunked(v); - BEAST_EXPECT( + BOOST_BEAST_EXPECT( (res.chunked() && v) || (! res.chunked() && ! v)); - BEAST_EXPECT(res.count( + BOOST_BEAST_EXPECT(res.count( field::content_length) == 0); }; res.erase(field::transfer_encoding); res.set(field::content_length, 32); chunked(true); - BEAST_EXPECT(res[field::transfer_encoding] == "chunked"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked"); res.set(field::transfer_encoding, "chunked"); chunked(true); - BEAST_EXPECT(res[field::transfer_encoding] == "chunked"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked"); res.erase(field::transfer_encoding); res.set(field::content_length, 32); chunked(false); - BEAST_EXPECT(res.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0); res.set(field::transfer_encoding, "chunked"); chunked(false); - BEAST_EXPECT(res.count(field::transfer_encoding) == 0); + BOOST_BEAST_EXPECT(res.count(field::transfer_encoding) == 0); res.set(field::transfer_encoding, "foo"); chunked(true); - BEAST_EXPECT(res[field::transfer_encoding] == "foo, chunked"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "foo, chunked"); res.set(field::transfer_encoding, "chunked, foo"); chunked(true); - BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo, chunked"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo, chunked"); res.set(field::transfer_encoding, "chunked, foo, chunked"); chunked(true); - BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo, chunked"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo, chunked"); res.set(field::transfer_encoding, "foo, chunked"); chunked(false); - BEAST_EXPECT(res[field::transfer_encoding] == "foo"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "foo"); res.set(field::transfer_encoding, "chunked, foo"); chunked(false); - BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo"); res.set(field::transfer_encoding, "chunked, foo, chunked"); chunked(false); - BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo"); + BOOST_BEAST_EXPECT(res[field::transfer_encoding] == "chunked, foo"); } void @@ -915,7 +918,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(fields,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(fields,http,beast); } // http } // beast +} // boost diff --git a/test/http/file_body.cpp b/test/http/file_body.cpp index 3555be71..b591ff2f 100644 --- a/test/http/file_body.cpp +++ b/test/http/file_body.cpp @@ -4,17 +4,20 @@ // 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 +#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include +namespace boost { namespace beast { namespace http { @@ -53,22 +56,22 @@ public: p.get().body.open( temp.string().c_str(), file_mode::write, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); p.put(boost::asio::buffer(s.data(), s.size()), ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); } { File f; f.open(temp.string().c_str(), file_mode::read, ec); auto size = f.size(ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(size == 3); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(size == 3); std::string s1; s1.resize(3); f.read(&s1[0], s1.size(), ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECTS(s1 == "xyz", s); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(s1 == "xyz", s); } { lambda visit; @@ -77,36 +80,37 @@ public: res.set(field::server, "test"); res.body.open(temp.string().c_str(), file_mode::scan, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); res.prepare_payload(); serializer, fields> sr{res}; sr.next(ec, visit); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); auto const cb = *visit.buffer.data().begin(); string_view const s1{ boost::asio::buffer_cast(cb), boost::asio::buffer_size(cb)}; - BEAST_EXPECTS(s1 == s, s1); + BOOST_BEAST_EXPECTS(s1 == s, s1); } } boost::filesystem::remove(temp, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); } void run() override { doTestFileBody(); - #if BEAST_USE_WIN32_FILE + #if BOOST_BEAST_USE_WIN32_FILE doTestFileBody(); #endif - #if BEAST_USE_POSIX_FILE + #if BOOST_BEAST_USE_POSIX_FILE doTestFileBody(); #endif } }; -BEAST_DEFINE_TESTSUITE(file_body,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(file_body,http,beast); } // http } // beast +} // boost diff --git a/test/http/message.cpp b/test/http/message.cpp index 18159fee..6a6c3ca9 100644 --- a/test/http/message.cpp +++ b/test/http/message.cpp @@ -4,17 +4,20 @@ // 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 +#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include +namespace boost { namespace beast { namespace http { @@ -123,26 +126,26 @@ public: { Arg1 arg1; request{verb::get, "/", 11, std::move(arg1)}; - BEAST_EXPECT(arg1.moved); + BOOST_BEAST_EXPECT(arg1.moved); } { header h; h.set(field::user_agent, "test"); - BEAST_EXPECT(h[field::user_agent] == "test"); + BOOST_BEAST_EXPECT(h[field::user_agent] == "test"); request m{std::move(h)}; - BEAST_EXPECT(m[field::user_agent] == "test"); - BEAST_EXPECT(h.count(field::user_agent) == 0); + BOOST_BEAST_EXPECT(m[field::user_agent] == "test"); + BOOST_BEAST_EXPECT(h.count(field::user_agent) == 0); } { request h{verb::get, "/", 10}; h.set(field::user_agent, "test"); request m{std::move(h.base()), Arg1{}}; - BEAST_EXPECT(m["User-Agent"] == "test"); - BEAST_EXPECT(h.count(http::field::user_agent) == 0); - BEAST_EXPECT(m.method() == verb::get); - BEAST_EXPECT(m.target() == "/"); - BEAST_EXPECT(m.version == 10); + BOOST_BEAST_EXPECT(m["User-Agent"] == "test"); + BOOST_BEAST_EXPECT(h.count(http::field::user_agent) == 0); + BOOST_BEAST_EXPECT(m.method() == verb::get); + BOOST_BEAST_EXPECT(m.target() == "/"); + BOOST_BEAST_EXPECT(m.version == 10); } // swap @@ -154,14 +157,14 @@ public: m2.method_string("G"); m2.body = "2"; swap(m1, m2); - BEAST_EXPECT(m1.method_string() == "G"); - BEAST_EXPECT(m2.method_string().empty()); - BEAST_EXPECT(m1.target().empty()); - BEAST_EXPECT(m2.target() == "u"); - BEAST_EXPECT(m1.body == "2"); - BEAST_EXPECT(m2.body == "1"); - BEAST_EXPECT(! m1.count("h")); - BEAST_EXPECT(m2.count("h")); + BOOST_BEAST_EXPECT(m1.method_string() == "G"); + BOOST_BEAST_EXPECT(m2.method_string().empty()); + BOOST_BEAST_EXPECT(m1.target().empty()); + BOOST_BEAST_EXPECT(m2.target() == "u"); + BOOST_BEAST_EXPECT(m1.body == "2"); + BOOST_BEAST_EXPECT(m2.body == "1"); + BOOST_BEAST_EXPECT(! m1.count("h")); + BOOST_BEAST_EXPECT(m2.count("h")); } struct MoveFields : fields @@ -209,57 +212,57 @@ public: { { request req; - BEAST_EXPECT(req.version == 11); - BEAST_EXPECT(req.method() == verb::unknown); - BEAST_EXPECT(req.target() == ""); + BOOST_BEAST_EXPECT(req.version == 11); + BOOST_BEAST_EXPECT(req.method() == verb::unknown); + BOOST_BEAST_EXPECT(req.target() == ""); } { request req{verb::get, "/", 11}; - BEAST_EXPECT(req.version == 11); - BEAST_EXPECT(req.method() == verb::get); - BEAST_EXPECT(req.target() == "/"); + BOOST_BEAST_EXPECT(req.version == 11); + BOOST_BEAST_EXPECT(req.method() == verb::get); + BOOST_BEAST_EXPECT(req.target() == "/"); } { request req{verb::get, "/", 11, "Hello"}; - BEAST_EXPECT(req.version == 11); - BEAST_EXPECT(req.method() == verb::get); - BEAST_EXPECT(req.target() == "/"); - BEAST_EXPECT(req.body == "Hello"); + BOOST_BEAST_EXPECT(req.version == 11); + BOOST_BEAST_EXPECT(req.method() == verb::get); + BOOST_BEAST_EXPECT(req.target() == "/"); + BOOST_BEAST_EXPECT(req.body == "Hello"); } { request req{ verb::get, "/", 11, "Hello", token{}}; - BEAST_EXPECT(req.version == 11); - BEAST_EXPECT(req.method() == verb::get); - BEAST_EXPECT(req.target() == "/"); - BEAST_EXPECT(req.body == "Hello"); + BOOST_BEAST_EXPECT(req.version == 11); + BOOST_BEAST_EXPECT(req.method() == verb::get); + BOOST_BEAST_EXPECT(req.target() == "/"); + BOOST_BEAST_EXPECT(req.body == "Hello"); } { response res; - BEAST_EXPECT(res.version == 11); - BEAST_EXPECT(res.result() == status::ok); - BEAST_EXPECT(res.reason() == "OK"); + BOOST_BEAST_EXPECT(res.version == 11); + BOOST_BEAST_EXPECT(res.result() == status::ok); + BOOST_BEAST_EXPECT(res.reason() == "OK"); } { response res{status::bad_request, 10}; - BEAST_EXPECT(res.version == 10); - BEAST_EXPECT(res.result() == status::bad_request); - BEAST_EXPECT(res.reason() == "Bad Request"); + BOOST_BEAST_EXPECT(res.version == 10); + BOOST_BEAST_EXPECT(res.result() == status::bad_request); + BOOST_BEAST_EXPECT(res.reason() == "Bad Request"); } { response res{status::bad_request, 10, "Hello"}; - BEAST_EXPECT(res.version == 10); - BEAST_EXPECT(res.result() == status::bad_request); - BEAST_EXPECT(res.reason() == "Bad Request"); - BEAST_EXPECT(res.body == "Hello"); + BOOST_BEAST_EXPECT(res.version == 10); + BOOST_BEAST_EXPECT(res.result() == status::bad_request); + BOOST_BEAST_EXPECT(res.reason() == "Bad Request"); + BOOST_BEAST_EXPECT(res.body == "Hello"); } { response res{ status::bad_request, 10, "Hello", token{}}; - BEAST_EXPECT(res.version == 10); - BEAST_EXPECT(res.result() == status::bad_request); - BEAST_EXPECT(res.reason() == "Bad Request"); - BEAST_EXPECT(res.body == "Hello"); + BOOST_BEAST_EXPECT(res.version == 10); + BOOST_BEAST_EXPECT(res.result() == status::bad_request); + BOOST_BEAST_EXPECT(res.reason() == "Bad Request"); + BOOST_BEAST_EXPECT(res.body == "Hello"); } } @@ -276,18 +279,18 @@ public: m2.body = "2"; m2.version = 11; swap(m1, m2); - BEAST_EXPECT(m1.result() == status::not_found); - BEAST_EXPECT(m1.result_int() == 404); - BEAST_EXPECT(m2.result() == status::ok); - BEAST_EXPECT(m2.result_int() == 200); - BEAST_EXPECT(m1.reason() == "Not Found"); - BEAST_EXPECT(m2.reason() == "OK"); - BEAST_EXPECT(m1.version == 11); - BEAST_EXPECT(m2.version == 10); - BEAST_EXPECT(m1.body == "2"); - BEAST_EXPECT(m2.body == "1"); - BEAST_EXPECT(! m1.count("h")); - BEAST_EXPECT(m2.count("h")); + BOOST_BEAST_EXPECT(m1.result() == status::not_found); + BOOST_BEAST_EXPECT(m1.result_int() == 404); + BOOST_BEAST_EXPECT(m2.result() == status::ok); + BOOST_BEAST_EXPECT(m2.result_int() == 200); + BOOST_BEAST_EXPECT(m1.reason() == "Not Found"); + BOOST_BEAST_EXPECT(m2.reason() == "OK"); + BOOST_BEAST_EXPECT(m1.version == 11); + BOOST_BEAST_EXPECT(m2.version == 10); + BOOST_BEAST_EXPECT(m1.body == "2"); + BOOST_BEAST_EXPECT(m2.body == "1"); + BOOST_BEAST_EXPECT(! m1.count("h")); + BOOST_BEAST_EXPECT(m2.count("h")); } void @@ -311,15 +314,15 @@ public: [&](verb v) { h.method(v); - BEAST_EXPECT(h.method() == v); - BEAST_EXPECT(h.method_string() == to_string(v)); + BOOST_BEAST_EXPECT(h.method() == v); + BOOST_BEAST_EXPECT(h.method_string() == to_string(v)); }; auto const scheck = [&](string_view s) { h.method_string(s); - BEAST_EXPECT(h.method() == string_to_verb(s)); - BEAST_EXPECT(h.method_string() == s); + BOOST_BEAST_EXPECT(h.method() == string_to_verb(s)); + BOOST_BEAST_EXPECT(h.method_string() == s); }; vcheck(verb::get); vcheck(verb::head); @@ -333,14 +336,14 @@ public: { header h; h.result(200); - BEAST_EXPECT(h.result_int() == 200); - BEAST_EXPECT(h.result() == status::ok); + BOOST_BEAST_EXPECT(h.result_int() == 200); + BOOST_BEAST_EXPECT(h.result() == status::ok); h.result(status::switching_protocols); - BEAST_EXPECT(h.result_int() == 101); - BEAST_EXPECT(h.result() == status::switching_protocols); + BOOST_BEAST_EXPECT(h.result_int() == 101); + BOOST_BEAST_EXPECT(h.result() == status::switching_protocols); h.result(1); - BEAST_EXPECT(h.result_int() == 1); - BEAST_EXPECT(h.result() == status::unknown); + BOOST_BEAST_EXPECT(h.result_int() == 1); + BOOST_BEAST_EXPECT(h.result() == status::unknown); } void @@ -348,13 +351,13 @@ public: { header h; h.result(status::ok); - BEAST_EXPECT(h.reason() == "OK"); + BOOST_BEAST_EXPECT(h.reason() == "OK"); h.reason("Pepe"); - BEAST_EXPECT(h.reason() == "Pepe"); + BOOST_BEAST_EXPECT(h.reason() == "Pepe"); h.result(status::not_found); - BEAST_EXPECT(h.reason() == "Pepe"); + BOOST_BEAST_EXPECT(h.reason() == "Pepe"); h.reason({}); - BEAST_EXPECT(h.reason() == "Not Found"); + BOOST_BEAST_EXPECT(h.reason() == "Not Found"); } void @@ -370,7 +373,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(message,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(message,http,beast); } // http } // beast +} // boost diff --git a/test/http/message_fuzz.hpp b/test/http/message_fuzz.hpp index f68910de..d7f6436c 100644 --- a/test/http/message_fuzz.hpp +++ b/test/http/message_fuzz.hpp @@ -4,16 +4,19 @@ // 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 BEAST_HTTP_TEST_MESSAGE_FUZZ_HPP -#define BEAST_HTTP_TEST_MESSAGE_FUZZ_HPP +#ifndef BOOST_BEAST_HTTP_TEST_MESSAGE_FUZZ_HPP +#define BOOST_BEAST_HTTP_TEST_MESSAGE_FUZZ_HPP -#include -#include +#include +#include #include #include #include +namespace boost { namespace beast { namespace http { @@ -600,5 +603,6 @@ chunkExtensionsTest( } // http } // beast +} // boost #endif diff --git a/test/http/parser.cpp b/test/http/parser.cpp index f63e2834..c7c1b5d7 100644 --- a/test/http/parser.cpp +++ b/test/http/parser.cpp @@ -4,24 +4,27 @@ // 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 +#include #include "test_parser.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +namespace boost { namespace beast { namespace http { @@ -80,7 +83,7 @@ public: error_code ec; parser_type p; put(buffer(s.data(), s.size()), p, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; f(p); } @@ -96,22 +99,22 @@ public: s.remove_prefix(used); if(ec == error::need_more) ec.assign(0, ec.category()); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) continue; - BEAST_EXPECT(! p.is_done()); + BOOST_BEAST_EXPECT(! p.is_done()); used = p.put( buffer(s.data(), s.size()), ec); s.remove_prefix(used); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) continue; - BEAST_EXPECT(s.empty()); + BOOST_BEAST_EXPECT(s.empty()); if(p.need_eof()) { p.put_eof(ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) continue; } - if(BEAST_EXPECT(p.is_done())) + if(BOOST_BEAST_EXPECT(p.is_done())) f(p); } } @@ -127,14 +130,14 @@ public: [&](parser_type const& p) { auto const& m = p.get(); - BEAST_EXPECT(! p.is_chunked()); - BEAST_EXPECT(p.need_eof()); - BEAST_EXPECT(p.content_length() == boost::none); - BEAST_EXPECT(m.version == 10); - BEAST_EXPECT(m.result() == status::ok); - BEAST_EXPECT(m.reason() == "OK"); - BEAST_EXPECT(m["Server"] == "test"); - BEAST_EXPECT(m.body == "Hello, world!"); + BOOST_BEAST_EXPECT(! p.is_chunked()); + BOOST_BEAST_EXPECT(p.need_eof()); + BOOST_BEAST_EXPECT(p.content_length() == boost::none); + BOOST_BEAST_EXPECT(m.version == 10); + BOOST_BEAST_EXPECT(m.result() == status::ok); + BOOST_BEAST_EXPECT(m.reason() == "OK"); + BOOST_BEAST_EXPECT(m["Server"] == "test"); + BOOST_BEAST_EXPECT(m.body == "Hello, world!"); } ); doMatrix( @@ -154,17 +157,17 @@ public: [&](parser_type const& p) { auto const& m = p.get(); - BEAST_EXPECT(! p.need_eof()); - BEAST_EXPECT(p.is_chunked()); - BEAST_EXPECT(p.content_length() == boost::none); - BEAST_EXPECT(m.version == 11); - BEAST_EXPECT(m.result() == status::ok); - BEAST_EXPECT(m.reason() == "OK"); - BEAST_EXPECT(m["Server"] == "test"); - BEAST_EXPECT(m["Transfer-Encoding"] == "chunked"); - BEAST_EXPECT(m["Expires"] == "never"); - BEAST_EXPECT(m["MD5-Fingerprint"] == "-"); - BEAST_EXPECT(m.body == "*****--"); + BOOST_BEAST_EXPECT(! p.need_eof()); + BOOST_BEAST_EXPECT(p.is_chunked()); + BOOST_BEAST_EXPECT(p.content_length() == boost::none); + BOOST_BEAST_EXPECT(m.version == 11); + BOOST_BEAST_EXPECT(m.result() == status::ok); + BOOST_BEAST_EXPECT(m.reason() == "OK"); + BOOST_BEAST_EXPECT(m["Server"] == "test"); + BOOST_BEAST_EXPECT(m["Transfer-Encoding"] == "chunked"); + BOOST_BEAST_EXPECT(m["Expires"] == "never"); + BOOST_BEAST_EXPECT(m["MD5-Fingerprint"] == "-"); + BOOST_BEAST_EXPECT(m.body == "*****--"); } ); doMatrix( @@ -176,7 +179,7 @@ public: [&](parser_type const& p) { auto const& m = p.get(); - BEAST_EXPECT(m.body == "*****"); + BOOST_BEAST_EXPECT(m.body == "*****"); } ); doMatrix( @@ -186,12 +189,12 @@ public: [&](parser_type const& p) { auto const& m = p.get(); - BEAST_EXPECT(m.method() == verb::get); - BEAST_EXPECT(m.target() == "/"); - BEAST_EXPECT(m.version == 11); - BEAST_EXPECT(! p.need_eof()); - BEAST_EXPECT(! p.is_chunked()); - BEAST_EXPECT(p.content_length() == boost::none); + BOOST_BEAST_EXPECT(m.method() == verb::get); + BOOST_BEAST_EXPECT(m.target() == "/"); + BOOST_BEAST_EXPECT(m.version == 11); + BOOST_BEAST_EXPECT(! p.need_eof()); + BOOST_BEAST_EXPECT(! p.is_chunked()); + BOOST_BEAST_EXPECT(p.content_length() == boost::none); } ); doMatrix( @@ -202,7 +205,7 @@ public: [&](parser_type const& p) { auto const& m = p.get(); - BEAST_EXPECT(m["X"] == "x"); + BOOST_BEAST_EXPECT(m["X"] == "x"); } ); @@ -219,15 +222,15 @@ public: "*") , ec); auto const& m = p.get(); - BEAST_EXPECT(! ec); - BEAST_EXPECT(p.is_done()); - BEAST_EXPECT(p.is_header_done()); - BEAST_EXPECT(! p.need_eof()); - BEAST_EXPECT(m.method() == verb::get); - BEAST_EXPECT(m.target() == "/"); - BEAST_EXPECT(m.version == 11); - BEAST_EXPECT(m["User-Agent"] == "test"); - BEAST_EXPECT(m.body == "*"); + BOOST_BEAST_EXPECT(! ec); + BOOST_BEAST_EXPECT(p.is_done()); + BOOST_BEAST_EXPECT(p.is_header_done()); + BOOST_BEAST_EXPECT(! p.need_eof()); + BOOST_BEAST_EXPECT(m.method() == verb::get); + BOOST_BEAST_EXPECT(m.target() == "/"); + BOOST_BEAST_EXPECT(m.version == 11); + BOOST_BEAST_EXPECT(m["User-Agent"] == "test"); + BOOST_BEAST_EXPECT(m.body == "*"); } { // test partial parsing of final chunk @@ -244,9 +247,9 @@ public: "*"; auto used = p.put(b.data(), ec); b.consume(used); - BEAST_EXPECT(! ec); - BEAST_EXPECT(! p.is_done()); - BEAST_EXPECT(p.get().body == "*"); + BOOST_BEAST_EXPECT(! ec); + BOOST_BEAST_EXPECT(! p.is_done()); + BOOST_BEAST_EXPECT(p.get().body == "*"); ostream(b) << "\r\n" "0;d;e=3;f=\"4\"\r\n" @@ -255,15 +258,15 @@ public: // incomplete parse, missing the final crlf used = p.put(b.data(), ec); b.consume(used); - BEAST_EXPECT(ec == error::need_more); + BOOST_BEAST_EXPECT(ec == error::need_more); ec.assign(0, ec.category()); - BEAST_EXPECT(! p.is_done()); + BOOST_BEAST_EXPECT(! p.is_done()); ostream(b) << "\r\n"; // final crlf to end message used = p.put(b.data(), ec); b.consume(used); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(p.is_done()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(p.is_done()); } // skip body { @@ -276,10 +279,10 @@ public: "\r\n" "*****") , ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(p.is_done()); - BEAST_EXPECT(p.is_header_done()); - BEAST_EXPECT(p.content_length() && + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(p.is_done()); + BOOST_BEAST_EXPECT(p.is_header_done()); + BOOST_BEAST_EXPECT(p.content_length() && *p.content_length() == 5); } } @@ -298,17 +301,17 @@ public: ostream(b) << "GET / HTTP/1.1\r\n"; used = p.put(b.data(), ec); - BEAST_EXPECTS(ec == error::need_more, ec.message()); + BOOST_BEAST_EXPECTS(ec == error::need_more, ec.message()); b.consume(used); ec.assign(0, ec.category()); ostream(b) << "User-Agent: test\r\n" "\r\n"; used = p.put(b.data(), ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); b.consume(used); - BEAST_EXPECT(p.is_done()); - BEAST_EXPECT(p.is_header_done()); + BOOST_BEAST_EXPECT(p.is_done()); + BOOST_BEAST_EXPECT(p.is_header_done()); } } @@ -318,14 +321,14 @@ public: error_code ec; parser_type p; auto used = p.put(buf(""), ec); - BEAST_EXPECT(ec == error::need_more); - BEAST_EXPECT(! p.got_some()); - BEAST_EXPECT(used == 0); + BOOST_BEAST_EXPECT(ec == error::need_more); + BOOST_BEAST_EXPECT(! p.got_some()); + BOOST_BEAST_EXPECT(used == 0); ec.assign(0, ec.category()); used = p.put(buf("G"), ec); - BEAST_EXPECT(ec == error::need_more); - BEAST_EXPECT(p.got_some()); - BEAST_EXPECT(used == 0); + BOOST_BEAST_EXPECT(ec == error::need_more); + BOOST_BEAST_EXPECT(p.got_some()); + BOOST_BEAST_EXPECT(used == 0); } void @@ -338,8 +341,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(parser,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(parser,http,beast); } // http } // beast - +} // boost diff --git a/test/http/read.cpp b/test/http/read.cpp index 8069569f..322fc44b 100644 --- a/test/http/read.cpp +++ b/test/http/read.cpp @@ -4,26 +4,29 @@ // 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 +#include #include "test_parser.hpp" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include +namespace boost { namespace beast { namespace http { @@ -55,7 +58,7 @@ public: if(! ec) break; } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { static std::size_t constexpr pre = 10; @@ -71,7 +74,7 @@ public: if(! ec) break; } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { multi_buffer b; @@ -86,7 +89,7 @@ public: if(! ec) break; } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { static std::size_t constexpr pre = 10; @@ -102,7 +105,7 @@ public: if(! ec) break; } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); } void testThrow() @@ -162,7 +165,7 @@ public: flat_static_buffer<10> b; request req; read(p.server, b, req, ec); - BEAST_EXPECTS(ec == error::buffer_overflow, + BOOST_BEAST_EXPECTS(ec == error::buffer_overflow, ec.message()); } } @@ -254,7 +257,7 @@ public: { } } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { @@ -272,7 +275,7 @@ public: if(! ec) break; } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { @@ -290,7 +293,7 @@ public: if(! ec) break; } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); } void @@ -302,7 +305,7 @@ public: request_parser p; error_code ec; read(ss, b, p, ec); - BEAST_EXPECT(ec == http::error::end_of_stream); + BOOST_BEAST_EXPECT(ec == http::error::end_of_stream); } { multi_buffer b; @@ -310,7 +313,7 @@ public: request_parser p; error_code ec; async_read(ss, b, p, do_yield[ec]); - BEAST_EXPECT(ec == http::error::end_of_stream); + BOOST_BEAST_EXPECT(ec == http::error::end_of_stream); } } @@ -334,17 +337,17 @@ public: boost::asio::io_service ios; test::string_istream is{ios, "GET / HTTP/1.1\r\n\r\n"}; - BEAST_EXPECT(handler::count() == 0); + BOOST_BEAST_EXPECT(handler::count() == 0); multi_buffer b; request m; async_read(is, b, m, handler{}); - BEAST_EXPECT(handler::count() > 0); + BOOST_BEAST_EXPECT(handler::count() > 0); ios.stop(); - BEAST_EXPECT(handler::count() > 0); + BOOST_BEAST_EXPECT(handler::count() > 0); ios.reset(); - BEAST_EXPECT(handler::count() > 0); + BOOST_BEAST_EXPECT(handler::count() > 0); ios.run_one(); - BEAST_EXPECT(handler::count() == 0); + BOOST_BEAST_EXPECT(handler::count() == 0); } { // Make sure uninvoked handlers are @@ -353,13 +356,13 @@ public: boost::asio::io_service ios; test::string_istream is{ios, "GET / HTTP/1.1\r\n\r\n"}; - BEAST_EXPECT(handler::count() == 0); + BOOST_BEAST_EXPECT(handler::count() == 0); multi_buffer b; request m; async_read(is, b, m, handler{}); - BEAST_EXPECT(handler::count() > 0); + BOOST_BEAST_EXPECT(handler::count() > 0); } - BEAST_EXPECT(handler::count() == 0); + BOOST_BEAST_EXPECT(handler::count() == 0); } } @@ -380,7 +383,7 @@ public: flat_buffer fb; parser p; read(c.server, fb, p, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); } //-------------------------------------------------------------------------- @@ -399,7 +402,7 @@ public: ostream(c.server.buffer) << s; c.server.read_size(n); read(c.server, b, p, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) continue; pred(p); } @@ -417,7 +420,7 @@ public: "0\r\n\r\n" ,[&](test_parser const& p) { - BEAST_EXPECT(p.body == "abcd"); + BOOST_BEAST_EXPECT(p.body == "abcd"); }); readgrind>( "HTTP/1.1 200 OK\r\n" @@ -435,7 +438,7 @@ public: "\r\n" ,[&](test_parser const& p) { - BEAST_EXPECT(p.body == "*****--"); + BOOST_BEAST_EXPECT(p.body == "*****--"); }); } @@ -458,7 +461,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(read,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(read,http,beast); } // http } // beast +} // boost diff --git a/test/http/rfc7230.cpp b/test/http/rfc7230.cpp index dfa5b068..ff7d2967 100644 --- a/test/http/rfc7230.cpp +++ b/test/http/rfc7230.cpp @@ -4,17 +4,20 @@ // 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 +#include -#include -#include +#include +#include #include #include -#include +#include +namespace boost { namespace beast { namespace http { @@ -60,7 +63,7 @@ public: [&](std::string const& s) { auto const got = str(param_list{s}); - BEAST_EXPECTS(got == s, fmt(got)); + BOOST_BEAST_EXPECTS(got == s, fmt(got)); }; auto const cs = [&](std::string const& s, std::string const& answer) @@ -68,13 +71,13 @@ public: ce(answer); auto const got = str(param_list{s}); ce(got); - BEAST_EXPECTS(got == answer, fmt(got)); + BOOST_BEAST_EXPECTS(got == answer, fmt(got)); }; auto const cq = [&](std::string const& s, std::string const& answer) { auto const got = str(param_list{s}); - BEAST_EXPECTS(got == answer, fmt(got)); + BOOST_BEAST_EXPECTS(got == answer, fmt(got)); }; ce(""); @@ -119,7 +122,7 @@ public: [&](std::string const& s) { auto const got = str(ext_list{s}); - BEAST_EXPECTS(got == s, fmt(got)); + BOOST_BEAST_EXPECTS(got == s, fmt(got)); }; auto const cs = [&](std::string const& s, std::string const& good) @@ -127,13 +130,13 @@ public: ce(good); auto const got = str(ext_list{s}); ce(got); - BEAST_EXPECTS(got == good, fmt(got)); + BOOST_BEAST_EXPECTS(got == good, fmt(got)); }; auto const cq = [&](std::string const& s, std::string const& good) { auto const got = str(ext_list{s}); - BEAST_EXPECTS(got == good, fmt(got)); + BOOST_BEAST_EXPECTS(got == good, fmt(got)); }; /* ext-basic_parsed_list = *( "," OWS ) ext *( OWS "," [ OWS ext ] ) @@ -169,9 +172,9 @@ public: cq("ab;x=\" \"", "ab;x= "); cq("ab;x=\"\\\"\"", "ab;x=\""); - BEAST_EXPECT(ext_list{"a,b;i=1,c;j=2;k=3"}.exists("A")); - BEAST_EXPECT(ext_list{"a,b;i=1,c;j=2;k=3"}.exists("b")); - BEAST_EXPECT(! ext_list{"a,b;i=1,c;j=2;k=3"}.exists("d")); + BOOST_BEAST_EXPECT(ext_list{"a,b;i=1,c;j=2;k=3"}.exists("A")); + BOOST_BEAST_EXPECT(ext_list{"a,b;i=1,c;j=2;k=3"}.exists("b")); + BOOST_BEAST_EXPECT(! ext_list{"a,b;i=1,c;j=2;k=3"}.exists("d")); // invalid strings cs("i j", "i"); @@ -201,7 +204,7 @@ public: [&](std::string const& s) { auto const got = str(token_list{s}); - BEAST_EXPECTS(got == s, fmt(got)); + BOOST_BEAST_EXPECTS(got == s, fmt(got)); }; auto const cs = [&](std::string const& s, std::string const& good) @@ -209,7 +212,7 @@ public: ce(good); auto const got = str(token_list{s}); ce(got); - BEAST_EXPECTS(got == good, fmt(got)); + BOOST_BEAST_EXPECTS(got == good, fmt(got)); }; cs("", ""); @@ -230,9 +233,9 @@ public: cs("x ,\ty ", "x,y"); cs("x, y, z", "x,y,z"); - BEAST_EXPECT(token_list{"a,b,c"}.exists("A")); - BEAST_EXPECT(token_list{"a,b,c"}.exists("b")); - BEAST_EXPECT(! token_list{"a,b,c"}.exists("d")); + BOOST_BEAST_EXPECT(token_list{"a,b,c"}.exists("A")); + BOOST_BEAST_EXPECT(token_list{"a,b,c"}.exists("b")); + BOOST_BEAST_EXPECT(! token_list{"a,b,c"}.exists("d")); // invalid cs("x y", "x"); @@ -256,14 +259,14 @@ public: validate(string_view in, std::vector const& v) { - BEAST_EXPECT(to_vector(in) == v); + BOOST_BEAST_EXPECT(to_vector(in) == v); } template void good(string_view in) { - BEAST_EXPECT(validate_list( + BOOST_BEAST_EXPECT(validate_list( detail::basic_parsed_list{in})); } @@ -272,7 +275,7 @@ public: good(string_view in, std::vector const& v) { - BEAST_EXPECT(validate_list( + BOOST_BEAST_EXPECT(validate_list( detail::basic_parsed_list{in})); validate(in, v); } @@ -281,7 +284,7 @@ public: void bad(string_view in) { - BEAST_EXPECT(! validate_list( + BOOST_BEAST_EXPECT(! validate_list( detail::basic_parsed_list{in})); } @@ -351,7 +354,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(rfc7230,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(rfc7230,http,beast); } // http } // beast +} // boost diff --git a/test/http/serializer.cpp b/test/http/serializer.cpp index d39dbcb5..faca999e 100644 --- a/test/http/serializer.cpp +++ b/test/http/serializer.cpp @@ -4,13 +4,16 @@ // 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 +#include -#include -#include +#include +#include +namespace boost { namespace beast { namespace http { @@ -105,7 +108,7 @@ public: for(;;) { sr.next(ec, visit); - BEAST_EXPECT(visit.size <= limit); + BOOST_BEAST_EXPECT(visit.size <= limit); sr.consume(visit.size); if(sr.is_done()) break; @@ -119,7 +122,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(serializer,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(serializer,http,beast); } // http } // beast +} // boost diff --git a/test/http/span_body.cpp b/test/http/span_body.cpp index 3e9e3b17..1447c75f 100644 --- a/test/http/span_body.cpp +++ b/test/http/span_body.cpp @@ -4,13 +4,16 @@ // 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 +#include -#include -#include +#include +#include +namespace boost { namespace beast { namespace http { @@ -24,23 +27,23 @@ struct span_body_test using B = span_body; request req; - BEAST_EXPECT(req.body.size() == 0); - BEAST_EXPECT(B::size(req.body) == 0); + BOOST_BEAST_EXPECT(req.body.size() == 0); + BOOST_BEAST_EXPECT(B::size(req.body) == 0); req.body = B::value_type("xyz", 3); - BEAST_EXPECT(req.body.size() == 3); - BEAST_EXPECT(B::size(req.body) == 3); + BOOST_BEAST_EXPECT(req.body.size() == 3); + BOOST_BEAST_EXPECT(B::size(req.body) == 3); B::reader r{req}; error_code ec; r.init(ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); auto const buf = r.get(ec); - BEAST_EXPECTS(! ec, ec.message()); - if(! BEAST_EXPECT(buf != boost::none)) + BOOST_BEAST_EXPECTS(! ec, ec.message()); + if(! BOOST_BEAST_EXPECT(buf != boost::none)) return; - BEAST_EXPECT(boost::asio::buffer_size(buf->first) == 3); - BEAST_EXPECT(! buf->second); + BOOST_BEAST_EXPECT(boost::asio::buffer_size(buf->first) == 3); + BOOST_BEAST_EXPECT(! buf->second); } { char buf[5]; @@ -50,16 +53,16 @@ struct span_body_test B::writer w{req}; error_code ec; w.init(boost::none, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); w.put(boost::asio::const_buffers_1{ "123", 3}, ec); - BEAST_EXPECTS(! ec, ec.message()); - BEAST_EXPECT(buf[0] == '1'); - BEAST_EXPECT(buf[1] == '2'); - BEAST_EXPECT(buf[2] == '3'); + BOOST_BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECT(buf[0] == '1'); + BOOST_BEAST_EXPECT(buf[1] == '2'); + BOOST_BEAST_EXPECT(buf[2] == '3'); w.put(boost::asio::const_buffers_1{ "456", 3}, ec); - BEAST_EXPECTS(ec == error::buffer_overflow, ec.message()); + BOOST_BEAST_EXPECTS(ec == error::buffer_overflow, ec.message()); } } @@ -70,7 +73,8 @@ struct span_body_test } }; -BEAST_DEFINE_TESTSUITE(span_body,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(span_body,http,beast); } // http } // beast +} // boost diff --git a/test/http/status.cpp b/test/http/status.cpp index 69cdcbff..3609b564 100644 --- a/test/http/status.cpp +++ b/test/http/status.cpp @@ -4,12 +4,15 @@ // 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 +#include -#include +#include +namespace boost { namespace beast { namespace http { @@ -22,9 +25,9 @@ public: { auto const check = [&](status s, int i, status_class sc) { - BEAST_EXPECT(int_to_status(i) == s); - BEAST_EXPECT(to_status_class(i) == sc); - BEAST_EXPECT(to_status_class(int_to_status(i)) == sc); + BOOST_BEAST_EXPECT(int_to_status(i) == s); + BOOST_BEAST_EXPECT(to_status_class(i) == sc); + BOOST_BEAST_EXPECT(to_status_class(int_to_status(i)) == sc); }; check(status::continue_ ,100, status_class::informational); check(status::switching_protocols ,101, status_class::informational); @@ -93,13 +96,13 @@ public: check(status::network_authentication_required ,511, status_class::server_error); check(status::network_connect_timeout_error ,599, status_class::server_error); - BEAST_EXPECT(to_status_class(1) == status_class::unknown); - BEAST_EXPECT(to_status_class(status::unknown) == status_class::unknown); + BOOST_BEAST_EXPECT(to_status_class(1) == status_class::unknown); + BOOST_BEAST_EXPECT(to_status_class(status::unknown) == status_class::unknown); auto const good = [&](status v) { - BEAST_EXPECT(obsolete_reason(v) != "Unknown Status"); + BOOST_BEAST_EXPECT(obsolete_reason(v) != "Unknown Status"); }; good(status::continue_); good(status::switching_protocols); @@ -169,8 +172,9 @@ public: } }; -BEAST_DEFINE_TESTSUITE(status,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(status,http,beast); } // http } // beast +} // boost diff --git a/test/http/string_body.cpp b/test/http/string_body.cpp index 71e9dea2..e31b4db3 100644 --- a/test/http/string_body.cpp +++ b/test/http/string_body.cpp @@ -4,10 +4,13 @@ // 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 +#include +namespace boost { namespace beast { namespace http { @@ -17,3 +20,4 @@ BOOST_STATIC_ASSERT(is_body_writer::value); } // http } // beast +} // boost diff --git a/test/http/test_parser.hpp b/test/http/test_parser.hpp index 0f922d5c..fc1a42fe 100644 --- a/test/http/test_parser.hpp +++ b/test/http/test_parser.hpp @@ -4,15 +4,18 @@ // 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 BEAST_HTTP_TEST_PARSER_HPP -#define BEAST_HTTP_TEST_PARSER_HPP +#ifndef BOOST_BEAST_HTTP_TEST_PARSER_HPP +#define BOOST_BEAST_HTTP_TEST_PARSER_HPP -#include -#include +#include +#include #include #include +namespace boost { namespace beast { namespace http { @@ -171,5 +174,6 @@ public: } // http } // beast +} // boost #endif diff --git a/test/http/type_traits.cpp b/test/http/type_traits.cpp index a461c5b0..ed973637 100644 --- a/test/http/type_traits.cpp +++ b/test/http/type_traits.cpp @@ -4,13 +4,16 @@ // 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 +#include -#include +#include #include +namespace boost { namespace beast { namespace http { @@ -30,3 +33,4 @@ BOOST_STATIC_ASSERT(! is_fields::value); } // http } // beast +} // boost diff --git a/test/http/vector_body.cpp b/test/http/vector_body.cpp index 91252137..d0a38b13 100644 --- a/test/http/vector_body.cpp +++ b/test/http/vector_body.cpp @@ -4,10 +4,13 @@ // 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 +#include +namespace boost { namespace beast { namespace http { @@ -17,3 +20,4 @@ BOOST_STATIC_ASSERT(is_body_writer>::value); } // http } // beast +} // boost diff --git a/test/http/verb.cpp b/test/http/verb.cpp index ec90033d..ab938e82 100644 --- a/test/http/verb.cpp +++ b/test/http/verb.cpp @@ -4,12 +4,15 @@ // 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 +#include -#include +#include +namespace boost { namespace beast { namespace http { @@ -23,7 +26,7 @@ public: auto const good = [&](verb v) { - BEAST_EXPECT(string_to_verb(to_string(v)) == v); + BOOST_BEAST_EXPECT(string_to_verb(to_string(v)) == v); }; good(verb::unknown); @@ -66,7 +69,7 @@ public: [&](string_view s) { auto const v = string_to_verb(s); - BEAST_EXPECTS(v == verb::unknown, to_string(v)); + BOOST_BEAST_EXPECTS(v == verb::unknown, to_string(v)); }; bad("AC_"); @@ -121,8 +124,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(verb,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(verb,http,beast); } // http } // beast - +} // boost diff --git a/test/http/write.cpp b/test/http/write.cpp index d2aac8e1..0250dd37 100644 --- a/test/http/write.cpp +++ b/test/http/write.cpp @@ -4,28 +4,31 @@ // 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 +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include +namespace boost { namespace beast { namespace http { @@ -300,8 +303,8 @@ public: error_code ec; test::string_ostream ss{ios_}; async_write(ss, m, do_yield[ec]); - if(BEAST_EXPECTS(ec == error::end_of_stream, ec.message())) - BEAST_EXPECT(ss.str == + if(BOOST_BEAST_EXPECTS(ec == error::end_of_stream, ec.message())) + BOOST_BEAST_EXPECT(ss.str == "HTTP/1.0 200 OK\r\n" "Server: test\r\n" "Content-Length: 5\r\n" @@ -318,8 +321,8 @@ public: error_code ec; test::string_ostream ss(ios_); async_write(ss, m, do_yield[ec]); - if(BEAST_EXPECTS(! ec, ec.message())) - BEAST_EXPECT(ss.str == + if(BOOST_BEAST_EXPECTS(! ec, ec.message())) + BOOST_BEAST_EXPECT(ss.str == "HTTP/1.1 200 OK\r\n" "Server: test\r\n" "Transfer-Encoding: chunked\r\n" @@ -349,7 +352,7 @@ public: try { write(fs, m); - BEAST_EXPECT(fs.next_layer().str == + BOOST_BEAST_EXPECT(fs.next_layer().str == "GET / HTTP/1.0\r\n" "User-Agent: test\r\n" "Connection: keep-alive\r\n" @@ -364,7 +367,7 @@ public: { } } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { @@ -379,7 +382,7 @@ public: write(fs, m, ec); if(ec == error::end_of_stream) { - BEAST_EXPECT(fs.next_layer().str == + BOOST_BEAST_EXPECT(fs.next_layer().str == "GET / HTTP/1.0\r\n" "User-Agent: test\r\n" "Transfer-Encoding: chunked\r\n" @@ -394,7 +397,7 @@ public: break; } } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { @@ -409,7 +412,7 @@ public: async_write(fs, m, do_yield[ec]); if(ec == error::end_of_stream) { - BEAST_EXPECT(fs.next_layer().str == + BOOST_BEAST_EXPECT(fs.next_layer().str == "GET / HTTP/1.0\r\n" "User-Agent: test\r\n" "Transfer-Encoding: chunked\r\n" @@ -424,7 +427,7 @@ public: break; } } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { @@ -440,7 +443,7 @@ public: write(fs, m, ec); if(! ec) { - BEAST_EXPECT(fs.next_layer().str == + BOOST_BEAST_EXPECT(fs.next_layer().str == "GET / HTTP/1.0\r\n" "User-Agent: test\r\n" "Connection: keep-alive\r\n" @@ -451,7 +454,7 @@ public: break; } } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); for(n = 0; n < limit; ++n) { @@ -467,7 +470,7 @@ public: async_write(fs, m, do_yield[ec]); if(! ec) { - BEAST_EXPECT(fs.next_layer().str == + BOOST_BEAST_EXPECT(fs.next_layer().str == "GET / HTTP/1.0\r\n" "User-Agent: test\r\n" "Connection: keep-alive\r\n" @@ -478,7 +481,7 @@ public: break; } } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); } void @@ -493,7 +496,7 @@ public: m.set(field::user_agent, "test"); m.body = "*"; m.prepare_payload(); - BEAST_EXPECT(str(m) == + BOOST_BEAST_EXPECT(str(m) == "GET / HTTP/1.0\r\n" "User-Agent: test\r\n" "Content-Length: 1\r\n" @@ -513,8 +516,8 @@ public: test::string_ostream ss(ios_); error_code ec; write(ss, m, ec); - BEAST_EXPECT(ec == error::end_of_stream); - BEAST_EXPECT(ss.str == + BOOST_BEAST_EXPECT(ec == error::end_of_stream); + BOOST_BEAST_EXPECT(ss.str == "GET / HTTP/1.0\r\n" "User-Agent: test\r\n" "\r\n" @@ -530,7 +533,7 @@ public: m.set(field::user_agent, "test"); m.body = "*"; m.prepare_payload(); - BEAST_EXPECT(str(m) == + BOOST_BEAST_EXPECT(str(m) == "GET / HTTP/1.1\r\n" "User-Agent: test\r\n" "Content-Length: 1\r\n" @@ -550,7 +553,7 @@ public: test::string_ostream ss(ios_); error_code ec; write(ss, m, ec); - BEAST_EXPECT(ss.str == + BOOST_BEAST_EXPECT(ss.str == "GET / HTTP/1.1\r\n" "User-Agent: test\r\n" "Transfer-Encoding: chunked\r\n" @@ -571,7 +574,7 @@ public: m.version = 11; m.set(field::user_agent, "test"); m.body = "*"; - BEAST_EXPECT(boost::lexical_cast(m) == + BOOST_BEAST_EXPECT(boost::lexical_cast(m) == "GET / HTTP/1.1\r\nUser-Agent: test\r\n\r\n*"); } @@ -594,7 +597,7 @@ public: // after calling io_service::stop boost::asio::io_service ios; test::string_ostream os{ios}; - BEAST_EXPECT(handler::count() == 0); + BOOST_BEAST_EXPECT(handler::count() == 0); request m; m.method(verb::get); m.version = 11; @@ -602,13 +605,13 @@ public: m.set("Content-Length", 5); m.body = "*****"; async_write(os, m, handler{}); - BEAST_EXPECT(handler::count() > 0); + BOOST_BEAST_EXPECT(handler::count() > 0); ios.stop(); - BEAST_EXPECT(handler::count() > 0); + BOOST_BEAST_EXPECT(handler::count() > 0); ios.reset(); - BEAST_EXPECT(handler::count() > 0); + BOOST_BEAST_EXPECT(handler::count() > 0); ios.run_one(); - BEAST_EXPECT(handler::count() == 0); + BOOST_BEAST_EXPECT(handler::count() == 0); } { // Make sure uninvoked handlers are @@ -616,7 +619,7 @@ public: { boost::asio::io_service ios; test::string_ostream is{ios}; - BEAST_EXPECT(handler::count() == 0); + BOOST_BEAST_EXPECT(handler::count() == 0); request m; m.method(verb::get); m.version = 11; @@ -624,9 +627,9 @@ public: m.set("Content-Length", 5); m.body = "*****"; async_write(is, m, handler{}); - BEAST_EXPECT(handler::count() > 0); + BOOST_BEAST_EXPECT(handler::count() > 0); } - BEAST_EXPECT(handler::count() == 0); + BOOST_BEAST_EXPECT(handler::count() == 0); } } @@ -646,7 +649,7 @@ public: write_some(stream, sr, ec); if(ec) return; - BEAST_EXPECT(stream.nwrite <= 1); + BOOST_BEAST_EXPECT(stream.nwrite <= 1); if(sr.is_done()) break; } @@ -669,7 +672,7 @@ public: async_write_some(stream, sr, yield[ec]); if(ec) return; - BEAST_EXPECT(stream.nwrite <= 1); + BOOST_BEAST_EXPECT(stream.nwrite <= 1); if(sr.is_done()) break; } @@ -699,8 +702,8 @@ public: auto m = m0; error_code ec; do_write(p.client, m, ec); - BEAST_EXPECT(p.server.str() == result); - BEAST_EXPECT(equal_body( + BOOST_BEAST_EXPECT(p.server.str() == result); + BOOST_BEAST_EXPECT(equal_body( p.server.str(), m.body.s)); p.server.clear(); } @@ -708,8 +711,8 @@ public: auto m = m0; error_code ec; do_async_write(p.client, m, ec, yield); - BEAST_EXPECT(p.server.str() == result); - BEAST_EXPECT(equal_body( + BOOST_BEAST_EXPECT(p.server.str() == result); + BOOST_BEAST_EXPECT(equal_body( p.server.str(), m.body.s)); p.server.clear(); } @@ -724,7 +727,7 @@ public: if(sr.is_header_done()) break; } - BEAST_EXPECT(! m.body.read); + BOOST_BEAST_EXPECT(! m.body.read); p.server.clear(); } { @@ -738,7 +741,7 @@ public: if(sr.is_header_done()) break; } - BEAST_EXPECT(! m.body.read); + BOOST_BEAST_EXPECT(! m.body.read); p.server.clear(); } } @@ -748,7 +751,7 @@ public: auto m = m0; error_code ec; do_write(p.client, m, ec); - BEAST_EXPECT(equal_body( + BOOST_BEAST_EXPECT(equal_body( p.server.str(), m.body.s)); p.server.clear(); } @@ -756,7 +759,7 @@ public: auto m = m0; error_code ec; do_async_write(p.client, m, ec, yield); - BEAST_EXPECT(equal_body( + BOOST_BEAST_EXPECT(equal_body( p.server.str(), m.body.s)); p.server.clear(); } @@ -772,7 +775,7 @@ public: if(sr.is_header_done()) break; } - BEAST_EXPECT(! m.body.read); + BOOST_BEAST_EXPECT(! m.body.read); p.server.clear(); } { @@ -786,7 +789,7 @@ public: if(sr.is_header_done()) break; } - BEAST_EXPECT(! m.body.read); + BOOST_BEAST_EXPECT(! m.body.read); p.server.clear(); } } @@ -832,7 +835,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(write,http,beast); +BOOST_BEAST_DEFINE_TESTSUITE(write,http,beast); } // http } // beast +} // boost diff --git a/test/server/CMakeLists.txt b/test/server/CMakeLists.txt index fe7cbbde..82b26c81 100644 --- a/test/server/CMakeLists.txt +++ b/test/server/CMakeLists.txt @@ -1,17 +1,25 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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(example/server-framework framework) GroupSources(example/common common) -GroupSources(extras/beast extras) -GroupSources(include/beast beast) +GroupSources(extras/boost/beast extras) +GroupSources(include/boost/beast beast) GroupSources(test/server "/") add_executable (server-test - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${COMMON_INCLUDES} ${SERVER_INCLUDES} - ../../extras/beast/unit_test/main.cpp + Jamfile + ../../extras/boost/beast/unit_test/main.cpp file_service.cpp framework.cpp http_async_port.cpp diff --git a/test/server/Jamfile b/test/server/Jamfile index 20117160..f7f46c9b 100644 --- a/test/server/Jamfile +++ b/test/server/Jamfile @@ -4,9 +4,11 @@ # 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 +# unit-test server-test : - ../../extras/beast/unit_test/main.cpp + ../../extras/boost/beast/unit_test/main.cpp file_service.cpp framework.cpp http_async_port.cpp diff --git a/test/server/file_service.cpp b/test/server/file_service.cpp index 334c60b2..432e2fef 100644 --- a/test/server/file_service.cpp +++ b/test/server/file_service.cpp @@ -4,7 +4,9 @@ // 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 "../../example/server-framework/file_service.hpp" +#include "example/server-framework/file_service.hpp" diff --git a/test/server/framework.cpp b/test/server/framework.cpp index ac995427..710ffbad 100644 --- a/test/server/framework.cpp +++ b/test/server/framework.cpp @@ -4,7 +4,9 @@ // 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 "../../example/server-framework/framework.hpp" +#include "example/server-framework/framework.hpp" diff --git a/test/server/http_async_port.cpp b/test/server/http_async_port.cpp index dfed5a0a..4e2b40ec 100644 --- a/test/server/http_async_port.cpp +++ b/test/server/http_async_port.cpp @@ -4,7 +4,9 @@ // 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 "../../example/server-framework/http_async_port.hpp" +#include "example/server-framework/http_async_port.hpp" diff --git a/test/server/http_base.cpp b/test/server/http_base.cpp index b27661d1..9fc40165 100644 --- a/test/server/http_base.cpp +++ b/test/server/http_base.cpp @@ -4,7 +4,9 @@ // 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 "../../example/server-framework/http_base.hpp" +#include "example/server-framework/http_base.hpp" diff --git a/test/server/http_sync_port.cpp b/test/server/http_sync_port.cpp index 4625ad94..f777552a 100644 --- a/test/server/http_sync_port.cpp +++ b/test/server/http_sync_port.cpp @@ -4,7 +4,9 @@ // 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 "../../example/server-framework/http_sync_port.hpp" +#include "example/server-framework/http_sync_port.hpp" diff --git a/test/server/https_ports.cpp b/test/server/https_ports.cpp index f8414cfc..7f7dc7c5 100644 --- a/test/server/https_ports.cpp +++ b/test/server/https_ports.cpp @@ -4,10 +4,12 @@ // 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 BEAST_USE_OPENSSL +#if BOOST_BEAST_USE_OPENSSL // Test that header file is self-contained. -#include "../../example/server-framework/https_ports.hpp" +#include "example/server-framework/https_ports.hpp" #endif diff --git a/test/server/multi_port.cpp b/test/server/multi_port.cpp index a86ee0f3..dfd0f06f 100644 --- a/test/server/multi_port.cpp +++ b/test/server/multi_port.cpp @@ -4,11 +4,13 @@ // 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 BEAST_USE_OPENSSL +#if BOOST_BEAST_USE_OPENSSL // Test that header file is self-contained. -#include "../../example/server-framework/multi_port.hpp" +#include "example/server-framework/multi_port.hpp" #endif diff --git a/test/server/server.cpp b/test/server/server.cpp index 0920a344..6924b96f 100644 --- a/test/server/server.cpp +++ b/test/server/server.cpp @@ -4,7 +4,9 @@ // 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 "../../example/server-framework/server.hpp" +#include "example/server-framework/server.hpp" diff --git a/test/server/service_list.cpp b/test/server/service_list.cpp index dd1569f8..1b06f5ac 100644 --- a/test/server/service_list.cpp +++ b/test/server/service_list.cpp @@ -4,7 +4,9 @@ // 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 "../../example/server-framework/service_list.hpp" +#include "example/server-framework/service_list.hpp" diff --git a/test/server/ssl_certificate.cpp b/test/server/ssl_certificate.cpp index 19b0baee..79e95efd 100644 --- a/test/server/ssl_certificate.cpp +++ b/test/server/ssl_certificate.cpp @@ -4,10 +4,12 @@ // 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 BEAST_USE_OPENSSL +#if BOOST_BEAST_USE_OPENSSL // Test that header file is self-contained. -#include "../../example/server-framework/ssl_certificate.hpp" +#include "example/server-framework/ssl_certificate.hpp" #endif diff --git a/test/server/tests.cpp b/test/server/tests.cpp index efd4b456..2376b727 100644 --- a/test/server/tests.cpp +++ b/test/server/tests.cpp @@ -4,6 +4,8 @@ // 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 +// #include "example/server-framework/http_sync_port.hpp" #include "example/server-framework/http_async_port.hpp" @@ -11,18 +13,19 @@ #include "example/server-framework/ws_async_port.hpp" #include "example/server-framework/ws_upgrade_service.hpp" -#if BEAST_USE_OPENSSL +#if BOOST_BEAST_USE_OPENSSL # include "example/server-framework/https_ports.hpp" # include "example/server-framework/multi_port.hpp" # include "example/server-framework/ssl_certificate.hpp" # include "example/server-framework/wss_ports.hpp" #endif -#include -#include -#include -#include +#include +#include +#include +#include +namespace boost { namespace beast { namespace websocket { @@ -75,7 +78,7 @@ public: req.set(beast::http::field::connection, "close"); beast::http::write(stream, req, ec); - if(! BEAST_EXPECTS( + if(! BOOST_BEAST_EXPECTS( ec == beast::http::error::end_of_stream, ec.message())) return; @@ -83,7 +86,7 @@ public: beast::flat_buffer b; beast::http::response res; beast::http::read(stream, b, res, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; } @@ -92,17 +95,17 @@ public: doHello(stream& ws, error_code& ec) { ws.handshake("localhost", "/", ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; ws.write(boost::asio::buffer(std::string("Hello, world!")), ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; beast::multi_buffer b; ws.read(b, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; ws.close(beast::websocket::close_code::normal, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; // VFALCO Verify the buffer's contents drain_buffer drain; @@ -111,7 +114,7 @@ public: ws.read(drain, ec); if(ec == beast::websocket::error::closed) break; - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; } } @@ -122,7 +125,7 @@ public: error_code ec; boost::asio::ip::tcp::socket con{ios_}; con.connect(ep, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; doOptions(con, ec); } @@ -133,7 +136,7 @@ public: error_code ec; stream ws{ios_}; ws.next_layer().connect(ep, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; doHello(ws, ec); } @@ -151,7 +154,7 @@ public: address_type::from_string("127.0.0.1"), port_num}; auto const wsp = instance.make_port( ec, ep1, instance, log, get_ws_options()); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; auto const ep2 = endpoint_type{ address_type::from_string("127.0.0.1"), @@ -159,10 +162,10 @@ public: auto const sp = instance.make_port< http_sync_port>>( ec, ep2, instance, log); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; sp->template init<0>(ec, *wsp); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; wsClient(ep1); @@ -179,7 +182,7 @@ public: address_type::from_string("127.0.0.1"), port_num}; auto const wsp = instance.make_port( ec, ep1, instance, log, get_ws_options()); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; auto const ep2 = endpoint_type{ address_type::from_string("127.0.0.1"), @@ -187,10 +190,10 @@ public: auto const sp = instance.make_port< http_async_port>>( ec, ep2, instance, log); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; sp->template init<0>(ec, *wsp); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; wsClient(ep1); @@ -200,7 +203,7 @@ public: } } -#if BEAST_USE_OPENSSL +#if BOOST_BEAST_USE_OPENSSL // // OpenSSL enabled ports // @@ -212,11 +215,11 @@ public: error_code ec; boost::asio::ssl::stream con{ios_, ctx}; con.next_layer().connect(ep, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; con.handshake( boost::asio::ssl::stream_base::client, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; doOptions(con, ec); if(ec) @@ -225,7 +228,7 @@ public: // VFALCO No idea why we get eof in the normal case if(ec == boost::asio::error::eof) ec.assign(0, ec.category()); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; } @@ -236,11 +239,11 @@ public: error_code ec; stream> wss{ios_, ctx}; wss.next_layer().next_layer().connect(ep, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; wss.next_layer().handshake( boost::asio::ssl::stream_base::client, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; doHello(wss, ec); } @@ -260,7 +263,7 @@ public: address_type::from_string("127.0.0.1"), port_num}; auto const wsp = instance.make_port( ec, ep1, instance, log, cert.get(), get_ws_options()); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; auto const ep2 = endpoint_type{ address_type::from_string("127.0.0.1"), @@ -268,10 +271,10 @@ public: auto const sp = instance.make_port< https_sync_port>>( ec, ep2, instance, log, cert.get()); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; sp->template init<0>(ec, *wsp); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; wssClient(ep1, cert.get()); @@ -288,7 +291,7 @@ public: address_type::from_string("127.0.0.1"), port_num}; auto const wsp = instance.make_port( ec, ep1, instance, log, cert.get(), get_ws_options()); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; auto const ep2 = endpoint_type{ address_type::from_string("127.0.0.1"), @@ -296,10 +299,10 @@ public: auto const sp = instance.make_port< https_async_port>>( ec, ep2, instance, log, cert.get()); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; sp->template init<0>(ec, *wsp); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; wssClient(ep1, cert.get()); @@ -315,14 +318,14 @@ public: { testPlain(); - #if BEAST_USE_OPENSSL + #if BOOST_BEAST_USE_OPENSSL testSSL(); #endif } }; -BEAST_DEFINE_TESTSUITE(server,websocket,beast); +BOOST_BEAST_DEFINE_TESTSUITE(server,websocket,beast); } // websocket } // beast - +} // boost diff --git a/test/server/ws_async_port.cpp b/test/server/ws_async_port.cpp index e826d97c..a9762829 100644 --- a/test/server/ws_async_port.cpp +++ b/test/server/ws_async_port.cpp @@ -4,7 +4,9 @@ // 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 "../../example/server-framework/ws_async_port.hpp" +#include "example/server-framework/ws_async_port.hpp" diff --git a/test/server/ws_sync_port.cpp b/test/server/ws_sync_port.cpp index 8bba84d8..20519aa2 100644 --- a/test/server/ws_sync_port.cpp +++ b/test/server/ws_sync_port.cpp @@ -4,7 +4,9 @@ // 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 "../../example/server-framework/ws_sync_port.hpp" +#include "example/server-framework/ws_sync_port.hpp" diff --git a/test/server/ws_upgrade_service.cpp b/test/server/ws_upgrade_service.cpp index dcabff75..1b005c14 100644 --- a/test/server/ws_upgrade_service.cpp +++ b/test/server/ws_upgrade_service.cpp @@ -4,7 +4,9 @@ // 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 "../../example/server-framework/ws_upgrade_service.hpp" +#include "example/server-framework/ws_upgrade_service.hpp" diff --git a/test/server/wss_ports.cpp b/test/server/wss_ports.cpp index 6307f532..0b4e0ec7 100644 --- a/test/server/wss_ports.cpp +++ b/test/server/wss_ports.cpp @@ -4,10 +4,12 @@ // 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 BEAST_USE_OPENSSL +#if BOOST_BEAST_USE_OPENSSL // Test that header file is self-contained. -#include "../../example/server-framework/wss_ports.hpp" +#include "example/server-framework/wss_ports.hpp" #endif diff --git a/test/version.cpp b/test/version.cpp index f4f10f9d..db180a9e 100644 --- a/test/version.cpp +++ b/test/version.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/websocket.cpp b/test/websocket.cpp index d1be7b29..d61f954a 100644 --- a/test/websocket.cpp +++ b/test/websocket.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/websocket/CMakeLists.txt b/test/websocket/CMakeLists.txt index 2807477d..846859fb 100644 --- a/test/websocket/CMakeLists.txt +++ b/test/websocket/CMakeLists.txt @@ -1,16 +1,24 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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(extras/beast extras) -GroupSources(include/beast beast) +GroupSources(extras/boost/beast extras) +GroupSources(include/boost/beast beast) GroupSources(test/websocket "/") #include_directories(../../example/) add_executable (websocket-tests - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${EXTRAS_INCLUDES} - ../../extras/beast/unit_test/main.cpp + Jamfile + ../../extras/boost/beast/unit_test/main.cpp websocket_async_echo_server.hpp websocket_sync_echo_server.hpp doc_snippets.cpp diff --git a/test/websocket/Jamfile b/test/websocket/Jamfile index 4781f16a..e4898f12 100644 --- a/test/websocket/Jamfile +++ b/test/websocket/Jamfile @@ -4,9 +4,11 @@ # 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 +# unit-test websocket-tests : - ../../extras/beast/unit_test/main.cpp + ../../extras/boost/beast/unit_test/main.cpp doc_snippets.cpp error.cpp option.cpp diff --git a/test/websocket/doc_snippets.cpp b/test/websocket/doc_snippets.cpp index 1e27c58e..1ce46f8a 100644 --- a/test/websocket/doc_snippets.cpp +++ b/test/websocket/doc_snippets.cpp @@ -4,8 +4,10 @@ // 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 +// -#include +#include #include #include #include @@ -15,11 +17,11 @@ #include //[ws_snippet_1 -#include -using namespace beast::websocket; +#include +using namespace boost::beast::websocket; //] -using namespace beast; +using namespace boost::beast; namespace doc_ws_snippets { @@ -233,10 +235,10 @@ void echo(stream& ws, //------------------------------------------------------------------------------ -#if BEAST_USE_OPENSSL +#if BOOST_BEAST_USE_OPENSSL //[wss_snippet_1 -#include +#include #include //] diff --git a/test/websocket/error.cpp b/test/websocket/error.cpp index a82b399b..a6ef8e03 100644 --- a/test/websocket/error.cpp +++ b/test/websocket/error.cpp @@ -4,13 +4,16 @@ // 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 +#include -#include +#include #include +namespace boost { namespace beast { namespace websocket { @@ -20,15 +23,15 @@ public: void check(char const* name, error ev) { auto const ec = make_error_code(ev); - BEAST_EXPECT(std::string{ec.category().name()} == name); - BEAST_EXPECT(! ec.message().empty()); - BEAST_EXPECT(std::addressof(ec.category()) == + BOOST_BEAST_EXPECT(std::string{ec.category().name()} == name); + BOOST_BEAST_EXPECT(! ec.message().empty()); + BOOST_BEAST_EXPECT(std::addressof(ec.category()) == std::addressof(detail::get_error_category())); - BEAST_EXPECT(detail::get_error_category().equivalent( + BOOST_BEAST_EXPECT(detail::get_error_category().equivalent( static_cast::type>(ev), ec.category().default_error_condition( static_cast::type>(ev)))); - BEAST_EXPECT(detail::get_error_category().equivalent( + BOOST_BEAST_EXPECT(detail::get_error_category().equivalent( ec, static_cast::type>(ev))); } @@ -41,7 +44,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(error,websocket,beast); +BOOST_BEAST_DEFINE_TESTSUITE(error,websocket,beast); } // websocket } // beast +} // boost diff --git a/test/websocket/frame.cpp b/test/websocket/frame.cpp index 2dc21c4e..497b1ba0 100644 --- a/test/websocket/frame.cpp +++ b/test/websocket/frame.cpp @@ -4,15 +4,18 @@ // 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 +// -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include +namespace boost { namespace beast { namespace websocket { namespace detail { @@ -39,20 +42,20 @@ class frame_test public: void testCloseCodes() { - BEAST_EXPECT(! is_valid_close_code(0)); - BEAST_EXPECT(! is_valid_close_code(1)); - BEAST_EXPECT(! is_valid_close_code(999)); - BEAST_EXPECT(! is_valid_close_code(1004)); - BEAST_EXPECT(! is_valid_close_code(1005)); - BEAST_EXPECT(! is_valid_close_code(1006)); - BEAST_EXPECT(! is_valid_close_code(1016)); - BEAST_EXPECT(! is_valid_close_code(2000)); - BEAST_EXPECT(! is_valid_close_code(2999)); - BEAST_EXPECT(is_valid_close_code(1000)); - BEAST_EXPECT(is_valid_close_code(1002)); - BEAST_EXPECT(is_valid_close_code(3000)); - BEAST_EXPECT(is_valid_close_code(4000)); - BEAST_EXPECT(is_valid_close_code(5000)); + BOOST_BEAST_EXPECT(! is_valid_close_code(0)); + BOOST_BEAST_EXPECT(! is_valid_close_code(1)); + BOOST_BEAST_EXPECT(! is_valid_close_code(999)); + BOOST_BEAST_EXPECT(! is_valid_close_code(1004)); + BOOST_BEAST_EXPECT(! is_valid_close_code(1005)); + BOOST_BEAST_EXPECT(! is_valid_close_code(1006)); + BOOST_BEAST_EXPECT(! is_valid_close_code(1016)); + BOOST_BEAST_EXPECT(! is_valid_close_code(2000)); + BOOST_BEAST_EXPECT(! is_valid_close_code(2999)); + BOOST_BEAST_EXPECT(is_valid_close_code(1000)); + BOOST_BEAST_EXPECT(is_valid_close_code(1002)); + BOOST_BEAST_EXPECT(is_valid_close_code(3000)); + BOOST_BEAST_EXPECT(is_valid_close_code(4000)); + BOOST_BEAST_EXPECT(is_valid_close_code(5000)); } struct test_fh : frame_header @@ -92,16 +95,16 @@ public: detail::frame_header fh1; auto const n = stream.read_fh1(fh1, b, code); - if(! BEAST_EXPECT(! code)) + if(! BOOST_BEAST_EXPECT(! code)) return; - if(! BEAST_EXPECT(b.size() == n)) + if(! BOOST_BEAST_EXPECT(b.size() == n)) return; stream.read_fh2(fh1, b, code); - if(! BEAST_EXPECT(! code)) + if(! BOOST_BEAST_EXPECT(! code)) return; - if(! BEAST_EXPECT(b.size() == 0)) + if(! BOOST_BEAST_EXPECT(b.size() == 0)) return; - BEAST_EXPECT(fh1 == fh); + BOOST_BEAST_EXPECT(fh1 == fh); }; test_fh fh; @@ -149,12 +152,12 @@ public: pass(); return; } - if(! BEAST_EXPECT(b.size() == n)) + if(! BOOST_BEAST_EXPECT(b.size() == n)) return; stream.read_fh2(fh1, b, code); - if(! BEAST_EXPECT(code)) + if(! BOOST_BEAST_EXPECT(code)) return; - if(! BEAST_EXPECT(b.size() == 0)) + if(! BOOST_BEAST_EXPECT(b.size() == 0)) return; }; @@ -218,12 +221,12 @@ public: pass(); return; } - if(! BEAST_EXPECT(b.size() == n)) + if(! BOOST_BEAST_EXPECT(b.size() == n)) return; stream.read_fh2(fh, b, code); - if(! BEAST_EXPECT(code)) + if(! BOOST_BEAST_EXPECT(code)) return; - if(! BEAST_EXPECT(b.size() == 0)) + if(! BOOST_BEAST_EXPECT(b.size() == 0)) return; } @@ -246,8 +249,9 @@ public: } }; -BEAST_DEFINE_TESTSUITE(frame,websocket,beast); +BOOST_BEAST_DEFINE_TESTSUITE(frame,websocket,beast); } // detail } // websocket } // beast +} // boost diff --git a/test/websocket/mask.cpp b/test/websocket/mask.cpp index 83472556..e9cae5b6 100644 --- a/test/websocket/mask.cpp +++ b/test/websocket/mask.cpp @@ -4,12 +4,15 @@ // 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 +#include -#include +#include +namespace boost { namespace beast { namespace websocket { namespace detail { @@ -43,13 +46,13 @@ public: void run() override { maskgen_t mg; - BEAST_EXPECT(mg() != 0); + BOOST_BEAST_EXPECT(mg() != 0); } }; -BEAST_DEFINE_TESTSUITE(mask,websocket,beast); +BOOST_BEAST_DEFINE_TESTSUITE(mask,websocket,beast); } // detail } // websocket } // beast - +} // boost diff --git a/test/websocket/option.cpp b/test/websocket/option.cpp index e0cd2ee5..0a3c1194 100644 --- a/test/websocket/option.cpp +++ b/test/websocket/option.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/websocket/rfc6455.cpp b/test/websocket/rfc6455.cpp index 169ba810..46515597 100644 --- a/test/websocket/rfc6455.cpp +++ b/test/websocket/rfc6455.cpp @@ -4,12 +4,15 @@ // 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 +#include -#include +#include +namespace boost { namespace beast { namespace websocket { @@ -22,18 +25,18 @@ public: { http::header req; req.version = 10; - BEAST_EXPECT(! is_upgrade(req)); + BOOST_BEAST_EXPECT(! is_upgrade(req)); req.version = 11; req.method(http::verb::post); req.target("/"); - BEAST_EXPECT(! is_upgrade(req)); + BOOST_BEAST_EXPECT(! is_upgrade(req)); req.method(http::verb::get); req.insert("Connection", "upgrade"); - BEAST_EXPECT(! is_upgrade(req)); + BOOST_BEAST_EXPECT(! is_upgrade(req)); req.insert("Upgrade", "websocket"); - BEAST_EXPECT(! is_upgrade(req)); + BOOST_BEAST_EXPECT(! is_upgrade(req)); req.insert("Sec-WebSocket-Version", "13"); - BEAST_EXPECT(is_upgrade(req)); + BOOST_BEAST_EXPECT(is_upgrade(req)); } void @@ -43,7 +46,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(rfc6455,websocket,beast); +BOOST_BEAST_DEFINE_TESTSUITE(rfc6455,websocket,beast); } // websocket } // beast +} // boost diff --git a/test/websocket/stream.cpp b/test/websocket/stream.cpp index 878a38a9..2ab8c9ef 100644 --- a/test/websocket/stream.cpp +++ b/test/websocket/stream.cpp @@ -4,27 +4,30 @@ // 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 +#include #include "websocket_async_echo_server.hpp" #include "websocket_sync_echo_server.hpp" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include #include #include +namespace boost { namespace beast { namespace websocket { @@ -624,7 +627,7 @@ public: , 20}; bool called = false; c.accept_ex(ws, res_decorator{called}); - BEAST_EXPECT(called); + BOOST_BEAST_EXPECT(called); } // request in buffers { @@ -653,7 +656,7 @@ public: "Sec-WebSocket-Version: 13\r\n" "\r\n"), res_decorator{called}); - BEAST_EXPECT(called); + BOOST_BEAST_EXPECT(called); } // request in buffers and stream { @@ -684,7 +687,7 @@ public: "Host: localhost\r\n" "Upgrade: websocket\r\n"), res_decorator{called}); - BEAST_EXPECT(called); + BOOST_BEAST_EXPECT(called); } // request in message { @@ -716,7 +719,7 @@ public: bool called = false; c.accept_ex(ws, req, res_decorator{called}); - BEAST_EXPECT(called); + BOOST_BEAST_EXPECT(called); } // request in message, close frame in buffers { @@ -761,7 +764,7 @@ public: c.accept_ex(ws, req, cbuf(0x88, 0x82, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x17), res_decorator{called}); - BEAST_EXPECT(called); + BOOST_BEAST_EXPECT(called); try { multi_buffer b; @@ -861,7 +864,7 @@ public: } break; } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); } void @@ -932,7 +935,7 @@ public: bool called = false; c.handshake_ex(ws, "localhost", "/", req_decorator{called}); - BEAST_EXPECT(called); + BOOST_BEAST_EXPECT(called); } // handshake_ex, response { @@ -944,7 +947,7 @@ public: c.handshake_ex(ws, res, "localhost", "/", req_decorator{called}); // VFALCO validate res? - BEAST_EXPECT(called); + BOOST_BEAST_EXPECT(called); } } catch(system_error const&) @@ -953,7 +956,7 @@ public: } break; } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); } void @@ -964,7 +967,7 @@ public: auto const any = endpoint_type{ address_type::from_string("127.0.0.1"), 0}; server.open(any, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); auto const ep = server.local_endpoint(); testHandshake(ep, SyncClient{}); yield_to( @@ -989,11 +992,11 @@ public: { ws.accept( boost::asio::buffer(s.data(), i)); - BEAST_EXPECTS(! ev, ev.message()); + BOOST_BEAST_EXPECTS(! ev, ev.message()); } catch(system_error const& se) { - BEAST_EXPECTS(se.code() == ev, se.what()); + BOOST_BEAST_EXPECTS(se.code() == ev, se.what()); } } }; @@ -1099,7 +1102,7 @@ public: } catch(system_error const& se) { - BEAST_EXPECT(se.code() == error::handshake_failed); + BOOST_BEAST_EXPECT(se.code() == error::handshake_failed); } }; // wrong HTTP version @@ -1174,20 +1177,20 @@ public: error_code ec = test::error::fail_error; socket_type sock(ios_); sock.connect(ep, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) break; stream ws(sock); ws.handshake("localhost", "/", ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) break; ws.write(boost::asio::buffer(v), ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) break; multi_buffer db; ws.read(db, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) break; - BEAST_EXPECT(to_string(db.data()) == + BOOST_BEAST_EXPECT(to_string(db.data()) == std::string(v.data(), v.size())); v.push_back(n+1); } @@ -1199,20 +1202,20 @@ public: error_code ec = test::error::fail_error; socket_type sock(ios_); sock.connect(ep, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) break; stream ws(sock); ws.handshake("localhost", "/", ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) break; ws.async_write(boost::asio::buffer(v), do_yield[ec]); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) break; multi_buffer db; ws.async_read(db, do_yield[ec]); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) break; - BEAST_EXPECT(to_string(db.data()) == + BOOST_BEAST_EXPECT(to_string(db.data()) == std::string(v.data(), v.size())); v.push_back(n+1); } @@ -1289,7 +1292,7 @@ public: { ++count; // Send is canceled because close received. - BEAST_EXPECT(ec == boost::asio:: + BOOST_BEAST_EXPECT(ec == boost::asio:: error::operation_aborted, ec.message()); // Writes after close are aborted. @@ -1297,7 +1300,7 @@ public: [&](error_code ec) { ++count; - BEAST_EXPECT(ec == boost::asio:: + BOOST_BEAST_EXPECT(ec == boost::asio:: error::operation_aborted, ec.message()); }); @@ -1311,7 +1314,7 @@ public: break; ios.run_one(); } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); ios.run(); } #endif @@ -1336,14 +1339,14 @@ public: { // Read should fail with protocol error ++count; - BEAST_EXPECTS( + BOOST_BEAST_EXPECTS( ec == error::failed, ec.message()); // Reads after failure are aborted ws.async_read(db, [&](error_code ec) { ++count; - BEAST_EXPECTS(ec == boost::asio:: + BOOST_BEAST_EXPECTS(ec == boost::asio:: error::operation_aborted, ec.message()); }); @@ -1358,7 +1361,7 @@ public: { ++count; // Send is canceled because close received. - BEAST_EXPECTS(ec == boost::asio:: + BOOST_BEAST_EXPECTS(ec == boost::asio:: error::operation_aborted, ec.message()); // Writes after close are aborted. @@ -1366,7 +1369,7 @@ public: [&](error_code ec) { ++count; - BEAST_EXPECTS(ec == boost::asio:: + BOOST_BEAST_EXPECTS(ec == boost::asio:: error::operation_aborted, ec.message()); }); @@ -1380,7 +1383,7 @@ public: break; ios.run_one(); } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); ios.run(); } @@ -1403,19 +1406,19 @@ public: { // Read should complete with error::closed ++count; - BEAST_EXPECTS(ec == error::closed, + BOOST_BEAST_EXPECTS(ec == error::closed, ec.message()); // Pings after a close are aborted ws.async_ping("", [&](error_code ec) { ++count; - BEAST_EXPECTS(ec == boost::asio:: + BOOST_BEAST_EXPECTS(ec == boost::asio:: error::operation_aborted, ec.message()); }); }); - if(! BEAST_EXPECT(run_until(ios, 100, + if(! BOOST_BEAST_EXPECT(run_until(ios, 100, [&]{ return ws.wr_close_; }))) return; // Try to ping @@ -1424,7 +1427,7 @@ public: { // Pings after a close are aborted ++count; - BEAST_EXPECTS(ec == boost::asio:: + BOOST_BEAST_EXPECTS(ec == boost::asio:: error::operation_aborted, ec.message()); // Subsequent calls to close are aborted @@ -1432,7 +1435,7 @@ public: [&](error_code ec) { ++count; - BEAST_EXPECTS(ec == boost::asio:: + BOOST_BEAST_EXPECTS(ec == boost::asio:: error::operation_aborted, ec.message()); }); @@ -1445,7 +1448,7 @@ public: break; ios.run_one(); } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); ios.run(); } @@ -1465,7 +1468,7 @@ public: [&](error_code ec) { ++count; - BEAST_EXPECTS(ec == error::closed, + BOOST_BEAST_EXPECTS(ec == error::closed, ec.message()); }); while(! ws.wr_block_) @@ -1475,7 +1478,7 @@ public: [&](error_code ec) { ++count; - BEAST_EXPECTS(ec == boost::asio:: + BOOST_BEAST_EXPECTS(ec == boost::asio:: error::operation_aborted, ec.message()); }); @@ -1487,7 +1490,7 @@ public: break; ios.run_one(); } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); ios.run(); } @@ -1502,20 +1505,20 @@ public: ws.async_write(sbuf("CLOSE"), [&](error_code ec) { - BEAST_EXPECT(! ec); + BOOST_BEAST_EXPECT(! ec); ws.async_write(sbuf("PING"), [&](error_code ec) { - BEAST_EXPECT(! ec); + BOOST_BEAST_EXPECT(! ec); }); }); multi_buffer db; ws.async_read(db, [&](error_code ec) { - BEAST_EXPECTS(ec == error::closed, ec.message()); + BOOST_BEAST_EXPECTS(ec == error::closed, ec.message()); }); - if(! BEAST_EXPECT(run_until(ios, 100, + if(! BOOST_BEAST_EXPECT(run_until(ios, 100, [&]{ return ios.stopped(); }))) return; } @@ -1532,17 +1535,17 @@ public: error_code ec; socket_type sock{ios_}; sock.connect(ep, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; stream ws{sock}; ws.handshake("localhost", "/", ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; ws.write_some(false, sbuf("u")); ws.write_some(true, sbuf("v")); multi_buffer b; ws.read(b, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; } @@ -1555,11 +1558,11 @@ public: error_code ec; socket_type sock(ios); sock.connect(ep, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) break; stream ws(sock); ws.handshake("localhost", "/", ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) break; ws.async_write_some(false, boost::asio::null_buffers{}, @@ -1568,7 +1571,7 @@ public: fail(); }); ws.next_layer().cancel(ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) break; // // Destruction of the io_service will cause destruction @@ -1611,7 +1614,7 @@ public: } error_code ec; ws.lowest_layer().connect(ep, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) throw abort_test{}; c.handshake(ws, "localhost", "/"); }; @@ -1621,7 +1624,7 @@ public: // connect error_code ec; ws.lowest_layer().connect(ep, ec); - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) return; } c.handshake(ws, "localhost", "/"); @@ -1634,8 +1637,8 @@ public: // receive echoed message multi_buffer db; c.read(ws, db); - BEAST_EXPECT(ws.got_text()); - BEAST_EXPECT(to_string(db.data()) == "Hello"); + BOOST_BEAST_EXPECT(ws.got_text()); + BOOST_BEAST_EXPECT(to_string(db.data()) == "Hello"); } // close, no payload @@ -1657,10 +1660,10 @@ public: ws.control_callback( [&](frame_type kind, string_view s) { - BEAST_EXPECT(kind == frame_type::pong); - BEAST_EXPECT(! once); + BOOST_BEAST_EXPECT(kind == frame_type::pong); + BOOST_BEAST_EXPECT(! once); once = true; - BEAST_EXPECT(s == ""); + BOOST_BEAST_EXPECT(s == ""); }); c.ping(ws, ""); ws.binary(true); @@ -1669,9 +1672,9 @@ public: // receive echoed message multi_buffer db; c.read(ws, db); - BEAST_EXPECT(once); - BEAST_EXPECT(ws.got_binary()); - BEAST_EXPECT(to_string(db.data()) == "Hello"); + BOOST_BEAST_EXPECT(once); + BOOST_BEAST_EXPECT(ws.got_binary()); + BOOST_BEAST_EXPECT(to_string(db.data()) == "Hello"); } ws.control_callback({}); @@ -1680,10 +1683,10 @@ public: ws.control_callback( [&](frame_type kind, string_view s) { - BEAST_EXPECT(kind == frame_type::pong); - BEAST_EXPECT(! once); + BOOST_BEAST_EXPECT(kind == frame_type::pong); + BOOST_BEAST_EXPECT(! once); once = true; - BEAST_EXPECT(s == "payload"); + BOOST_BEAST_EXPECT(s == "payload"); }); ws.ping("payload"); c.write_some(ws, false, sbuf("Hello, ")); @@ -1693,8 +1696,8 @@ public: // receive echoed message multi_buffer db; c.read(ws, db); - BEAST_EXPECT(once); - BEAST_EXPECT(to_string(db.data()) == "Hello, World!"); + BOOST_BEAST_EXPECT(once); + BOOST_BEAST_EXPECT(to_string(db.data()) == "Hello, World!"); } ws.control_callback({}); @@ -1709,7 +1712,7 @@ public: // receive echoed message multi_buffer b; c.read(ws, b); - BEAST_EXPECT(to_string(b.data()) == "Now is the time for all good men"); + BOOST_BEAST_EXPECT(to_string(b.data()) == "Now is the time for all good men"); } ws.auto_fragment(false); ws.write_buffer_size(4096); @@ -1723,7 +1726,7 @@ public: // receive echoed message multi_buffer db; c.read(ws, db); - BEAST_EXPECT(to_string(db.data()) == s); + BOOST_BEAST_EXPECT(to_string(db.data()) == s); } } @@ -1736,8 +1739,8 @@ public: // receive echoed message multi_buffer db; c.read(ws, db); - BEAST_EXPECT(ws.got_text()); - BEAST_EXPECT(to_string(db.data()) == "Hello"); + BOOST_BEAST_EXPECT(ws.got_text()); + BOOST_BEAST_EXPECT(to_string(db.data()) == "Hello"); } // cause close @@ -1807,7 +1810,7 @@ public: } break; } - BEAST_EXPECT(n < limit); + BOOST_BEAST_EXPECT(n < limit); } void @@ -1852,7 +1855,7 @@ public: ::websocket::sync_echo_server server{nullptr}; server.set_option(pmd); server.open(any, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); auto const ep = server.local_endpoint(); //testPausation1(ep); testPausation2(ep); @@ -1867,7 +1870,7 @@ public: error_code ec; ::websocket::async_echo_server server{nullptr, 4}; server.open(any, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); auto const ep = server.local_endpoint(); testAsyncWriteFrame(ep); } @@ -1880,7 +1883,7 @@ public: ::websocket::sync_echo_server server{nullptr}; server.set_option(pmd); server.open(any, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); auto const ep = server.local_endpoint(); testEndpoint(SyncClient{}, ep, pmd); yield_to( @@ -1895,7 +1898,7 @@ public: ::websocket::async_echo_server server{nullptr, 4}; server.set_option(pmd); server.open(any, ec); - BEAST_EXPECTS(! ec, ec.message()); + BOOST_BEAST_EXPECTS(! ec, ec.message()); auto const ep = server.local_endpoint(); testEndpoint(SyncClient{}, ep, pmd); yield_to( @@ -1911,7 +1914,7 @@ public: pmd.server_enable = false; doClientTests(pmd); - #if ! BEAST_NO_SLOW_TESTS + #if ! BOOST_BEAST_NO_SLOW_TESTS pmd.client_enable = true; pmd.server_enable = true; pmd.client_max_window_bits = 10; @@ -1927,7 +1930,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(stream,websocket,beast); +BOOST_BEAST_DEFINE_TESTSUITE(stream,websocket,beast); } // websocket } // beast +} // boost diff --git a/test/websocket/teardown.cpp b/test/websocket/teardown.cpp index e0985f7b..0efb1aa9 100644 --- a/test/websocket/teardown.cpp +++ b/test/websocket/teardown.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/websocket/utf8_checker.cpp b/test/websocket/utf8_checker.cpp index dc01a332..9ee1ef13 100644 --- a/test/websocket/utf8_checker.cpp +++ b/test/websocket/utf8_checker.cpp @@ -4,15 +4,18 @@ // 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 +#include -#include -#include -#include +#include +#include +#include #include +namespace boost { namespace beast { namespace websocket { namespace detail { @@ -35,22 +38,22 @@ public: })(); // Valid range 0-127 - BEAST_EXPECT(utf8.write(buf.data(), 128)); - BEAST_EXPECT(utf8.finish()); + BOOST_BEAST_EXPECT(utf8.write(buf.data(), 128)); + BOOST_BEAST_EXPECT(utf8.finish()); // Invalid range 128-193 for(auto it = std::next(buf.begin(), 128); it != std::next(buf.begin(), 194); ++it) - BEAST_EXPECT(! utf8.write(&(*it), 1)); + BOOST_BEAST_EXPECT(! utf8.write(&(*it), 1)); // Invalid range 245-255 for(auto it = std::next(buf.begin(), 245); it != buf.end(); ++it) - BEAST_EXPECT(! utf8.write(&(*it), 1)); + BOOST_BEAST_EXPECT(! utf8.write(&(*it), 1)); // Invalid sequence std::fill(buf.begin(), buf.end(), '\xff'); - BEAST_EXPECT(! utf8.write(&buf.front(), buf.size())); + BOOST_BEAST_EXPECT(! utf8.write(&buf.front(), buf.size())); } void @@ -67,27 +70,27 @@ public: { // Second byte valid range 128-191 buf[1] = static_cast(j); - BEAST_EXPECT(utf8.write(buf, 2)); - BEAST_EXPECT(utf8.finish()); + BOOST_BEAST_EXPECT(utf8.write(buf, 2)); + BOOST_BEAST_EXPECT(utf8.finish()); } for(auto j = 0; j <= 127; ++j) { // Second byte invalid range 0-127 buf[1] = static_cast(j); - BEAST_EXPECT(! utf8.write(buf, 2)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 2)); } for(auto j = 192; j <= 255; ++j) { // Second byte invalid range 192-255 buf[1] = static_cast(j); - BEAST_EXPECT(! utf8.write(buf, 2)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 2)); } // Segmented sequence second byte invalid - BEAST_EXPECT(utf8.write(buf, 1)); - BEAST_EXPECT(! utf8.write(&buf[1], 1)); + BOOST_BEAST_EXPECT(utf8.write(buf, 1)); + BOOST_BEAST_EXPECT(! utf8.write(&buf[1], 1)); utf8.reset(); } } @@ -113,15 +116,15 @@ public: { // Third byte valid range 128-191 buf[2] = static_cast(k); - BEAST_EXPECT(utf8.write(buf, 3)); - BEAST_EXPECT(utf8.finish()); + BOOST_BEAST_EXPECT(utf8.write(buf, 3)); + BOOST_BEAST_EXPECT(utf8.finish()); // Segmented sequence - BEAST_EXPECT(utf8.write(buf, 1)); - BEAST_EXPECT(utf8.write(&buf[1], 2)); + BOOST_BEAST_EXPECT(utf8.write(buf, 1)); + BOOST_BEAST_EXPECT(utf8.write(&buf[1], 2)); utf8.reset(); // Segmented sequence - BEAST_EXPECT(utf8.write(buf, 2)); - BEAST_EXPECT(utf8.write(&buf[2], 1)); + BOOST_BEAST_EXPECT(utf8.write(buf, 2)); + BOOST_BEAST_EXPECT(utf8.write(&buf[2], 1)); utf8.reset(); if (i == 224) @@ -130,11 +133,11 @@ public: { // Second byte invalid range 0-127 or 0-159 buf[1] = static_cast(l); - BEAST_EXPECT(! utf8.write(buf, 3)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 3)); if (l > 127) { // Segmented sequence second byte invalid - BEAST_EXPECT(! utf8.write(buf, 2)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 2)); utf8.reset(); } } @@ -146,11 +149,11 @@ public: { // Second byte invalid range 160-255 or 192-255 buf[1] = static_cast(l); - BEAST_EXPECT(!utf8.write(buf, 3)); + BOOST_BEAST_EXPECT(!utf8.write(buf, 3)); if (l > 159) { // Segmented sequence second byte invalid - BEAST_EXPECT(! utf8.write(buf, 2)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 2)); utf8.reset(); } } @@ -162,19 +165,19 @@ public: { // Third byte invalid range 0-127 buf[2] = static_cast(k); - BEAST_EXPECT(! utf8.write(buf, 3)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 3)); } for(auto k = 192; k <= 255; ++k) { // Third byte invalid range 192-255 buf[2] = static_cast(k); - BEAST_EXPECT(! utf8.write(buf, 3)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 3)); } // Segmented sequence third byte invalid - BEAST_EXPECT(utf8.write(buf, 2)); - BEAST_EXPECT(! utf8.write(&buf[2], 1)); + BOOST_BEAST_EXPECT(utf8.write(buf, 2)); + BOOST_BEAST_EXPECT(! utf8.write(&buf[2], 1)); utf8.reset(); } @@ -182,19 +185,19 @@ public: { // Second byte invalid range 0-127 or 0-159 buf[1] = static_cast(j); - BEAST_EXPECT(! utf8.write(buf, 3)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 3)); } for(auto j = e + 1; j <= 255; ++j) { // Second byte invalid range 160-255 or 192-255 buf[1] = static_cast(j); - BEAST_EXPECT(! utf8.write(buf, 3)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 3)); } // Segmented sequence second byte invalid - BEAST_EXPECT(utf8.write(buf, 1)); - BEAST_EXPECT(! utf8.write(&buf[1], 1)); + BOOST_BEAST_EXPECT(utf8.write(buf, 1)); + BOOST_BEAST_EXPECT(! utf8.write(&buf[1], 1)); utf8.reset(); } } @@ -226,19 +229,19 @@ public: { // Fourth byte valid range 128-191 buf[3] = static_cast(n); - BEAST_EXPECT(utf8.write(const_buffers_1{buf, 4})); - BEAST_EXPECT(utf8.finish()); + BOOST_BEAST_EXPECT(utf8.write(const_buffers_1{buf, 4})); + BOOST_BEAST_EXPECT(utf8.finish()); // Segmented sequence - BEAST_EXPECT(utf8.write(buf, 1)); - BEAST_EXPECT(utf8.write(&buf[1], 3)); + BOOST_BEAST_EXPECT(utf8.write(buf, 1)); + BOOST_BEAST_EXPECT(utf8.write(&buf[1], 3)); utf8.reset(); // Segmented sequence - BEAST_EXPECT(utf8.write(buf, 2)); - BEAST_EXPECT(utf8.write(&buf[2], 2)); + BOOST_BEAST_EXPECT(utf8.write(buf, 2)); + BOOST_BEAST_EXPECT(utf8.write(&buf[2], 2)); utf8.reset(); // Segmented sequence - BEAST_EXPECT(utf8.write(buf, 3)); - BEAST_EXPECT(utf8.write(&buf[3], 1)); + BOOST_BEAST_EXPECT(utf8.write(buf, 3)); + BOOST_BEAST_EXPECT(utf8.write(&buf[3], 1)); utf8.reset(); if (i == 240) @@ -247,11 +250,11 @@ public: { // Second byte invalid range 0-127 or 0-143 buf[1] = static_cast(l); - BEAST_EXPECT(! utf8.write(buf, 4)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 4)); if (l > 127) { // Segmented sequence second byte invalid - BEAST_EXPECT(! utf8.write(buf, 2)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 2)); utf8.reset(); } } @@ -263,11 +266,11 @@ public: { // Second byte invalid range 144-255 or 192-255 buf[1] = static_cast(l); - BEAST_EXPECT(! utf8.write(buf, 4)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 4)); if (l > 143) { // Segmented sequence second byte invalid - BEAST_EXPECT(! utf8.write(buf, 2)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 2)); utf8.reset(); } } @@ -279,19 +282,19 @@ public: { // Fourth byte invalid range 0-127 buf[3] = static_cast(n); - BEAST_EXPECT(! utf8.write(const_buffers_1{buf, 4})); + BOOST_BEAST_EXPECT(! utf8.write(const_buffers_1{buf, 4})); } for(auto n = 192; n <= 255; ++n) { // Fourth byte invalid range 192-255 buf[3] = static_cast(n); - BEAST_EXPECT(! utf8.write(buf, 4)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 4)); } // Segmented sequence fourth byte invalid - BEAST_EXPECT(utf8.write(buf, 3)); - BEAST_EXPECT(! utf8.write(&buf[3], 1)); + BOOST_BEAST_EXPECT(utf8.write(buf, 3)); + BOOST_BEAST_EXPECT(! utf8.write(&buf[3], 1)); utf8.reset(); } @@ -299,19 +302,19 @@ public: { // Third byte invalid range 0-127 buf[2] = static_cast(k); - BEAST_EXPECT(! utf8.write(buf, 4)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 4)); } for(auto k = 192; k <= 255; ++k) { // Third byte invalid range 192-255 buf[2] = static_cast(k); - BEAST_EXPECT(! utf8.write(buf, 4)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 4)); } // Segmented sequence third byte invalid - BEAST_EXPECT(utf8.write(buf, 2)); - BEAST_EXPECT(! utf8.write(&buf[2], 1)); + BOOST_BEAST_EXPECT(utf8.write(buf, 2)); + BOOST_BEAST_EXPECT(! utf8.write(&buf[2], 1)); utf8.reset(); } @@ -319,19 +322,19 @@ public: { // Second byte invalid range 0-127 or 0-143 buf[1] = static_cast(j); - BEAST_EXPECT(! utf8.write(buf, 4)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 4)); } for(auto j = e + 1; j <= 255; ++j) { // Second byte invalid range 144-255 or 192-255 buf[1] = static_cast(j); - BEAST_EXPECT(! utf8.write(buf, 4)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 4)); } // Segmented sequence second byte invalid - BEAST_EXPECT(utf8.write(buf, 1)); - BEAST_EXPECT(! utf8.write(&buf[1], 1)); + BOOST_BEAST_EXPECT(utf8.write(buf, 1)); + BOOST_BEAST_EXPECT(! utf8.write(&buf[1], 1)); utf8.reset(); } @@ -339,7 +342,7 @@ public: { // First byte invalid range 245-255 buf[0] = static_cast(i); - BEAST_EXPECT(! utf8.write(buf, 4)); + BOOST_BEAST_EXPECT(! utf8.write(buf, 4)); } } @@ -387,8 +390,8 @@ public: cb.consume(amount); n -= amount; } - BEAST_EXPECT(utf8.write(b.data())); - BEAST_EXPECT(utf8.finish()); + BOOST_BEAST_EXPECT(utf8.write(b.data())); + BOOST_BEAST_EXPECT(utf8.finish()); } } } @@ -403,10 +406,11 @@ public: } }; -#if defined(NDEBUG) && ! BEAST_NO_SLOW_TESTS -BEAST_DEFINE_TESTSUITE(utf8_checker,websocket,beast); +#if defined(NDEBUG) && ! BOOST_BEAST_NO_SLOW_TESTS +BOOST_BEAST_DEFINE_TESTSUITE(utf8_checker,websocket,beast); #endif } // detail } // websocket } // beast +} // boost diff --git a/test/websocket/websocket_async_echo_server.hpp b/test/websocket/websocket_async_echo_server.hpp index 8aa39991..9c04fa5f 100644 --- a/test/websocket/websocket_async_echo_server.hpp +++ b/test/websocket/websocket_async_echo_server.hpp @@ -4,12 +4,14 @@ // 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 BEAST_WEBSOCKET_ASYNC_ECHO_SERVER_HPP -#define BEAST_WEBSOCKET_ASYNC_ECHO_SERVER_HPP +#ifndef BOOST_BEAST_WEBSOCKET_ASYNC_ECHO_SERVER_HPP +#define BOOST_BEAST_WEBSOCKET_ASYNC_ECHO_SERVER_HPP -#include -#include +#include +#include #include #include #include @@ -32,7 +34,7 @@ namespace websocket { class async_echo_server { public: - using error_code = beast::error_code; + using error_code = boost::beast::error_code; using address_type = boost::asio::ip::address; using socket_type = boost::asio::ip::tcp::socket; using endpoint_type = boost::asio::ip::tcp::endpoint; @@ -48,7 +50,7 @@ private: { virtual ~callable() = default; virtual void operator()( - beast::websocket::stream&) = 0; + boost::beast::websocket::stream&) = 0; }; template @@ -64,7 +66,7 @@ private: } void - operator()(beast::websocket::stream& ws) + operator()(boost::beast::websocket::stream& ws) { t_(ws); } @@ -85,7 +87,7 @@ private: } void - operator()(beast::websocket::stream& ws) const + operator()(boost::beast::websocket::stream& ws) const { ws.set_option(opt_); } @@ -106,7 +108,7 @@ private: } void - set_options(beast::websocket::stream& ws) + set_options(boost::beast::websocket::stream& ws) { for(auto const& op : list_) (*op.second)(ws); @@ -213,9 +215,9 @@ private: async_echo_server& server; endpoint_type ep; int state = 0; - beast::websocket::stream ws; + boost::beast::websocket::stream ws; boost::asio::io_service::strand strand; - beast::multi_buffer db; + boost::beast::multi_buffer db; std::size_t id; data(async_echo_server& server_, @@ -261,7 +263,7 @@ private: { auto& d = *d_; d.ws.async_accept_ex( - [](beast::websocket::response_type& res) + [](boost::beast::websocket::response_type& res) { res.insert( "Server", "async_echo_server"); @@ -278,7 +280,7 @@ private: using boost::asio::buffer_copy; if(db.size() < N-1) return false; - beast::static_string t; + boost::beast::static_string t; t.resize(N-1); buffer_copy(buffer(t.data(), t.size()), db.data()); @@ -318,7 +320,7 @@ private: // got message case 2: - if(ec == beast::websocket::error::closed) + if(ec == boost::beast::websocket::error::closed) return; if(ec) return fail("async_read", ec); @@ -339,7 +341,7 @@ private: } else if(match(d.db, "PING")) { - beast::websocket::ping_data payload; + boost::beast::websocket::ping_data payload; d.db.consume(buffer_copy( buffer(payload.data(), payload.size()), d.db.data())); @@ -370,7 +372,7 @@ private: { auto& d = *d_; if(d.server.log_) - if(ec != beast::websocket::error::closed) + if(ec != boost::beast::websocket::error::closed) d.server.fail("[#" + std::to_string(d.id) + " " + boost::lexical_cast(d.ep) + "] " + what, ec); diff --git a/test/websocket/websocket_sync_echo_server.hpp b/test/websocket/websocket_sync_echo_server.hpp index ab4384e9..d2432381 100644 --- a/test/websocket/websocket_sync_echo_server.hpp +++ b/test/websocket/websocket_sync_echo_server.hpp @@ -4,12 +4,14 @@ // 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 BEAST_WEBSOCKET_SYNC_ECHO_SERVER_HPP -#define BEAST_WEBSOCKET_SYNC_ECHO_SERVER_HPP +#ifndef BOOST_BEAST_WEBSOCKET_SYNC_ECHO_SERVER_HPP +#define BOOST_BEAST_WEBSOCKET_SYNC_ECHO_SERVER_HPP -#include -#include +#include +#include #include #include #include @@ -31,7 +33,7 @@ namespace websocket { class sync_echo_server { public: - using error_code = beast::error_code; + using error_code = boost::beast::error_code; using endpoint_type = boost::asio::ip::tcp::endpoint; using address_type = boost::asio::ip::address; using socket_type = boost::asio::ip::tcp::socket; @@ -47,7 +49,7 @@ private: { virtual ~callable() = default; virtual void operator()( - beast::websocket::stream&) = 0; + boost::beast::websocket::stream&) = 0; }; template @@ -63,7 +65,7 @@ private: } void - operator()(beast::websocket::stream& ws) + operator()(boost::beast::websocket::stream& ws) { t_(ws); } @@ -84,7 +86,7 @@ private: } void - operator()(beast::websocket::stream& ws) const + operator()(boost::beast::websocket::stream& ws) const { ws.set_option(opt_); } @@ -105,7 +107,7 @@ private: } void - set_options(beast::websocket::stream& ws) + set_options(boost::beast::websocket::stream& ws) { for(auto const& op : list_) (*op.second)(ws); @@ -212,7 +214,7 @@ private: std::size_t id, endpoint_type const& ep) { if(log_) - if(ec != beast::websocket::error::closed) + if(ec != boost::beast::websocket::error::closed) fail("[#" + std::to_string(id) + " " + boost::lexical_cast(ep) + "] " + what, ec); @@ -270,7 +272,7 @@ private: using boost::asio::buffer_copy; if(db.size() < N-1) return false; - beast::static_string t; + boost::beast::static_string t; t.resize(N-1); buffer_copy(buffer(t.data(), t.size()), db.data()); @@ -286,12 +288,12 @@ private: { using boost::asio::buffer; using boost::asio::buffer_copy; - beast::websocket::stream< + boost::beast::websocket::stream< socket_type> ws{std::move(sock)}; opts_.set_options(ws); error_code ec; ws.accept_ex( - [](beast::websocket::response_type& res) + [](boost::beast::websocket::response_type& res) { res.insert( "Server", "sync_echo_server"); @@ -304,7 +306,7 @@ private: } for(;;) { - beast::multi_buffer b; + boost::beast::multi_buffer b; ws.read(b, ec); if(ec) { @@ -324,7 +326,7 @@ private: } else if(match(b, "PING")) { - beast::websocket::ping_data payload; + boost::beast::websocket::ping_data payload; b.consume(buffer_copy( buffer(payload.data(), payload.size()), b.data())); @@ -341,7 +343,7 @@ private: if(ec) break; } - if(ec && ec != beast::websocket::error::closed) + if(ec && ec != boost::beast::websocket::error::closed) { fail("read", ec, id, ep); } diff --git a/test/wstest/CMakeLists.txt b/test/wstest/CMakeLists.txt index 26a14fb4..e7120d88 100644 --- a/test/wstest/CMakeLists.txt +++ b/test/wstest/CMakeLists.txt @@ -1,14 +1,22 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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/beast beast) +GroupSources(include/boost/beast beast) GroupSources(example/common common) -GroupSources(extras/beast extras) +GroupSources(extras/boost/beast extras) GroupSources(test/wstest "/") add_executable (wstest - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${COMMON_INCLUDES} ${EXTRAS_INCLUDES} + Jamfile main.cpp ) diff --git a/test/wstest/Jamfile b/test/wstest/Jamfile index 2feb22dc..afc9f05a 100644 --- a/test/wstest/Jamfile +++ b/test/wstest/Jamfile @@ -4,6 +4,8 @@ # 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 +# exe wstest : main.cpp diff --git a/test/wstest/main.cpp b/test/wstest/main.cpp index acbcf82e..0230e263 100644 --- a/test/wstest/main.cpp +++ b/test/wstest/main.cpp @@ -4,13 +4,15 @@ // 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 +// #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -27,9 +29,9 @@ namespace asio = boost::asio; namespace ip = boost::asio::ip; using tcp = boost::asio::ip::tcp; -namespace ws = beast::websocket; +namespace ws = boost::beast::websocket; namespace ph = std::placeholders; -using error_code = beast::error_code; +using error_code = boost::beast::error_code; class test_buffer : public asio::const_buffers_1 { @@ -84,7 +86,7 @@ class connection report& rep_; test_buffer const& tb_; asio::io_service::strand strand_; - beast::multi_buffer buffer_; + boost::beast::multi_buffer buffer_; std::mt19937_64 rng_; std::size_t count_ = 0; std::size_t bytes_ = 0; @@ -132,7 +134,7 @@ public: private: void - fail(beast::string_view what, error_code ec) + fail(boost::beast::string_view what, error_code ec) { if( ec == asio::error::operation_aborted || ec == ws::error::closed) @@ -168,7 +170,7 @@ private: std::geometric_distribution dist{ double(4) / boost::asio::buffer_size(tb_)}; ws_.async_write_some(true, - beast::buffer_prefix(dist(rng_), tb_), + boost::beast::buffer_prefix(dist(rng_), tb_), alloc_.wrap(std::bind( &connection::on_write, shared_from_this(), @@ -275,7 +277,7 @@ throughput( int main(int argc, char** argv) { - beast::unit_test::dstream dout(std::cerr); + boost::beast::unit_test::dstream dout(std::cerr); try { diff --git a/test/zlib.cpp b/test/zlib.cpp index 10db45cb..b9728606 100644 --- a/test/zlib.cpp +++ b/test/zlib.cpp @@ -4,6 +4,8 @@ // 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 +#include diff --git a/test/zlib/CMakeLists.txt b/test/zlib/CMakeLists.txt index 319a1829..22f813e4 100644 --- a/test/zlib/CMakeLists.txt +++ b/test/zlib/CMakeLists.txt @@ -1,7 +1,14 @@ -# Part of Beast +# +# Copyright (c) 2013-2017 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(extras/beast extras) -GroupSources(include/beast beast) +GroupSources(extras/boost/beast extras) +GroupSources(include/boost/beast beast) GroupSources(test/zlib "/") @@ -33,10 +40,11 @@ if (MSVC) endif() add_executable (zlib-tests - ${BEAST_INCLUDES} + ${BOOST_BEAST_INCLUDES} ${EXTRAS_INCLUDES} ${ZLIB_SOURCES} - ../../extras/beast/unit_test/main.cpp + Jamfile + ../../extras/boost/beast/unit_test/main.cpp ztest.hpp deflate_stream.cpp error.cpp diff --git a/test/zlib/Jamfile b/test/zlib/Jamfile index 5ba2ed0b..ce3623e6 100644 --- a/test/zlib/Jamfile +++ b/test/zlib/Jamfile @@ -4,9 +4,11 @@ # 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 +# unit-test zlib-tests : - ../../extras/beast/unit_test/main.cpp + ../../extras/boost/beast/unit_test/main.cpp zlib-1.2.11/adler32.c zlib-1.2.11/compress.c zlib-1.2.11/crc32.c diff --git a/test/zlib/deflate_stream.cpp b/test/zlib/deflate_stream.cpp index b60bb95a..66a2f7ef 100644 --- a/test/zlib/deflate_stream.cpp +++ b/test/zlib/deflate_stream.cpp @@ -4,13 +4,17 @@ // 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 +#include #include "ztest.hpp" -#include +#include + +namespace boost { namespace beast { namespace zlib { @@ -52,7 +56,7 @@ public: -windowBits, 8, strategy); - if(! BEAST_EXPECT(result == Z_OK)) + if(! BOOST_BEAST_EXPECT(result == Z_OK)) goto err; out.resize(deflateBound(&zs, static_cast(check.size()))); @@ -68,7 +72,7 @@ public: if( result == Z_BUF_ERROR || result == Z_STREAM_END) // per zlib FAQ goto fin; - if(! BEAST_EXPECT(progress)) + if(! BOOST_BEAST_EXPECT(progress)) goto err; progress = false; } @@ -79,7 +83,7 @@ public: { z_inflator zi; auto const s = zi(out); - BEAST_EXPECT(s == check); + BOOST_BEAST_EXPECT(s == check); } err: @@ -114,9 +118,9 @@ public: if( ec == error::need_buffers || ec == error::end_of_stream) // per zlib FAQ goto fin; - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) goto err; - if(! BEAST_EXPECT(progress)) + if(! BOOST_BEAST_EXPECT(progress)) goto err; progress = false; } @@ -127,7 +131,7 @@ public: { z_inflator zi; auto const s = zi(out); - BEAST_EXPECT(s == check); + BOOST_BEAST_EXPECT(s == check); } err: @@ -154,7 +158,7 @@ public: -windowBits, 8, strategy); - if(! BEAST_EXPECT(result == Z_OK)) + if(! BOOST_BEAST_EXPECT(result == Z_OK)) continue; std::string out; out.resize(deflateBound(&zs, @@ -177,7 +181,7 @@ public: if( result == Z_BUF_ERROR || result == Z_STREAM_END) // per zlib FAQ goto fin; - if(! BEAST_EXPECT(result == Z_OK)) + if(! BOOST_BEAST_EXPECT(result == Z_OK)) goto err; if(zs.avail_in == 0 && ! bi) { @@ -198,7 +202,7 @@ public: { z_inflator zi; auto const s = zi(out); - BEAST_EXPECT(s == check); + BOOST_BEAST_EXPECT(s == check); } err: @@ -242,7 +246,7 @@ public: if( ec == error::need_buffers || ec == error::end_of_stream) // per zlib FAQ goto fin; - if(! BEAST_EXPECTS(! ec, ec.message())) + if(! BOOST_BEAST_EXPECTS(! ec, ec.message())) goto err; if(zs.avail_in == 0 && ! bi) { @@ -263,7 +267,7 @@ public: { z_inflator zi; auto const s = zi(out); - BEAST_EXPECT(s == check); + BOOST_BEAST_EXPECT(s == check); } err: @@ -308,7 +312,7 @@ public: { doMatrix("1.beast ", "Hello, world!", &self::doDeflate1_beast); doMatrix("1.zlib ", "Hello, world!", &self::doDeflate1_zlib); - #if ! BEAST_NO_SLOW_TESTS + #if ! BOOST_BEAST_NO_SLOW_TESTS doMatrix("2.beast ", "Hello, world!", &self::doDeflate2_beast); doMatrix("2.zlib ", "Hello, world!", &self::doDeflate2_zlib); { @@ -335,7 +339,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(deflate_stream,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(deflate_stream,core,beast); } // zlib } // beast +} // boost diff --git a/test/zlib/error.cpp b/test/zlib/error.cpp index eb40185d..43d12b1c 100644 --- a/test/zlib/error.cpp +++ b/test/zlib/error.cpp @@ -4,13 +4,16 @@ // 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 +#include -#include +#include #include +namespace boost { namespace beast { namespace zlib { @@ -20,15 +23,15 @@ public: void check(char const* name, error ev) { auto const ec = make_error_code(ev); - BEAST_EXPECT(std::string{ec.category().name()} == name); - BEAST_EXPECT(! ec.message().empty()); - BEAST_EXPECT(std::addressof(ec.category()) == + BOOST_BEAST_EXPECT(std::string{ec.category().name()} == name); + BOOST_BEAST_EXPECT(! ec.message().empty()); + BOOST_BEAST_EXPECT(std::addressof(ec.category()) == std::addressof(detail::get_error_category())); - BEAST_EXPECT(detail::get_error_category().equivalent( + BOOST_BEAST_EXPECT(detail::get_error_category().equivalent( static_cast::type>(ev), ec.category().default_error_condition( static_cast::type>(ev)))); - BEAST_EXPECT(detail::get_error_category().equivalent( + BOOST_BEAST_EXPECT(detail::get_error_category().equivalent( ec, static_cast::type>(ev))); } @@ -55,7 +58,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(error,zlib,beast); +BOOST_BEAST_DEFINE_TESTSUITE(error,zlib,beast); } // zlib } // beast +} // boost diff --git a/test/zlib/inflate_stream.cpp b/test/zlib/inflate_stream.cpp index dfc3d992..7594460c 100644 --- a/test/zlib/inflate_stream.cpp +++ b/test/zlib/inflate_stream.cpp @@ -4,15 +4,19 @@ // 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 +#include #include "ztest.hpp" -#include + +#include #include #include +namespace boost { namespace beast { namespace zlib { @@ -326,7 +330,7 @@ public: m("1. zlib ", ZLib {half, half}, check); } - #if ! BEAST_NO_SLOW_TESTS + #if ! BOOST_BEAST_NO_SLOW_TESTS { Matrix m{*this}; auto const check = corpus1(50000); @@ -409,7 +413,8 @@ public: } }; -BEAST_DEFINE_TESTSUITE(inflate_stream,core,beast); +BOOST_BEAST_DEFINE_TESTSUITE(inflate_stream,core,beast); } // zlib } // beast +} // boost diff --git a/test/zlib/ztest.hpp b/test/zlib/ztest.hpp index 142f8329..f227e520 100644 --- a/test/zlib/ztest.hpp +++ b/test/zlib/ztest.hpp @@ -4,11 +4,14 @@ // 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 BEAST_ZTEST_HPP -#define BEAST_ZTEST_HPP +#ifndef BOOST_BEAST_ZTEST_HPP +#define BOOST_BEAST_ZTEST_HPP #include "zlib-1.2.11/zlib.h" + #include #include #include