diff --git a/.travis.yml b/.travis.yml index 840eafca09..0423273a37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,8 +8,10 @@ env: # Note that for simplicity, BOOST_ROOT's final # namepart must match the folder name internal # to boost's .tar.gz. - - BOOST_ROOT=$HOME/boost_1_65_1 - - BOOST_URL='https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz' + - LCOV_ROOT=$HOME/lcov + - GDB_ROOT=$HOME/gdb + - BOOST_ROOT=$HOME/boost_1_67_0 + - BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.67.0/boost_1_67_0.tar.gz' addons: apt: diff --git a/Builds/CMake/CMakeFuncs.cmake b/Builds/CMake/CMakeFuncs.cmake index 8e3cac4eea..6c986a5939 100644 --- a/Builds/CMake/CMakeFuncs.cmake +++ b/Builds/CMake/CMakeFuncs.cmake @@ -358,6 +358,10 @@ macro(use_boost) message(WARNING "Boost directory found, but not all components. May not be able to build.") endif() + if(Boost_VERSION VERSION_LESS 106700) + message(FATAL_ERROR "Boost version 1.67 or greater is required for boost::beast. Found version: ${Boost_VERSION}") + endif() + if(MSVC14) # VS2017 with boost <= 1.66.0 requires a flag to suppress warnings if(NOT Boost_VERSION VERSION_GREATER 106600) @@ -581,6 +585,8 @@ macro(setup_build_boilerplate) -DSOCI_CXX_C11=1 -D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS -DBOOST_NO_AUTO_PTR + -DBOOST_BEAST_ALLOW_DEPRECATED + -DBOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS ) if (is_gcc) diff --git a/Builds/VisualStudio2017/README.md b/Builds/VisualStudio2017/README.md index 38c3203632..7f1b82f50e 100644 --- a/Builds/VisualStudio2017/README.md +++ b/Builds/VisualStudio2017/README.md @@ -18,7 +18,7 @@ need these software components | [Git for Windows](README.md#install-git-for-windows)| 2.16.1| | [Google Protocol Buffers Compiler](README.md#install-google-protocol-buffers-compiler) | 2.5.1| | [OpenSSL Library](README.md#install-openssl) | 1.0.2n | -| [Boost library](README.md#build-boost) | 1.66.0 | +| [Boost library](README.md#build-boost) | 1.67.0 | | [CMake for Windows](README.md#optional-install-cmake-for-windows)* | 3.10.2 | \* Only needed if not using the integrated CMake in VS 2017 and prefer generating dedicated project/solution files. @@ -99,11 +99,13 @@ to get the correct 32-/64-bit variant. ### Build Boost +Boost 1.67 or later is required. + After [downloading boost](http://www.boost.org/users/download/) and unpacking it -to `c:\lib`. As of this writing, the most recent version of boost is 1.66.0, -which will unpack into a directory named `boost_1_66_0`. We recommended either +to `c:\lib`. As of this writing, the most recent version of boost is 1.67.0, +which will unpack into a directory named `boost_1_67_0`. We recommended either renaming this directory to `boost`, or creating a junction link `mklink /J boost -boost_1_66_0`, so that you can more easily switch between versions. +boost_1_67_0`, so that you can more easily switch between versions. Next, open **Developer Command Prompt** and type the following commands @@ -235,7 +237,7 @@ execute the following commands within your `rippled` cloned repository: ``` mkdir build\cmake cd build\cmake -cmake ..\.. -G"Visual Studio 15 2017 Win64" -DBOOST_ROOT="C:\lib\boost_1_66_0" -DOPENSSL_ROOT="C:\lib\OpenSSL-Win64" +cmake ..\.. -G"Visual Studio 15 2017 Win64" -DBOOST_ROOT="C:\lib\boost_1_67_0" -DOPENSSL_ROOT="C:\lib\OpenSSL-Win64" ``` Now launch Visual Studio 2017 and select **File | Open | Project/Solution**. Navigate to the `build\cmake` folder created above and select the `rippled.sln` diff --git a/Builds/linux/README.md b/Builds/linux/README.md index 05a1f3f206..a07dcc5eb7 100644 --- a/Builds/linux/README.md +++ b/Builds/linux/README.md @@ -25,14 +25,14 @@ protobuf will give errors. ### Build Boost -We recommend downloading and compiling a more recent version of boost than -provided by the `boost-all-dev` package. After changing to the directory where +Boost 1.67 or later is required. We recommend downloading and compiling boost +with the following process: After changing to the directory where you wish to download and compile boost, run ``` -$ wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz -$ tar -xzf boost_1_65_1.tar.gz -$ cd boost_1_65_1 +$ wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz +$ tar -xzf boost_1_67_0.tar.gz +$ cd boost_1_67_0 $ ./bootstrap.sh $ ./b2 headers $ ./b2 -j @@ -81,14 +81,14 @@ git checkout develop If you didn't persistently set the `BOOST_ROOT` environment variable to the directory in which you compiled boost, then you should set it temporarily. -For example, you built Boost in your home directory `~/boost_1_65_1`, you +For example, you built Boost in your home directory `~/boost_1_67_0`, you would do for any shell in which you want to build: ``` -export BOOST_ROOT=~/boost_1_65_1 +export BOOST_ROOT=~/boost_1_67_0 ``` -Alternatively, you can add `DBOOST_ROOT=~/boost_1_65_1` to the command line when +Alternatively, you can add `DBOOST_ROOT=~/boost_1_67_0` to the command line when invoking `cmake`. ### Generate and Build diff --git a/Builds/macos/README.md b/Builds/macos/README.md index 8a9ca02080..c17679b278 100644 --- a/Builds/macos/README.md +++ b/Builds/macos/README.md @@ -60,9 +60,11 @@ brew install git cmake pkg-config protobuf openssl ninja ### Build Boost +Boost 1.67 or later is required. + We want to compile boost with clang/libc++ -Download [a release](https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2) +Download [a release](https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2) Extract it to a folder, making note of where, open a terminal, then: @@ -118,11 +120,11 @@ If you didn't persistently set the `BOOST_ROOT` environment variable to the root of the extracted directory above, then you should set it temporarily. For example, assuming your username were `Abigail` and you extracted Boost -1.66.0 in `/Users/Abigail/Downloads/boost_1_66_0`, you would do for any +1.67.0 in `/Users/Abigail/Downloads/boost_1_67_0`, you would do for any shell in which you want to build: ``` -export BOOST_ROOT=/Users/Abigail/Downloads/boost_1_66_0 +export BOOST_ROOT=/Users/Abigail/Downloads/boost_1_67_0 ``` ### Generate and Build diff --git a/CMakeLists.txt b/CMakeLists.txt index e03513a633..44cd22d0f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,7 +125,6 @@ check_gcc4_abi() include_directories( src src/beast - src/beast/include src/beast/extras src/nudb/include src/soci/src diff --git a/Jenkinsfile b/Jenkinsfile index 43572d4fbb..4b2451e981 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -168,7 +168,7 @@ try { echo "USE_CC: ${ucc}" if (compiler == 'msvc') { env_vars.addAll([ - 'BOOST_ROOT=c:\\lib\\boost_1_66', + 'BOOST_ROOT=c:\\lib\\boost_1_67', 'PROJECT_NAME=rippled', 'MSBUILDDISABLENODEREUSE=1', // this ENV setting is probably redundant since we also pass /nr:false to msbuild 'OPENSSL_ROOT=c:\\OpenSSL-Win64']) @@ -184,7 +184,7 @@ try { 'LCOV_ROOT=""', 'PATH+CMAKE_BIN=/opt/local/cmake', 'GDB_ROOT=/opt/local/gdb', - 'BOOST_ROOT=/opt/local/boost_1_66_0', + 'BOOST_ROOT=/opt/local/boost_1_67_0', "USE_CCACHE=${ucc}"]) } diff --git a/appveyor.yml b/appveyor.yml index 0d9288dd37..b3c221881e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ environment: # that it's a small download. We also use appveyor's free cache, avoiding fees # downloading from S3 each time. # TODO: script to create this package. - RIPPLED_DEPS_PATH: rippled_deps17.01 + RIPPLED_DEPS_PATH: rippled_deps17.03 RIPPLED_DEPS_URL: https://ripple.github.io/Downloads/appveyor/%RIPPLED_DEPS_PATH%.zip # CMake honors these environment variables, setting the include/lib paths. diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index b92a5bb7e2..521eafac5f 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -1707,7 +1707,7 @@ bool ApplicationImp::loadOldLedger ( } } } - else if (ledgerID.empty () || beast::detail::iequals(ledgerID, "latest")) + else if (ledgerID.empty () || boost::beast::detail::iequals(ledgerID, "latest")) { loadLedger = getLastFullLedger (); } diff --git a/src/ripple/app/main/Application.h b/src/ripple/app/main/Application.h index 8888af9aa7..7cfa0da359 100644 --- a/src/ripple/app/main/Application.h +++ b/src/ripple/app/main/Application.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index 48d71599fe..c9b1439611 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -55,7 +55,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/ripple/app/misc/NetworkOPs.h b/src/ripple/app/misc/NetworkOPs.h index d6c7a723ca..8389890819 100644 --- a/src/ripple/app/misc/NetworkOPs.h +++ b/src/ripple/app/misc/NetworkOPs.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/ripple/app/misc/detail/Work.h b/src/ripple/app/misc/detail/Work.h index b3be25c18d..f4f4b556b9 100644 --- a/src/ripple/app/misc/detail/Work.h +++ b/src/ripple/app/misc/detail/Work.h @@ -20,15 +20,15 @@ #ifndef RIPPLE_APP_MISC_DETAIL_WORK_H_INCLUDED #define RIPPLE_APP_MISC_DETAIL_WORK_H_INCLUDED -#include -#include +#include +#include namespace ripple { namespace detail { using response_type = - beast::http::response; + boost::beast::http::response; class Work { diff --git a/src/ripple/app/misc/detail/WorkBase.h b/src/ripple/app/misc/detail/WorkBase.h index 1c59ab664e..4ab2f49bfa 100644 --- a/src/ripple/app/misc/detail/WorkBase.h +++ b/src/ripple/app/misc/detail/WorkBase.h @@ -22,10 +22,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace ripple { @@ -48,7 +48,7 @@ protected: using resolver_type = boost::asio::ip::tcp::resolver; using query_type = resolver_type::query; using request_type = - beast::http::request; + boost::beast::http::request; std::string host_; std::string path_; @@ -60,7 +60,7 @@ protected: socket_type socket_; request_type req_; response_type res_; - beast::multi_buffer read_buf_; + boost::beast::multi_buffer read_buf_; public: WorkBase( @@ -177,14 +177,14 @@ template void WorkBase::onStart() { - req_.method(beast::http::verb::get); + req_.method(boost::beast::http::verb::get); req_.target(path_.empty() ? "/" : path_); - req_.version = 11; + req_.version(11); req_.set ( "Host", host_ + ":" + port_); req_.set ("User-Agent", BuildInfo::getFullVersionString()); req_.prepare_payload(); - beast::http::async_write(impl().stream(), req_, + boost::beast::http::async_write(impl().stream(), req_, strand_.wrap (std::bind (&WorkBase::onRequest, impl().shared_from_this(), std::placeholders::_1))); } @@ -196,7 +196,7 @@ WorkBase::onRequest(error_code const& ec) if (ec) return fail(ec); - beast::http::async_read (impl().stream(), read_buf_, res_, + boost::beast::http::async_read (impl().stream(), read_buf_, res_, strand_.wrap (std::bind (&WorkBase::onResponse, impl().shared_from_this(), std::placeholders::_1))); } diff --git a/src/ripple/app/misc/impl/Manifest.cpp b/src/ripple/app/misc/impl/Manifest.cpp index 003c0272ec..56b15c0364 100644 --- a/src/ripple/app/misc/impl/Manifest.cpp +++ b/src/ripple/app/misc/impl/Manifest.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -182,7 +182,7 @@ ValidatorToken::make_ValidatorToken(std::vector const& tokenBlob) for (auto const& line : tokenBlob) tokenStr += beast::rfc2616::trim(line); - tokenStr = beast::detail::base64_decode(tokenStr); + tokenStr = boost::beast::detail::base64_decode(tokenStr); Json::Reader r; Json::Value token; @@ -384,7 +384,7 @@ ManifestCache::load ( if (! configManifest.empty()) { auto mo = Manifest::make_Manifest ( - beast::detail::base64_decode(configManifest)); + boost::beast::detail::base64_decode(configManifest)); if (! mo) { JLOG (j_.error()) << "Malformed validator_token in config"; @@ -419,7 +419,7 @@ ManifestCache::load ( revocationStr += beast::rfc2616::trim(line); auto mo = Manifest::make_Manifest ( - beast::detail::base64_decode(revocationStr)); + boost::beast::detail::base64_decode(revocationStr)); if (! mo || ! mo->revoked() || applyManifest (std::move(*mo)) == ManifestDisposition::invalid) diff --git a/src/ripple/app/misc/impl/ValidatorKeys.cpp b/src/ripple/app/misc/impl/ValidatorKeys.cpp index 2f96777c4d..7f5d19fd6f 100644 --- a/src/ripple/app/misc/impl/ValidatorKeys.cpp +++ b/src/ripple/app/misc/impl/ValidatorKeys.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace ripple { ValidatorKeys::ValidatorKeys(Config const& config, beast::Journal j) @@ -45,7 +45,8 @@ ValidatorKeys::ValidatorKeys(Config const& config, beast::Journal j) auto const pk = derivePublicKey( KeyType::secp256k1, token->validationSecret); auto const m = Manifest::make_Manifest( - beast::detail::base64_decode(token->manifest)); + boost::beast::detail::base64_decode(token->manifest)); + if (! m || pk != m->signingKey) { configInvalid_ = true; diff --git a/src/ripple/app/misc/impl/ValidatorList.cpp b/src/ripple/app/misc/impl/ValidatorList.cpp index 3cc4579be2..2c51689a1f 100644 --- a/src/ripple/app/misc/impl/ValidatorList.cpp +++ b/src/ripple/app/misc/impl/ValidatorList.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include namespace ripple { @@ -292,7 +292,7 @@ ValidatorList::applyList ( for (auto const& valManifest : manifests) { auto m = Manifest::make_Manifest ( - beast::detail::base64_decode(valManifest)); + boost::beast::detail::base64_decode(valManifest)); if (! m || ! keyListings_.count (m->masterKey)) { @@ -322,7 +322,7 @@ ValidatorList::verify ( std::string const& blob, std::string const& signature) { - auto m = Manifest::make_Manifest (beast::detail::base64_decode(manifest)); + auto m = Manifest::make_Manifest (boost::beast::detail::base64_decode(manifest)); if (! m || ! publisherLists_.count (m->masterKey)) return ListDisposition::untrusted; @@ -343,7 +343,7 @@ ValidatorList::verify ( return ListDisposition::untrusted; auto const sig = strUnHex(signature); - auto const data = beast::detail::base64_decode (blob); + auto const data = boost::beast::detail::base64_decode (blob); if (! sig.second || ! ripple::verify ( publisherManifests_.getSigningKey(pubKey), diff --git a/src/ripple/app/misc/impl/ValidatorSite.cpp b/src/ripple/app/misc/impl/ValidatorSite.cpp index 127095da76..01a6695bc8 100644 --- a/src/ripple/app/misc/impl/ValidatorSite.cpp +++ b/src/ripple/app/misc/impl/ValidatorSite.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include namespace ripple { @@ -207,7 +207,7 @@ ValidatorSite::onSiteFetch( detail::response_type&& res, std::size_t siteIdx) { - if (! ec && res.result() != beast::http::status::ok) + if (! ec && res.result() != boost::beast::http::status::ok) { std::lock_guard lock{sites_mutex_}; JLOG (j_.warn()) << @@ -222,8 +222,8 @@ ValidatorSite::onSiteFetch( std::lock_guard lock{sites_mutex_}; Json::Reader r; Json::Value body; - if (r.parse(res.body.data(), body) && - body.isObject() && + if (r.parse(res.body().data(), body) && + body.isObject () && body.isMember("blob") && body["blob"].isString () && body.isMember("manifest") && body["manifest"].isString () && body.isMember("signature") && body["signature"].isString() && diff --git a/src/ripple/basics/BasicConfig.h b/src/ripple/basics/BasicConfig.h index 75c987b991..008611d241 100644 --- a/src/ripple/basics/BasicConfig.h +++ b/src/ripple/basics/BasicConfig.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -41,7 +41,7 @@ using IniFileSections = std::map>; */ class Section : public beast::unit_test::detail::const_container < - std::map > + std::map > { private: std::string name_; @@ -173,7 +173,7 @@ public: class BasicConfig { private: - std::map map_; + std::map map_; public: /** Returns `true` if a section with the given name exists. */ diff --git a/src/ripple/basics/Log.h b/src/ripple/basics/Log.h index 68e687eb0a..9a3ccc9656 100644 --- a/src/ripple/basics/Log.h +++ b/src/ripple/basics/Log.h @@ -21,7 +21,7 @@ #define RIPPLE_BASICS_LOG_H_INCLUDED #include -#include +#include #include #include #include @@ -148,7 +148,7 @@ private: std::mutex mutable mutex_; std::map , - beast::iless> sinks_; + boost::beast::iless> sinks_; beast::severities::Severity thresh_; File file_; bool silent_ = false; diff --git a/src/ripple/basics/random.h b/src/ripple/basics/random.h index b4388fd588..dfb379e6c8 100644 --- a/src/ripple/basics/random.h +++ b/src/ripple/basics/random.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -52,7 +52,7 @@ namespace detail { // Determines if a type can be called like an Engine template using is_engine = - beast::detail::is_invocable; + boost::beast::detail::is_invocable; } /** Return the default random engine. diff --git a/src/ripple/beast/container/detail/aged_ordered_container.h b/src/ripple/beast/container/detail/aged_ordered_container.h index 8ec880d81b..6663b90c03 100644 --- a/src/ripple/beast/container/detail/aged_ordered_container.h +++ b/src/ripple/beast/container/detail/aged_ordered_container.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -171,7 +171,7 @@ private: // VFALCO TODO This should only be enabled for maps. class pair_value_compare - : private empty_base_optimization + : public boost::beast::detail::empty_base_optimization , public std::binary_function { public: @@ -185,7 +185,7 @@ private: } pair_value_compare (pair_value_compare const& other) - : empty_base_optimization (other) + : boost::beast::detail::empty_base_optimization (other) { } @@ -193,7 +193,7 @@ private: friend aged_ordered_container; pair_value_compare (Compare const& compare) - : empty_base_optimization (compare) + : boost::beast::detail::empty_base_optimization (compare) { } }; @@ -201,14 +201,14 @@ private: // Compares value_type against element, used in insert_check // VFALCO TODO hoist to remove template argument dependencies class KeyValueCompare - : private empty_base_optimization + : public boost::beast::detail::empty_base_optimization , public std::binary_function { public: KeyValueCompare () = default; KeyValueCompare (Compare const& compare) - : empty_base_optimization (compare) + : boost::beast::detail::empty_base_optimization (compare) { } @@ -245,12 +245,12 @@ private: Compare& compare() { - return empty_base_optimization ::member(); + return boost::beast::detail::empty_base_optimization ::member(); } Compare const& compare() const { - return empty_base_optimization ::member(); + return boost::beast::detail::empty_base_optimization ::member(); } }; @@ -276,7 +276,7 @@ private: class config_t : private KeyValueCompare - , private empty_base_optimization + , public boost::beast::detail::empty_base_optimization { public: explicit config_t ( @@ -296,7 +296,7 @@ private: config_t ( clock_type& clock_, Allocator const& alloc_) - : empty_base_optimization (alloc_) + : boost::beast::detail::empty_base_optimization (alloc_) , clock (clock_) { } @@ -306,14 +306,14 @@ private: Compare const& comp, Allocator const& alloc_) : KeyValueCompare (comp) - , empty_base_optimization (alloc_) + , boost::beast::detail::empty_base_optimization (alloc_) , clock (clock_) { } config_t (config_t const& other) : KeyValueCompare (other.key_compare()) - , empty_base_optimization ( + , boost::beast::detail::empty_base_optimization ( ElementAllocatorTraits:: select_on_container_copy_construction ( other.alloc())) @@ -323,14 +323,14 @@ private: config_t (config_t const& other, Allocator const& alloc) : KeyValueCompare (other.key_compare()) - , empty_base_optimization (alloc) + , boost::beast::detail::empty_base_optimization (alloc) , clock (other.clock) { } config_t (config_t&& other) : KeyValueCompare (std::move (other.key_compare())) - , empty_base_optimization ( + , boost::beast::detail::empty_base_optimization ( std::move (other)) , clock (other.clock) { @@ -338,7 +338,7 @@ private: config_t (config_t&& other, Allocator const& alloc) : KeyValueCompare (std::move (other.key_compare())) - , empty_base_optimization (alloc) + , boost::beast::detail::empty_base_optimization (alloc) , clock (other.clock) { } @@ -384,13 +384,13 @@ private: ElementAllocator& alloc() { - return empty_base_optimization < + return boost::beast::detail::empty_base_optimization < ElementAllocator>::member(); } ElementAllocator const& alloc() const { - return empty_base_optimization < + return boost::beast::detail::empty_base_optimization < ElementAllocator>::member(); } diff --git a/src/ripple/beast/container/detail/aged_unordered_container.h b/src/ripple/beast/container/detail/aged_unordered_container.h index 7372b69018..7dda0d07f8 100644 --- a/src/ripple/beast/container/detail/aged_unordered_container.h +++ b/src/ripple/beast/container/detail/aged_unordered_container.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -163,7 +163,7 @@ private: // VFALCO TODO hoist to remove template argument dependencies class ValueHash - : private empty_base_optimization + : private boost::beast::detail::empty_base_optimization , public std::unary_function { public: @@ -172,7 +172,7 @@ private: } ValueHash (Hash const& hash) - : empty_base_optimization (hash) + : boost::beast::detail::empty_base_optimization (hash) { } @@ -195,7 +195,7 @@ private: // Compares value_type against element, used in find/insert_check // VFALCO TODO hoist to remove template argument dependencies class KeyValueEqual - : private empty_base_optimization + : private boost::beast::detail::empty_base_optimization , public std::binary_function { public: @@ -204,7 +204,7 @@ private: } KeyValueEqual (KeyEqual const& keyEqual) - : empty_base_optimization (keyEqual) + : boost::beast::detail::empty_base_optimization (keyEqual) { } @@ -285,7 +285,7 @@ private: class config_t : private ValueHash , private KeyValueEqual - , private empty_base_optimization + , private boost::beast::detail::empty_base_optimization { public: explicit config_t ( @@ -313,7 +313,7 @@ private: config_t ( clock_type& clock_, Allocator const& alloc_) - : empty_base_optimization (alloc_) + : boost::beast::detail::empty_base_optimization (alloc_) , clock (clock_) { } @@ -333,7 +333,7 @@ private: Hash const& hash, Allocator const& alloc_) : ValueHash (hash) - , empty_base_optimization (alloc_) + , boost::beast::detail::empty_base_optimization (alloc_) , clock (clock_) { } @@ -343,7 +343,7 @@ private: KeyEqual const& keyEqual, Allocator const& alloc_) : KeyValueEqual (keyEqual) - , empty_base_optimization (alloc_) + , boost::beast::detail::empty_base_optimization (alloc_) , clock (clock_) { } @@ -355,7 +355,7 @@ private: Allocator const& alloc_) : ValueHash (hash) , KeyValueEqual (keyEqual) - , empty_base_optimization (alloc_) + , boost::beast::detail::empty_base_optimization (alloc_) , clock (clock_) { } @@ -363,7 +363,7 @@ private: config_t (config_t const& other) : ValueHash (other.hash_function()) , KeyValueEqual (other.key_eq()) - , empty_base_optimization ( + , boost::beast::detail::empty_base_optimization ( ElementAllocatorTraits:: select_on_container_copy_construction ( other.alloc())) @@ -374,7 +374,7 @@ private: config_t (config_t const& other, Allocator const& alloc) : ValueHash (other.hash_function()) , KeyValueEqual (other.key_eq()) - , empty_base_optimization (alloc) + , boost::beast::detail::empty_base_optimization (alloc) , clock (other.clock) { } @@ -382,7 +382,7 @@ private: config_t (config_t&& other) : ValueHash (std::move (other.hash_function())) , KeyValueEqual (std::move (other.key_eq())) - , empty_base_optimization ( + , boost::beast::detail::empty_base_optimization ( std::move (other.alloc())) , clock (other.clock) { @@ -391,7 +391,7 @@ private: config_t (config_t&& other, Allocator const& alloc) : ValueHash (std::move (other.hash_function())) , KeyValueEqual (std::move (other.key_eq())) - , empty_base_optimization (alloc) + , boost::beast::detail::empty_base_optimization (alloc) , clock (other.clock) { } @@ -456,13 +456,13 @@ private: ElementAllocator& alloc() { - return empty_base_optimization < + return boost::beast::detail::empty_base_optimization < ElementAllocator>::member(); } ElementAllocator const& alloc() const { - return empty_base_optimization < + return boost::beast::detail::empty_base_optimization < ElementAllocator>::member(); } diff --git a/src/ripple/beast/net/IPAddress.h b/src/ripple/beast/net/IPAddress.h index 8381f14236..1139ee87e8 100644 --- a/src/ripple/beast/net/IPAddress.h +++ b/src/ripple/beast/net/IPAddress.h @@ -347,14 +347,14 @@ struct hash namespace boost { template <> -struct hash +struct hash <::beast::IP::Address> { explicit hash() = default; std::size_t - operator() (beast::IP::Address const& addr) const + operator() (::beast::IP::Address const& addr) const { - return beast::uhash<>{} (addr); + return ::beast::uhash<>{} (addr); } }; } diff --git a/src/ripple/beast/net/IPEndpoint.h b/src/ripple/beast/net/IPEndpoint.h index 7608b48595..6803629175 100644 --- a/src/ripple/beast/net/IPEndpoint.h +++ b/src/ripple/beast/net/IPEndpoint.h @@ -97,7 +97,7 @@ public: void hash_append (Hasher& h, Endpoint const& endpoint) { - using beast::hash_append; + using ::beast::hash_append; hash_append(h, endpoint.m_addr, endpoint.m_port); } @@ -155,24 +155,24 @@ std::istream& operator>> (std::istream& is, Endpoint& endpoint); namespace std { /** std::hash support. */ template <> -struct hash +struct hash <::beast::IP::Endpoint> { explicit hash() = default; - std::size_t operator() (beast::IP::Endpoint const& endpoint) const - { return beast::uhash<>{} (endpoint); } + std::size_t operator() (::beast::IP::Endpoint const& endpoint) const + { return ::beast::uhash<>{} (endpoint); } }; } namespace boost { /** boost::hash support. */ template <> -struct hash +struct hash <::beast::IP::Endpoint> { explicit hash() = default; - std::size_t operator() (beast::IP::Endpoint const& endpoint) const - { return beast::uhash<>{} (endpoint); } + std::size_t operator() (::beast::IP::Endpoint const& endpoint) const + { return ::beast::uhash<>{} (endpoint); } }; } diff --git a/src/ripple/beast/rfc2616.h b/src/ripple/beast/rfc2616.h index fc25b81870..b7d9fb8747 100644 --- a/src/ripple/beast/rfc2616.h +++ b/src/ripple/beast/rfc2616.h @@ -20,8 +20,8 @@ #ifndef BEAST_RFC2616_HPP #define BEAST_RFC2616_HPP -#include -#include +#include +#include #include #include #include @@ -282,7 +282,7 @@ split_commas(FwdIt first, FwdIt last) template > Result -split_commas(beast::string_view const& s) +split_commas(boost::beast::string_view const& s) { return split_commas(s.begin(), s.end()); } @@ -471,13 +471,13 @@ token_in_list(boost::string_ref const& value, template bool -is_keep_alive(beast::http::message const& m) +is_keep_alive(boost::beast::http::message const& m) { - if(m.version <= 10) - return beast::http::token_list{ - m[beast::http::field::connection]}.exists("keep-alive"); - return ! beast::http::token_list{ - m[beast::http::field::connection]}.exists("close"); + if(m.version() <= 10) + return boost::beast::http::token_list{ + m[boost::beast::http::field::connection]}.exists("keep-alive"); + return ! boost::beast::http::token_list{ + m[boost::beast::http::field::connection]}.exists("close"); } } // rfc2616 diff --git a/src/ripple/beast/utility/weak_fn.h b/src/ripple/beast/utility/weak_fn.h index 04e682d443..f53b70844e 100644 --- a/src/ripple/beast/utility/weak_fn.h +++ b/src/ripple/beast/utility/weak_fn.h @@ -20,7 +20,7 @@ #ifndef BEAST_WEAK_FN_H_INCLUDED #define BEAST_WEAK_FN_H_INCLUDED -#include +#include #include // Original version: @@ -91,7 +91,7 @@ namespace detail { template class weak_binder - : private beast::detail::empty_base_optimization + : private boost::beast::detail::empty_base_optimization { private: using member_type = R (T::*)(Args...); @@ -105,7 +105,7 @@ public: weak_binder (member_type member, Policy policy, pointer_type object) - : beast::detail::empty_base_optimization(std::move(policy)) + : boost::beast::detail::empty_base_optimization(std::move(policy)) , member_(member) , object_(object) { } diff --git a/src/ripple/core/Config.h b/src/ripple/core/Config.h index 64d684c4c3..6cc3593956 100644 --- a/src/ripple/core/Config.h +++ b/src/ripple/core/Config.h @@ -24,7 +24,7 @@ #include #include // VFALCO Breaks levelization #include -#include +#include #include #include // VFALCO FIX: This include should not be here #include // VFALCO FIX: This include should not be here diff --git a/src/ripple/core/impl/Config.cpp b/src/ripple/core/impl/Config.cpp index 1ea7c2b88d..fcae22281b 100644 --- a/src/ripple/core/impl/Config.cpp +++ b/src/ripple/core/impl/Config.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -324,15 +324,15 @@ void Config::loadFromString (std::string const& fileContents) if (getSingleSection (secConfig, SECTION_NODE_SIZE, strTemp, j_)) { - if (beast::detail::iequals(strTemp, "tiny")) + if (boost::beast::detail::iequals(strTemp, "tiny")) NODE_SIZE = 0; - else if (beast::detail::iequals(strTemp, "small")) + else if (boost::beast::detail::iequals(strTemp, "small")) NODE_SIZE = 1; - else if (beast::detail::iequals(strTemp, "medium")) + else if (boost::beast::detail::iequals(strTemp, "medium")) NODE_SIZE = 2; - else if (beast::detail::iequals(strTemp, "large")) + else if (boost::beast::detail::iequals(strTemp, "large")) NODE_SIZE = 3; - else if (beast::detail::iequals(strTemp, "huge")) + else if (boost::beast::detail::iequals(strTemp, "huge")) NODE_SIZE = 4; else { @@ -379,9 +379,9 @@ void Config::loadFromString (std::string const& fileContents) if (getSingleSection (secConfig, SECTION_LEDGER_HISTORY, strTemp, j_)) { - if (beast::detail::iequals(strTemp, "full")) + if (boost::beast::detail::iequals(strTemp, "full")) LEDGER_HISTORY = 1000000000u; - else if (beast::detail::iequals(strTemp, "none")) + else if (boost::beast::detail::iequals(strTemp, "none")) LEDGER_HISTORY = 0; else LEDGER_HISTORY = beast::lexicalCastThrow (strTemp); @@ -389,9 +389,9 @@ void Config::loadFromString (std::string const& fileContents) if (getSingleSection (secConfig, SECTION_FETCH_DEPTH, strTemp, j_)) { - if (beast::detail::iequals(strTemp, "none")) + if (boost::beast::detail::iequals(strTemp, "none")) FETCH_DEPTH = 0; - else if (beast::detail::iequals(strTemp, "full")) + else if (boost::beast::detail::iequals(strTemp, "full")) FETCH_DEPTH = 1000000000u; else FETCH_DEPTH = beast::lexicalCastThrow (strTemp); diff --git a/src/ripple/json/Output.h b/src/ripple/json/Output.h index 5122357449..cc685d03be 100644 --- a/src/ripple/json/Output.h +++ b/src/ripple/json/Output.h @@ -20,19 +20,19 @@ #ifndef RIPPLE_JSON_OUTPUT_H_INCLUDED #define RIPPLE_JSON_OUTPUT_H_INCLUDED -#include +#include #include namespace Json { class Value; -using Output = std::function ; +using Output = std::function ; inline Output stringOutput (std::string& s) { - return [&](beast::string_view const& b) { s.append (b.data(), b.size()); }; + return [&](boost::beast::string_view const& b) { s.append (b.data(), b.size()); }; } /** Writes a minimal representation of a Json value to an Output in O(n) time. diff --git a/src/ripple/json/impl/Writer.cpp b/src/ripple/json/impl/Writer.cpp index 2d7f495372..27aac6f800 100644 --- a/src/ripple/json/impl/Writer.cpp +++ b/src/ripple/json/impl/Writer.cpp @@ -92,13 +92,13 @@ public: stack_.top().type = ct; } - void output (beast::string_view const& bytes) + void output (boost::beast::string_view const& bytes) { markStarted (); output_ (bytes); } - void stringOutput (beast::string_view const& bytes) + void stringOutput (boost::beast::string_view const& bytes) { markStarted (); std::size_t position = 0, writtenUntil = 0; diff --git a/src/ripple/net/AutoSocket.h b/src/ripple/net/AutoSocket.h index 1dbe4b1d6b..f2d27e384f 100644 --- a/src/ripple/net/AutoSocket.h +++ b/src/ripple/net/AutoSocket.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -177,7 +177,7 @@ public: // must be plain mSecure = false; mSocket->get_io_service ().post ( - beast::bind_handler (cbFunc, error_code())); + boost::beast::bind_handler (cbFunc, error_code())); } else { @@ -210,7 +210,7 @@ public: ec = e.code(); } mSocket->get_io_service ().post ( - beast::bind_handler (handler, ec)); + boost::beast::bind_handler (handler, ec)); } } diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index 90cddfd267..a796abe077 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -424,9 +424,9 @@ private: // This may look reversed, but it's intentional: jss::vetoed // determines whether an amendment is vetoed - so "reject" means // that jss::vetoed is true. - if (beast::detail::iequals(action, "reject")) + if (boost::beast::detail::iequals(action, "reject")) jvRequest[jss::vetoed] = Json::Value (true); - else if (beast::detail::iequals(action, "accept")) + else if (boost::beast::detail::iequals(action, "accept")) jvRequest[jss::vetoed] = Json::Value (false); else return rpcError (rpcINVALID_PARAMS); @@ -1476,7 +1476,7 @@ void fromNetwork ( } // HTTP basic authentication - auto const auth = beast::detail::base64_encode(strUsername + ":" + strPassword); + auto const auth = boost::beast::detail::base64_encode(strUsername + ":" + strPassword); std::map mapRequestHeaders; diff --git a/src/ripple/nodestore/backend/MemoryFactory.cpp b/src/ripple/nodestore/backend/MemoryFactory.cpp index 89f12e8599..72c6bf84fa 100644 --- a/src/ripple/nodestore/backend/MemoryFactory.cpp +++ b/src/ripple/nodestore/backend/MemoryFactory.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -41,7 +41,7 @@ class MemoryFactory : public Factory { private: std::mutex mutex_; - std::map map_; + std::map map_; public: MemoryFactory(); diff --git a/src/ripple/nodestore/impl/ManagerImp.cpp b/src/ripple/nodestore/impl/ManagerImp.cpp index 0daf284fdf..b8ced70dc0 100644 --- a/src/ripple/nodestore/impl/ManagerImp.cpp +++ b/src/ripple/nodestore/impl/ManagerImp.cpp @@ -110,7 +110,7 @@ ManagerImp::find (std::string const& name) auto const iter = std::find_if(list_.begin(), list_.end(), [&name](Factory* other) { - return beast::detail::iequals(name, other->getName()); + return boost::beast::detail::iequals(name, other->getName()); } ); if (iter == list_.end()) return nullptr; diff --git a/src/ripple/overlay/Overlay.h b/src/ripple/overlay/Overlay.h index 305fb0fb86..1a2b0ad5f8 100644 --- a/src/ripple/overlay/Overlay.h +++ b/src/ripple/overlay/Overlay.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/ripple/overlay/impl/ConnectAttempt.cpp b/src/ripple/overlay/impl/ConnectAttempt.cpp index b9c65726f4..a63961acf8 100644 --- a/src/ripple/overlay/impl/ConnectAttempt.cpp +++ b/src/ripple/overlay/impl/ConnectAttempt.cpp @@ -219,7 +219,7 @@ ConnectAttempt::onHandshake (error_code ec) appendHello (req_, hello); setTimer(); - beast::http::async_write(stream_, req_, + boost::beast::http::async_write(stream_, req_, strand_.wrap (std::bind (&ConnectAttempt::onWrite, shared_from_this(), std::placeholders::_1))); } @@ -234,7 +234,7 @@ ConnectAttempt::onWrite (error_code ec) return; if(ec) return fail("onWrite", ec); - beast::http::async_read(stream_, read_buf_, response_, + boost::beast::http::async_read(stream_, read_buf_, response_, strand_.wrap(std::bind(&ConnectAttempt::onRead, shared_from_this(), std::placeholders::_1))); } @@ -285,9 +285,9 @@ ConnectAttempt::makeRequest (bool crawl, request_type { request_type m; - m.method(beast::http::verb::get); + m.method(boost::beast::http::verb::get); m.target("/"); - m.version = 11; + m.version(11); m.insert ("User-Agent", BuildInfo::getFullVersionString()); m.insert ("Upgrade", "RTXP/1.2"); //std::string("RTXP/") + to_string (BuildInfo::getCurrentProtocol())); @@ -300,13 +300,13 @@ ConnectAttempt::makeRequest (bool crawl, void ConnectAttempt::processResponse() { - if (response_.result() == beast::http::status::service_unavailable) + if (response_.result() == boost::beast::http::status::service_unavailable) { Json::Value json; Json::Reader r; std::string s; - s.reserve(boost::asio::buffer_size(response_.body.data())); - for(auto const& buffer : response_.body.data()) + s.reserve(boost::asio::buffer_size(response_.body().data())); + for(auto const& buffer : response_.body().data()) s.append( boost::asio::buffer_cast(buffer), boost::asio::buffer_size(buffer)); diff --git a/src/ripple/overlay/impl/ConnectAttempt.h b/src/ripple/overlay/impl/ConnectAttempt.h index d22463e0fd..80b5c941b7 100644 --- a/src/ripple/overlay/impl/ConnectAttempt.h +++ b/src/ripple/overlay/impl/ConnectAttempt.h @@ -37,10 +37,10 @@ private: using endpoint_type = boost::asio::ip::tcp::endpoint; using request_type = - beast::http::request; + boost::beast::http::request; using response_type = - beast::http::response; + boost::beast::http::response; Application& app_; std::uint32_t const id_; @@ -53,7 +53,7 @@ private: std::unique_ptr ssl_bundle_; beast::asio::ssl_bundle::socket_type& socket_; beast::asio::ssl_bundle::stream_type& stream_; - beast::multi_buffer read_buf_; + boost::beast::multi_buffer read_buf_; response_type response_; PeerFinder::Slot::ptr slot_; request_type req_; diff --git a/src/ripple/overlay/impl/OverlayImpl.cpp b/src/ripple/overlay/impl/OverlayImpl.cpp index 88e26dfc17..8ea11175ce 100644 --- a/src/ripple/overlay/impl/OverlayImpl.cpp +++ b/src/ripple/overlay/impl/OverlayImpl.cpp @@ -213,7 +213,7 @@ OverlayImpl::onHandoff (std::unique_ptr && ssl_bundle, if (std::find_if(types.begin(), types.end(), [](std::string const& s) { - return beast::detail::iequals(s, "peer"); + return boost::beast::detail::iequals(s, "peer"); }) == types.end()) { handoff.moved = false; @@ -327,17 +327,17 @@ std::shared_ptr OverlayImpl::makeRedirectResponse (PeerFinder::Slot::ptr const& slot, http_request_type const& request, address_type remote_address) { - beast::http::response msg; - msg.version = request.version; - msg.result(beast::http::status::service_unavailable); + boost::beast::http::response msg; + msg.version(request.version()); + msg.result(boost::beast::http::status::service_unavailable); msg.insert("Server", BuildInfo::getFullVersionString()); msg.insert("Remote-Address", remote_address); msg.insert("Content-Type", "application/json"); - msg.insert(beast::http::field::connection, "close"); - msg.body = Json::objectValue; + msg.insert(boost::beast::http::field::connection, "close"); + msg.body() = Json::objectValue; { auto const result = m_peerFinder->redirect(slot); - Json::Value& ips = (msg.body["peer-ips"] = Json::arrayValue); + Json::Value& ips = (msg.body()["peer-ips"] = Json::arrayValue); for (auto const& _ : m_peerFinder->redirect(slot)) ips.append(_.address.to_string()); } @@ -351,13 +351,13 @@ OverlayImpl::makeErrorResponse (PeerFinder::Slot::ptr const& slot, address_type remote_address, std::string text) { - beast::http::response msg; - msg.version = request.version; - msg.result(beast::http::status::bad_request); + boost::beast::http::response msg; + msg.version(request.version()); + msg.result(boost::beast::http::status::bad_request); msg.insert("Server", BuildInfo::getFullVersionString()); msg.insert("Remote-Address", remote_address.to_string()); - msg.insert(beast::http::field::connection, "close"); - msg.body = text; + msg.insert(boost::beast::http::field::connection, "close"); + msg.body() = text; msg.prepare_payload(); return std::make_shared(msg); } @@ -762,7 +762,7 @@ OverlayImpl::crawl() for_each ([&](std::shared_ptr&& sp) { auto& pv = av.append(Json::Value(Json::objectValue)); - pv[jss::public_key] = beast::detail::base64_encode( + pv[jss::public_key] = boost::beast::detail::base64_encode( sp->getNodePublic().data(), sp->getNodePublic().size()); pv[jss::type] = sp->slot()->inbound() ? @@ -817,13 +817,13 @@ OverlayImpl::processRequest (http_request_type const& req, if (req.target() != "/crawl") return false; - beast::http::response msg; - msg.version = req.version; - msg.result(beast::http::status::ok); + boost::beast::http::response msg; + msg.version(req.version()); + msg.result(boost::beast::http::status::ok); msg.insert("Server", BuildInfo::getFullVersionString()); msg.insert("Content-Type", "application/json"); msg.insert("Connection", "close"); - msg.body["overlay"] = crawl(); + msg.body()["overlay"] = crawl(); msg.prepare_payload(); handoff.response = std::make_shared(msg); return true; diff --git a/src/ripple/overlay/impl/OverlayImpl.h b/src/ripple/overlay/impl/OverlayImpl.h index c8a04faa11..1e41b916c9 100644 --- a/src/ripple/overlay/impl/OverlayImpl.h +++ b/src/ripple/overlay/impl/OverlayImpl.h @@ -255,11 +255,11 @@ public: template static bool - isPeerUpgrade (beast::http::response const& response) + isPeerUpgrade (boost::beast::http::response const& response) { if (! is_upgrade(response)) return false; - if(response.result() != beast::http::status::switching_protocols) + if(response.result() != boost::beast::http::status::switching_protocols) return false; auto const versions = parse_ProtocolVersions( response["Upgrade"]); @@ -271,13 +271,13 @@ public: template static bool - is_upgrade(beast::http::header const& req) + is_upgrade(boost::beast::http::header const& req) { - if(req.version < 11) + if(req.version() < 11) return false; - if(req.method() != beast::http::verb::get) + if(req.method() != boost::beast::http::verb::get) return false; - if(! beast::http::token_list{req["Connection"]}.exists("upgrade")) + if(! boost::beast::http::token_list{req["Connection"]}.exists("upgrade")) return false; return true; } @@ -285,11 +285,11 @@ public: template static bool - is_upgrade(beast::http::header const& req) + is_upgrade(boost::beast::http::header const& req) { - if(req.version < 11) + if(req.version() < 11) return false; - if(! beast::http::token_list{req["Connection"]}.exists("upgrade")) + if(! boost::beast::http::token_list{req["Connection"]}.exists("upgrade")) return false; return true; } diff --git a/src/ripple/overlay/impl/PeerImp.cpp b/src/ripple/overlay/impl/PeerImp.cpp index fc903ca755..33c03ad042 100644 --- a/src/ripple/overlay/impl/PeerImp.cpp +++ b/src/ripple/overlay/impl/PeerImp.cpp @@ -237,7 +237,7 @@ PeerImp::crawl() const auto const iter = headers_.find("Crawl"); if (iter == headers_.end()) return false; - return beast::detail::iequals(iter->value(), "public"); + return boost::beast::detail::iequals(iter->value(), "public"); } std::string @@ -621,7 +621,7 @@ void PeerImp::doAccept() // TODO Apply headers to connection state. - beast::ostream(write_buffer_) << makeResponse( + boost::beast::ostream(write_buffer_) << makeResponse( ! overlay_.peerFinder().config().peerPrivate, request_, remote_address_, *sharedValue); @@ -669,8 +669,8 @@ PeerImp::makeResponse (bool crawl, uint256 const& sharedValue) { http_response_type resp; - resp.result(beast::http::status::switching_protocols); - resp.version = req.version; + resp.result(boost::beast::http::status::switching_protocols); + resp.version(req.version()); resp.insert("Connection", "Upgrade"); resp.insert("Upgrade", "RTXP/1.2"); resp.insert("Connect-As", "Peer"); diff --git a/src/ripple/overlay/impl/PeerImp.h b/src/ripple/overlay/impl/PeerImp.h index e07c5d1006..67e118a444 100644 --- a/src/ripple/overlay/impl/PeerImp.h +++ b/src/ripple/overlay/impl/PeerImp.h @@ -143,11 +143,11 @@ private: Resource::Consumer usage_; Resource::Charge fee_; PeerFinder::Slot::ptr slot_; - beast::multi_buffer read_buffer_; + boost::beast::multi_buffer read_buffer_; http_request_type request_; http_response_type response_; - beast::http::fields const& headers_; - beast::multi_buffer write_buffer_; + boost::beast::http::fields const& headers_; + boost::beast::multi_buffer write_buffer_; std::queue send_queue_; bool gracefulClose_ = false; int large_sendq_ = 0; diff --git a/src/ripple/overlay/impl/TMHello.cpp b/src/ripple/overlay/impl/TMHello.cpp index a828ee9263..c3fca6d81a 100644 --- a/src/ripple/overlay/impl/TMHello.cpp +++ b/src/ripple/overlay/impl/TMHello.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -150,14 +150,14 @@ buildHello ( } void -appendHello (beast::http::fields& h, +appendHello (boost::beast::http::fields& h, protocol::TMHello const& hello) { //h.append ("Protocol-Versions",... h.insert ("Public-Key", hello.nodepublic()); - h.insert ("Session-Signature", beast::detail::base64_encode ( + h.insert ("Session-Signature", boost::beast::detail::base64_encode ( hello.nodeproof())); if (hello.has_nettime()) @@ -167,11 +167,11 @@ appendHello (beast::http::fields& h, h.insert ("Ledger", std::to_string (hello.ledgerindex())); if (hello.has_ledgerclosed()) - h.insert ("Closed-Ledger", beast::detail::base64_encode ( + h.insert ("Closed-Ledger", boost::beast::detail::base64_encode ( hello.ledgerclosed())); if (hello.has_ledgerprevious()) - h.insert ("Previous-Ledger", beast::detail::base64_encode ( + h.insert ("Previous-Ledger", boost::beast::detail::base64_encode ( hello.ledgerprevious())); if (hello.has_local_ip()) @@ -184,7 +184,7 @@ appendHello (beast::http::fields& h, } std::vector -parse_ProtocolVersions(beast::string_view const& value) +parse_ProtocolVersions(boost::beast::string_view const& value) { static boost::regex re ( "^" // start of line @@ -218,7 +218,7 @@ parse_ProtocolVersions(beast::string_view const& value) } boost::optional -parseHello (bool request, beast::http::fields const& h, beast::Journal journal) +parseHello (bool request, boost::beast::http::fields const& h, beast::Journal journal) { // protocol version in TMHello is obsolete, // it is supplanted by the values in the headers. @@ -258,7 +258,7 @@ parseHello (bool request, beast::http::fields const& h, beast::Journal journal) if (iter == h.end()) return boost::none; // TODO Security Review - hello.set_nodeproof (beast::detail::base64_decode (iter->value().to_string())); + hello.set_nodeproof (boost::beast::detail::base64_decode (iter->value().to_string())); } { @@ -293,13 +293,13 @@ parseHello (bool request, beast::http::fields const& h, beast::Journal journal) { auto const iter = h.find ("Closed-Ledger"); if (iter != h.end()) - hello.set_ledgerclosed (beast::detail::base64_decode (iter->value().to_string())); + hello.set_ledgerclosed (boost::beast::detail::base64_decode (iter->value().to_string())); } { auto const iter = h.find ("Previous-Ledger"); if (iter != h.end()) - hello.set_ledgerprevious (beast::detail::base64_decode (iter->value().to_string())); + hello.set_ledgerprevious (boost::beast::detail::base64_decode (iter->value().to_string())); } { diff --git a/src/ripple/overlay/impl/TMHello.h b/src/ripple/overlay/impl/TMHello.h index ed03f1543e..9deba3474d 100644 --- a/src/ripple/overlay/impl/TMHello.h +++ b/src/ripple/overlay/impl/TMHello.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -56,14 +56,14 @@ buildHello (uint256 const& sharedValue, /** Insert HTTP headers based on the TMHello protocol message. */ void -appendHello (beast::http::fields& h, protocol::TMHello const& hello); +appendHello (boost::beast::http::fields& h, protocol::TMHello const& hello); /** Parse HTTP headers into TMHello protocol message. @return A protocol message on success; an empty optional if the parsing failed. */ boost::optional -parseHello (bool request, beast::http::fields const& h, beast::Journal journal); +parseHello (bool request, boost::beast::http::fields const& h, beast::Journal journal); /** Validate and store the public key in the TMHello. This includes signature verification on the shared value. @@ -82,7 +82,7 @@ verifyHello (protocol::TMHello const& h, uint256 const& sharedValue, excluded from the result set. */ std::vector -parse_ProtocolVersions(beast::string_view const& s); +parse_ProtocolVersions(boost::beast::string_view const& s); } diff --git a/src/ripple/rpc/impl/ServerHandlerImp.cpp b/src/ripple/rpc/impl/ServerHandlerImp.cpp index 4bfa70b650..cc3ddf6452 100644 --- a/src/ripple/rpc/impl/ServerHandlerImp.cpp +++ b/src/ripple/rpc/impl/ServerHandlerImp.cpp @@ -39,9 +39,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -57,10 +57,10 @@ isStatusRequest( http_request_type const& request) { return - request.version >= 11 && + request.version() >= 11 && request.target() == "/" && - request.body.size() == 0 && - request.method() == beast::http::verb::get; + request.body().size() == 0 && + request.method() == boost::beast::http::verb::get; } static @@ -68,21 +68,21 @@ Handoff unauthorizedResponse( http_request_type const& request) { - using namespace beast::http; + using namespace boost::beast::http; Handoff handoff; response msg; - msg.version = request.version; - msg.result(beast::http::status::unauthorized); + msg.version(request.version()); + msg.result(boost::beast::http::status::unauthorized); msg.insert("Server", BuildInfo::getFullVersionString()); msg.insert("Content-Type", "text/html"); msg.insert("Connection", "close"); - msg.body = "Invalid protocol."; + msg.body() = "Invalid protocol."; msg.prepare_payload(); handoff.response = std::make_shared(msg); return handoff; } -// VFALCO TODO Rewrite to use beast::http::fields +// VFALCO TODO Rewrite to use boost::beast::http::fields static bool authorized ( @@ -97,7 +97,7 @@ authorized ( return false; std::string strUserPass64 = it->second.substr (6); boost::trim (strUserPass64); - std::string strUserPass = beast::detail::base64_decode (strUserPass64); + std::string strUserPass = boost::beast::detail::base64_decode (strUserPass64); std::string::size_type nColon = strUserPass.find (":"); if (nColon == std::string::npos) return false; @@ -178,7 +178,7 @@ ServerHandlerImp::onHandoff (Session& session, (session.port().protocol.count("wss") > 0) || (session.port().protocol.count("wss2") > 0); - if(beast::websocket::is_upgrade(request)) + if(boost::beast::websocket::is_upgrade(request)) { if(is_ws) { @@ -218,7 +218,7 @@ ServerHandlerImp::onHandoff (Session& session, boost::asio::ip::tcp::endpoint remote_address) -> Handoff { - if(beast::websocket::is_upgrade(request)) + if(boost::beast::websocket::is_upgrade(request)) { if (session.port().protocol.count("ws2") > 0 || session.port().protocol.count("ws") > 0) @@ -250,7 +250,7 @@ ServerHandlerImp::onHandoff (Session& session, static inline Json::Output makeOutput (Session& session) { - return [&](beast::string_view const& b) + return [&](boost::beast::string_view const& b) { session.write (b.data(), b.size()); }; @@ -259,7 +259,7 @@ Json::Output makeOutput (Session& session) // HACK! static std::map -build_map(beast::http::fields const& h) +build_map(boost::beast::http::fields const& h) { std::map c; for (auto const& e : h) @@ -343,7 +343,7 @@ ServerHandlerImp::onWSMessage( jvResult[jss::type] = jss::error; jvResult[jss::error] = "jsonInvalid"; jvResult[jss::value] = buffers_to_string(buffers); - beast::multi_buffer sb; + boost::beast::multi_buffer sb; Json::stream(jvResult, [&sb](auto const p, auto const n) { @@ -369,7 +369,7 @@ ServerHandlerImp::onWSMessage( this->processSession(session, coro, jv); auto const s = to_string(jr); auto const n = s.length(); - beast::multi_buffer sb(n); + boost::beast::multi_buffer sb(n); sb.commit(boost::asio::buffer_copy( sb.prepare(n), boost::asio::buffer(s.c_str(), n))); session->send(std::make_shared< @@ -511,7 +511,7 @@ ServerHandlerImp::processSession (std::shared_ptr const& session, { processRequest ( session->port(), buffers_to_string( - session->request().body.data()), + session->request().body().data()), session->remoteAddress().at_port (0), makeOutput (*session), coro, [&] @@ -849,25 +849,25 @@ Handoff ServerHandlerImp::statusResponse( http_request_type const& request) const { - using namespace beast::http; + using namespace boost::beast::http; Handoff handoff; response msg; std::string reason; if (app_.serverOkay(reason)) { - msg.result(beast::http::status::ok); - msg.body = "" + systemName() + + msg.result(boost::beast::http::status::ok); + msg.body() = "<!DOCTYPE html><html><head><title>" + systemName() + " Test page for rippled

" + systemName() + " Test

This page shows rippled http(s) " "connectivity is working.

"; } else { - msg.result(beast::http::status::internal_server_error); - msg.body = "Server cannot accept clients: " + + msg.result(boost::beast::http::status::internal_server_error); + msg.body() = "Server cannot accept clients: " + reason + ""; } - msg.version = request.version; + msg.version(request.version()); msg.insert("Server", BuildInfo::getFullVersionString()); msg.insert("Content-Type", "text/html"); msg.insert("Connection", "close"); diff --git a/src/ripple/rpc/impl/WSInfoSub.h b/src/ripple/rpc/impl/WSInfoSub.h index 0eaffd3baa..183084910f 100644 --- a/src/ripple/rpc/impl/WSInfoSub.h +++ b/src/ripple/rpc/impl/WSInfoSub.h @@ -73,7 +73,7 @@ public: auto sp = ws_.lock(); if(! sp) return; - beast::multi_buffer sb; + boost::beast::multi_buffer sb; Json::stream(jv, [&](void const* data, std::size_t n) { diff --git a/src/ripple/rpc/json_body.h b/src/ripple/rpc/json_body.h index e115ca8834..00d94dc7c0 100644 --- a/src/ripple/rpc/json_body.h +++ b/src/ripple/rpc/json_body.h @@ -21,8 +21,10 @@ #define RIPPLE_RPC_JSON_BODY_H #include -#include -#include +#include + +#include +#include namespace ripple { @@ -35,7 +37,7 @@ struct json_body class reader { - using dynamic_buffer_type = beast::multi_buffer; + using dynamic_buffer_type = boost::beast::multi_buffer; dynamic_buffer_type buffer_; @@ -47,7 +49,7 @@ struct json_body template explicit - reader(beast::http::message< + reader(boost::beast::http::message< isRequest, json_body, Fields> const& m) { stream(m.body, @@ -59,21 +61,52 @@ struct json_body } void - init(beast::error_code&) noexcept + init(boost::beast::error_code&) noexcept { } boost::optional> - get(beast::error_code& ec) + get(boost::beast::error_code& ec) { return {{buffer_.data(), false}}; } void - finish(beast::error_code&) + finish(boost::beast::error_code&) { } }; + + class writer + { + std::string body_string_; + + public: + using const_buffers_type = + boost::asio::const_buffer; + + template + explicit + writer(boost::beast::http::message const& msg) + : body_string_(to_string(msg.body())) + { + } + + void + init(boost::beast::error_code& ec) + { + ec.assign(0, ec.category()); + } + + boost::optional> + get(boost::beast::error_code& ec) + { + ec.assign(0, ec.category()); + return {{const_buffers_type{ + body_string_.data(), body_string_.size()}, false}}; + } + }; }; } // ripple diff --git a/src/ripple/server/Handoff.h b/src/ripple/server/Handoff.h index 48220545ff..60077f0dd7 100644 --- a/src/ripple/server/Handoff.h +++ b/src/ripple/server/Handoff.h @@ -21,17 +21,17 @@ #define RIPPLE_SERVER_HANDOFF_H_INCLUDED #include -#include -#include +#include +#include #include namespace ripple { using http_request_type = - beast::http::request; + boost::beast::http::request; using http_response_type = - beast::http::response; + boost::beast::http::response; /** Used to indicate the result of a server connection handoff. */ struct Handoff diff --git a/src/ripple/server/Port.h b/src/ripple/server/Port.h index d15f3cd0ca..244402c9cd 100644 --- a/src/ripple/server/Port.h +++ b/src/ripple/server/Port.h @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include #include #include #include @@ -42,7 +42,7 @@ struct Port std::string name; boost::asio::ip::address ip; std::uint16_t port = 0; - std::set protocol; + std::set protocol; std::vector admin_ip; std::vector secure_gateway_ip; std::string user; @@ -53,7 +53,7 @@ struct Port std::string ssl_cert; std::string ssl_chain; std::string ssl_ciphers; - beast::websocket::permessage_deflate pmd_options; + boost::beast::websocket::permessage_deflate pmd_options; std::shared_ptr context; // How many incoming connections are allowed on this @@ -83,7 +83,7 @@ struct ParsedPort explicit ParsedPort() = default; std::string name; - std::set protocol; + std::set protocol; std::string user; std::string password; std::string admin_user; @@ -92,7 +92,7 @@ struct ParsedPort std::string ssl_cert; std::string ssl_chain; std::string ssl_ciphers; - beast::websocket::permessage_deflate pmd_options; + boost::beast::websocket::permessage_deflate pmd_options; int limit = 0; std::uint16_t ws_queue_limit; diff --git a/src/ripple/server/Session.h b/src/ripple/server/Session.h index 102b0094c3..2e04ca23fb 100644 --- a/src/ripple/server/Session.h +++ b/src/ripple/server/Session.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/ripple/server/SimpleWriter.h b/src/ripple/server/SimpleWriter.h index 9d17dbd1cd..0badea441b 100644 --- a/src/ripple/server/SimpleWriter.h +++ b/src/ripple/server/SimpleWriter.h @@ -21,10 +21,10 @@ #define RIPPLE_SERVER_SIMPLEWRITER_H_INCLUDED #include -#include -#include -#include -#include +#include +#include +#include +#include #include namespace ripple { @@ -32,15 +32,14 @@ namespace ripple { /// Deprecated: Writer that serializes a HTTP/1 message class SimpleWriter : public Writer { - beast::multi_buffer sb_; + boost::beast::multi_buffer sb_; public: - template + template explicit - SimpleWriter(beast::http::message< - isRequest, Body, Headers> const& msg) + SimpleWriter(boost::beast::http::message const& msg) { - beast::ostream(sb_) << msg; + boost::beast::ostream(sb_) << msg; } bool diff --git a/src/ripple/server/WSSession.h b/src/ripple/server/WSSession.h index 0cd685a637..230037384e 100644 --- a/src/ripple/server/WSSession.h +++ b/src/ripple/server/WSSession.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -98,7 +98,7 @@ public: n_ = sb_.size(); done = true; } - auto const pb = beast::buffer_prefix(n_, sb_.data()); + auto const pb = boost::beast::buffers_prefix(n_, sb_.data()); std::vector vb ( std::distance(pb.begin(), pb.end())); std::copy(pb.begin(), pb.end(), std::back_inserter(vb)); diff --git a/src/ripple/server/impl/BaseHTTPPeer.h b/src/ripple/server/impl/BaseHTTPPeer.h index 90ad13a006..f4d6118cc6 100644 --- a/src/ripple/server/impl/BaseHTTPPeer.h +++ b/src/ripple/server/impl/BaseHTTPPeer.h @@ -25,10 +25,10 @@ #include #include #include // for is_short_read? -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include @@ -324,10 +324,10 @@ do_read(yield_context do_yield) complete_ = false; error_code ec; start_timer(); - beast::http::async_read(impl().stream_, + boost::beast::http::async_read(impl().stream_, read_buf_, message_, do_yield[ec]); cancel_timer(); - if(ec == beast::http::error::end_of_stream) + if(ec == boost::beast::http::error::end_of_stream) return do_close(); if(ec) return fail(ec, "http::read"); diff --git a/src/ripple/server/impl/BaseWSPeer.h b/src/ripple/server/impl/BaseWSPeer.h index a4a2d3861a..ca1656e7b1 100644 --- a/src/ripple/server/impl/BaseWSPeer.h +++ b/src/ripple/server/impl/BaseWSPeer.h @@ -24,10 +24,11 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include +#include namespace ripple { @@ -48,24 +49,24 @@ private: friend class BasePeer; http_request_type request_; - beast::multi_buffer rb_; - beast::multi_buffer wb_; + boost::beast::multi_buffer rb_; + boost::beast::multi_buffer wb_; std::list> wq_; bool do_close_ = false; - beast::websocket::close_reason cr_; + boost::beast::websocket::close_reason cr_; waitable_timer timer_; bool close_on_timer_ = false; bool ping_active_ = false; - beast::websocket::ping_data payload_; + boost::beast::websocket::ping_data payload_; error_code ec_; - + std::function control_callback_; public: template BaseWSPeer( Port const& port, Handler& handler, endpoint_type remote_address, - beast::http::request&& request, + boost::beast::http::request&& request, boost::asio::io_service& io_service, beast::Journal journal); @@ -141,8 +142,8 @@ protected: on_ping(error_code const& ec); void - on_ping_pong(beast::websocket::frame_type kind, - beast::string_view payload); + on_ping_pong(boost::beast::websocket::frame_type kind, + boost::beast::string_view payload); void on_timer(error_code ec); @@ -161,7 +162,7 @@ BaseWSPeer( Port const& port, Handler& handler, endpoint_type remote_address, - beast::http::request&& request, + boost::beast::http::request&& request, boost::asio::io_service& io_service, beast::Journal journal) : BasePeer(port, handler, remote_address, @@ -180,15 +181,17 @@ run() return strand_.post(std::bind( &BaseWSPeer::run, impl().shared_from_this())); impl().ws_.set_option(port().pmd_options); - impl().ws_.control_callback( - std::bind(&BaseWSPeer::on_ping_pong, this, - std::placeholders::_1, std::placeholders::_2)); + // Must manage the control callback memory outside of the `control_callback` function + control_callback_ = std::bind( + &BaseWSPeer::on_ping_pong, + this, std::placeholders::_1, std::placeholders::_2); + impl().ws_.control_callback(control_callback_); start_timer(); close_on_timer_ = true; impl().ws_.async_accept_ex(request_, [](auto & res) { - res.set(beast::http::field::server, + res.set(boost::beast::http::field::server, BuildInfo::getFullVersionString()); }, strand_.wrap(std::bind(&BaseWSPeer::on_ws_handshake, @@ -210,7 +213,7 @@ send(std::shared_ptr w) { JLOG(this->j_.info()) << "closing slow client"; - cr_.code = static_cast(4000); + cr_.code = static_cast(4000); cr_.reason = "Client is too slow."; wq_.erase(std::next(wq_.begin()), wq_.end()); close(); @@ -284,12 +287,12 @@ on_write(error_code const& ec) return; start_timer(); if(! result.first) - impl().ws_.async_write_frame( + impl().ws_.async_write_some( result.first, result.second, strand_.wrap(std::bind( &BaseWSPeer::on_write, impl().shared_from_this(), std::placeholders::_1))); else - impl().ws_.async_write_frame( + impl().ws_.async_write_some( result.first, result.second, strand_.wrap(std::bind( &BaseWSPeer::on_write_fin, impl().shared_from_this(), std::placeholders::_1))); @@ -329,7 +332,7 @@ void BaseWSPeer:: on_read(error_code const& ec) { - if(ec == beast::websocket::error::closed) + if(ec == boost::beast::websocket::error::closed) return on_close({}); if(ec) return fail(ec, "read"); @@ -395,12 +398,12 @@ on_ping(error_code const& ec) template void BaseWSPeer:: -on_ping_pong(beast::websocket::frame_type kind, - beast::string_view payload) +on_ping_pong(boost::beast::websocket::frame_type kind, + boost::beast::string_view payload) { - if(kind == beast::websocket::frame_type::pong) + if(kind == boost::beast::websocket::frame_type::pong) { - beast::string_view p(payload_.begin()); + boost::beast::string_view p(payload_.begin()); if(payload == p) { close_on_timer_ = false; diff --git a/src/ripple/server/impl/Door.h b/src/ripple/server/impl/Door.h index db78aec8c4..bb4a069db5 100644 --- a/src/ripple/server/impl/Door.h +++ b/src/ripple/server/impl/Door.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -229,7 +229,7 @@ do_detect(boost::asio::yield_context do_yield) { bool ssl; error_code ec; - beast::multi_buffer buf(16); + boost::beast::multi_buffer buf(16); timer_.expires_from_now(std::chrono::seconds(15)); std::tie(ec, ssl) = detect_ssl(socket_, buf, do_yield); error_code unused; diff --git a/src/ripple/server/impl/PlainWSPeer.h b/src/ripple/server/impl/PlainWSPeer.h index 18f8ae4cad..d06f612ec2 100644 --- a/src/ripple/server/impl/PlainWSPeer.h +++ b/src/ripple/server/impl/PlainWSPeer.h @@ -39,7 +39,7 @@ class PlainWSPeer using waitable_timer = boost::asio::basic_waitable_timer ; using socket_type = boost::asio::ip::tcp::socket; - beast::websocket::stream ws_; + boost::beast::websocket::stream ws_; public: template @@ -47,7 +47,7 @@ public: Port const& port, Handler& handler, endpoint_type remote_address, - beast::http::request&& request, + boost::beast::http::request&& request, socket_type&& socket, beast::Journal journal); }; @@ -61,7 +61,7 @@ PlainWSPeer( Port const& port, Handler& handler, endpoint_type remote_address, - beast::http::request&& request, + boost::beast::http::request&& request, socket_type&& socket, beast::Journal journal) : BaseWSPeer(port, handler, remote_address, diff --git a/src/ripple/server/impl/Port.cpp b/src/ripple/server/impl/Port.cpp index 1f70b8ae51..0e7bcea9aa 100644 --- a/src/ripple/server/impl/Port.cpp +++ b/src/ripple/server/impl/Port.cpp @@ -188,7 +188,7 @@ parse_Port (ParsedPort& port, Section const& section, std::ostream& log) { auto const lim = get (section, "limit", "unlimited"); - if (!beast::detail::iequals (lim, "unlimited")) + if (!boost::beast::detail::iequals (lim, "unlimited")) { try { diff --git a/src/ripple/server/impl/SSLWSPeer.h b/src/ripple/server/impl/SSLWSPeer.h index 1bf9afe49f..3b662ff471 100644 --- a/src/ripple/server/impl/SSLWSPeer.h +++ b/src/ripple/server/impl/SSLWSPeer.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include namespace ripple { @@ -43,7 +43,7 @@ class SSLWSPeer boost::asio::basic_waitable_timer ; std::unique_ptr ssl_bundle_; - beast::websocket::stream< + boost::beast::websocket::stream< beast::asio::ssl_bundle::stream_type&> ws_; public: @@ -52,7 +52,7 @@ public: Port const& port, Handler& handler, endpoint_type remote_endpoint, - beast::http::request&& request, + boost::beast::http::request&& request, std::unique_ptr< beast::asio::ssl_bundle>&& ssl_bundle, beast::Journal journal); @@ -67,7 +67,7 @@ SSLWSPeer( Port const& port, Handler& handler, endpoint_type remote_endpoint, - beast::http::request&& request, + boost::beast::http::request&& request, std::unique_ptr< beast::asio::ssl_bundle>&& ssl_bundle, beast::Journal journal) diff --git a/src/test/app/Manifest_test.cpp b/src/test/app/Manifest_test.cpp index ba248f60ca..393db0afba 100644 --- a/src/test/app/Manifest_test.cpp +++ b/src/test/app/Manifest_test.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -123,7 +123,7 @@ public: Serializer s; st.add(s); - return beast::detail::base64_encode (std::string( + return boost::beast::detail::base64_encode (std::string( static_cast (s.data()), s.size())); } @@ -176,7 +176,7 @@ public: Serializer s; st.add(s); - return beast::detail::base64_encode (std::string( + return boost::beast::detail::base64_encode (std::string( static_cast (s.data()), s.size())); } diff --git a/src/test/app/ValidatorKeys_test.cpp b/src/test/app/ValidatorKeys_test.cpp index 76bbb30955..99a0ebdfef 100644 --- a/src/test/app/ValidatorKeys_test.cpp +++ b/src/test/app/ValidatorKeys_test.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include namespace ripple { @@ -91,7 +91,7 @@ public: derivePublicKey(KeyType::secp256k1, tokenSecretKey); auto const m = Manifest::make_Manifest( - beast::detail::base64_decode(tokenManifest)); + boost::beast::detail::base64_decode(tokenManifest)); BEAST_EXPECT(m); NodeID const tokenNodeID = calcNodeID(m->masterKey); diff --git a/src/test/app/ValidatorList_test.cpp b/src/test/app/ValidatorList_test.cpp index 3c83eb3870..6dd126e587 100644 --- a/src/test/app/ValidatorList_test.cpp +++ b/src/test/app/ValidatorList_test.cpp @@ -17,7 +17,7 @@ */ //============================================================================== -#include +#include #include #include #include @@ -89,7 +89,7 @@ private: derivePublicKey(KeyType::ed25519, secret); auto const signingKeys = randomKeyPair(KeyType::secp256k1); return { masterPublic, signingKeys.first, - beast::detail::base64_encode(makeManifestString ( + boost::beast::detail::base64_encode(makeManifestString ( masterPublic, secret, signingKeys.first, signingKeys.second, 1)) }; } @@ -112,7 +112,7 @@ private: data.pop_back(); data += "]}"; - return beast::detail::base64_encode(data); + return boost::beast::detail::base64_encode(data); } std::string @@ -120,7 +120,7 @@ private: std::string const& blob, std::pair const& keys) { - auto const data = beast::detail::base64_decode (blob); + auto const data = boost::beast::detail::base64_decode (blob); return strHex(sign( keys.first, keys.second, makeSlice(data))); } @@ -374,7 +374,7 @@ private: auto const publisherPublic = derivePublicKey(KeyType::ed25519, publisherSecret); auto const pubSigningKeys1 = randomKeyPair(KeyType::secp256k1); - auto const manifest1 = beast::detail::base64_encode(makeManifestString ( + auto const manifest1 = boost::beast::detail::base64_encode(makeManifestString ( publisherPublic, publisherSecret, pubSigningKeys1.first, pubSigningKeys1.second, 1)); @@ -425,7 +425,7 @@ private: } // do not use list from untrusted publisher - auto const untrustedManifest = beast::detail::base64_encode( + auto const untrustedManifest = boost::beast::detail::base64_encode( makeManifestString ( randomMasterKey(), publisherSecret, pubSigningKeys1.first, pubSigningKeys1.second, 1)); @@ -472,7 +472,7 @@ private: // apply list with new publisher key updated by manifest auto const pubSigningKeys2 = randomKeyPair(KeyType::secp256k1); - auto manifest2 = beast::detail::base64_encode(makeManifestString ( + auto manifest2 = boost::beast::detail::base64_encode(makeManifestString ( publisherPublic, publisherSecret, pubSigningKeys2.first, pubSigningKeys2.second, 2)); @@ -496,7 +496,7 @@ private: // do not apply list with revoked publisher key // applied list is removed due to revoked publisher key auto const signingKeysMax = randomKeyPair(KeyType::secp256k1); - auto maxManifest = beast::detail::base64_encode(makeManifestString ( + auto maxManifest = boost::beast::detail::base64_encode(makeManifestString ( publisherPublic, publisherSecret, pubSigningKeys2.first, pubSigningKeys2.second, std::numeric_limits::max ())); @@ -792,7 +792,7 @@ private: std::vector emptyCfgKeys; auto const publisherKeys = randomKeyPair(KeyType::secp256k1); auto const pubSigningKeys = randomKeyPair(KeyType::secp256k1); - auto const manifest = beast::detail::base64_encode ( + auto const manifest = boost::beast::detail::base64_encode ( makeManifestString ( publisherKeys.first, publisherKeys.second, pubSigningKeys.first, pubSigningKeys.second, 1)); @@ -963,7 +963,7 @@ private: auto const publisherPublic = derivePublicKey(KeyType::ed25519, publisherSecret); auto const pubSigningKeys = randomKeyPair(KeyType::secp256k1); - auto const manifest = beast::detail::base64_encode(makeManifestString ( + auto const manifest = boost::beast::detail::base64_encode(makeManifestString ( publisherPublic, publisherSecret, pubSigningKeys.first, pubSigningKeys.second, 1)); @@ -1073,7 +1073,7 @@ private: auto const publisherPublic = derivePublicKey(KeyType::ed25519, publisherSecret); auto const pubSigningKeys = randomKeyPair(KeyType::secp256k1); - auto const manifest = beast::detail::base64_encode(makeManifestString ( + auto const manifest = boost::beast::detail::base64_encode(makeManifestString ( publisherPublic, publisherSecret, pubSigningKeys.first, pubSigningKeys.second, 1)); diff --git a/src/test/app/ValidatorSite_test.cpp b/src/test/app/ValidatorSite_test.cpp index 132552647e..b46ee196d6 100644 --- a/src/test/app/ValidatorSite_test.cpp +++ b/src/test/app/ValidatorSite_test.cpp @@ -17,7 +17,6 @@ */ //============================================================================== -#include #include #include #include @@ -29,6 +28,7 @@ #include #include #include +#include namespace ripple { namespace test { @@ -67,7 +67,7 @@ private: Serializer s; st.add(s); - return beast::detail::base64_encode (std::string( + return boost::beast::detail::base64_encode (std::string( static_cast (s.data()), s.size())); } diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index a4493be114..6c8c1c58f5 100644 --- a/src/test/jtx/Env.h +++ b/src/test/jtx/Env.h @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include #include @@ -713,7 +713,7 @@ protected: FN const&... fN) { maybe_invoke(stx, f, - beast::detail::is_invocable()); invoke(stx, fN...); } @@ -747,7 +747,7 @@ protected: FN const&... fN) { maybe_invoke(jt, f, - beast::detail::is_invocable()); invoke(jt, fN...); } diff --git a/src/test/jtx/TrustedPublisherServer.h b/src/test/jtx/TrustedPublisherServer.h index 4cf67a7219..3288127f75 100644 --- a/src/test/jtx/TrustedPublisherServer.h +++ b/src/test/jtx/TrustedPublisherServer.h @@ -19,14 +19,13 @@ #ifndef RIPPLE_TEST_TRUSTED_PUBLISHER_SERVER_H_INCLUDED #define RIPPLE_TEST_TRUSTED_PUBLISHER_SERVER_H_INCLUDED -#include #include #include #include #include #include -#include -#include +#include +#include namespace ripple { namespace test { @@ -37,8 +36,8 @@ class TrustedPublisherServer using address_type = boost::asio::ip::address; using socket_type = boost::asio::ip::tcp::socket; - using req_type = beast::http::request; - using resp_type = beast::http::response; + using req_type = boost::beast::http::request; + using resp_type = boost::beast::http::response; using error_code = boost::system::error_code; socket_type sock_; @@ -78,7 +77,7 @@ public: } data.pop_back(); data += "]}"; - std::string blob = beast::detail::base64_encode(data); + std::string blob = boost::beast::detail::base64_encode(data); list_ = "{\"blob\":\"" + blob + "\""; @@ -155,35 +154,35 @@ private: do_peer(int id, socket_type&& sock0) { socket_type sock(std::move(sock0)); - beast::multi_buffer sb; + boost::beast::multi_buffer sb; error_code ec; for (;;) { req_type req; - beast::http::read(sock, sb, req, ec); + boost::beast::http::read(sock, sb, req, ec); if (ec) break; auto path = req.target().to_string(); if (path != "/validators") { resp_type res; - res.result(beast::http::status::not_found); - res.version = req.version; + res.result(boost::beast::http::status::not_found); + res.version(req.version()); res.insert("Server", "TrustedPublisherServer"); res.insert("Content-Type", "text/html"); - res.body = "The file '" + path + "' was not found"; + res.body() = "The file '" + path + "' was not found"; res.prepare_payload(); write(sock, res, ec); if (ec) break; } resp_type res; - res.result(beast::http::status::ok); - res.version = req.version; + res.result(boost::beast::http::status::ok); + res.version(req.version()); res.insert("Server", "TrustedPublisherServer"); res.insert("Content-Type", "application/json"); - res.body = list_; + res.body() = list_; try { res.prepare_payload(); @@ -191,11 +190,11 @@ private: catch (std::exception const& e) { res = {}; - res.result(beast::http::status::internal_server_error); - res.version = req.version; + res.result(boost::beast::http::status::internal_server_error); + res.version(req.version()); res.insert("Server", "TrustedPublisherServer"); res.insert("Content-Type", "text/html"); - res.body = std::string{"An internal error occurred"} + e.what(); + res.body() = std::string{"An internal error occurred"} + e.what(); res.prepare_payload(); } write(sock, res, ec); diff --git a/src/test/jtx/WSClient_test.cpp b/src/test/jtx/WSClient_test.cpp index 85c6b06b51..1962f562a8 100644 --- a/src/test/jtx/WSClient_test.cpp +++ b/src/test/jtx/WSClient_test.cpp @@ -20,7 +20,6 @@ #include #include #include -#include namespace ripple { namespace test { diff --git a/src/test/jtx/impl/JSONRPCClient.cpp b/src/test/jtx/impl/JSONRPCClient.cpp index 9c54a2cc98..f32d5cf042 100644 --- a/src/test/jtx/impl/JSONRPCClient.cpp +++ b/src/test/jtx/impl/JSONRPCClient.cpp @@ -21,11 +21,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -73,8 +73,8 @@ class JSONRPCClient : public AbstractClient boost::asio::ip::tcp::endpoint ep_; boost::asio::io_service ios_; boost::asio::ip::tcp::socket stream_; - beast::multi_buffer bin_; - beast::multi_buffer bout_; + boost::beast::multi_buffer bin_; + boost::beast::multi_buffer bout_; unsigned rpc_version_; public: @@ -103,14 +103,14 @@ public: invoke(std::string const& cmd, Json::Value const& params) override { - using namespace beast::http; + using namespace boost::beast::http; using namespace boost::asio; using namespace std::string_literals; request req; - req.method(beast::http::verb::post); + req.method(boost::beast::http::verb::post); req.target("/"); - req.version = 11; + req.version(11); req.insert("Content-Type", "application/json; charset=UTF-8"); req.insert("Host", ep_); { @@ -127,7 +127,7 @@ public: Json::Value& ja = jr[jss::params] = Json::arrayValue; ja.append(params); } - req.body = to_string(jr); + req.body() = to_string(jr); } req.prepare_payload(); write(stream_, req); @@ -137,7 +137,7 @@ public: Json::Reader jr; Json::Value jv; - jr.parse(buffer_string(res.body.data()), jv); + jr.parse(buffer_string(res.body().data()), jv); if(jv["result"].isMember("error")) jv["error"] = jv["result"]["error"]; if(jv["result"].isMember("status")) diff --git a/src/test/jtx/impl/WSClient.cpp b/src/test/jtx/impl/WSClient.cpp index 9c468c86a2..f239b9c36c 100644 --- a/src/test/jtx/impl/WSClient.cpp +++ b/src/test/jtx/impl/WSClient.cpp @@ -23,8 +23,8 @@ #include #include #include -#include -#include +#include +#include #include @@ -92,8 +92,8 @@ class WSClientImpl : public WSClient boost::asio::io_service::strand strand_; std::thread thread_; boost::asio::ip::tcp::socket stream_; - beast::websocket::stream ws_; - beast::multi_buffer rb_; + boost::beast::websocket::stream ws_; + boost::beast::multi_buffer rb_; bool peerClosed_ = false; @@ -109,13 +109,17 @@ class WSClientImpl : public WSClient unsigned rpc_version_; - void cleanup() + void + cleanup() { ios_.post(strand_.wrap([this] { error_code ec; if (!peerClosed_) - ws_.close({}, ec); - stream_.close(ec); + { + ws_.async_close({}, strand_.wrap([&](error_code ec) { + stream_.cancel(ec); + })); + } })); work_ = boost::none; thread_.join(); @@ -173,7 +177,7 @@ public: else jp[jss::command] = cmd; auto const s = to_string(jp); - ws_.write_frame(true, buffer(s)); + ws_.write_some(true, buffer(s)); } auto jv = findMsg(5s, @@ -259,7 +263,7 @@ private: { if(ec) { - if(ec == beast::websocket::error::closed) + if(ec == boost::beast::websocket::error::closed) peerClosed_ = true; return; } diff --git a/src/test/nodestore/import_test.cpp b/src/test/nodestore/import_test.cpp index 442b65c167..5121d2bfd9 100644 --- a/src/test/nodestore/import_test.cpp +++ b/src/test/nodestore/import_test.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include @@ -257,7 +257,7 @@ public: } }; -std::map +std::map parse_args(std::string const& s) { // '=' @@ -273,7 +273,7 @@ parse_args(std::string const& s) , boost::regex_constants::optimize ); std::map map; + std::string, boost::beast::iless> map; auto const v = beast::rfc2616::split( s.begin(), s.end(), ','); for (auto const& kv : v) diff --git a/src/test/rpc/ValidatorRPC_test.cpp b/src/test/rpc/ValidatorRPC_test.cpp index be6761ec12..74ec0b15d7 100644 --- a/src/test/rpc/ValidatorRPC_test.cpp +++ b/src/test/rpc/ValidatorRPC_test.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include @@ -75,7 +75,7 @@ class ValidatorRPC_test : public beast::unit_test::suite Serializer s; st.add(s); - return beast::detail::base64_encode( + return boost::beast::detail::base64_encode( std::string(static_cast(s.data()), s.size())); } diff --git a/src/test/server/ServerStatus_test.cpp b/src/test/server/ServerStatus_test.cpp index f27c70a57e..656dbea28f 100644 --- a/src/test/server/ServerStatus_test.cpp +++ b/src/test/server/ServerStatus_test.cpp @@ -26,10 +26,10 @@ #include #include #include -#include +#include #include -#include -#include +#include +#include #include #include #include @@ -41,7 +41,7 @@ namespace test { class ServerStatus_test : public beast::unit_test::suite, public beast::test::enable_yield_to { - class myFields : public beast::http::fields {}; + class myFields : public boost::beast::http::fields {}; auto makeConfig( std::string const& proto, @@ -87,21 +87,21 @@ class ServerStatus_test : uint16_t port) { using namespace boost::asio; - using namespace beast::http; + using namespace boost::beast::http; request req; req.target("/"); - req.version = 11; + req.version(11); req.insert("Host", host + ":" + std::to_string(port)); req.insert("User-Agent", "test"); - req.method(beast::http::verb::get); + req.method(boost::beast::http::verb::get); req.insert("Upgrade", "websocket"); - beast::websocket::detail::maskgen maskgen; - beast::websocket::detail::sec_ws_key_type key; - beast::websocket::detail::make_sec_ws_key(key, maskgen); + boost::beast::websocket::detail::maskgen maskgen; + boost::beast::websocket::detail::sec_ws_key_type key; + boost::beast::websocket::detail::make_sec_ws_key(key, maskgen); req.insert("Sec-WebSocket-Key", key); req.insert("Sec-WebSocket-Version", "13"); - req.insert(beast::http::field::connection, "upgrade"); + req.insert(boost::beast::http::field::connection, "upgrade"); return req; } @@ -112,24 +112,24 @@ class ServerStatus_test : myFields const& fields) { using namespace boost::asio; - using namespace beast::http; + using namespace boost::beast::http; request req; req.target("/"); - req.version = 11; + req.version(11); for(auto const& f : fields) req.insert(f.name(), f.value()); req.insert("Host", host + ":" + std::to_string(port)); req.insert("User-Agent", "test"); if(body.empty()) { - req.method(beast::http::verb::get); + req.method(boost::beast::http::verb::get); } else { - req.method(beast::http::verb::post); + req.method(boost::beast::http::verb::post); req.insert("Content-Type", "application/json; charset=UTF-8"); - req.body = body; + req.body() = body; } req.prepare_payload(); @@ -139,18 +139,18 @@ class ServerStatus_test : void doRequest( boost::asio::yield_context& yield, - beast::http::request&& req, + boost::beast::http::request&& req, std::string const& host, uint16_t port, bool secure, - beast::http::response& resp, + boost::beast::http::response& resp, boost::system::error_code& ec) { using namespace boost::asio; - using namespace beast::http; + using namespace boost::beast::http; io_service& ios = get_io_service(); ip::tcp::resolver r{ios}; - beast::multi_buffer sb; + boost::beast::multi_buffer sb; auto it = r.async_resolve( @@ -169,7 +169,7 @@ class ServerStatus_test : ss.async_handshake(ssl::stream_base::client, yield[ec]); if(ec) return; - beast::http::async_write(ss, req, yield[ec]); + boost::beast::http::async_write(ss, req, yield[ec]); if(ec) return; async_read(ss, sb, resp, yield[ec]); @@ -182,7 +182,7 @@ class ServerStatus_test : async_connect(sock, it, yield[ec]); if(ec) return; - beast::http::async_write(sock, req, yield[ec]); + boost::beast::http::async_write(sock, req, yield[ec]); if(ec) return; async_read(sock, sb, resp, yield[ec]); @@ -198,7 +198,7 @@ class ServerStatus_test : test::jtx::Env& env, boost::asio::yield_context& yield, bool secure, - beast::http::response& resp, + boost::beast::http::response& resp, boost::system::error_code& ec) { auto const port = env.app().config()["port_ws"]. @@ -221,7 +221,7 @@ class ServerStatus_test : test::jtx::Env& env, boost::asio::yield_context& yield, bool secure, - beast::http::response& resp, + boost::beast::http::response& resp, boost::system::error_code& ec, std::string const& body = "", myFields const& fields = {}) @@ -383,21 +383,21 @@ class ServerStatus_test : //non-secure request { boost::system::error_code ec; - beast::http::response resp; + boost::beast::http::response resp; doWSRequest(env, yield, false, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == beast::http::status::unauthorized); + BEAST_EXPECT(resp.result() == boost::beast::http::status::unauthorized); } //secure request { boost::system::error_code ec; - beast::http::response resp; + boost::beast::http::response resp; doWSRequest(env, yield, true, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == beast::http::status::unauthorized); + BEAST_EXPECT(resp.result() == boost::beast::http::status::unauthorized); } } @@ -416,21 +416,21 @@ class ServerStatus_test : //non-secure request { boost::system::error_code ec; - beast::http::response resp; + boost::beast::http::response resp; doHTTPRequest(env, yield, false, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == beast::http::status::ok); + BEAST_EXPECT(resp.result() == boost::beast::http::status::ok); } //secure request { boost::system::error_code ec; - beast::http::response resp; + boost::beast::http::response resp; doHTTPRequest(env, yield, true, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == beast::http::status::ok); + BEAST_EXPECT(resp.result() == boost::beast::http::status::ok); } } @@ -440,7 +440,7 @@ class ServerStatus_test : testcase("Partial WS upgrade request"); using namespace jtx; using namespace boost::asio; - using namespace beast::http; + using namespace boost::beast::http; Env env {*this, envconfig([](std::unique_ptr cfg) { cfg->section("port_ws").set("protocol", "ws2"); @@ -462,7 +462,7 @@ class ServerStatus_test : io_service& ios = get_io_service(); ip::tcp::resolver r{ios}; - beast::multi_buffer sb; + boost::beast::multi_buffer sb; auto it = r.async_resolve( @@ -497,7 +497,7 @@ class ServerStatus_test : using namespace jtx; Env env {*this, makeConfig(server_protocol)}; - beast::http::response resp; + boost::beast::http::response resp; boost::system::error_code ec; if(boost::starts_with(client_protocol, "h")) { @@ -539,23 +539,23 @@ class ServerStatus_test : Json::Value jr; jr[jss::method] = "server_info"; - beast::http::response resp; + boost::beast::http::response resp; boost::system::error_code ec; doHTTPRequest(env, yield, secure, resp, ec, to_string(jr)); - BEAST_EXPECT(resp.result() == beast::http::status::forbidden); + BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden); myFields auth; auth.insert("Authorization", ""); doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth); - BEAST_EXPECT(resp.result() == beast::http::status::forbidden); + BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden); auth.set("Authorization", "Basic NOT-VALID"); doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth); - BEAST_EXPECT(resp.result() == beast::http::status::forbidden); + BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden); - auth.set("Authorization", "Basic " + beast::detail::base64_encode("me:badpass")); + auth.set("Authorization", "Basic " + boost::beast::detail::base64_encode("me:badpass")); doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth); - BEAST_EXPECT(resp.result() == beast::http::status::forbidden); + BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden); auto const user = env.app().config().section("port_rpc"). get("user").value(); @@ -565,14 +565,14 @@ class ServerStatus_test : // try with the correct user/pass, but not encoded auth.set("Authorization", "Basic " + user + ":" + pass); doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth); - BEAST_EXPECT(resp.result() == beast::http::status::forbidden); + BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden); // finally if we use the correct user/pass encoded, we should get a 200 auth.set("Authorization", "Basic " + - beast::detail::base64_encode(user + ":" + pass)); + boost::beast::detail::base64_encode(user + ":" + pass)); doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth); - BEAST_EXPECT(resp.result() == beast::http::status::ok); - BEAST_EXPECT(! resp.body.empty()); + BEAST_EXPECT(resp.result() == boost::beast::http::status::ok); + BEAST_EXPECT(! resp.body().empty()); } void @@ -582,7 +582,7 @@ class ServerStatus_test : using namespace test::jtx; using namespace boost::asio; - using namespace beast::http; + using namespace boost::beast::http; Env env {*this, envconfig([&](std::unique_ptr cfg) { (*cfg)["port_rpc"].set("limit", to_string(limit)); return cfg; @@ -606,7 +606,7 @@ class ServerStatus_test : ip::tcp::resolver::query{ip, to_string(port)}, yield[ec]); BEAST_EXPECT(! ec); - std::vector> clients; + std::vector> clients; int connectionCount {1}; //starts at 1 because the Env already has one //for JSONRPCCLient @@ -619,7 +619,7 @@ class ServerStatus_test : while (connectionCount < testTo) { clients.emplace_back( - std::make_pair(ip::tcp::socket {ios}, beast::multi_buffer{})); + std::make_pair(ip::tcp::socket {ios}, boost::beast::multi_buffer{})); async_connect(clients.back().first, it, yield[ec]); BEAST_EXPECT(! ec); auto req = makeHTTPRequest(ip, port, to_string(jr), {}); @@ -634,7 +634,7 @@ class ServerStatus_test : int readCount = 0; for (auto& c : clients) { - beast::http::response resp; + boost::beast::http::response resp; async_read(c.first, c.second, resp, yield[ec]); ++readCount; // expect the reads to fail for the clients that connected at or @@ -658,11 +658,11 @@ class ServerStatus_test : get("port").value(); auto const ip = env.app().config()["port_ws"]. get("ip").value(); - beast::http::response resp; + boost::beast::http::response resp; boost::system::error_code ec; doRequest( yield, makeWSUpgrade(ip, port), ip, port, true, resp, ec); - BEAST_EXPECT(resp.result() == beast::http::status::switching_protocols); + BEAST_EXPECT(resp.result() == boost::beast::http::status::switching_protocols); BEAST_EXPECT(resp.find("Upgrade") != resp.end() && resp["Upgrade"] == "websocket"); BEAST_EXPECT(resp.find("Connection") != resp.end() && @@ -681,14 +681,14 @@ class ServerStatus_test : get("port").value(); auto const ip = env.app().config()["port_ws"]. get("ip").value(); - beast::http::response resp; + boost::beast::http::response resp; boost::system::error_code ec; // body content is required here to avoid being // detected as a status request doRequest(yield, makeHTTPRequest(ip, port, "foo", {}), ip, port, false, resp, ec); - BEAST_EXPECT(resp.result() == beast::http::status::forbidden); - BEAST_EXPECT(resp.body == "Forbidden\r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden); + BEAST_EXPECT(resp.body() == "Forbidden\r\n"); } void @@ -698,7 +698,7 @@ class ServerStatus_test : using namespace test::jtx; using namespace boost::asio; - using namespace beast::http; + using namespace boost::beast::http; Env env {*this}; auto const port = env.app().config()["port_ws"]. @@ -721,17 +721,17 @@ class ServerStatus_test : if(! BEAST_EXPECT(! ec)) return; - beast::websocket::stream ws{sock}; + boost::beast::websocket::stream ws{sock}; ws.handshake(ip + ":" + to_string(port), "/"); // helper lambda, used below auto sendAndParse = [&](std::string const& req) -> Json::Value { - ws.async_write_frame(true, buffer(req), yield[ec]); + ws.async_write_some(true, buffer(req), yield[ec]); if(! BEAST_EXPECT(! ec)) return Json::objectValue; - beast::multi_buffer sb; + boost::beast::multi_buffer sb; ws.async_read(sb, yield[ec]); if(! BEAST_EXPECT(! ec)) return Json::objectValue; @@ -740,7 +740,7 @@ class ServerStatus_test : Json::Reader jr; if(! BEAST_EXPECT(jr.parse( boost::lexical_cast( - beast::buffers(sb.data())), resp))) + boost::beast::buffers(sb.data())), resp))) return Json::objectValue; sb.consume(sb.size()); return resp; @@ -782,7 +782,7 @@ class ServerStatus_test : testcase("Status request over WS and RPC with/without Amendment Block"); using namespace jtx; using namespace boost::asio; - using namespace beast::http; + using namespace boost::beast::http; Env env {*this, validator( envconfig([](std::unique_ptr cfg) { cfg->section("port_rpc").set("protocol", "http"); @@ -823,9 +823,9 @@ class ServerStatus_test : if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == beast::http::status::ok); + BEAST_EXPECT(resp.result() == boost::beast::http::status::ok); BEAST_EXPECT( - resp.body.find("connectivity is working.") != std::string::npos); + resp.body().find("connectivity is working.") != std::string::npos); // mark the Network as Amendment Blocked, but still won't fail until // ELB is enabled (next step) @@ -855,9 +855,9 @@ class ServerStatus_test : if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == beast::http::status::ok); + BEAST_EXPECT(resp.result() == boost::beast::http::status::ok); BEAST_EXPECT( - resp.body.find("connectivity is working.") != std::string::npos); + resp.body().find("connectivity is working.") != std::string::npos); env.app().config().ELB_SUPPORT = true; @@ -872,11 +872,11 @@ class ServerStatus_test : if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == beast::http::status::internal_server_error); + BEAST_EXPECT(resp.result() == boost::beast::http::status::internal_server_error); BEAST_EXPECT( - resp.body.find("cannot accept clients:") != std::string::npos); + resp.body().find("cannot accept clients:") != std::string::npos); BEAST_EXPECT( - resp.body.find("Server version too old") != std::string::npos); + resp.body().find("Server version too old") != std::string::npos); } void @@ -889,103 +889,103 @@ class ServerStatus_test : boost::system::error_code ec; { - beast::http::response resp; + boost::beast::http::response resp; doHTTPRequest(env, yield, false, resp, ec, "{}"); - BEAST_EXPECT(resp.result() == beast::http::status::bad_request); - BEAST_EXPECT(resp.body == "Unable to parse request: \r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); + BEAST_EXPECT(resp.body() == "Unable to parse request: \r\n"); } { - beast::http::response resp; + boost::beast::http::response resp; Json::Value jv; jv["invalid"] = 1; doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == beast::http::status::bad_request); - BEAST_EXPECT(resp.body == "Null method\r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); + BEAST_EXPECT(resp.body() == "Null method\r\n"); } { - beast::http::response resp; + boost::beast::http::response resp; Json::Value jv(Json::arrayValue); jv.append("invalid"); doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == beast::http::status::bad_request); - BEAST_EXPECT(resp.body == "Unable to parse request: \r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); + BEAST_EXPECT(resp.body() == "Unable to parse request: \r\n"); } { - beast::http::response resp; + boost::beast::http::response resp; Json::Value jv(Json::arrayValue); Json::Value j; j["invalid"] = 1; jv.append(j); doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == beast::http::status::bad_request); - BEAST_EXPECT(resp.body == "Unable to parse request: \r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); + BEAST_EXPECT(resp.body() == "Unable to parse request: \r\n"); } { - beast::http::response resp; + boost::beast::http::response resp; Json::Value jv; jv[jss::method] = "batch"; jv[jss::params] = 2; doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == beast::http::status::bad_request); - BEAST_EXPECT(resp.body == "Malformed batch request\r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); + BEAST_EXPECT(resp.body() == "Malformed batch request\r\n"); } { - beast::http::response resp; + boost::beast::http::response resp; Json::Value jv; jv[jss::method] = "batch"; jv[jss::params] = Json::objectValue; jv[jss::params]["invalid"] = 3; doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == beast::http::status::bad_request); - BEAST_EXPECT(resp.body == "Malformed batch request\r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); + BEAST_EXPECT(resp.body() == "Malformed batch request\r\n"); } Json::Value jv; { - beast::http::response resp; + boost::beast::http::response resp; jv[jss::method] = Json::nullValue; doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == beast::http::status::bad_request); - BEAST_EXPECT(resp.body == "Null method\r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); + BEAST_EXPECT(resp.body() == "Null method\r\n"); } { - beast::http::response resp; + boost::beast::http::response resp; jv[jss::method] = 1; doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == beast::http::status::bad_request); - BEAST_EXPECT(resp.body == "method is not string\r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); + BEAST_EXPECT(resp.body() == "method is not string\r\n"); } { - beast::http::response resp; + boost::beast::http::response resp; jv[jss::method] = ""; doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == beast::http::status::bad_request); - BEAST_EXPECT(resp.body == "method is empty\r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); + BEAST_EXPECT(resp.body() == "method is empty\r\n"); } { - beast::http::response resp; + boost::beast::http::response resp; jv[jss::method] = "some_method"; jv[jss::params] = "params"; doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == beast::http::status::bad_request); - BEAST_EXPECT(resp.body == "params unparseable\r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); + BEAST_EXPECT(resp.body() == "params unparseable\r\n"); } { - beast::http::response resp; + boost::beast::http::response resp; jv[jss::params] = Json::arrayValue; jv[jss::params][0u] = "not an object"; doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == beast::http::status::bad_request); - BEAST_EXPECT(resp.body == "params unparseable\r\n"); + BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); + BEAST_EXPECT(resp.body() == "params unparseable\r\n"); } } @@ -1003,12 +1003,12 @@ class ServerStatus_test : //raise the fee so that the server is considered overloaded env.app().getFeeTrack().raiseLocalFee(); - beast::http::response resp; + boost::beast::http::response resp; boost::system::error_code ec; doHTTPRequest(env, yield, false, resp, ec); - BEAST_EXPECT(resp.result() == beast::http::status::internal_server_error); + BEAST_EXPECT(resp.result() == boost::beast::http::status::internal_server_error); std::regex body {"Server cannot accept clients"}; - BEAST_EXPECT(std::regex_search(resp.body, body)); + BEAST_EXPECT(std::regex_search(resp.body(), body)); } public: diff --git a/src/test/unit_test/multi_runner.h b/src/test/unit_test/multi_runner.h index 79143eaf47..068b8d4056 100644 --- a/src/test/unit_test/multi_runner.h +++ b/src/test/unit_test/multi_runner.h @@ -20,7 +20,7 @@ #ifndef TEST_UNIT_TEST_MULTI_RUNNER_H #define TEST_UNIT_TEST_MULTI_RUNNER_H -#include +#include #include #include @@ -78,7 +78,7 @@ struct suite_results struct results { - using static_string = beast::static_string<256>; + using static_string = boost::beast::static_string<256>; // results may be stored in shared memory. Use `static_string` to ensure // pointers from different memory spaces do not co-mingle using run_time = std::pair;