diff --git a/.travis.yml b/.travis.yml index f55cd2351..22ba9fecb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,8 +11,8 @@ env: # to boost's .tar.gz. - LCOV_ROOT=$HOME/lcov - GDB_ROOT=$HOME/gdb - - BOOST_ROOT=$HOME/boost_1_66_0 - - BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.66.0/boost_1_66_0.tar.gz' + - BOOST_ROOT=$HOME/boost_1_60_0 + - BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.60.0/boost_1_60_0.tar.gz' # Travis is timing out on Trusty. So, for now, use Precise. July 2017 dist: precise diff --git a/Builds/Ubuntu/install_boost.sh b/Builds/Ubuntu/install_boost.sh index c9a0e1ab6..f1911b118 100755 --- a/Builds/Ubuntu/install_boost.sh +++ b/Builds/Ubuntu/install_boost.sh @@ -4,7 +4,7 @@ # This script builds boost with the correct ABI flags for ubuntu # -version=66 +version=63 patch=0 if hash lsb_release 2>/dev/null; then diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj index b3c119e50..559b7d59f 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj +++ b/Builds/VisualStudio2015/RippleD.vcxproj @@ -87,7 +87,7 @@ HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;BOOST_COROUTINES_NO_DEPRECATION_WARNING;BOOST_COROUTINE_NO_DEPRECATION_WARNING;BOOST_NO_AUTO_PTR;DEBUG;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;_DEBUG;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) - ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\beast\extras;..\..\src\nudb\include;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) + ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\beast\extras;..\..\src\beast\include;..\..\src\nudb\include;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) 4800;4244;4267;4503;4018 Async MultiThreadedDebug @@ -124,7 +124,7 @@ HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;BOOST_COROUTINES_NO_DEPRECATION_WARNING;BOOST_COROUTINE_NO_DEPRECATION_WARNING;BOOST_NO_AUTO_PTR;DEBUG;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRTDBG_MAP_ALLOC;_CRT_SECURE_NO_WARNINGS;_DEBUG;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) - ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\beast\extras;..\..\src\nudb\include;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) + ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\beast\extras;..\..\src\beast\include;..\..\src\nudb\include;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) 4800;4244;4267;4503;4018 Async MultiThreadedDebug @@ -161,7 +161,7 @@ HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;BOOST_COROUTINES_NO_DEPRECATION_WARNING;BOOST_COROUTINE_NO_DEPRECATION_WARNING;BOOST_NO_AUTO_PTR;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NDEBUG;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) - ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\beast\extras;..\..\src\nudb\include;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) + ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\beast\extras;..\..\src\beast\include;..\..\src\nudb\include;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) 4800;4244;4267;4503;4018 Async Precise @@ -196,7 +196,7 @@ HAVE_USLEEP=1;SOCI_CXX_C11=1;_WIN32_WINNT=0x6000;BOOST_COROUTINES_NO_DEPRECATION_WARNING;BOOST_COROUTINE_NO_DEPRECATION_WARNING;BOOST_NO_AUTO_PTR;DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;NDEBUG;NOMINMAX;OPENSSL_NO_SSL2;WIN32_CONSOLE;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) - ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\beast\extras;..\..\src\nudb\include;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) + ..\..\build\proto;..\..\src;..\..\src\beast;..\..\src\beast\extras;..\..\src\beast\include;..\..\src\nudb\include;..\..\src\protobuf\src;..\..\src\protobuf\vsprojects;..\..\src\soci\include;..\..\src\soci\src;%(AdditionalIncludeDirectories) 4800;4244;4267;4503;4018 Async Precise @@ -264,6 +264,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters index 7681fc79b..3e084c1ee 100644 --- a/Builds/VisualStudio2015/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters @@ -7,6 +7,24 @@ {6DD9EDCB-63DB-D377-3F12-12825FA8437E} + + {3CBEFECB-9A7C-B235-BA05-30D41AB8827D} + + + {79EFD023-52CA-3A59-E21D-E73328FA46EA} + + + {2A1F4F78-5521-936E-8CE2-BA798D578A14} + + + {7138D215-DA65-98D5-EF7D-C9896685201E} + + + {3E84AA4C-CB48-99F0-EB35-5603FF633A51} + + + {932F732F-F09E-5C50-C8A1-D62342CCAA1F} + {0ED4CDBE-296D-2599-04B3-095BFD1668A4} @@ -16,6 +34,24 @@ {AC49CD8A-C2A7-FBEC-CA36-635A5303E73E} + + {D05C2DB7-CE99-9326-23E6-4C7828632E0E} + + + {FB0BEDED-4C83-F0AF-0450-3DB01A05BD0B} + + + {A7FC9CC0-AB8D-4252-CCB2-B67F7BE99CF5} + + + {9455431B-BD48-F8C8-B53B-D9BCAF355341} + + + {508136FB-F124-7376-5A6F-F28EDEB18389} + + + {F85F4A52-7A2A-700C-4804-97FFC11E99FD} + {9DEED977-2072-A182-5BD9-CEBF206E8C91} @@ -549,6 +585,384 @@ beast\unit_test + + beast + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core\detail + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core\impl + + + beast\core\impl + + + beast\core\impl + + + beast\core\impl + + + beast\core\impl + + + beast\core\impl + + + beast\core\impl + + + beast\core\impl + + + beast\core\impl + + + beast\core\impl + + + beast\core\impl + + + beast\core\impl + + + beast\core\impl + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast\core + + + beast + + + beast\http + + + beast\http + + + beast\http\detail + + + beast\http\detail + + + beast\http\detail + + + beast\http\detail + + + beast\http\detail + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast\http\impl + + + beast\http\impl + + + beast\http\impl + + + beast\http\impl + + + beast\http\impl + + + beast\http\impl + + + beast\http\impl + + + beast\http\impl + + + beast\http\impl + + + beast\http\impl + + + beast\http\impl + + + beast\http\impl + + + beast\http\impl + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast\http + + + beast + + + beast + + + beast\websocket\detail + + + beast\websocket\detail + + + beast\websocket\detail + + + beast\websocket\detail + + + beast\websocket\detail + + + beast\websocket\detail + + + beast\websocket\detail + + + beast\websocket + + + beast\websocket\impl + + + beast\websocket\impl + + + beast\websocket\impl + + + beast\websocket\impl + + + beast\websocket\impl + + + beast\websocket\impl + + + beast\websocket\impl + + + beast\websocket\impl + + + beast\websocket\impl + + + beast\websocket\impl + + + beast\websocket\impl + + + beast\websocket + + + beast\websocket + + + beast\websocket + + + beast\websocket + + + beast\websocket + + + beast\zlib + + + beast\zlib\detail + + + beast\zlib\detail + + + beast\zlib\detail + + + beast\zlib\detail + + + beast\zlib\detail + + + beast\zlib + + + beast\zlib\impl + + + beast\zlib + + + beast\zlib + ed25519-donna diff --git a/CMakeLists.txt b/CMakeLists.txt index b4c9e5c54..6f4c0ec72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,6 +130,7 @@ 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 74dfa1cb1..b2be9324b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -127,7 +127,6 @@ try { withEnv(["CCACHE_BASEDIR=${cdir}", "CCACHE_NOHASHDIR=true", 'LCOV_ROOT=""', - 'BOOST_ROOT=/opt/local/boost_1_66_0', "TARGET=${target}", "CC=${compiler}", 'BUILD=cmake', diff --git a/SConstruct b/SConstruct index 1d527e0b3..7d485dfd9 100644 --- a/SConstruct +++ b/SConstruct @@ -807,6 +807,7 @@ config_base(base) base.Append(CPPPATH=[ 'src', os.path.join('src', 'beast'), + os.path.join('src', 'beast', 'include'), os.path.join('src', 'beast', 'extras'), os.path.join('src', 'nudb', 'include'), os.path.join(build_dir, 'proto'), diff --git a/appveyor.yml b/appveyor.yml index 5a1aeb9f6..84b50c45b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,7 +6,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.02 + RIPPLED_DEPS_PATH: rippled_deps17.01 RIPPLED_DEPS_URL: https://ripple.github.io/Downloads/appveyor/%RIPPLED_DEPS_PATH%.zip # Other dependencies we just download each time. diff --git a/src/ripple/app/main/Application.cpp b/src/ripple/app/main/Application.cpp index 1bf3408f9..ded64b7d7 100644 --- a/src/ripple/app/main/Application.cpp +++ b/src/ripple/app/main/Application.cpp @@ -1687,7 +1687,7 @@ bool ApplicationImp::loadOldLedger ( } } } - else if (ledgerID.empty () || boost::beast::detail::iequals(ledgerID, "latest")) + else if (ledgerID.empty () || beast::detail::iequals(ledgerID, "latest")) { loadLedger = getLastFullLedger (); } diff --git a/src/ripple/app/main/Application.h b/src/ripple/app/main/Application.h index 6dcac7a3d..6074b7a13 100644 --- a/src/ripple/app/main/Application.h +++ b/src/ripple/app/main/Application.h @@ -26,10 +26,11 @@ #include #include #include -#include #include #include +namespace boost { namespace asio { class io_service; } } + namespace ripple { namespace unl { class Manager; } diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp index 583573880..5ed2a8630 100644 --- a/src/ripple/app/misc/NetworkOPs.cpp +++ b/src/ripple/app/misc/NetworkOPs.cpp @@ -56,7 +56,7 @@ #include #include #include -#include +#include #include namespace ripple { diff --git a/src/ripple/app/misc/NetworkOPs.h b/src/ripple/app/misc/NetworkOPs.h index e08ccbe76..dd8662993 100644 --- a/src/ripple/app/misc/NetworkOPs.h +++ b/src/ripple/app/misc/NetworkOPs.h @@ -27,7 +27,6 @@ #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 f4f4b556b..b3be25c18 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 = - boost::beast::http::response; + beast::http::response; class Work { diff --git a/src/ripple/app/misc/detail/WorkBase.h b/src/ripple/app/misc/detail/WorkBase.h index 4ab2f49bf..1c59ab664 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 = - boost::beast::http::request; + beast::http::request; std::string host_; std::string path_; @@ -60,7 +60,7 @@ protected: socket_type socket_; request_type req_; response_type res_; - boost::beast::multi_buffer read_buf_; + beast::multi_buffer read_buf_; public: WorkBase( @@ -177,14 +177,14 @@ template void WorkBase::onStart() { - req_.method(boost::beast::http::verb::get); + req_.method(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(); - boost::beast::http::async_write(impl().stream(), req_, + 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); - boost::beast::http::async_read (impl().stream(), read_buf_, res_, + 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 532df5b04..4ef6109ee 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 @@ -184,7 +184,7 @@ ValidatorToken::make_ValidatorToken(std::vector const& tokenBlob) for (auto const& line : tokenBlob) tokenStr += beast::rfc2616::trim(line); - tokenStr = boost::beast::detail::base64_decode(tokenStr); + tokenStr = beast::detail::base64_decode(tokenStr); Json::Reader r; Json::Value token; @@ -386,7 +386,7 @@ ManifestCache::load ( if (! configManifest.empty()) { auto mo = Manifest::make_Manifest ( - boost::beast::detail::base64_decode(configManifest)); + beast::detail::base64_decode(configManifest)); if (! mo) { JLOG (j_.error()) << "Malformed validator_token in config"; @@ -421,7 +421,7 @@ ManifestCache::load ( revocationStr += beast::rfc2616::trim(line); auto mo = Manifest::make_Manifest ( - boost::beast::detail::base64_decode(revocationStr)); + 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 cc5d636e4..599d83c56 100644 --- a/src/ripple/app/misc/impl/ValidatorKeys.cpp +++ b/src/ripple/app/misc/impl/ValidatorKeys.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include namespace ripple { ValidatorKeys::ValidatorKeys(Config const& config, beast::Journal j) @@ -46,7 +46,7 @@ ValidatorKeys::ValidatorKeys(Config const& config, beast::Journal j) auto const pk = derivePublicKey( KeyType::secp256k1, token->validationSecret); auto const m = Manifest::make_Manifest( - boost::beast::detail::base64_decode(token->manifest)); + beast::detail::base64_decode(token->manifest)); if (! m || pk != m->signingKey) { diff --git a/src/ripple/app/misc/impl/ValidatorList.cpp b/src/ripple/app/misc/impl/ValidatorList.cpp index 066dcf148..12bbab8eb 100644 --- a/src/ripple/app/misc/impl/ValidatorList.cpp +++ b/src/ripple/app/misc/impl/ValidatorList.cpp @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include namespace ripple { @@ -291,7 +291,7 @@ ValidatorList::applyList ( for (auto const& valManifest : manifests) { auto m = Manifest::make_Manifest ( - boost::beast::detail::base64_decode(valManifest)); + beast::detail::base64_decode(valManifest)); if (! m || ! keyListings_.count (m->masterKey)) { @@ -321,7 +321,7 @@ ValidatorList::verify ( std::string const& blob, std::string const& signature) { - auto m = Manifest::make_Manifest (boost::beast::detail::base64_decode(manifest)); + auto m = Manifest::make_Manifest (beast::detail::base64_decode(manifest)); if (! m || ! publisherLists_.count (m->masterKey)) return ListDisposition::untrusted; @@ -342,7 +342,7 @@ ValidatorList::verify ( return ListDisposition::untrusted; auto const sig = strUnHex(signature); - auto const data = boost::beast::detail::base64_decode (blob); + auto const data = 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 01a6695bc..58052ef84 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() != boost::beast::http::status::ok) + if (! ec && res.result() != beast::http::status::ok) { std::lock_guard lock{sites_mutex_}; JLOG (j_.warn()) << @@ -222,7 +222,7 @@ ValidatorSite::onSiteFetch( std::lock_guard lock{sites_mutex_}; Json::Reader r; Json::Value body; - if (r.parse(res.body().data(), body) && + if (r.parse(res.body.data(), body) && body.isObject () && body.isMember("blob") && body["blob"].isString () && body.isMember("manifest") && body["manifest"].isString () && diff --git a/src/ripple/basics/BasicConfig.h b/src/ripple/basics/BasicConfig.h index 008611d24..75c987b99 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 9a3ccc965..68e687eb0 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 , - boost::beast::iless> sinks_; + 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 dfb379e6c..b4388fd58 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 = - boost::beast::detail::is_invocable; + 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 730c86137..08149e61e 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 @@ -163,7 +163,7 @@ private: // VFALCO TODO This should only be enabled for maps. class pair_value_compare - : public boost::beast::detail::empty_base_optimization + : private empty_base_optimization , public std::binary_function { public: @@ -177,7 +177,7 @@ private: } pair_value_compare (pair_value_compare const& other) - : boost::beast::detail::empty_base_optimization (other) + : empty_base_optimization (other) { } @@ -185,7 +185,7 @@ private: friend aged_ordered_container; pair_value_compare (Compare const& compare) - : boost::beast::detail::empty_base_optimization (compare) + : empty_base_optimization (compare) { } }; @@ -193,14 +193,14 @@ private: // Compares value_type against element, used in insert_check // VFALCO TODO hoist to remove template argument dependencies class KeyValueCompare - : public boost::beast::detail::empty_base_optimization + : private empty_base_optimization , public std::binary_function { public: KeyValueCompare () = default; KeyValueCompare (Compare const& compare) - : boost::beast::detail::empty_base_optimization (compare) + : empty_base_optimization (compare) { } @@ -237,12 +237,12 @@ private: Compare& compare() { - return boost::beast::detail::empty_base_optimization ::member(); + return empty_base_optimization ::member(); } Compare const& compare() const { - return boost::beast::detail::empty_base_optimization ::member(); + return empty_base_optimization ::member(); } }; @@ -268,7 +268,7 @@ private: class config_t : private KeyValueCompare - , public boost::beast::detail::empty_base_optimization + , private empty_base_optimization { public: explicit config_t ( @@ -288,7 +288,7 @@ private: config_t ( clock_type& clock_, Allocator const& alloc_) - : boost::beast::detail::empty_base_optimization (alloc_) + : empty_base_optimization (alloc_) , clock (clock_) { } @@ -298,14 +298,14 @@ private: Compare const& comp, Allocator const& alloc_) : KeyValueCompare (comp) - , boost::beast::detail::empty_base_optimization (alloc_) + , empty_base_optimization (alloc_) , clock (clock_) { } config_t (config_t const& other) : KeyValueCompare (other.key_compare()) - , boost::beast::detail::empty_base_optimization ( + , empty_base_optimization ( ElementAllocatorTraits:: select_on_container_copy_construction ( other.alloc())) @@ -315,14 +315,14 @@ private: config_t (config_t const& other, Allocator const& alloc) : KeyValueCompare (other.key_compare()) - , boost::beast::detail::empty_base_optimization (alloc) + , empty_base_optimization (alloc) , clock (other.clock) { } config_t (config_t&& other) : KeyValueCompare (std::move (other.key_compare())) - , boost::beast::detail::empty_base_optimization ( + , empty_base_optimization ( std::move (other)) , clock (other.clock) { @@ -330,7 +330,7 @@ private: config_t (config_t&& other, Allocator const& alloc) : KeyValueCompare (std::move (other.key_compare())) - , boost::beast::detail::empty_base_optimization (alloc) + , empty_base_optimization (alloc) , clock (other.clock) { } @@ -376,13 +376,13 @@ private: ElementAllocator& alloc() { - return boost::beast::detail::empty_base_optimization < + return empty_base_optimization < ElementAllocator>::member(); } ElementAllocator const& alloc() const { - return boost::beast::detail::empty_base_optimization < + return 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 33547ce4b..91d404617 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 @@ -161,7 +161,7 @@ private: // VFALCO TODO hoist to remove template argument dependencies class ValueHash - : private boost::beast::detail::empty_base_optimization + : private empty_base_optimization , public std::unary_function { public: @@ -170,7 +170,7 @@ private: } ValueHash (Hash const& hash) - : boost::beast::detail::empty_base_optimization (hash) + : empty_base_optimization (hash) { } @@ -193,7 +193,7 @@ private: // Compares value_type against element, used in find/insert_check // VFALCO TODO hoist to remove template argument dependencies class KeyValueEqual - : private boost::beast::detail::empty_base_optimization + : private empty_base_optimization , public std::binary_function { public: @@ -202,7 +202,7 @@ private: } KeyValueEqual (KeyEqual const& keyEqual) - : boost::beast::detail::empty_base_optimization (keyEqual) + : empty_base_optimization (keyEqual) { } @@ -283,7 +283,7 @@ private: class config_t : private ValueHash , private KeyValueEqual - , private boost::beast::detail::empty_base_optimization + , private empty_base_optimization { public: explicit config_t ( @@ -311,7 +311,7 @@ private: config_t ( clock_type& clock_, Allocator const& alloc_) - : boost::beast::detail::empty_base_optimization (alloc_) + : empty_base_optimization (alloc_) , clock (clock_) { } @@ -331,7 +331,7 @@ private: Hash const& hash, Allocator const& alloc_) : ValueHash (hash) - , boost::beast::detail::empty_base_optimization (alloc_) + , empty_base_optimization (alloc_) , clock (clock_) { } @@ -341,7 +341,7 @@ private: KeyEqual const& keyEqual, Allocator const& alloc_) : KeyValueEqual (keyEqual) - , boost::beast::detail::empty_base_optimization (alloc_) + , empty_base_optimization (alloc_) , clock (clock_) { } @@ -353,7 +353,7 @@ private: Allocator const& alloc_) : ValueHash (hash) , KeyValueEqual (keyEqual) - , boost::beast::detail::empty_base_optimization (alloc_) + , empty_base_optimization (alloc_) , clock (clock_) { } @@ -361,7 +361,7 @@ private: config_t (config_t const& other) : ValueHash (other.hash_function()) , KeyValueEqual (other.key_eq()) - , boost::beast::detail::empty_base_optimization ( + , empty_base_optimization ( ElementAllocatorTraits:: select_on_container_copy_construction ( other.alloc())) @@ -372,7 +372,7 @@ private: config_t (config_t const& other, Allocator const& alloc) : ValueHash (other.hash_function()) , KeyValueEqual (other.key_eq()) - , boost::beast::detail::empty_base_optimization (alloc) + , empty_base_optimization (alloc) , clock (other.clock) { } @@ -380,7 +380,7 @@ private: config_t (config_t&& other) : ValueHash (std::move (other.hash_function())) , KeyValueEqual (std::move (other.key_eq())) - , boost::beast::detail::empty_base_optimization ( + , empty_base_optimization ( std::move (other.alloc())) , clock (other.clock) { @@ -389,7 +389,7 @@ private: config_t (config_t&& other, Allocator const& alloc) : ValueHash (std::move (other.hash_function())) , KeyValueEqual (std::move (other.key_eq())) - , boost::beast::detail::empty_base_optimization (alloc) + , empty_base_optimization (alloc) , clock (other.clock) { } @@ -454,13 +454,13 @@ private: ElementAllocator& alloc() { - return boost::beast::detail::empty_base_optimization < + return empty_base_optimization < ElementAllocator>::member(); } ElementAllocator const& alloc() const { - return boost::beast::detail::empty_base_optimization < + return empty_base_optimization < ElementAllocator>::member(); } diff --git a/src/ripple/beast/net/IPAddress.h b/src/ripple/beast/net/IPAddress.h index 34f5dfe87..a2de956f4 100644 --- a/src/ripple/beast/net/IPAddress.h +++ b/src/ripple/beast/net/IPAddress.h @@ -345,12 +345,12 @@ struct hash namespace boost { template <> -struct hash <::beast::IP::Address> +struct hash { 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 5d4918e58..5557a9028 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,20 +155,20 @@ std::istream& operator>> (std::istream& is, Endpoint& endpoint); namespace std { /** std::hash support. */ template <> -struct hash <::beast::IP::Endpoint> +struct hash { - 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 <::beast::IP::Endpoint> +struct hash { - 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 e59da3746..b2c22d403 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 @@ -279,7 +279,7 @@ split_commas(FwdIt first, FwdIt last) template > Result -split_commas(boost::beast::string_view const& s) +split_commas(beast::string_view const& s) { return split_commas(s.begin(), s.end()); } @@ -468,13 +468,13 @@ token_in_list(boost::string_ref const& value, template bool -is_keep_alive(boost::beast::http::message const& m) +is_keep_alive(beast::http::message const& m) { - 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"); + 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"); } } // rfc2616 diff --git a/src/ripple/beast/utility/weak_fn.h b/src/ripple/beast/utility/weak_fn.h index 619eb8a17..d52bf92f1 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: @@ -87,7 +87,7 @@ namespace detail { template class weak_binder - : private boost::beast::detail::empty_base_optimization + : private beast::detail::empty_base_optimization { private: using member_type = R (T::*)(Args...); @@ -101,7 +101,7 @@ public: weak_binder (member_type member, Policy policy, pointer_type object) - : boost::beast::detail::empty_base_optimization(std::move(policy)) + : 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 66b581bdf..f70005542 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 473420a1d..6c1dff527 100644 --- a/src/ripple/core/impl/Config.cpp +++ b/src/ripple/core/impl/Config.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -325,15 +325,15 @@ void Config::loadFromString (std::string const& fileContents) if (getSingleSection (secConfig, SECTION_NODE_SIZE, strTemp, j_)) { - if (boost::beast::detail::iequals(strTemp, "tiny")) + if (beast::detail::iequals(strTemp, "tiny")) NODE_SIZE = 0; - else if (boost::beast::detail::iequals(strTemp, "small")) + else if (beast::detail::iequals(strTemp, "small")) NODE_SIZE = 1; - else if (boost::beast::detail::iequals(strTemp, "medium")) + else if (beast::detail::iequals(strTemp, "medium")) NODE_SIZE = 2; - else if (boost::beast::detail::iequals(strTemp, "large")) + else if (beast::detail::iequals(strTemp, "large")) NODE_SIZE = 3; - else if (boost::beast::detail::iequals(strTemp, "huge")) + else if (beast::detail::iequals(strTemp, "huge")) NODE_SIZE = 4; else { @@ -380,9 +380,9 @@ void Config::loadFromString (std::string const& fileContents) if (getSingleSection (secConfig, SECTION_LEDGER_HISTORY, strTemp, j_)) { - if (boost::beast::detail::iequals(strTemp, "full")) + if (beast::detail::iequals(strTemp, "full")) LEDGER_HISTORY = 1000000000u; - else if (boost::beast::detail::iequals(strTemp, "none")) + else if (beast::detail::iequals(strTemp, "none")) LEDGER_HISTORY = 0; else LEDGER_HISTORY = beast::lexicalCastThrow (strTemp); @@ -390,9 +390,9 @@ void Config::loadFromString (std::string const& fileContents) if (getSingleSection (secConfig, SECTION_FETCH_DEPTH, strTemp, j_)) { - if (boost::beast::detail::iequals(strTemp, "none")) + if (beast::detail::iequals(strTemp, "none")) FETCH_DEPTH = 0; - else if (boost::beast::detail::iequals(strTemp, "full")) + else if (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 cc685d03b..512235744 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 [&](boost::beast::string_view const& b) { s.append (b.data(), b.size()); }; + return [&](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 0f76e043d..d6064ed29 100644 --- a/src/ripple/json/impl/Writer.cpp +++ b/src/ripple/json/impl/Writer.cpp @@ -93,13 +93,13 @@ public: stack_.top().type = ct; } - void output (boost::beast::string_view const& bytes) + void output (beast::string_view const& bytes) { markStarted (); output_ (bytes); } - void stringOutput (boost::beast::string_view const& bytes) + void stringOutput (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 f2d27e384..1dbe4b1d6 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 ( - boost::beast::bind_handler (cbFunc, error_code())); + beast::bind_handler (cbFunc, error_code())); } else { @@ -210,7 +210,7 @@ public: ec = e.code(); } mSocket->get_io_service ().post ( - boost::beast::bind_handler (handler, ec)); + beast::bind_handler (handler, ec)); } } diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index 041921dc3..360cbc2e6 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -452,9 +452,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 (boost::beast::detail::iequals(action, "reject")) + if (beast::detail::iequals(action, "reject")) jvRequest[jss::vetoed] = Json::Value (true); - else if (boost::beast::detail::iequals(action, "accept")) + else if (beast::detail::iequals(action, "accept")) jvRequest[jss::vetoed] = Json::Value (false); else return rpcError (rpcINVALID_PARAMS); @@ -1492,7 +1492,7 @@ void fromNetwork ( } // HTTP basic authentication - auto const auth = boost::beast::detail::base64_encode(strUsername + ":" + strPassword); + auto const auth = 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 14fb27319..36d576fb6 100644 --- a/src/ripple/nodestore/backend/MemoryFactory.cpp +++ b/src/ripple/nodestore/backend/MemoryFactory.cpp @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -40,7 +40,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 b8d8a2ccf..a139f2136 100644 --- a/src/ripple/nodestore/impl/ManagerImp.cpp +++ b/src/ripple/nodestore/impl/ManagerImp.cpp @@ -111,7 +111,7 @@ ManagerImp::find (std::string const& name) auto const iter = std::find_if(list_.begin(), list_.end(), [&name](Factory* other) { - return boost::beast::detail::iequals(name, other->getName()); + return 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 02044530a..75cfdf971 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 b4206fcc6..bdb05e15c 100644 --- a/src/ripple/overlay/impl/ConnectAttempt.cpp +++ b/src/ripple/overlay/impl/ConnectAttempt.cpp @@ -220,7 +220,7 @@ ConnectAttempt::onHandshake (error_code ec) appendHello (req_, hello); setTimer(); - boost::beast::http::async_write(stream_, req_, + beast::http::async_write(stream_, req_, strand_.wrap (std::bind (&ConnectAttempt::onWrite, shared_from_this(), std::placeholders::_1))); } @@ -235,7 +235,7 @@ ConnectAttempt::onWrite (error_code ec) return; if(ec) return fail("onWrite", ec); - boost::beast::http::async_read(stream_, read_buf_, response_, + beast::http::async_read(stream_, read_buf_, response_, strand_.wrap(std::bind(&ConnectAttempt::onRead, shared_from_this(), std::placeholders::_1))); } @@ -286,9 +286,9 @@ ConnectAttempt::makeRequest (bool crawl, request_type { request_type m; - m.method(boost::beast::http::verb::get); + m.method(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())); @@ -301,13 +301,13 @@ ConnectAttempt::makeRequest (bool crawl, void ConnectAttempt::processResponse() { - if (response_.result() == boost::beast::http::status::service_unavailable) + if (response_.result() == 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 80b5c941b..d22463e0f 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 = - boost::beast::http::request; + beast::http::request; using response_type = - boost::beast::http::response; + 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_; - boost::beast::multi_buffer read_buf_; + 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 75a39fc61..ca549eada 100644 --- a/src/ripple/overlay/impl/OverlayImpl.cpp +++ b/src/ripple/overlay/impl/OverlayImpl.cpp @@ -214,7 +214,7 @@ OverlayImpl::onHandoff (std::unique_ptr && ssl_bundle, if (std::find_if(types.begin(), types.end(), [](std::string const& s) { - return boost::beast::detail::iequals(s, "peer"); + return beast::detail::iequals(s, "peer"); }) == types.end()) { handoff.moved = false; @@ -328,17 +328,17 @@ std::shared_ptr OverlayImpl::makeRedirectResponse (PeerFinder::Slot::ptr const& slot, http_request_type const& request, address_type remote_address) { - boost::beast::http::response msg; - msg.version(request.version()); - msg.result(boost::beast::http::status::service_unavailable); + beast::http::response msg; + msg.version = request.version; + msg.result(beast::http::status::service_unavailable); msg.insert("Server", BuildInfo::getFullVersionString()); msg.insert("Remote-Address", remote_address); msg.insert("Content-Type", "application/json"); - msg.insert(boost::beast::http::field::connection, "close"); - msg.body() = Json::objectValue; + msg.insert(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()); } @@ -352,13 +352,13 @@ OverlayImpl::makeErrorResponse (PeerFinder::Slot::ptr const& slot, address_type remote_address, std::string text) { - boost::beast::http::response msg; - msg.version(request.version()); - msg.result(boost::beast::http::status::bad_request); + beast::http::response msg; + msg.version = request.version; + msg.result(beast::http::status::bad_request); msg.insert("Server", BuildInfo::getFullVersionString()); msg.insert("Remote-Address", remote_address.to_string()); - msg.insert(boost::beast::http::field::connection, "close"); - msg.body() = text; + msg.insert(beast::http::field::connection, "close"); + msg.body = text; msg.prepare_payload(); return std::make_shared(msg); } @@ -763,7 +763,7 @@ OverlayImpl::crawl() for_each ([&](std::shared_ptr&& sp) { auto& pv = av.append(Json::Value(Json::objectValue)); - pv[jss::public_key] = boost::beast::detail::base64_encode( + pv[jss::public_key] = beast::detail::base64_encode( sp->getNodePublic().data(), sp->getNodePublic().size()); pv[jss::type] = sp->slot()->inbound() ? @@ -818,13 +818,13 @@ OverlayImpl::processRequest (http_request_type const& req, if (req.target() != "/crawl") return false; - boost::beast::http::response msg; - msg.version(req.version()); - msg.result(boost::beast::http::status::ok); + beast::http::response msg; + msg.version = req.version; + msg.result(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 ae874eccb..81b518fcc 100644 --- a/src/ripple/overlay/impl/OverlayImpl.h +++ b/src/ripple/overlay/impl/OverlayImpl.h @@ -255,11 +255,11 @@ public: template static bool - isPeerUpgrade (boost::beast::http::response const& response) + isPeerUpgrade (beast::http::response const& response) { if (! is_upgrade(response)) return false; - if(response.result() != boost::beast::http::status::switching_protocols) + if(response.result() != beast::http::status::switching_protocols) return false; auto const versions = parse_ProtocolVersions( response["Upgrade"]); @@ -271,13 +271,13 @@ public: template static bool - is_upgrade(boost::beast::http::header const& req) + is_upgrade(beast::http::header const& req) { - if(req.version() < 11) + if(req.version < 11) return false; - if(req.method() != boost::beast::http::verb::get) + if(req.method() != beast::http::verb::get) return false; - if(! boost::beast::http::token_list{req["Connection"]}.exists("upgrade")) + if(! beast::http::token_list{req["Connection"]}.exists("upgrade")) return false; return true; } @@ -285,11 +285,11 @@ public: template static bool - is_upgrade(boost::beast::http::header const& req) + is_upgrade(beast::http::header const& req) { - if(req.version() < 11) + if(req.version < 11) return false; - if(! boost::beast::http::token_list{req["Connection"]}.exists("upgrade")) + if(! 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 638919b2e..e8be93995 100644 --- a/src/ripple/overlay/impl/PeerImp.cpp +++ b/src/ripple/overlay/impl/PeerImp.cpp @@ -238,7 +238,7 @@ PeerImp::crawl() const auto const iter = headers_.find("Crawl"); if (iter == headers_.end()) return false; - return boost::beast::detail::iequals(iter->value(), "public"); + return beast::detail::iequals(iter->value(), "public"); } std::string @@ -621,7 +621,7 @@ void PeerImp::doAccept() // TODO Apply headers to connection state. - boost::beast::ostream(write_buffer_) << makeResponse( + 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(boost::beast::http::status::switching_protocols); - resp.version(req.version()); + resp.result(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 67e118a44..e07c5d100 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_; - boost::beast::multi_buffer read_buffer_; + beast::multi_buffer read_buffer_; http_request_type request_; http_response_type response_; - boost::beast::http::fields const& headers_; - boost::beast::multi_buffer write_buffer_; + beast::http::fields const& headers_; + 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 9cb40b526..0ea6a5c31 100644 --- a/src/ripple/overlay/impl/TMHello.cpp +++ b/src/ripple/overlay/impl/TMHello.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include @@ -151,14 +151,14 @@ buildHello ( } void -appendHello (boost::beast::http::fields& h, +appendHello (beast::http::fields& h, protocol::TMHello const& hello) { //h.append ("Protocol-Versions",... h.insert ("Public-Key", hello.nodepublic()); - h.insert ("Session-Signature", boost::beast::detail::base64_encode ( + h.insert ("Session-Signature", beast::detail::base64_encode ( hello.nodeproof())); if (hello.has_nettime()) @@ -168,11 +168,11 @@ appendHello (boost::beast::http::fields& h, h.insert ("Ledger", std::to_string (hello.ledgerindex())); if (hello.has_ledgerclosed()) - h.insert ("Closed-Ledger", boost::beast::detail::base64_encode ( + h.insert ("Closed-Ledger", beast::detail::base64_encode ( hello.ledgerclosed())); if (hello.has_ledgerprevious()) - h.insert ("Previous-Ledger", boost::beast::detail::base64_encode ( + h.insert ("Previous-Ledger", beast::detail::base64_encode ( hello.ledgerprevious())); if (hello.has_local_ip()) @@ -185,7 +185,7 @@ appendHello (boost::beast::http::fields& h, } std::vector -parse_ProtocolVersions(boost::beast::string_view const& value) +parse_ProtocolVersions(beast::string_view const& value) { static boost::regex re ( "^" // start of line @@ -219,7 +219,7 @@ parse_ProtocolVersions(boost::beast::string_view const& value) } boost::optional -parseHello (bool request, boost::beast::http::fields const& h, beast::Journal journal) +parseHello (bool request, beast::http::fields const& h, beast::Journal journal) { // protocol version in TMHello is obsolete, // it is supplanted by the values in the headers. @@ -259,7 +259,7 @@ parseHello (bool request, boost::beast::http::fields const& h, beast::Journal jo if (iter == h.end()) return boost::none; // TODO Security Review - hello.set_nodeproof (boost::beast::detail::base64_decode (iter->value().to_string())); + hello.set_nodeproof (beast::detail::base64_decode (iter->value().to_string())); } { @@ -294,13 +294,13 @@ parseHello (bool request, boost::beast::http::fields const& h, beast::Journal jo { auto const iter = h.find ("Closed-Ledger"); if (iter != h.end()) - hello.set_ledgerclosed (boost::beast::detail::base64_decode (iter->value().to_string())); + hello.set_ledgerclosed (beast::detail::base64_decode (iter->value().to_string())); } { auto const iter = h.find ("Previous-Ledger"); if (iter != h.end()) - hello.set_ledgerprevious (boost::beast::detail::base64_decode (iter->value().to_string())); + hello.set_ledgerprevious (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 9deba3474..ed03f1543 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 (boost::beast::http::fields& h, protocol::TMHello const& hello); +appendHello (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, boost::beast::http::fields const& h, beast::Journal journal); +parseHello (bool request, 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(boost::beast::string_view const& s); +parse_ProtocolVersions(beast::string_view const& s); } diff --git a/src/ripple/rpc/impl/ServerHandlerImp.cpp b/src/ripple/rpc/impl/ServerHandlerImp.cpp index ae484b02e..49eac8c12 100644 --- a/src/ripple/rpc/impl/ServerHandlerImp.cpp +++ b/src/ripple/rpc/impl/ServerHandlerImp.cpp @@ -40,9 +40,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -58,10 +58,10 @@ isStatusRequest( http_request_type const& request) { return - request.version() >= 11 && + request.version >= 11 && request.target() == "/" && - request.body().size() == 0 && - request.method() == boost::beast::http::verb::get; + request.body.size() == 0 && + request.method() == beast::http::verb::get; } static @@ -69,21 +69,21 @@ Handoff unauthorizedResponse( http_request_type const& request) { - using namespace boost::beast::http; + using namespace beast::http; Handoff handoff; response msg; - msg.version(request.version()); - msg.result(boost::beast::http::status::unauthorized); + msg.version = request.version; + msg.result(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 boost::beast::http::fields +// VFALCO TODO Rewrite to use beast::http::fields static bool authorized ( @@ -98,7 +98,7 @@ authorized ( return false; std::string strUserPass64 = it->second.substr (6); boost::trim (strUserPass64); - std::string strUserPass = boost::beast::detail::base64_decode (strUserPass64); + std::string strUserPass = beast::detail::base64_decode (strUserPass64); std::string::size_type nColon = strUserPass.find (":"); if (nColon == std::string::npos) return false; @@ -179,7 +179,7 @@ ServerHandlerImp::onHandoff (Session& session, (session.port().protocol.count("wss") > 0) || (session.port().protocol.count("wss2") > 0); - if(boost::beast::websocket::is_upgrade(request)) + if(beast::websocket::is_upgrade(request)) { if(is_ws) { @@ -219,7 +219,7 @@ ServerHandlerImp::onHandoff (Session& session, boost::asio::ip::tcp::endpoint remote_address) -> Handoff { - if(boost::beast::websocket::is_upgrade(request)) + if(beast::websocket::is_upgrade(request)) { if (session.port().protocol.count("ws2") > 0 || session.port().protocol.count("ws") > 0) @@ -251,7 +251,7 @@ ServerHandlerImp::onHandoff (Session& session, static inline Json::Output makeOutput (Session& session) { - return [&](boost::beast::string_view const& b) + return [&](beast::string_view const& b) { session.write (b.data(), b.size()); }; @@ -260,7 +260,7 @@ Json::Output makeOutput (Session& session) // HACK! static std::map -build_map(boost::beast::http::fields const& h) +build_map(beast::http::fields const& h) { std::map c; for (auto const& e : h) @@ -341,7 +341,7 @@ ServerHandlerImp::onWSMessage( jvResult[jss::type] = jss::error; jvResult[jss::error] = "jsonInvalid"; jvResult[jss::value] = buffers_to_string(buffers); - boost::beast::multi_buffer sb; + beast::multi_buffer sb; Json::stream(jvResult, [&sb](auto const p, auto const n) { @@ -367,7 +367,7 @@ ServerHandlerImp::onWSMessage( this->processSession(session, coro, jv); auto const s = to_string(jr); auto const n = s.length(); - boost::beast::multi_buffer sb(n); + 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< @@ -509,7 +509,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, [&] @@ -832,25 +832,25 @@ Handoff ServerHandlerImp::statusResponse( http_request_type const& request) const { - using namespace boost::beast::http; + using namespace beast::http; Handoff handoff; response msg; std::string reason; if (app_.serverOkay(reason)) { - msg.result(boost::beast::http::status::ok); - msg.body() = "" + systemName() + + msg.result(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(boost::beast::http::status::internal_server_error); - msg.body() = "Server cannot accept clients: " + + msg.result(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 183084910..0eaffd3ba 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; - boost::beast::multi_buffer sb; + 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 900c7a161..6dc1e8786 100644 --- a/src/ripple/rpc/json_body.h +++ b/src/ripple/rpc/json_body.h @@ -21,10 +21,8 @@ #define RIPPLE_RPC_JSON_BODY_H #include -#include - -#include -#include +#include +#include namespace ripple { @@ -35,7 +33,7 @@ struct json_body class reader { - using dynamic_buffer_type = boost::beast::multi_buffer; + using dynamic_buffer_type = beast::multi_buffer; dynamic_buffer_type buffer_; @@ -47,7 +45,7 @@ struct json_body template explicit - reader(boost::beast::http::message< + reader(beast::http::message< isRequest, json_body, Fields> const& m) { stream(m.body, @@ -59,52 +57,21 @@ struct json_body } void - init(boost::beast::error_code&) noexcept + init(beast::error_code&) noexcept { } boost::optional> - get(boost::beast::error_code& ec) + get(beast::error_code& ec) { return {{buffer_.data(), false}}; } void - finish(boost::beast::error_code&) + finish(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 60077f0dd..48220545f 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 = - boost::beast::http::request; + beast::http::request; using http_response_type = - boost::beast::http::response; + 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 35b948be9..e911ebc7a 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 @@ -40,7 +40,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; @@ -51,7 +51,7 @@ struct Port std::string ssl_cert; std::string ssl_chain; std::string ssl_ciphers; - boost::beast::websocket::permessage_deflate pmd_options; + beast::websocket::permessage_deflate pmd_options; std::shared_ptr context; // How many incoming connections are allowed on this @@ -79,7 +79,7 @@ operator<< (std::ostream& os, Port const& p); struct ParsedPort { std::string name; - std::set protocol; + std::set protocol; std::string user; std::string password; std::string admin_user; @@ -88,7 +88,7 @@ struct ParsedPort std::string ssl_cert; std::string ssl_chain; std::string ssl_ciphers; - boost::beast::websocket::permessage_deflate pmd_options; + 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 82f19e01f..db0d35956 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 0badea441..9d17dbd1c 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,14 +32,15 @@ namespace ripple { /// Deprecated: Writer that serializes a HTTP/1 message class SimpleWriter : public Writer { - boost::beast::multi_buffer sb_; + beast::multi_buffer sb_; public: - template + template explicit - SimpleWriter(boost::beast::http::message const& msg) + SimpleWriter(beast::http::message< + isRequest, Body, Headers> const& msg) { - boost::beast::ostream(sb_) << msg; + beast::ostream(sb_) << msg; } bool diff --git a/src/ripple/server/WSSession.h b/src/ripple/server/WSSession.h index 71da1e27b..b89e5d3cc 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 = boost::beast::buffers_prefix(n_, sb_.data()); + auto const pb = beast::buffer_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 f4d6118cc..90ad13a00 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(); - boost::beast::http::async_read(impl().stream_, + beast::http::async_read(impl().stream_, read_buf_, message_, do_yield[ec]); cancel_timer(); - if(ec == boost::beast::http::error::end_of_stream) + if(ec == 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 ca1656e7b..a4a2d3861 100644 --- a/src/ripple/server/impl/BaseWSPeer.h +++ b/src/ripple/server/impl/BaseWSPeer.h @@ -24,11 +24,10 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include -#include namespace ripple { @@ -49,24 +48,24 @@ private: friend class BasePeer; http_request_type request_; - boost::beast::multi_buffer rb_; - boost::beast::multi_buffer wb_; + beast::multi_buffer rb_; + beast::multi_buffer wb_; std::list> wq_; bool do_close_ = false; - boost::beast::websocket::close_reason cr_; + beast::websocket::close_reason cr_; waitable_timer timer_; bool close_on_timer_ = false; bool ping_active_ = false; - boost::beast::websocket::ping_data payload_; + beast::websocket::ping_data payload_; error_code ec_; - std::function control_callback_; + public: template BaseWSPeer( Port const& port, Handler& handler, endpoint_type remote_address, - boost::beast::http::request&& request, + beast::http::request&& request, boost::asio::io_service& io_service, beast::Journal journal); @@ -142,8 +141,8 @@ protected: on_ping(error_code const& ec); void - on_ping_pong(boost::beast::websocket::frame_type kind, - boost::beast::string_view payload); + on_ping_pong(beast::websocket::frame_type kind, + beast::string_view payload); void on_timer(error_code ec); @@ -162,7 +161,7 @@ BaseWSPeer( Port const& port, Handler& handler, endpoint_type remote_address, - boost::beast::http::request&& request, + beast::http::request&& request, boost::asio::io_service& io_service, beast::Journal journal) : BasePeer(port, handler, remote_address, @@ -181,17 +180,15 @@ run() return strand_.post(std::bind( &BaseWSPeer::run, impl().shared_from_this())); impl().ws_.set_option(port().pmd_options); - // 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_); + impl().ws_.control_callback( + std::bind(&BaseWSPeer::on_ping_pong, this, + std::placeholders::_1, std::placeholders::_2)); start_timer(); close_on_timer_ = true; impl().ws_.async_accept_ex(request_, [](auto & res) { - res.set(boost::beast::http::field::server, + res.set(beast::http::field::server, BuildInfo::getFullVersionString()); }, strand_.wrap(std::bind(&BaseWSPeer::on_ws_handshake, @@ -213,7 +210,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(); @@ -287,12 +284,12 @@ on_write(error_code const& ec) return; start_timer(); if(! result.first) - impl().ws_.async_write_some( + impl().ws_.async_write_frame( result.first, result.second, strand_.wrap(std::bind( &BaseWSPeer::on_write, impl().shared_from_this(), std::placeholders::_1))); else - impl().ws_.async_write_some( + impl().ws_.async_write_frame( result.first, result.second, strand_.wrap(std::bind( &BaseWSPeer::on_write_fin, impl().shared_from_this(), std::placeholders::_1))); @@ -332,7 +329,7 @@ void BaseWSPeer:: on_read(error_code const& ec) { - if(ec == boost::beast::websocket::error::closed) + if(ec == beast::websocket::error::closed) return on_close({}); if(ec) return fail(ec, "read"); @@ -398,12 +395,12 @@ on_ping(error_code const& ec) template void BaseWSPeer:: -on_ping_pong(boost::beast::websocket::frame_type kind, - boost::beast::string_view payload) +on_ping_pong(beast::websocket::frame_type kind, + beast::string_view payload) { - if(kind == boost::beast::websocket::frame_type::pong) + if(kind == beast::websocket::frame_type::pong) { - boost::beast::string_view p(payload_.begin()); + 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 bb4a069db..db78aec8c 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; - boost::beast::multi_buffer buf(16); + 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 d06f612ec..18f8ae4ca 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; - boost::beast::websocket::stream ws_; + beast::websocket::stream ws_; public: template @@ -47,7 +47,7 @@ public: Port const& port, Handler& handler, endpoint_type remote_address, - boost::beast::http::request&& request, + beast::http::request&& request, socket_type&& socket, beast::Journal journal); }; @@ -61,7 +61,7 @@ PlainWSPeer( Port const& port, Handler& handler, endpoint_type remote_address, - boost::beast::http::request&& request, + 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 2f9c26bfc..c8b18511f 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 (!boost::beast::detail::iequals (lim, "unlimited")) + if (!beast::detail::iequals (lim, "unlimited")) { try { diff --git a/src/ripple/server/impl/SSLWSPeer.h b/src/ripple/server/impl/SSLWSPeer.h index 3b662ff47..1bf9afe49 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_; - boost::beast::websocket::stream< + 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, - boost::beast::http::request&& request, + 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, - boost::beast::http::request&& request, + 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 425bd8017..ffa6a6b2e 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 boost::beast::detail::base64_encode (std::string( + return beast::detail::base64_encode (std::string( static_cast (s.data()), s.size())); } @@ -176,7 +176,7 @@ public: Serializer s; st.add(s); - return boost::beast::detail::base64_encode (std::string( + return beast::detail::base64_encode (std::string( static_cast (s.data()), s.size())); } diff --git a/src/test/app/TxQ_test.cpp b/src/test/app/TxQ_test.cpp index 1d8035f55..115a9e9b2 100644 --- a/src/test/app/TxQ_test.cpp +++ b/src/test/app/TxQ_test.cpp @@ -1092,6 +1092,8 @@ public: auto alice = Account("alice"); + auto queued = ter(terQUEUED); + BEAST_EXPECT(env.current()->fees().base == 10); checkMetrics(env, 0, boost::none, 0, 1, 256); @@ -1131,6 +1133,7 @@ public: {"maximum_txn_in_ledger", "5"} })); auto alice = Account("alice"); + auto queued = ter(terQUEUED); checkMetrics(env, 0, boost::none, 0, 2, 256); diff --git a/src/test/app/ValidatorList_test.cpp b/src/test/app/ValidatorList_test.cpp index fbd4a61b7..b351370d1 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, - boost::beast::detail::base64_encode(makeManifestString ( + beast::detail::base64_encode(makeManifestString ( masterPublic, secret, signingKeys.first, signingKeys.second, 1)) }; } @@ -112,7 +112,7 @@ private: data.pop_back(); data += "]}"; - return boost::beast::detail::base64_encode(data); + return beast::detail::base64_encode(data); } std::string @@ -120,7 +120,7 @@ private: std::string const& blob, std::pair const& keys) { - auto const data = boost::beast::detail::base64_decode (blob); + auto const data = beast::detail::base64_decode (blob); return strHex(sign( keys.first, keys.second, makeSlice(data))); } @@ -364,7 +364,7 @@ private: auto const publisherPublic = derivePublicKey(KeyType::ed25519, publisherSecret); auto const pubSigningKeys1 = randomKeyPair(KeyType::secp256k1); - auto const manifest1 = boost::beast::detail::base64_encode(makeManifestString ( + auto const manifest1 = beast::detail::base64_encode(makeManifestString ( publisherPublic, publisherSecret, pubSigningKeys1.first, pubSigningKeys1.second, 1)); @@ -415,7 +415,7 @@ private: } // do not use list from untrusted publisher - auto const untrustedManifest = boost::beast::detail::base64_encode( + auto const untrustedManifest = beast::detail::base64_encode( makeManifestString ( randomMasterKey(), publisherSecret, pubSigningKeys1.first, pubSigningKeys1.second, 1)); @@ -462,7 +462,7 @@ private: // apply list with new publisher key updated by manifest auto const pubSigningKeys2 = randomKeyPair(KeyType::secp256k1); - auto manifest2 = boost::beast::detail::base64_encode(makeManifestString ( + auto manifest2 = beast::detail::base64_encode(makeManifestString ( publisherPublic, publisherSecret, pubSigningKeys2.first, pubSigningKeys2.second, 2)); @@ -486,7 +486,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 = boost::beast::detail::base64_encode(makeManifestString ( + auto maxManifest = beast::detail::base64_encode(makeManifestString ( publisherPublic, publisherSecret, pubSigningKeys2.first, pubSigningKeys2.second, std::numeric_limits::max ())); @@ -746,7 +746,7 @@ private: std::vector emptyCfgKeys; auto const publisherKeys = randomKeyPair(KeyType::secp256k1); auto const pubSigningKeys = randomKeyPair(KeyType::secp256k1); - auto const manifest = boost::beast::detail::base64_encode ( + auto const manifest = beast::detail::base64_encode ( makeManifestString ( publisherKeys.first, publisherKeys.second, pubSigningKeys.first, pubSigningKeys.second, 1)); @@ -895,7 +895,7 @@ private: auto const publisherPublic = derivePublicKey(KeyType::ed25519, publisherSecret); auto const pubSigningKeys = randomKeyPair(KeyType::secp256k1); - auto const manifest = boost::beast::detail::base64_encode(makeManifestString ( + auto const manifest = beast::detail::base64_encode(makeManifestString ( publisherPublic, publisherSecret, pubSigningKeys.first, pubSigningKeys.second, 1)); @@ -998,7 +998,7 @@ private: auto const publisherPublic = derivePublicKey(KeyType::ed25519, publisherSecret); auto const pubSigningKeys = randomKeyPair(KeyType::secp256k1); - auto const manifest = boost::beast::detail::base64_encode(makeManifestString ( + auto const manifest = 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 b46ee196d..132552647 100644 --- a/src/test/app/ValidatorSite_test.cpp +++ b/src/test/app/ValidatorSite_test.cpp @@ -17,6 +17,7 @@ */ //============================================================================== +#include #include #include #include @@ -28,7 +29,6 @@ #include #include #include -#include namespace ripple { namespace test { @@ -67,7 +67,7 @@ private: Serializer s; st.add(s); - return boost::beast::detail::base64_encode (std::string( + return beast::detail::base64_encode (std::string( static_cast (s.data()), s.size())); } diff --git a/src/test/consensus/LedgerTiming_test.cpp b/src/test/consensus/LedgerTiming_test.cpp index a43c38585..8c036ab9d 100644 --- a/src/test/consensus/LedgerTiming_test.cpp +++ b/src/test/consensus/LedgerTiming_test.cpp @@ -127,4 +127,4 @@ class LedgerTiming_test : public beast::unit_test::suite BEAST_DEFINE_TESTSUITE(LedgerTiming, consensus, ripple); } // test -} // ripple +} // ripple \ No newline at end of file diff --git a/src/test/jtx/Env.h b/src/test/jtx/Env.h index 66ba9e9b7..fd7c883a7 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 @@ -711,7 +711,7 @@ protected: FN const&... fN) { maybe_invoke(stx, f, - boost::beast::detail::is_invocable()); invoke(stx, fN...); } @@ -745,7 +745,7 @@ protected: FN const&... fN) { maybe_invoke(jt, f, - boost::beast::detail::is_invocable()); invoke(jt, fN...); } diff --git a/src/test/jtx/TrustedPublisherServer.h b/src/test/jtx/TrustedPublisherServer.h index 3288127f7..4cf67a721 100644 --- a/src/test/jtx/TrustedPublisherServer.h +++ b/src/test/jtx/TrustedPublisherServer.h @@ -19,13 +19,14 @@ #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 { @@ -36,8 +37,8 @@ class TrustedPublisherServer using address_type = boost::asio::ip::address; using socket_type = boost::asio::ip::tcp::socket; - using req_type = boost::beast::http::request; - using resp_type = boost::beast::http::response; + using req_type = beast::http::request; + using resp_type = beast::http::response; using error_code = boost::system::error_code; socket_type sock_; @@ -77,7 +78,7 @@ public: } data.pop_back(); data += "]}"; - std::string blob = boost::beast::detail::base64_encode(data); + std::string blob = beast::detail::base64_encode(data); list_ = "{\"blob\":\"" + blob + "\""; @@ -154,35 +155,35 @@ private: do_peer(int id, socket_type&& sock0) { socket_type sock(std::move(sock0)); - boost::beast::multi_buffer sb; + beast::multi_buffer sb; error_code ec; for (;;) { req_type req; - boost::beast::http::read(sock, sb, req, ec); + beast::http::read(sock, sb, req, ec); if (ec) break; auto path = req.target().to_string(); if (path != "/validators") { resp_type res; - res.result(boost::beast::http::status::not_found); - res.version(req.version()); + res.result(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(boost::beast::http::status::ok); - res.version(req.version()); + res.result(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(); @@ -190,11 +191,11 @@ private: catch (std::exception const& e) { res = {}; - res.result(boost::beast::http::status::internal_server_error); - res.version(req.version()); + res.result(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 049d6e284..910166968 100644 --- a/src/test/jtx/WSClient_test.cpp +++ b/src/test/jtx/WSClient_test.cpp @@ -21,6 +21,7 @@ #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 b39f80d6f..a09fa7af4 100644 --- a/src/test/jtx/impl/JSONRPCClient.cpp +++ b/src/test/jtx/impl/JSONRPCClient.cpp @@ -22,11 +22,11 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include @@ -74,8 +74,8 @@ class JSONRPCClient : public AbstractClient boost::asio::ip::tcp::endpoint ep_; boost::asio::io_service ios_; boost::asio::ip::tcp::socket stream_; - boost::beast::multi_buffer bin_; - boost::beast::multi_buffer bout_; + beast::multi_buffer bin_; + beast::multi_buffer bout_; unsigned rpc_version_; public: @@ -104,14 +104,14 @@ public: invoke(std::string const& cmd, Json::Value const& params) override { - using namespace boost::beast::http; + using namespace beast::http; using namespace boost::asio; using namespace std::string_literals; request req; - req.method(boost::beast::http::verb::post); + req.method(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_); { @@ -128,7 +128,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); @@ -138,7 +138,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 05468b363..9f5de744b 100644 --- a/src/test/jtx/impl/WSClient.cpp +++ b/src/test/jtx/impl/WSClient.cpp @@ -24,8 +24,8 @@ #include #include #include -#include -#include +#include +#include #include @@ -93,8 +93,8 @@ class WSClientImpl : public WSClient boost::asio::io_service::strand strand_; std::thread thread_; boost::asio::ip::tcp::socket stream_; - boost::beast::websocket::stream ws_; - boost::beast::multi_buffer rb_; + beast::websocket::stream ws_; + beast::multi_buffer rb_; bool peerClosed_ = false; @@ -110,17 +110,13 @@ class WSClientImpl : public WSClient unsigned rpc_version_; - void - cleanup() + void cleanup() { ios_.post(strand_.wrap([this] { error_code ec; if (!peerClosed_) - { - ws_.async_close({}, strand_.wrap([&](error_code ec) { - stream_.cancel(ec); - })); - } + ws_.close({}, ec); + stream_.close(ec); })); work_ = boost::none; thread_.join(); @@ -178,7 +174,7 @@ public: else jp[jss::command] = cmd; auto const s = to_string(jp); - ws_.write_some(true, buffer(s)); + ws_.write_frame(true, buffer(s)); } auto jv = findMsg(5s, @@ -264,7 +260,7 @@ private: { if(ec) { - if(ec == boost::beast::websocket::error::closed) + if(ec == beast::websocket::error::closed) peerClosed_ = true; return; } diff --git a/src/test/nodestore/import_test.cpp b/src/test/nodestore/import_test.cpp index 107d372ed..ad1930f43 100644 --- a/src/test/nodestore/import_test.cpp +++ b/src/test/nodestore/import_test.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -258,7 +258,7 @@ public: } }; -std::map +std::map parse_args(std::string const& s) { // '=' @@ -274,7 +274,7 @@ parse_args(std::string const& s) , boost::regex_constants::optimize ); std::map map; + std::string, 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 008267ff3..abffdb3b6 100644 --- a/src/test/rpc/ValidatorRPC_test.cpp +++ b/src/test/rpc/ValidatorRPC_test.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include #include @@ -76,7 +76,7 @@ class ValidatorRPC_test : public beast::unit_test::suite Serializer s; st.add(s); - return boost::beast::detail::base64_encode( + return 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 ea89db89a..ff1f830cb 100644 --- a/src/test/server/ServerStatus_test.cpp +++ b/src/test/server/ServerStatus_test.cpp @@ -27,10 +27,10 @@ #include #include #include -#include +#include #include -#include -#include +#include +#include #include #include #include @@ -42,7 +42,7 @@ namespace test { class ServerStatus_test : public beast::unit_test::suite, public beast::test::enable_yield_to { - class myFields : public boost::beast::http::fields {}; + class myFields : public beast::http::fields {}; auto makeConfig( std::string const& proto, @@ -88,21 +88,21 @@ class ServerStatus_test : uint16_t port) { using namespace boost::asio; - using namespace boost::beast::http; + using namespace 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(boost::beast::http::verb::get); + req.method(beast::http::verb::get); req.insert("Upgrade", "websocket"); - 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); + beast::websocket::detail::maskgen maskgen; + beast::websocket::detail::sec_ws_key_type key; + beast::websocket::detail::make_sec_ws_key(key, maskgen); req.insert("Sec-WebSocket-Key", key); req.insert("Sec-WebSocket-Version", "13"); - req.insert(boost::beast::http::field::connection, "upgrade"); + req.insert(beast::http::field::connection, "upgrade"); return req; } @@ -113,24 +113,24 @@ class ServerStatus_test : myFields const& fields) { using namespace boost::asio; - using namespace boost::beast::http; + using namespace 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(boost::beast::http::verb::get); + req.method(beast::http::verb::get); } else { - req.method(boost::beast::http::verb::post); + req.method(beast::http::verb::post); req.insert("Content-Type", "application/json; charset=UTF-8"); - req.body() = body; + req.body = body; } req.prepare_payload(); @@ -140,18 +140,18 @@ class ServerStatus_test : void doRequest( boost::asio::yield_context& yield, - boost::beast::http::request&& req, + beast::http::request&& req, std::string const& host, uint16_t port, bool secure, - boost::beast::http::response& resp, + beast::http::response& resp, boost::system::error_code& ec) { using namespace boost::asio; - using namespace boost::beast::http; + using namespace beast::http; io_service& ios = get_io_service(); ip::tcp::resolver r{ios}; - boost::beast::multi_buffer sb; + beast::multi_buffer sb; auto it = r.async_resolve( @@ -170,7 +170,7 @@ class ServerStatus_test : ss.async_handshake(ssl::stream_base::client, yield[ec]); if(ec) return; - boost::beast::http::async_write(ss, req, yield[ec]); + beast::http::async_write(ss, req, yield[ec]); if(ec) return; async_read(ss, sb, resp, yield[ec]); @@ -183,7 +183,7 @@ class ServerStatus_test : async_connect(sock, it, yield[ec]); if(ec) return; - boost::beast::http::async_write(sock, req, yield[ec]); + beast::http::async_write(sock, req, yield[ec]); if(ec) return; async_read(sock, sb, resp, yield[ec]); @@ -199,7 +199,7 @@ class ServerStatus_test : test::jtx::Env& env, boost::asio::yield_context& yield, bool secure, - boost::beast::http::response& resp, + beast::http::response& resp, boost::system::error_code& ec) { auto const port = env.app().config()["port_ws"]. @@ -222,7 +222,7 @@ class ServerStatus_test : test::jtx::Env& env, boost::asio::yield_context& yield, bool secure, - boost::beast::http::response& resp, + beast::http::response& resp, boost::system::error_code& ec, std::string const& body = "", myFields const& fields = {}) @@ -384,21 +384,21 @@ class ServerStatus_test : //non-secure request { boost::system::error_code ec; - boost::beast::http::response resp; + beast::http::response resp; doWSRequest(env, yield, false, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == boost::beast::http::status::unauthorized); + BEAST_EXPECT(resp.result() == beast::http::status::unauthorized); } //secure request { boost::system::error_code ec; - boost::beast::http::response resp; + beast::http::response resp; doWSRequest(env, yield, true, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == boost::beast::http::status::unauthorized); + BEAST_EXPECT(resp.result() == beast::http::status::unauthorized); } } @@ -417,21 +417,21 @@ class ServerStatus_test : //non-secure request { boost::system::error_code ec; - boost::beast::http::response resp; + beast::http::response resp; doHTTPRequest(env, yield, false, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == boost::beast::http::status::ok); + BEAST_EXPECT(resp.result() == beast::http::status::ok); } //secure request { boost::system::error_code ec; - boost::beast::http::response resp; + beast::http::response resp; doHTTPRequest(env, yield, true, resp, ec); if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == boost::beast::http::status::ok); + BEAST_EXPECT(resp.result() == beast::http::status::ok); } }; @@ -441,7 +441,7 @@ class ServerStatus_test : testcase("Partial WS upgrade request"); using namespace jtx; using namespace boost::asio; - using namespace boost::beast::http; + using namespace beast::http; Env env {*this, envconfig([](std::unique_ptr cfg) { cfg->section("port_ws").set("protocol", "ws2"); @@ -463,7 +463,7 @@ class ServerStatus_test : io_service& ios = get_io_service(); ip::tcp::resolver r{ios}; - boost::beast::multi_buffer sb; + beast::multi_buffer sb; auto it = r.async_resolve( @@ -498,7 +498,7 @@ class ServerStatus_test : using namespace jtx; Env env {*this, makeConfig(server_protocol)}; - boost::beast::http::response resp; + beast::http::response resp; boost::system::error_code ec; if(boost::starts_with(client_protocol, "h")) { @@ -540,23 +540,23 @@ class ServerStatus_test : Json::Value jr; jr[jss::method] = "server_info"; - boost::beast::http::response resp; + beast::http::response resp; boost::system::error_code ec; doHTTPRequest(env, yield, secure, resp, ec, to_string(jr)); - BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden); + BEAST_EXPECT(resp.result() == beast::http::status::forbidden); myFields auth; auth.insert("Authorization", ""); doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth); - BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden); + BEAST_EXPECT(resp.result() == beast::http::status::forbidden); auth.set("Authorization", "Basic NOT-VALID"); doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth); - BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden); + BEAST_EXPECT(resp.result() == beast::http::status::forbidden); - auth.set("Authorization", "Basic " + boost::beast::detail::base64_encode("me:badpass")); + auth.set("Authorization", "Basic " + beast::detail::base64_encode("me:badpass")); doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth); - BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden); + BEAST_EXPECT(resp.result() == beast::http::status::forbidden); auto const user = env.app().config().section("port_rpc"). get("user").value(); @@ -566,14 +566,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() == boost::beast::http::status::forbidden); + BEAST_EXPECT(resp.result() == beast::http::status::forbidden); // finally if we use the correct user/pass encoded, we should get a 200 auth.set("Authorization", "Basic " + - boost::beast::detail::base64_encode(user + ":" + pass)); + beast::detail::base64_encode(user + ":" + pass)); doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth); - BEAST_EXPECT(resp.result() == boost::beast::http::status::ok); - BEAST_EXPECT(! resp.body().empty()); + BEAST_EXPECT(resp.result() == beast::http::status::ok); + BEAST_EXPECT(! resp.body.empty()); } void @@ -583,7 +583,7 @@ class ServerStatus_test : using namespace test::jtx; using namespace boost::asio; - using namespace boost::beast::http; + using namespace beast::http; Env env {*this, envconfig([&](std::unique_ptr cfg) { (*cfg)["port_rpc"].set("limit", to_string(limit)); return cfg; @@ -607,7 +607,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 @@ -620,7 +620,7 @@ class ServerStatus_test : while (connectionCount < testTo) { clients.emplace_back( - std::make_pair(ip::tcp::socket {ios}, boost::beast::multi_buffer{})); + std::make_pair(ip::tcp::socket {ios}, beast::multi_buffer{})); async_connect(clients.back().first, it, yield[ec]); BEAST_EXPECT(! ec); auto req = makeHTTPRequest(ip, port, to_string(jr), {}); @@ -635,7 +635,7 @@ class ServerStatus_test : int readCount = 0; for (auto& c : clients) { - boost::beast::http::response resp; + 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 @@ -659,11 +659,11 @@ class ServerStatus_test : get("port").value(); auto const ip = env.app().config()["port_ws"]. get("ip").value(); - boost::beast::http::response resp; + beast::http::response resp; boost::system::error_code ec; doRequest( yield, makeWSUpgrade(ip, port), ip, port, true, resp, ec); - BEAST_EXPECT(resp.result() == boost::beast::http::status::switching_protocols); + BEAST_EXPECT(resp.result() == beast::http::status::switching_protocols); BEAST_EXPECT(resp.find("Upgrade") != resp.end() && resp["Upgrade"] == "websocket"); BEAST_EXPECT(resp.find("Connection") != resp.end() && @@ -682,14 +682,14 @@ class ServerStatus_test : get("port").value(); auto const ip = env.app().config()["port_ws"]. get("ip").value(); - boost::beast::http::response resp; + 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() == boost::beast::http::status::forbidden); - BEAST_EXPECT(resp.body() == "Forbidden\r\n"); + BEAST_EXPECT(resp.result() == beast::http::status::forbidden); + BEAST_EXPECT(resp.body == "Forbidden\r\n"); } void @@ -699,7 +699,7 @@ class ServerStatus_test : using namespace test::jtx; using namespace boost::asio; - using namespace boost::beast::http; + using namespace beast::http; Env env {*this}; auto const port = env.app().config()["port_ws"]. @@ -722,17 +722,17 @@ class ServerStatus_test : if(! BEAST_EXPECT(! ec)) return; - boost::beast::websocket::stream ws{sock}; + 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_some(true, buffer(req), yield[ec]); + ws.async_write_frame(true, buffer(req), yield[ec]); if(! BEAST_EXPECT(! ec)) return Json::objectValue; - boost::beast::multi_buffer sb; + beast::multi_buffer sb; ws.async_read(sb, yield[ec]); if(! BEAST_EXPECT(! ec)) return Json::objectValue; @@ -741,7 +741,7 @@ class ServerStatus_test : Json::Reader jr; if(! BEAST_EXPECT(jr.parse( boost::lexical_cast( - boost::beast::buffers(sb.data())), resp))) + beast::buffers(sb.data())), resp))) return Json::objectValue; sb.consume(sb.size()); return resp; @@ -783,7 +783,7 @@ class ServerStatus_test : testcase("Status request over WS and RPC with/without Amendment Block"); using namespace jtx; using namespace boost::asio; - using namespace boost::beast::http; + using namespace beast::http; Env env {*this, validator( envconfig([](std::unique_ptr cfg) { cfg->section("port_rpc").set("protocol", "http"); @@ -824,9 +824,9 @@ class ServerStatus_test : if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == boost::beast::http::status::ok); + BEAST_EXPECT(resp.result() == 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) @@ -856,9 +856,9 @@ class ServerStatus_test : if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == boost::beast::http::status::ok); + BEAST_EXPECT(resp.result() == 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; @@ -873,11 +873,11 @@ class ServerStatus_test : if(! BEAST_EXPECTS(! ec, ec.message())) return; - BEAST_EXPECT(resp.result() == boost::beast::http::status::internal_server_error); + BEAST_EXPECT(resp.result() == 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 @@ -890,53 +890,53 @@ class ServerStatus_test : boost::system::error_code ec; { - boost::beast::http::response resp; + beast::http::response resp; doHTTPRequest(env, yield, false, resp, ec, "{}"); - BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); - BEAST_EXPECT(resp.body() == "Unable to parse request: \r\n"); + BEAST_EXPECT(resp.result() == beast::http::status::bad_request); + BEAST_EXPECT(resp.body == "Unable to parse request: \r\n"); } Json::Value jv; { - boost::beast::http::response resp; + beast::http::response resp; jv[jss::method] = Json::nullValue; doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); - BEAST_EXPECT(resp.body() == "Null method\r\n"); + BEAST_EXPECT(resp.result() == beast::http::status::bad_request); + BEAST_EXPECT(resp.body == "Null method\r\n"); } { - boost::beast::http::response resp; + beast::http::response resp; jv[jss::method] = 1; doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); - BEAST_EXPECT(resp.body() == "method is not string\r\n"); + BEAST_EXPECT(resp.result() == beast::http::status::bad_request); + BEAST_EXPECT(resp.body == "method is not string\r\n"); } { - boost::beast::http::response resp; + beast::http::response resp; jv[jss::method] = ""; doHTTPRequest(env, yield, false, resp, ec, to_string(jv)); - BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request); - BEAST_EXPECT(resp.body() == "method is empty\r\n"); + BEAST_EXPECT(resp.result() == beast::http::status::bad_request); + BEAST_EXPECT(resp.body == "method is empty\r\n"); } { - boost::beast::http::response resp; + 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() == boost::beast::http::status::bad_request); - BEAST_EXPECT(resp.body() == "params unparseable\r\n"); + BEAST_EXPECT(resp.result() == beast::http::status::bad_request); + BEAST_EXPECT(resp.body == "params unparseable\r\n"); } { - boost::beast::http::response resp; + 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() == boost::beast::http::status::bad_request); - BEAST_EXPECT(resp.body() == "params unparseable\r\n"); + BEAST_EXPECT(resp.result() == beast::http::status::bad_request); + BEAST_EXPECT(resp.body == "params unparseable\r\n"); } } @@ -954,12 +954,12 @@ class ServerStatus_test : //raise the fee so that the server is considered overloaded env.app().getFeeTrack().raiseLocalFee(); - boost::beast::http::response resp; + beast::http::response resp; boost::system::error_code ec; doHTTPRequest(env, yield, false, resp, ec); - BEAST_EXPECT(resp.result() == boost::beast::http::status::internal_server_error); + BEAST_EXPECT(resp.result() == 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 8e4f1a208..dc21e0e1b 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 = boost::beast::static_string<256>; + using static_string = 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;