mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-31 11:00:23 +00:00
Convert code to use boost::beast
This commit is contained in:
@@ -8,8 +8,10 @@ env:
|
||||
# Note that for simplicity, BOOST_ROOT's final
|
||||
# namepart must match the folder name internal
|
||||
# to boost's .tar.gz.
|
||||
- BOOST_ROOT=$HOME/boost_1_65_1
|
||||
- BOOST_URL='https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz'
|
||||
- LCOV_ROOT=$HOME/lcov
|
||||
- GDB_ROOT=$HOME/gdb
|
||||
- BOOST_ROOT=$HOME/boost_1_67_0
|
||||
- BOOST_URL='http://sourceforge.net/projects/boost/files/boost/1.67.0/boost_1_67_0.tar.gz'
|
||||
|
||||
addons:
|
||||
apt:
|
||||
|
||||
@@ -358,6 +358,10 @@ macro(use_boost)
|
||||
message(WARNING "Boost directory found, but not all components. May not be able to build.")
|
||||
endif()
|
||||
|
||||
if(Boost_VERSION VERSION_LESS 106700)
|
||||
message(FATAL_ERROR "Boost version 1.67 or greater is required for boost::beast. Found version: ${Boost_VERSION}")
|
||||
endif()
|
||||
|
||||
if(MSVC14)
|
||||
# VS2017 with boost <= 1.66.0 requires a flag to suppress warnings
|
||||
if(NOT Boost_VERSION VERSION_GREATER 106600)
|
||||
@@ -581,6 +585,8 @@ macro(setup_build_boilerplate)
|
||||
-DSOCI_CXX_C11=1
|
||||
-D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
|
||||
-DBOOST_NO_AUTO_PTR
|
||||
-DBOOST_BEAST_ALLOW_DEPRECATED
|
||||
-DBOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS
|
||||
)
|
||||
|
||||
if (is_gcc)
|
||||
|
||||
@@ -18,7 +18,7 @@ need these software components
|
||||
| [Git for Windows](README.md#install-git-for-windows)| 2.16.1|
|
||||
| [Google Protocol Buffers Compiler](README.md#install-google-protocol-buffers-compiler) | 2.5.1|
|
||||
| [OpenSSL Library](README.md#install-openssl) | 1.0.2n |
|
||||
| [Boost library](README.md#build-boost) | 1.66.0 |
|
||||
| [Boost library](README.md#build-boost) | 1.67.0 |
|
||||
| [CMake for Windows](README.md#optional-install-cmake-for-windows)* | 3.10.2 |
|
||||
|
||||
\* Only needed if not using the integrated CMake in VS 2017 and prefer generating dedicated project/solution files.
|
||||
@@ -99,11 +99,13 @@ to get the correct 32-/64-bit variant.
|
||||
|
||||
### Build Boost
|
||||
|
||||
Boost 1.67 or later is required.
|
||||
|
||||
After [downloading boost](http://www.boost.org/users/download/) and unpacking it
|
||||
to `c:\lib`. As of this writing, the most recent version of boost is 1.66.0,
|
||||
which will unpack into a directory named `boost_1_66_0`. We recommended either
|
||||
to `c:\lib`. As of this writing, the most recent version of boost is 1.67.0,
|
||||
which will unpack into a directory named `boost_1_67_0`. We recommended either
|
||||
renaming this directory to `boost`, or creating a junction link `mklink /J boost
|
||||
boost_1_66_0`, so that you can more easily switch between versions.
|
||||
boost_1_67_0`, so that you can more easily switch between versions.
|
||||
|
||||
Next, open **Developer Command Prompt** and type the following commands
|
||||
|
||||
@@ -235,7 +237,7 @@ execute the following commands within your `rippled` cloned repository:
|
||||
```
|
||||
mkdir build\cmake
|
||||
cd build\cmake
|
||||
cmake ..\.. -G"Visual Studio 15 2017 Win64" -DBOOST_ROOT="C:\lib\boost_1_66_0" -DOPENSSL_ROOT="C:\lib\OpenSSL-Win64"
|
||||
cmake ..\.. -G"Visual Studio 15 2017 Win64" -DBOOST_ROOT="C:\lib\boost_1_67_0" -DOPENSSL_ROOT="C:\lib\OpenSSL-Win64"
|
||||
```
|
||||
Now launch Visual Studio 2017 and select **File | Open | Project/Solution**.
|
||||
Navigate to the `build\cmake` folder created above and select the `rippled.sln`
|
||||
|
||||
@@ -25,14 +25,14 @@ protobuf will give errors.
|
||||
|
||||
### Build Boost
|
||||
|
||||
We recommend downloading and compiling a more recent version of boost than
|
||||
provided by the `boost-all-dev` package. After changing to the directory where
|
||||
Boost 1.67 or later is required. We recommend downloading and compiling boost
|
||||
with the following process: After changing to the directory where
|
||||
you wish to download and compile boost, run
|
||||
|
||||
```
|
||||
$ wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
|
||||
$ tar -xzf boost_1_65_1.tar.gz
|
||||
$ cd boost_1_65_1
|
||||
$ wget https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.gz
|
||||
$ tar -xzf boost_1_67_0.tar.gz
|
||||
$ cd boost_1_67_0
|
||||
$ ./bootstrap.sh
|
||||
$ ./b2 headers
|
||||
$ ./b2 -j<Num Parallel>
|
||||
@@ -81,14 +81,14 @@ git checkout develop
|
||||
If you didn't persistently set the `BOOST_ROOT` environment variable to the
|
||||
directory in which you compiled boost, then you should set it temporarily.
|
||||
|
||||
For example, you built Boost in your home directory `~/boost_1_65_1`, you
|
||||
For example, you built Boost in your home directory `~/boost_1_67_0`, you
|
||||
would do for any shell in which you want to build:
|
||||
|
||||
```
|
||||
export BOOST_ROOT=~/boost_1_65_1
|
||||
export BOOST_ROOT=~/boost_1_67_0
|
||||
```
|
||||
|
||||
Alternatively, you can add `DBOOST_ROOT=~/boost_1_65_1` to the command line when
|
||||
Alternatively, you can add `DBOOST_ROOT=~/boost_1_67_0` to the command line when
|
||||
invoking `cmake`.
|
||||
|
||||
### Generate and Build
|
||||
|
||||
@@ -60,9 +60,11 @@ brew install git cmake pkg-config protobuf openssl ninja
|
||||
|
||||
### Build Boost
|
||||
|
||||
Boost 1.67 or later is required.
|
||||
|
||||
We want to compile boost with clang/libc++
|
||||
|
||||
Download [a release](https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.bz2)
|
||||
Download [a release](https://dl.bintray.com/boostorg/release/1.67.0/source/boost_1_67_0.tar.bz2)
|
||||
|
||||
Extract it to a folder, making note of where, open a terminal, then:
|
||||
|
||||
@@ -118,11 +120,11 @@ If you didn't persistently set the `BOOST_ROOT` environment variable to the
|
||||
root of the extracted directory above, then you should set it temporarily.
|
||||
|
||||
For example, assuming your username were `Abigail` and you extracted Boost
|
||||
1.66.0 in `/Users/Abigail/Downloads/boost_1_66_0`, you would do for any
|
||||
1.67.0 in `/Users/Abigail/Downloads/boost_1_67_0`, you would do for any
|
||||
shell in which you want to build:
|
||||
|
||||
```
|
||||
export BOOST_ROOT=/Users/Abigail/Downloads/boost_1_66_0
|
||||
export BOOST_ROOT=/Users/Abigail/Downloads/boost_1_67_0
|
||||
```
|
||||
|
||||
### Generate and Build
|
||||
|
||||
@@ -125,7 +125,6 @@ check_gcc4_abi()
|
||||
include_directories(
|
||||
src
|
||||
src/beast
|
||||
src/beast/include
|
||||
src/beast/extras
|
||||
src/nudb/include
|
||||
src/soci/src
|
||||
|
||||
4
Jenkinsfile
vendored
4
Jenkinsfile
vendored
@@ -168,7 +168,7 @@ try {
|
||||
echo "USE_CC: ${ucc}"
|
||||
if (compiler == 'msvc') {
|
||||
env_vars.addAll([
|
||||
'BOOST_ROOT=c:\\lib\\boost_1_66',
|
||||
'BOOST_ROOT=c:\\lib\\boost_1_67',
|
||||
'PROJECT_NAME=rippled',
|
||||
'MSBUILDDISABLENODEREUSE=1', // this ENV setting is probably redundant since we also pass /nr:false to msbuild
|
||||
'OPENSSL_ROOT=c:\\OpenSSL-Win64'])
|
||||
@@ -184,7 +184,7 @@ try {
|
||||
'LCOV_ROOT=""',
|
||||
'PATH+CMAKE_BIN=/opt/local/cmake',
|
||||
'GDB_ROOT=/opt/local/gdb',
|
||||
'BOOST_ROOT=/opt/local/boost_1_66_0',
|
||||
'BOOST_ROOT=/opt/local/boost_1_67_0',
|
||||
"USE_CCACHE=${ucc}"])
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ environment:
|
||||
# that it's a small download. We also use appveyor's free cache, avoiding fees
|
||||
# downloading from S3 each time.
|
||||
# TODO: script to create this package.
|
||||
RIPPLED_DEPS_PATH: rippled_deps17.01
|
||||
RIPPLED_DEPS_PATH: rippled_deps17.03
|
||||
RIPPLED_DEPS_URL: https://ripple.github.io/Downloads/appveyor/%RIPPLED_DEPS_PATH%.zip
|
||||
|
||||
# CMake honors these environment variables, setting the include/lib paths.
|
||||
|
||||
@@ -1707,7 +1707,7 @@ bool ApplicationImp::loadOldLedger (
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ledgerID.empty () || beast::detail::iequals(ledgerID, "latest"))
|
||||
else if (ledgerID.empty () || boost::beast::detail::iequals(ledgerID, "latest"))
|
||||
{
|
||||
loadLedger = getLastFullLedger ();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <ripple/core/Config.h>
|
||||
#include <ripple/protocol/Protocol.h>
|
||||
#include <ripple/beast/utility/PropertyStream.h>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#include <ripple/beast/core/LexicalCast.h>
|
||||
#include <ripple/beast/utility/rngfill.h>
|
||||
#include <ripple/basics/make_lock.h>
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
#include <boost/asio/ip/host_name.hpp>
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <ripple/ledger/ReadView.h>
|
||||
#include <ripple/net/InfoSub.h>
|
||||
#include <ripple/protocol/STValidation.h>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <memory>
|
||||
#include <deque>
|
||||
#include <tuple>
|
||||
|
||||
@@ -20,15 +20,15 @@
|
||||
#ifndef RIPPLE_APP_MISC_DETAIL_WORK_H_INCLUDED
|
||||
#define RIPPLE_APP_MISC_DETAIL_WORK_H_INCLUDED
|
||||
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/string_body.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/string_body.hpp>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
namespace detail {
|
||||
|
||||
using response_type =
|
||||
beast::http::response<beast::http::string_body>;
|
||||
boost::beast::http::response<boost::beast::http::string_body>;
|
||||
|
||||
class Work
|
||||
{
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
|
||||
#include <ripple/app/misc/detail/Work.h>
|
||||
#include <ripple/protocol/BuildInfo.h>
|
||||
#include <beast/core/multi_buffer.hpp>
|
||||
#include <beast/http/empty_body.hpp>
|
||||
#include <beast/http/read.hpp>
|
||||
#include <beast/http/write.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
#include <boost/beast/http/empty_body.hpp>
|
||||
#include <boost/beast/http/read.hpp>
|
||||
#include <boost/beast/http/write.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
|
||||
namespace ripple {
|
||||
@@ -48,7 +48,7 @@ protected:
|
||||
using resolver_type = boost::asio::ip::tcp::resolver;
|
||||
using query_type = resolver_type::query;
|
||||
using request_type =
|
||||
beast::http::request<beast::http::empty_body>;
|
||||
boost::beast::http::request<boost::beast::http::empty_body>;
|
||||
|
||||
std::string host_;
|
||||
std::string path_;
|
||||
@@ -60,7 +60,7 @@ protected:
|
||||
socket_type socket_;
|
||||
request_type req_;
|
||||
response_type res_;
|
||||
beast::multi_buffer read_buf_;
|
||||
boost::beast::multi_buffer read_buf_;
|
||||
|
||||
public:
|
||||
WorkBase(
|
||||
@@ -177,14 +177,14 @@ template<class Impl>
|
||||
void
|
||||
WorkBase<Impl>::onStart()
|
||||
{
|
||||
req_.method(beast::http::verb::get);
|
||||
req_.method(boost::beast::http::verb::get);
|
||||
req_.target(path_.empty() ? "/" : path_);
|
||||
req_.version = 11;
|
||||
req_.version(11);
|
||||
req_.set (
|
||||
"Host", host_ + ":" + port_);
|
||||
req_.set ("User-Agent", BuildInfo::getFullVersionString());
|
||||
req_.prepare_payload();
|
||||
beast::http::async_write(impl().stream(), req_,
|
||||
boost::beast::http::async_write(impl().stream(), req_,
|
||||
strand_.wrap (std::bind (&WorkBase::onRequest,
|
||||
impl().shared_from_this(), std::placeholders::_1)));
|
||||
}
|
||||
@@ -196,7 +196,7 @@ WorkBase<Impl>::onRequest(error_code const& ec)
|
||||
if (ec)
|
||||
return fail(ec);
|
||||
|
||||
beast::http::async_read (impl().stream(), read_buf_, res_,
|
||||
boost::beast::http::async_read (impl().stream(), read_buf_, res_,
|
||||
strand_.wrap (std::bind (&WorkBase::onResponse,
|
||||
impl().shared_from_this(), std::placeholders::_1)));
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <ripple/json/json_reader.h>
|
||||
#include <ripple/protocol/PublicKey.h>
|
||||
#include <ripple/protocol/Sign.h>
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <numeric>
|
||||
#include <stdexcept>
|
||||
@@ -182,7 +182,7 @@ ValidatorToken::make_ValidatorToken(std::vector<std::string> const& tokenBlob)
|
||||
for (auto const& line : tokenBlob)
|
||||
tokenStr += beast::rfc2616::trim(line);
|
||||
|
||||
tokenStr = beast::detail::base64_decode(tokenStr);
|
||||
tokenStr = boost::beast::detail::base64_decode(tokenStr);
|
||||
|
||||
Json::Reader r;
|
||||
Json::Value token;
|
||||
@@ -384,7 +384,7 @@ ManifestCache::load (
|
||||
if (! configManifest.empty())
|
||||
{
|
||||
auto mo = Manifest::make_Manifest (
|
||||
beast::detail::base64_decode(configManifest));
|
||||
boost::beast::detail::base64_decode(configManifest));
|
||||
if (! mo)
|
||||
{
|
||||
JLOG (j_.error()) << "Malformed validator_token in config";
|
||||
@@ -419,7 +419,7 @@ ManifestCache::load (
|
||||
revocationStr += beast::rfc2616::trim(line);
|
||||
|
||||
auto mo = Manifest::make_Manifest (
|
||||
beast::detail::base64_decode(revocationStr));
|
||||
boost::beast::detail::base64_decode(revocationStr));
|
||||
|
||||
if (! mo || ! mo->revoked() ||
|
||||
applyManifest (std::move(*mo)) == ManifestDisposition::invalid)
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/core/Config.h>
|
||||
#include <ripple/core/ConfigSections.h>
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
|
||||
namespace ripple {
|
||||
ValidatorKeys::ValidatorKeys(Config const& config, beast::Journal j)
|
||||
@@ -45,7 +45,8 @@ ValidatorKeys::ValidatorKeys(Config const& config, beast::Journal j)
|
||||
auto const pk = derivePublicKey(
|
||||
KeyType::secp256k1, token->validationSecret);
|
||||
auto const m = Manifest::make_Manifest(
|
||||
beast::detail::base64_decode(token->manifest));
|
||||
boost::beast::detail::base64_decode(token->manifest));
|
||||
|
||||
if (! m || pk != m->signingKey)
|
||||
{
|
||||
configInvalid_ = true;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ripple/basics/StringUtilities.h>
|
||||
#include <ripple/json/json_reader.h>
|
||||
#include <ripple/protocol/JsonFields.h>
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
namespace ripple {
|
||||
@@ -292,7 +292,7 @@ ValidatorList::applyList (
|
||||
for (auto const& valManifest : manifests)
|
||||
{
|
||||
auto m = Manifest::make_Manifest (
|
||||
beast::detail::base64_decode(valManifest));
|
||||
boost::beast::detail::base64_decode(valManifest));
|
||||
|
||||
if (! m || ! keyListings_.count (m->masterKey))
|
||||
{
|
||||
@@ -322,7 +322,7 @@ ValidatorList::verify (
|
||||
std::string const& blob,
|
||||
std::string const& signature)
|
||||
{
|
||||
auto m = Manifest::make_Manifest (beast::detail::base64_decode(manifest));
|
||||
auto m = Manifest::make_Manifest (boost::beast::detail::base64_decode(manifest));
|
||||
|
||||
if (! m || ! publisherLists_.count (m->masterKey))
|
||||
return ListDisposition::untrusted;
|
||||
@@ -343,7 +343,7 @@ ValidatorList::verify (
|
||||
return ListDisposition::untrusted;
|
||||
|
||||
auto const sig = strUnHex(signature);
|
||||
auto const data = beast::detail::base64_decode (blob);
|
||||
auto const data = boost::beast::detail::base64_decode (blob);
|
||||
if (! sig.second ||
|
||||
! ripple::verify (
|
||||
publisherManifests_.getSigningKey(pubKey),
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <ripple/basics/Slice.h>
|
||||
#include <ripple/json/json_reader.h>
|
||||
#include <ripple/protocol/JsonFields.h>
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
namespace ripple {
|
||||
@@ -207,7 +207,7 @@ ValidatorSite::onSiteFetch(
|
||||
detail::response_type&& res,
|
||||
std::size_t siteIdx)
|
||||
{
|
||||
if (! ec && res.result() != beast::http::status::ok)
|
||||
if (! ec && res.result() != boost::beast::http::status::ok)
|
||||
{
|
||||
std::lock_guard <std::mutex> lock{sites_mutex_};
|
||||
JLOG (j_.warn()) <<
|
||||
@@ -222,8 +222,8 @@ ValidatorSite::onSiteFetch(
|
||||
std::lock_guard <std::mutex> lock{sites_mutex_};
|
||||
Json::Reader r;
|
||||
Json::Value body;
|
||||
if (r.parse(res.body.data(), body) &&
|
||||
body.isObject() &&
|
||||
if (r.parse(res.body().data(), body) &&
|
||||
body.isObject () &&
|
||||
body.isMember("blob") && body["blob"].isString () &&
|
||||
body.isMember("manifest") && body["manifest"].isString () &&
|
||||
body.isMember("signature") && body["signature"].isString() &&
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <ripple/basics/contract.h>
|
||||
#include <beast/unit_test/detail/const_container.hpp>
|
||||
#include <beast/core/string.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <map>
|
||||
@@ -41,7 +41,7 @@ using IniFileSections = std::map<std::string, std::vector<std::string>>;
|
||||
*/
|
||||
class Section
|
||||
: public beast::unit_test::detail::const_container <
|
||||
std::map <std::string, std::string, beast::iless>>
|
||||
std::map <std::string, std::string, boost::beast::iless>>
|
||||
{
|
||||
private:
|
||||
std::string name_;
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
class BasicConfig
|
||||
{
|
||||
private:
|
||||
std::map <std::string, Section, beast::iless> map_;
|
||||
std::map <std::string, Section, boost::beast::iless> map_;
|
||||
|
||||
public:
|
||||
/** Returns `true` if a section with the given name exists. */
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define RIPPLE_BASICS_LOG_H_INCLUDED
|
||||
|
||||
#include <ripple/basics/UnorderedContainers.h>
|
||||
#include <beast/core/string.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <ripple/beast/utility/Journal.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <map>
|
||||
@@ -148,7 +148,7 @@ private:
|
||||
std::mutex mutable mutex_;
|
||||
std::map <std::string,
|
||||
std::unique_ptr<beast::Journal::Sink>,
|
||||
beast::iless> sinks_;
|
||||
boost::beast::iless> sinks_;
|
||||
beast::severities::Severity thresh_;
|
||||
File file_;
|
||||
bool silent_ = false;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <ripple/basics/win32_workaround.h>
|
||||
#include <ripple/beast/xor_shift_engine.h>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <boost/thread/tss.hpp>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
@@ -52,7 +52,7 @@ namespace detail {
|
||||
// Determines if a type can be called like an Engine
|
||||
template <class Engine, class Result = typename Engine::result_type>
|
||||
using is_engine =
|
||||
beast::detail::is_invocable<Engine, Result()>;
|
||||
boost::beast::detail::is_invocable<Engine, Result()>;
|
||||
}
|
||||
|
||||
/** Return the default random engine.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <ripple/beast/container/detail/aged_associative_container.h>
|
||||
#include <ripple/beast/container/aged_container.h>
|
||||
#include <ripple/beast/clock/abstract_clock.h>
|
||||
#include <beast/core/detail/empty_base_optimization.hpp>
|
||||
#include <boost/beast/core/detail/empty_base_optimization.hpp>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
#include <boost/intrusive/set.hpp>
|
||||
#include <boost/version.hpp>
|
||||
@@ -171,7 +171,7 @@ private:
|
||||
|
||||
// VFALCO TODO This should only be enabled for maps.
|
||||
class pair_value_compare
|
||||
: private empty_base_optimization <Compare>
|
||||
: public boost::beast::detail::empty_base_optimization <Compare>
|
||||
, public std::binary_function <value_type, value_type, bool>
|
||||
{
|
||||
public:
|
||||
@@ -185,7 +185,7 @@ private:
|
||||
}
|
||||
|
||||
pair_value_compare (pair_value_compare const& other)
|
||||
: empty_base_optimization <Compare> (other)
|
||||
: boost::beast::detail::empty_base_optimization <Compare> (other)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ private:
|
||||
friend aged_ordered_container;
|
||||
|
||||
pair_value_compare (Compare const& compare)
|
||||
: empty_base_optimization <Compare> (compare)
|
||||
: boost::beast::detail::empty_base_optimization <Compare> (compare)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -201,14 +201,14 @@ private:
|
||||
// Compares value_type against element, used in insert_check
|
||||
// VFALCO TODO hoist to remove template argument dependencies
|
||||
class KeyValueCompare
|
||||
: private empty_base_optimization <Compare>
|
||||
: public boost::beast::detail::empty_base_optimization <Compare>
|
||||
, public std::binary_function <Key, element, bool>
|
||||
{
|
||||
public:
|
||||
KeyValueCompare () = default;
|
||||
|
||||
KeyValueCompare (Compare const& compare)
|
||||
: empty_base_optimization <Compare> (compare)
|
||||
: boost::beast::detail::empty_base_optimization <Compare> (compare)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -245,12 +245,12 @@ private:
|
||||
|
||||
Compare& compare()
|
||||
{
|
||||
return empty_base_optimization <Compare>::member();
|
||||
return boost::beast::detail::empty_base_optimization <Compare>::member();
|
||||
}
|
||||
|
||||
Compare const& compare() const
|
||||
{
|
||||
return empty_base_optimization <Compare>::member();
|
||||
return boost::beast::detail::empty_base_optimization <Compare>::member();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -276,7 +276,7 @@ private:
|
||||
|
||||
class config_t
|
||||
: private KeyValueCompare
|
||||
, private empty_base_optimization <ElementAllocator>
|
||||
, public boost::beast::detail::empty_base_optimization <ElementAllocator>
|
||||
{
|
||||
public:
|
||||
explicit config_t (
|
||||
@@ -296,7 +296,7 @@ private:
|
||||
config_t (
|
||||
clock_type& clock_,
|
||||
Allocator const& alloc_)
|
||||
: empty_base_optimization <ElementAllocator> (alloc_)
|
||||
: boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
@@ -306,14 +306,14 @@ private:
|
||||
Compare const& comp,
|
||||
Allocator const& alloc_)
|
||||
: KeyValueCompare (comp)
|
||||
, empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
|
||||
config_t (config_t const& other)
|
||||
: KeyValueCompare (other.key_compare())
|
||||
, empty_base_optimization <ElementAllocator> (
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
ElementAllocatorTraits::
|
||||
select_on_container_copy_construction (
|
||||
other.alloc()))
|
||||
@@ -323,14 +323,14 @@ private:
|
||||
|
||||
config_t (config_t const& other, Allocator const& alloc)
|
||||
: KeyValueCompare (other.key_compare())
|
||||
, empty_base_optimization <ElementAllocator> (alloc)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, clock (other.clock)
|
||||
{
|
||||
}
|
||||
|
||||
config_t (config_t&& other)
|
||||
: KeyValueCompare (std::move (other.key_compare()))
|
||||
, empty_base_optimization <ElementAllocator> (
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
std::move (other))
|
||||
, clock (other.clock)
|
||||
{
|
||||
@@ -338,7 +338,7 @@ private:
|
||||
|
||||
config_t (config_t&& other, Allocator const& alloc)
|
||||
: KeyValueCompare (std::move (other.key_compare()))
|
||||
, empty_base_optimization <ElementAllocator> (alloc)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, clock (other.clock)
|
||||
{
|
||||
}
|
||||
@@ -384,13 +384,13 @@ private:
|
||||
|
||||
ElementAllocator& alloc()
|
||||
{
|
||||
return empty_base_optimization <
|
||||
return boost::beast::detail::empty_base_optimization <
|
||||
ElementAllocator>::member();
|
||||
}
|
||||
|
||||
ElementAllocator const& alloc() const
|
||||
{
|
||||
return empty_base_optimization <
|
||||
return boost::beast::detail::empty_base_optimization <
|
||||
ElementAllocator>::member();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <ripple/beast/container/detail/aged_associative_container.h>
|
||||
#include <ripple/beast/container/aged_container.h>
|
||||
#include <ripple/beast/clock/abstract_clock.h>
|
||||
#include <beast/core/detail/empty_base_optimization.hpp>
|
||||
#include <boost/beast/core/detail/empty_base_optimization.hpp>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
#include <boost/intrusive/unordered_set.hpp>
|
||||
#include <algorithm>
|
||||
@@ -163,7 +163,7 @@ private:
|
||||
|
||||
// VFALCO TODO hoist to remove template argument dependencies
|
||||
class ValueHash
|
||||
: private empty_base_optimization <Hash>
|
||||
: private boost::beast::detail::empty_base_optimization <Hash>
|
||||
, public std::unary_function <element, std::size_t>
|
||||
{
|
||||
public:
|
||||
@@ -172,7 +172,7 @@ private:
|
||||
}
|
||||
|
||||
ValueHash (Hash const& hash)
|
||||
: empty_base_optimization <Hash> (hash)
|
||||
: boost::beast::detail::empty_base_optimization <Hash> (hash)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ private:
|
||||
// Compares value_type against element, used in find/insert_check
|
||||
// VFALCO TODO hoist to remove template argument dependencies
|
||||
class KeyValueEqual
|
||||
: private empty_base_optimization <KeyEqual>
|
||||
: private boost::beast::detail::empty_base_optimization <KeyEqual>
|
||||
, public std::binary_function <Key, element, bool>
|
||||
{
|
||||
public:
|
||||
@@ -204,7 +204,7 @@ private:
|
||||
}
|
||||
|
||||
KeyValueEqual (KeyEqual const& keyEqual)
|
||||
: empty_base_optimization <KeyEqual> (keyEqual)
|
||||
: boost::beast::detail::empty_base_optimization <KeyEqual> (keyEqual)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ private:
|
||||
class config_t
|
||||
: private ValueHash
|
||||
, private KeyValueEqual
|
||||
, private empty_base_optimization <ElementAllocator>
|
||||
, private boost::beast::detail::empty_base_optimization <ElementAllocator>
|
||||
{
|
||||
public:
|
||||
explicit config_t (
|
||||
@@ -313,7 +313,7 @@ private:
|
||||
config_t (
|
||||
clock_type& clock_,
|
||||
Allocator const& alloc_)
|
||||
: empty_base_optimization <ElementAllocator> (alloc_)
|
||||
: boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
@@ -333,7 +333,7 @@ private:
|
||||
Hash const& hash,
|
||||
Allocator const& alloc_)
|
||||
: ValueHash (hash)
|
||||
, empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
@@ -343,7 +343,7 @@ private:
|
||||
KeyEqual const& keyEqual,
|
||||
Allocator const& alloc_)
|
||||
: KeyValueEqual (keyEqual)
|
||||
, empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
@@ -355,7 +355,7 @@ private:
|
||||
Allocator const& alloc_)
|
||||
: ValueHash (hash)
|
||||
, KeyValueEqual (keyEqual)
|
||||
, empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc_)
|
||||
, clock (clock_)
|
||||
{
|
||||
}
|
||||
@@ -363,7 +363,7 @@ private:
|
||||
config_t (config_t const& other)
|
||||
: ValueHash (other.hash_function())
|
||||
, KeyValueEqual (other.key_eq())
|
||||
, empty_base_optimization <ElementAllocator> (
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
ElementAllocatorTraits::
|
||||
select_on_container_copy_construction (
|
||||
other.alloc()))
|
||||
@@ -374,7 +374,7 @@ private:
|
||||
config_t (config_t const& other, Allocator const& alloc)
|
||||
: ValueHash (other.hash_function())
|
||||
, KeyValueEqual (other.key_eq())
|
||||
, empty_base_optimization <ElementAllocator> (alloc)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, clock (other.clock)
|
||||
{
|
||||
}
|
||||
@@ -382,7 +382,7 @@ private:
|
||||
config_t (config_t&& other)
|
||||
: ValueHash (std::move (other.hash_function()))
|
||||
, KeyValueEqual (std::move (other.key_eq()))
|
||||
, empty_base_optimization <ElementAllocator> (
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (
|
||||
std::move (other.alloc()))
|
||||
, clock (other.clock)
|
||||
{
|
||||
@@ -391,7 +391,7 @@ private:
|
||||
config_t (config_t&& other, Allocator const& alloc)
|
||||
: ValueHash (std::move (other.hash_function()))
|
||||
, KeyValueEqual (std::move (other.key_eq()))
|
||||
, empty_base_optimization <ElementAllocator> (alloc)
|
||||
, boost::beast::detail::empty_base_optimization <ElementAllocator> (alloc)
|
||||
, clock (other.clock)
|
||||
{
|
||||
}
|
||||
@@ -456,13 +456,13 @@ private:
|
||||
|
||||
ElementAllocator& alloc()
|
||||
{
|
||||
return empty_base_optimization <
|
||||
return boost::beast::detail::empty_base_optimization <
|
||||
ElementAllocator>::member();
|
||||
}
|
||||
|
||||
ElementAllocator const& alloc() const
|
||||
{
|
||||
return empty_base_optimization <
|
||||
return boost::beast::detail::empty_base_optimization <
|
||||
ElementAllocator>::member();
|
||||
}
|
||||
|
||||
|
||||
@@ -347,14 +347,14 @@ struct hash <beast::IP::Address>
|
||||
|
||||
namespace boost {
|
||||
template <>
|
||||
struct hash <beast::IP::Address>
|
||||
struct hash <::beast::IP::Address>
|
||||
{
|
||||
explicit hash() = default;
|
||||
|
||||
std::size_t
|
||||
operator() (beast::IP::Address const& addr) const
|
||||
operator() (::beast::IP::Address const& addr) const
|
||||
{
|
||||
return beast::uhash<>{} (addr);
|
||||
return ::beast::uhash<>{} (addr);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public:
|
||||
void
|
||||
hash_append (Hasher& h, Endpoint const& endpoint)
|
||||
{
|
||||
using beast::hash_append;
|
||||
using ::beast::hash_append;
|
||||
hash_append(h, endpoint.m_addr, endpoint.m_port);
|
||||
}
|
||||
|
||||
@@ -155,24 +155,24 @@ std::istream& operator>> (std::istream& is, Endpoint& endpoint);
|
||||
namespace std {
|
||||
/** std::hash support. */
|
||||
template <>
|
||||
struct hash <beast::IP::Endpoint>
|
||||
struct hash <::beast::IP::Endpoint>
|
||||
{
|
||||
explicit hash() = default;
|
||||
|
||||
std::size_t operator() (beast::IP::Endpoint const& endpoint) const
|
||||
{ return beast::uhash<>{} (endpoint); }
|
||||
std::size_t operator() (::beast::IP::Endpoint const& endpoint) const
|
||||
{ return ::beast::uhash<>{} (endpoint); }
|
||||
};
|
||||
}
|
||||
|
||||
namespace boost {
|
||||
/** boost::hash support. */
|
||||
template <>
|
||||
struct hash <beast::IP::Endpoint>
|
||||
struct hash <::beast::IP::Endpoint>
|
||||
{
|
||||
explicit hash() = default;
|
||||
|
||||
std::size_t operator() (beast::IP::Endpoint const& endpoint) const
|
||||
{ return beast::uhash<>{} (endpoint); }
|
||||
std::size_t operator() (::beast::IP::Endpoint const& endpoint) const
|
||||
{ return ::beast::uhash<>{} (endpoint); }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
#ifndef BEAST_RFC2616_HPP
|
||||
#define BEAST_RFC2616_HPP
|
||||
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/rfc7230.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/rfc7230.hpp>
|
||||
#include <boost/range/algorithm/equal.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/utility/string_ref.hpp>
|
||||
@@ -282,7 +282,7 @@ split_commas(FwdIt first, FwdIt last)
|
||||
|
||||
template <class Result = std::vector<std::string>>
|
||||
Result
|
||||
split_commas(beast::string_view const& s)
|
||||
split_commas(boost::beast::string_view const& s)
|
||||
{
|
||||
return split_commas(s.begin(), s.end());
|
||||
}
|
||||
@@ -471,13 +471,13 @@ token_in_list(boost::string_ref const& value,
|
||||
|
||||
template<bool isRequest, class Body, class Fields>
|
||||
bool
|
||||
is_keep_alive(beast::http::message<isRequest, Body, Fields> const& m)
|
||||
is_keep_alive(boost::beast::http::message<isRequest, Body, Fields> const& m)
|
||||
{
|
||||
if(m.version <= 10)
|
||||
return beast::http::token_list{
|
||||
m[beast::http::field::connection]}.exists("keep-alive");
|
||||
return ! beast::http::token_list{
|
||||
m[beast::http::field::connection]}.exists("close");
|
||||
if(m.version() <= 10)
|
||||
return boost::beast::http::token_list{
|
||||
m[boost::beast::http::field::connection]}.exists("keep-alive");
|
||||
return ! boost::beast::http::token_list{
|
||||
m[boost::beast::http::field::connection]}.exists("close");
|
||||
}
|
||||
|
||||
} // rfc2616
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef BEAST_WEAK_FN_H_INCLUDED
|
||||
#define BEAST_WEAK_FN_H_INCLUDED
|
||||
|
||||
#include <beast/core/detail/empty_base_optimization.hpp>
|
||||
#include <boost/beast/core/detail/empty_base_optimization.hpp>
|
||||
#include <memory>
|
||||
|
||||
// Original version:
|
||||
@@ -91,7 +91,7 @@ namespace detail {
|
||||
|
||||
template <class T, class R, class Policy, class... Args>
|
||||
class weak_binder
|
||||
: private beast::detail::empty_base_optimization<Policy>
|
||||
: private boost::beast::detail::empty_base_optimization<Policy>
|
||||
{
|
||||
private:
|
||||
using member_type = R (T::*)(Args...);
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
|
||||
weak_binder (member_type member,
|
||||
Policy policy, pointer_type object)
|
||||
: beast::detail::empty_base_optimization<Policy>(std::move(policy))
|
||||
: boost::beast::detail::empty_base_optimization<Policy>(std::move(policy))
|
||||
, member_(member)
|
||||
, object_(object)
|
||||
{ }
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <ripple/basics/base_uint.h>
|
||||
#include <ripple/protocol/SystemParameters.h> // VFALCO Breaks levelization
|
||||
#include <ripple/beast/net/IPEndpoint.h>
|
||||
#include <beast/core/string.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <ripple/beast/utility/Journal.h>
|
||||
#include <boost/asio/ip/tcp.hpp> // VFALCO FIX: This include should not be here
|
||||
#include <boost/filesystem.hpp> // VFALCO FIX: This include should not be here
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <ripple/protocol/SystemParameters.h>
|
||||
#include <ripple/net/HTTPClient.h>
|
||||
#include <ripple/beast/core/LexicalCast.h>
|
||||
#include <beast/core/string.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
@@ -324,15 +324,15 @@ void Config::loadFromString (std::string const& fileContents)
|
||||
|
||||
if (getSingleSection (secConfig, SECTION_NODE_SIZE, strTemp, j_))
|
||||
{
|
||||
if (beast::detail::iequals(strTemp, "tiny"))
|
||||
if (boost::beast::detail::iequals(strTemp, "tiny"))
|
||||
NODE_SIZE = 0;
|
||||
else if (beast::detail::iequals(strTemp, "small"))
|
||||
else if (boost::beast::detail::iequals(strTemp, "small"))
|
||||
NODE_SIZE = 1;
|
||||
else if (beast::detail::iequals(strTemp, "medium"))
|
||||
else if (boost::beast::detail::iequals(strTemp, "medium"))
|
||||
NODE_SIZE = 2;
|
||||
else if (beast::detail::iequals(strTemp, "large"))
|
||||
else if (boost::beast::detail::iequals(strTemp, "large"))
|
||||
NODE_SIZE = 3;
|
||||
else if (beast::detail::iequals(strTemp, "huge"))
|
||||
else if (boost::beast::detail::iequals(strTemp, "huge"))
|
||||
NODE_SIZE = 4;
|
||||
else
|
||||
{
|
||||
@@ -379,9 +379,9 @@ void Config::loadFromString (std::string const& fileContents)
|
||||
|
||||
if (getSingleSection (secConfig, SECTION_LEDGER_HISTORY, strTemp, j_))
|
||||
{
|
||||
if (beast::detail::iequals(strTemp, "full"))
|
||||
if (boost::beast::detail::iequals(strTemp, "full"))
|
||||
LEDGER_HISTORY = 1000000000u;
|
||||
else if (beast::detail::iequals(strTemp, "none"))
|
||||
else if (boost::beast::detail::iequals(strTemp, "none"))
|
||||
LEDGER_HISTORY = 0;
|
||||
else
|
||||
LEDGER_HISTORY = beast::lexicalCastThrow <std::uint32_t> (strTemp);
|
||||
@@ -389,9 +389,9 @@ void Config::loadFromString (std::string const& fileContents)
|
||||
|
||||
if (getSingleSection (secConfig, SECTION_FETCH_DEPTH, strTemp, j_))
|
||||
{
|
||||
if (beast::detail::iequals(strTemp, "none"))
|
||||
if (boost::beast::detail::iequals(strTemp, "none"))
|
||||
FETCH_DEPTH = 0;
|
||||
else if (beast::detail::iequals(strTemp, "full"))
|
||||
else if (boost::beast::detail::iequals(strTemp, "full"))
|
||||
FETCH_DEPTH = 1000000000u;
|
||||
else
|
||||
FETCH_DEPTH = beast::lexicalCastThrow <std::uint32_t> (strTemp);
|
||||
|
||||
@@ -20,19 +20,19 @@
|
||||
#ifndef RIPPLE_JSON_OUTPUT_H_INCLUDED
|
||||
#define RIPPLE_JSON_OUTPUT_H_INCLUDED
|
||||
|
||||
#include <beast/core/string.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace Json {
|
||||
|
||||
class Value;
|
||||
|
||||
using Output = std::function <void (beast::string_view const&)>;
|
||||
using Output = std::function <void (boost::beast::string_view const&)>;
|
||||
|
||||
inline
|
||||
Output stringOutput (std::string& s)
|
||||
{
|
||||
return [&](beast::string_view const& b) { s.append (b.data(), b.size()); };
|
||||
return [&](boost::beast::string_view const& b) { s.append (b.data(), b.size()); };
|
||||
}
|
||||
|
||||
/** Writes a minimal representation of a Json value to an Output in O(n) time.
|
||||
|
||||
@@ -92,13 +92,13 @@ public:
|
||||
stack_.top().type = ct;
|
||||
}
|
||||
|
||||
void output (beast::string_view const& bytes)
|
||||
void output (boost::beast::string_view const& bytes)
|
||||
{
|
||||
markStarted ();
|
||||
output_ (bytes);
|
||||
}
|
||||
|
||||
void stringOutput (beast::string_view const& bytes)
|
||||
void stringOutput (boost::beast::string_view const& bytes)
|
||||
{
|
||||
markStarted ();
|
||||
std::size_t position = 0, writtenUntil = 0;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <ripple/basics/Log.h>
|
||||
#include <ripple/beast/net/IPAddressConversion.h>
|
||||
#include <beast/core/bind_handler.hpp>
|
||||
#include <boost/beast/core/bind_handler.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
@@ -177,7 +177,7 @@ public:
|
||||
// must be plain
|
||||
mSecure = false;
|
||||
mSocket->get_io_service ().post (
|
||||
beast::bind_handler (cbFunc, error_code()));
|
||||
boost::beast::bind_handler (cbFunc, error_code()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
ec = e.code();
|
||||
}
|
||||
mSocket->get_io_service ().post (
|
||||
beast::bind_handler (handler, ec));
|
||||
boost::beast::bind_handler (handler, ec));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <ripple/protocol/types.h>
|
||||
#include <ripple/rpc/ServerHandler.h>
|
||||
#include <ripple/beast/core/LexicalCast.h>
|
||||
#include <beast/core/string.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/asio/streambuf.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
@@ -424,9 +424,9 @@ private:
|
||||
// This may look reversed, but it's intentional: jss::vetoed
|
||||
// determines whether an amendment is vetoed - so "reject" means
|
||||
// that jss::vetoed is true.
|
||||
if (beast::detail::iequals(action, "reject"))
|
||||
if (boost::beast::detail::iequals(action, "reject"))
|
||||
jvRequest[jss::vetoed] = Json::Value (true);
|
||||
else if (beast::detail::iequals(action, "accept"))
|
||||
else if (boost::beast::detail::iequals(action, "accept"))
|
||||
jvRequest[jss::vetoed] = Json::Value (false);
|
||||
else
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
@@ -1476,7 +1476,7 @@ void fromNetwork (
|
||||
}
|
||||
|
||||
// HTTP basic authentication
|
||||
auto const auth = beast::detail::base64_encode(strUsername + ":" + strPassword);
|
||||
auto const auth = boost::beast::detail::base64_encode(strUsername + ":" + strPassword);
|
||||
|
||||
std::map<std::string, std::string> mapRequestHeaders;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <ripple/basics/contract.h>
|
||||
#include <ripple/nodestore/Factory.h>
|
||||
#include <ripple/nodestore/Manager.h>
|
||||
#include <beast/core/string.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
@@ -41,7 +41,7 @@ class MemoryFactory : public Factory
|
||||
{
|
||||
private:
|
||||
std::mutex mutex_;
|
||||
std::map <std::string, MemoryDB, beast::iless> map_;
|
||||
std::map <std::string, MemoryDB, boost::beast::iless> map_;
|
||||
|
||||
public:
|
||||
MemoryFactory();
|
||||
|
||||
@@ -110,7 +110,7 @@ ManagerImp::find (std::string const& name)
|
||||
auto const iter = std::find_if(list_.begin(), list_.end(),
|
||||
[&name](Factory* other)
|
||||
{
|
||||
return beast::detail::iequals(name, other->getName());
|
||||
return boost::beast::detail::iequals(name, other->getName());
|
||||
} );
|
||||
if (iter == list_.end())
|
||||
return nullptr;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <ripple/overlay/PeerSet.h>
|
||||
#include <ripple/server/Handoff.h>
|
||||
#include <ripple/beast/asio/ssl_bundle.h>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <ripple/core/Stoppable.h>
|
||||
#include <ripple/beast/utility/PropertyStream.h>
|
||||
#include <memory>
|
||||
|
||||
@@ -219,7 +219,7 @@ ConnectAttempt::onHandshake (error_code ec)
|
||||
appendHello (req_, hello);
|
||||
|
||||
setTimer();
|
||||
beast::http::async_write(stream_, req_,
|
||||
boost::beast::http::async_write(stream_, req_,
|
||||
strand_.wrap (std::bind (&ConnectAttempt::onWrite,
|
||||
shared_from_this(), std::placeholders::_1)));
|
||||
}
|
||||
@@ -234,7 +234,7 @@ ConnectAttempt::onWrite (error_code ec)
|
||||
return;
|
||||
if(ec)
|
||||
return fail("onWrite", ec);
|
||||
beast::http::async_read(stream_, read_buf_, response_,
|
||||
boost::beast::http::async_read(stream_, read_buf_, response_,
|
||||
strand_.wrap(std::bind(&ConnectAttempt::onRead,
|
||||
shared_from_this(), std::placeholders::_1)));
|
||||
}
|
||||
@@ -285,9 +285,9 @@ ConnectAttempt::makeRequest (bool crawl,
|
||||
request_type
|
||||
{
|
||||
request_type m;
|
||||
m.method(beast::http::verb::get);
|
||||
m.method(boost::beast::http::verb::get);
|
||||
m.target("/");
|
||||
m.version = 11;
|
||||
m.version(11);
|
||||
m.insert ("User-Agent", BuildInfo::getFullVersionString());
|
||||
m.insert ("Upgrade", "RTXP/1.2");
|
||||
//std::string("RTXP/") + to_string (BuildInfo::getCurrentProtocol()));
|
||||
@@ -300,13 +300,13 @@ ConnectAttempt::makeRequest (bool crawl,
|
||||
void
|
||||
ConnectAttempt::processResponse()
|
||||
{
|
||||
if (response_.result() == beast::http::status::service_unavailable)
|
||||
if (response_.result() == boost::beast::http::status::service_unavailable)
|
||||
{
|
||||
Json::Value json;
|
||||
Json::Reader r;
|
||||
std::string s;
|
||||
s.reserve(boost::asio::buffer_size(response_.body.data()));
|
||||
for(auto const& buffer : response_.body.data())
|
||||
s.reserve(boost::asio::buffer_size(response_.body().data()));
|
||||
for(auto const& buffer : response_.body().data())
|
||||
s.append(
|
||||
boost::asio::buffer_cast<char const*>(buffer),
|
||||
boost::asio::buffer_size(buffer));
|
||||
|
||||
@@ -37,10 +37,10 @@ private:
|
||||
using endpoint_type = boost::asio::ip::tcp::endpoint;
|
||||
|
||||
using request_type =
|
||||
beast::http::request<beast::http::empty_body>;
|
||||
boost::beast::http::request<boost::beast::http::empty_body>;
|
||||
|
||||
using response_type =
|
||||
beast::http::response<beast::http::dynamic_body>;
|
||||
boost::beast::http::response<boost::beast::http::dynamic_body>;
|
||||
|
||||
Application& app_;
|
||||
std::uint32_t const id_;
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
std::unique_ptr<beast::asio::ssl_bundle> ssl_bundle_;
|
||||
beast::asio::ssl_bundle::socket_type& socket_;
|
||||
beast::asio::ssl_bundle::stream_type& stream_;
|
||||
beast::multi_buffer read_buf_;
|
||||
boost::beast::multi_buffer read_buf_;
|
||||
response_type response_;
|
||||
PeerFinder::Slot::ptr slot_;
|
||||
request_type req_;
|
||||
|
||||
@@ -213,7 +213,7 @@ OverlayImpl::onHandoff (std::unique_ptr <beast::asio::ssl_bundle>&& ssl_bundle,
|
||||
if (std::find_if(types.begin(), types.end(),
|
||||
[](std::string const& s)
|
||||
{
|
||||
return beast::detail::iequals(s, "peer");
|
||||
return boost::beast::detail::iequals(s, "peer");
|
||||
}) == types.end())
|
||||
{
|
||||
handoff.moved = false;
|
||||
@@ -327,17 +327,17 @@ std::shared_ptr<Writer>
|
||||
OverlayImpl::makeRedirectResponse (PeerFinder::Slot::ptr const& slot,
|
||||
http_request_type const& request, address_type remote_address)
|
||||
{
|
||||
beast::http::response<json_body> msg;
|
||||
msg.version = request.version;
|
||||
msg.result(beast::http::status::service_unavailable);
|
||||
boost::beast::http::response<json_body> msg;
|
||||
msg.version(request.version());
|
||||
msg.result(boost::beast::http::status::service_unavailable);
|
||||
msg.insert("Server", BuildInfo::getFullVersionString());
|
||||
msg.insert("Remote-Address", remote_address);
|
||||
msg.insert("Content-Type", "application/json");
|
||||
msg.insert(beast::http::field::connection, "close");
|
||||
msg.body = Json::objectValue;
|
||||
msg.insert(boost::beast::http::field::connection, "close");
|
||||
msg.body() = Json::objectValue;
|
||||
{
|
||||
auto const result = m_peerFinder->redirect(slot);
|
||||
Json::Value& ips = (msg.body["peer-ips"] = Json::arrayValue);
|
||||
Json::Value& ips = (msg.body()["peer-ips"] = Json::arrayValue);
|
||||
for (auto const& _ : m_peerFinder->redirect(slot))
|
||||
ips.append(_.address.to_string());
|
||||
}
|
||||
@@ -351,13 +351,13 @@ OverlayImpl::makeErrorResponse (PeerFinder::Slot::ptr const& slot,
|
||||
address_type remote_address,
|
||||
std::string text)
|
||||
{
|
||||
beast::http::response<beast::http::string_body> msg;
|
||||
msg.version = request.version;
|
||||
msg.result(beast::http::status::bad_request);
|
||||
boost::beast::http::response<boost::beast::http::string_body> msg;
|
||||
msg.version(request.version());
|
||||
msg.result(boost::beast::http::status::bad_request);
|
||||
msg.insert("Server", BuildInfo::getFullVersionString());
|
||||
msg.insert("Remote-Address", remote_address.to_string());
|
||||
msg.insert(beast::http::field::connection, "close");
|
||||
msg.body = text;
|
||||
msg.insert(boost::beast::http::field::connection, "close");
|
||||
msg.body() = text;
|
||||
msg.prepare_payload();
|
||||
return std::make_shared<SimpleWriter>(msg);
|
||||
}
|
||||
@@ -762,7 +762,7 @@ OverlayImpl::crawl()
|
||||
for_each ([&](std::shared_ptr<PeerImp>&& sp)
|
||||
{
|
||||
auto& pv = av.append(Json::Value(Json::objectValue));
|
||||
pv[jss::public_key] = beast::detail::base64_encode(
|
||||
pv[jss::public_key] = boost::beast::detail::base64_encode(
|
||||
sp->getNodePublic().data(),
|
||||
sp->getNodePublic().size());
|
||||
pv[jss::type] = sp->slot()->inbound() ?
|
||||
@@ -817,13 +817,13 @@ OverlayImpl::processRequest (http_request_type const& req,
|
||||
if (req.target() != "/crawl")
|
||||
return false;
|
||||
|
||||
beast::http::response<json_body> msg;
|
||||
msg.version = req.version;
|
||||
msg.result(beast::http::status::ok);
|
||||
boost::beast::http::response<json_body> msg;
|
||||
msg.version(req.version());
|
||||
msg.result(boost::beast::http::status::ok);
|
||||
msg.insert("Server", BuildInfo::getFullVersionString());
|
||||
msg.insert("Content-Type", "application/json");
|
||||
msg.insert("Connection", "close");
|
||||
msg.body["overlay"] = crawl();
|
||||
msg.body()["overlay"] = crawl();
|
||||
msg.prepare_payload();
|
||||
handoff.response = std::make_shared<SimpleWriter>(msg);
|
||||
return true;
|
||||
|
||||
@@ -255,11 +255,11 @@ public:
|
||||
template<class Body>
|
||||
static
|
||||
bool
|
||||
isPeerUpgrade (beast::http::response<Body> const& response)
|
||||
isPeerUpgrade (boost::beast::http::response<Body> const& response)
|
||||
{
|
||||
if (! is_upgrade(response))
|
||||
return false;
|
||||
if(response.result() != beast::http::status::switching_protocols)
|
||||
if(response.result() != boost::beast::http::status::switching_protocols)
|
||||
return false;
|
||||
auto const versions = parse_ProtocolVersions(
|
||||
response["Upgrade"]);
|
||||
@@ -271,13 +271,13 @@ public:
|
||||
template<class Fields>
|
||||
static
|
||||
bool
|
||||
is_upgrade(beast::http::header<true, Fields> const& req)
|
||||
is_upgrade(boost::beast::http::header<true, Fields> const& req)
|
||||
{
|
||||
if(req.version < 11)
|
||||
if(req.version() < 11)
|
||||
return false;
|
||||
if(req.method() != beast::http::verb::get)
|
||||
if(req.method() != boost::beast::http::verb::get)
|
||||
return false;
|
||||
if(! beast::http::token_list{req["Connection"]}.exists("upgrade"))
|
||||
if(! boost::beast::http::token_list{req["Connection"]}.exists("upgrade"))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -285,11 +285,11 @@ public:
|
||||
template<class Fields>
|
||||
static
|
||||
bool
|
||||
is_upgrade(beast::http::header<false, Fields> const& req)
|
||||
is_upgrade(boost::beast::http::header<false, Fields> const& req)
|
||||
{
|
||||
if(req.version < 11)
|
||||
if(req.version() < 11)
|
||||
return false;
|
||||
if(! beast::http::token_list{req["Connection"]}.exists("upgrade"))
|
||||
if(! boost::beast::http::token_list{req["Connection"]}.exists("upgrade"))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ PeerImp::crawl() const
|
||||
auto const iter = headers_.find("Crawl");
|
||||
if (iter == headers_.end())
|
||||
return false;
|
||||
return beast::detail::iequals(iter->value(), "public");
|
||||
return boost::beast::detail::iequals(iter->value(), "public");
|
||||
}
|
||||
|
||||
std::string
|
||||
@@ -621,7 +621,7 @@ void PeerImp::doAccept()
|
||||
|
||||
// TODO Apply headers to connection state.
|
||||
|
||||
beast::ostream(write_buffer_) << makeResponse(
|
||||
boost::beast::ostream(write_buffer_) << makeResponse(
|
||||
! overlay_.peerFinder().config().peerPrivate,
|
||||
request_, remote_address_, *sharedValue);
|
||||
|
||||
@@ -669,8 +669,8 @@ PeerImp::makeResponse (bool crawl,
|
||||
uint256 const& sharedValue)
|
||||
{
|
||||
http_response_type resp;
|
||||
resp.result(beast::http::status::switching_protocols);
|
||||
resp.version = req.version;
|
||||
resp.result(boost::beast::http::status::switching_protocols);
|
||||
resp.version(req.version());
|
||||
resp.insert("Connection", "Upgrade");
|
||||
resp.insert("Upgrade", "RTXP/1.2");
|
||||
resp.insert("Connect-As", "Peer");
|
||||
|
||||
@@ -143,11 +143,11 @@ private:
|
||||
Resource::Consumer usage_;
|
||||
Resource::Charge fee_;
|
||||
PeerFinder::Slot::ptr slot_;
|
||||
beast::multi_buffer read_buffer_;
|
||||
boost::beast::multi_buffer read_buffer_;
|
||||
http_request_type request_;
|
||||
http_response_type response_;
|
||||
beast::http::fields const& headers_;
|
||||
beast::multi_buffer write_buffer_;
|
||||
boost::beast::http::fields const& headers_;
|
||||
boost::beast::multi_buffer write_buffer_;
|
||||
std::queue<Message::pointer> send_queue_;
|
||||
bool gracefulClose_ = false;
|
||||
int large_sendq_ = 0;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ripple/beast/rfc2616.h>
|
||||
#include <ripple/beast/core/LexicalCast.h>
|
||||
#include <ripple/protocol/digest.h>
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <algorithm>
|
||||
|
||||
@@ -150,14 +150,14 @@ buildHello (
|
||||
}
|
||||
|
||||
void
|
||||
appendHello (beast::http::fields& h,
|
||||
appendHello (boost::beast::http::fields& h,
|
||||
protocol::TMHello const& hello)
|
||||
{
|
||||
//h.append ("Protocol-Versions",...
|
||||
|
||||
h.insert ("Public-Key", hello.nodepublic());
|
||||
|
||||
h.insert ("Session-Signature", beast::detail::base64_encode (
|
||||
h.insert ("Session-Signature", boost::beast::detail::base64_encode (
|
||||
hello.nodeproof()));
|
||||
|
||||
if (hello.has_nettime())
|
||||
@@ -167,11 +167,11 @@ appendHello (beast::http::fields& h,
|
||||
h.insert ("Ledger", std::to_string (hello.ledgerindex()));
|
||||
|
||||
if (hello.has_ledgerclosed())
|
||||
h.insert ("Closed-Ledger", beast::detail::base64_encode (
|
||||
h.insert ("Closed-Ledger", boost::beast::detail::base64_encode (
|
||||
hello.ledgerclosed()));
|
||||
|
||||
if (hello.has_ledgerprevious())
|
||||
h.insert ("Previous-Ledger", beast::detail::base64_encode (
|
||||
h.insert ("Previous-Ledger", boost::beast::detail::base64_encode (
|
||||
hello.ledgerprevious()));
|
||||
|
||||
if (hello.has_local_ip())
|
||||
@@ -184,7 +184,7 @@ appendHello (beast::http::fields& h,
|
||||
}
|
||||
|
||||
std::vector<ProtocolVersion>
|
||||
parse_ProtocolVersions(beast::string_view const& value)
|
||||
parse_ProtocolVersions(boost::beast::string_view const& value)
|
||||
{
|
||||
static boost::regex re (
|
||||
"^" // start of line
|
||||
@@ -218,7 +218,7 @@ parse_ProtocolVersions(beast::string_view const& value)
|
||||
}
|
||||
|
||||
boost::optional<protocol::TMHello>
|
||||
parseHello (bool request, beast::http::fields const& h, beast::Journal journal)
|
||||
parseHello (bool request, boost::beast::http::fields const& h, beast::Journal journal)
|
||||
{
|
||||
// protocol version in TMHello is obsolete,
|
||||
// it is supplanted by the values in the headers.
|
||||
@@ -258,7 +258,7 @@ parseHello (bool request, beast::http::fields const& h, beast::Journal journal)
|
||||
if (iter == h.end())
|
||||
return boost::none;
|
||||
// TODO Security Review
|
||||
hello.set_nodeproof (beast::detail::base64_decode (iter->value().to_string()));
|
||||
hello.set_nodeproof (boost::beast::detail::base64_decode (iter->value().to_string()));
|
||||
}
|
||||
|
||||
{
|
||||
@@ -293,13 +293,13 @@ parseHello (bool request, beast::http::fields const& h, beast::Journal journal)
|
||||
{
|
||||
auto const iter = h.find ("Closed-Ledger");
|
||||
if (iter != h.end())
|
||||
hello.set_ledgerclosed (beast::detail::base64_decode (iter->value().to_string()));
|
||||
hello.set_ledgerclosed (boost::beast::detail::base64_decode (iter->value().to_string()));
|
||||
}
|
||||
|
||||
{
|
||||
auto const iter = h.find ("Previous-Ledger");
|
||||
if (iter != h.end())
|
||||
hello.set_ledgerprevious (beast::detail::base64_decode (iter->value().to_string()));
|
||||
hello.set_ledgerprevious (boost::beast::detail::base64_decode (iter->value().to_string()));
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <ripple/beast/utility/Journal.h>
|
||||
#include <ripple/protocol/BuildInfo.h>
|
||||
|
||||
#include <beast/http/message.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <utility>
|
||||
@@ -56,14 +56,14 @@ buildHello (uint256 const& sharedValue,
|
||||
|
||||
/** Insert HTTP headers based on the TMHello protocol message. */
|
||||
void
|
||||
appendHello (beast::http::fields& h, protocol::TMHello const& hello);
|
||||
appendHello (boost::beast::http::fields& h, protocol::TMHello const& hello);
|
||||
|
||||
/** Parse HTTP headers into TMHello protocol message.
|
||||
@return A protocol message on success; an empty optional
|
||||
if the parsing failed.
|
||||
*/
|
||||
boost::optional<protocol::TMHello>
|
||||
parseHello (bool request, beast::http::fields const& h, beast::Journal journal);
|
||||
parseHello (bool request, boost::beast::http::fields const& h, beast::Journal journal);
|
||||
|
||||
/** Validate and store the public key in the TMHello.
|
||||
This includes signature verification on the shared value.
|
||||
@@ -82,7 +82,7 @@ verifyHello (protocol::TMHello const& h, uint256 const& sharedValue,
|
||||
excluded from the result set.
|
||||
*/
|
||||
std::vector<ProtocolVersion>
|
||||
parse_ProtocolVersions(beast::string_view const& s);
|
||||
parse_ProtocolVersions(boost::beast::string_view const& s);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -39,9 +39,9 @@
|
||||
#include <ripple/rpc/impl/Tuning.h>
|
||||
#include <ripple/rpc/RPCHandler.h>
|
||||
#include <ripple/server/SimpleWriter.h>
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <beast/http/fields.hpp>
|
||||
#include <beast/http/string_body.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/http/fields.hpp>
|
||||
#include <boost/beast/http/string_body.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/type_traits.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
@@ -57,10 +57,10 @@ isStatusRequest(
|
||||
http_request_type const& request)
|
||||
{
|
||||
return
|
||||
request.version >= 11 &&
|
||||
request.version() >= 11 &&
|
||||
request.target() == "/" &&
|
||||
request.body.size() == 0 &&
|
||||
request.method() == beast::http::verb::get;
|
||||
request.body().size() == 0 &&
|
||||
request.method() == boost::beast::http::verb::get;
|
||||
}
|
||||
|
||||
static
|
||||
@@ -68,21 +68,21 @@ Handoff
|
||||
unauthorizedResponse(
|
||||
http_request_type const& request)
|
||||
{
|
||||
using namespace beast::http;
|
||||
using namespace boost::beast::http;
|
||||
Handoff handoff;
|
||||
response<string_body> msg;
|
||||
msg.version = request.version;
|
||||
msg.result(beast::http::status::unauthorized);
|
||||
msg.version(request.version());
|
||||
msg.result(boost::beast::http::status::unauthorized);
|
||||
msg.insert("Server", BuildInfo::getFullVersionString());
|
||||
msg.insert("Content-Type", "text/html");
|
||||
msg.insert("Connection", "close");
|
||||
msg.body = "Invalid protocol.";
|
||||
msg.body() = "Invalid protocol.";
|
||||
msg.prepare_payload();
|
||||
handoff.response = std::make_shared<SimpleWriter>(msg);
|
||||
return handoff;
|
||||
}
|
||||
|
||||
// VFALCO TODO Rewrite to use beast::http::fields
|
||||
// VFALCO TODO Rewrite to use boost::beast::http::fields
|
||||
static
|
||||
bool
|
||||
authorized (
|
||||
@@ -97,7 +97,7 @@ authorized (
|
||||
return false;
|
||||
std::string strUserPass64 = it->second.substr (6);
|
||||
boost::trim (strUserPass64);
|
||||
std::string strUserPass = beast::detail::base64_decode (strUserPass64);
|
||||
std::string strUserPass = boost::beast::detail::base64_decode (strUserPass64);
|
||||
std::string::size_type nColon = strUserPass.find (":");
|
||||
if (nColon == std::string::npos)
|
||||
return false;
|
||||
@@ -178,7 +178,7 @@ ServerHandlerImp::onHandoff (Session& session,
|
||||
(session.port().protocol.count("wss") > 0) ||
|
||||
(session.port().protocol.count("wss2") > 0);
|
||||
|
||||
if(beast::websocket::is_upgrade(request))
|
||||
if(boost::beast::websocket::is_upgrade(request))
|
||||
{
|
||||
if(is_ws)
|
||||
{
|
||||
@@ -218,7 +218,7 @@ ServerHandlerImp::onHandoff (Session& session,
|
||||
boost::asio::ip::tcp::endpoint remote_address) ->
|
||||
Handoff
|
||||
{
|
||||
if(beast::websocket::is_upgrade(request))
|
||||
if(boost::beast::websocket::is_upgrade(request))
|
||||
{
|
||||
if (session.port().protocol.count("ws2") > 0 ||
|
||||
session.port().protocol.count("ws") > 0)
|
||||
@@ -250,7 +250,7 @@ ServerHandlerImp::onHandoff (Session& session,
|
||||
static inline
|
||||
Json::Output makeOutput (Session& session)
|
||||
{
|
||||
return [&](beast::string_view const& b)
|
||||
return [&](boost::beast::string_view const& b)
|
||||
{
|
||||
session.write (b.data(), b.size());
|
||||
};
|
||||
@@ -259,7 +259,7 @@ Json::Output makeOutput (Session& session)
|
||||
// HACK!
|
||||
static
|
||||
std::map<std::string, std::string>
|
||||
build_map(beast::http::fields const& h)
|
||||
build_map(boost::beast::http::fields const& h)
|
||||
{
|
||||
std::map <std::string, std::string> c;
|
||||
for (auto const& e : h)
|
||||
@@ -343,7 +343,7 @@ ServerHandlerImp::onWSMessage(
|
||||
jvResult[jss::type] = jss::error;
|
||||
jvResult[jss::error] = "jsonInvalid";
|
||||
jvResult[jss::value] = buffers_to_string(buffers);
|
||||
beast::multi_buffer sb;
|
||||
boost::beast::multi_buffer sb;
|
||||
Json::stream(jvResult,
|
||||
[&sb](auto const p, auto const n)
|
||||
{
|
||||
@@ -369,7 +369,7 @@ ServerHandlerImp::onWSMessage(
|
||||
this->processSession(session, coro, jv);
|
||||
auto const s = to_string(jr);
|
||||
auto const n = s.length();
|
||||
beast::multi_buffer sb(n);
|
||||
boost::beast::multi_buffer sb(n);
|
||||
sb.commit(boost::asio::buffer_copy(
|
||||
sb.prepare(n), boost::asio::buffer(s.c_str(), n)));
|
||||
session->send(std::make_shared<
|
||||
@@ -511,7 +511,7 @@ ServerHandlerImp::processSession (std::shared_ptr<Session> const& session,
|
||||
{
|
||||
processRequest (
|
||||
session->port(), buffers_to_string(
|
||||
session->request().body.data()),
|
||||
session->request().body().data()),
|
||||
session->remoteAddress().at_port (0),
|
||||
makeOutput (*session), coro,
|
||||
[&]
|
||||
@@ -849,25 +849,25 @@ Handoff
|
||||
ServerHandlerImp::statusResponse(
|
||||
http_request_type const& request) const
|
||||
{
|
||||
using namespace beast::http;
|
||||
using namespace boost::beast::http;
|
||||
Handoff handoff;
|
||||
response<string_body> msg;
|
||||
std::string reason;
|
||||
if (app_.serverOkay(reason))
|
||||
{
|
||||
msg.result(beast::http::status::ok);
|
||||
msg.body = "<!DOCTYPE html><html><head><title>" + systemName() +
|
||||
msg.result(boost::beast::http::status::ok);
|
||||
msg.body() = "<!DOCTYPE html><html><head><title>" + systemName() +
|
||||
" Test page for rippled</title></head><body><h1>" +
|
||||
systemName() + " Test</h1><p>This page shows rippled http(s) "
|
||||
"connectivity is working.</p></body></html>";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.result(beast::http::status::internal_server_error);
|
||||
msg.body = "<HTML><BODY>Server cannot accept clients: " +
|
||||
msg.result(boost::beast::http::status::internal_server_error);
|
||||
msg.body() = "<HTML><BODY>Server cannot accept clients: " +
|
||||
reason + "</BODY></HTML>";
|
||||
}
|
||||
msg.version = request.version;
|
||||
msg.version(request.version());
|
||||
msg.insert("Server", BuildInfo::getFullVersionString());
|
||||
msg.insert("Content-Type", "text/html");
|
||||
msg.insert("Connection", "close");
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
auto sp = ws_.lock();
|
||||
if(! sp)
|
||||
return;
|
||||
beast::multi_buffer sb;
|
||||
boost::beast::multi_buffer sb;
|
||||
Json::stream(jv,
|
||||
[&](void const* data, std::size_t n)
|
||||
{
|
||||
|
||||
@@ -21,8 +21,10 @@
|
||||
#define RIPPLE_RPC_JSON_BODY_H
|
||||
|
||||
#include <ripple/json/json_value.h>
|
||||
#include <beast/core/multi_buffer.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <ripple/json/to_string.h>
|
||||
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -35,7 +37,7 @@ struct json_body
|
||||
|
||||
class reader
|
||||
{
|
||||
using dynamic_buffer_type = beast::multi_buffer;
|
||||
using dynamic_buffer_type = boost::beast::multi_buffer;
|
||||
|
||||
dynamic_buffer_type buffer_;
|
||||
|
||||
@@ -47,7 +49,7 @@ struct json_body
|
||||
|
||||
template<bool isRequest, class Fields>
|
||||
explicit
|
||||
reader(beast::http::message<
|
||||
reader(boost::beast::http::message<
|
||||
isRequest, json_body, Fields> const& m)
|
||||
{
|
||||
stream(m.body,
|
||||
@@ -59,21 +61,52 @@ struct json_body
|
||||
}
|
||||
|
||||
void
|
||||
init(beast::error_code&) noexcept
|
||||
init(boost::beast::error_code&) noexcept
|
||||
{
|
||||
}
|
||||
|
||||
boost::optional<std::pair<const_buffers_type, bool>>
|
||||
get(beast::error_code& ec)
|
||||
get(boost::beast::error_code& ec)
|
||||
{
|
||||
return {{buffer_.data(), false}};
|
||||
}
|
||||
|
||||
void
|
||||
finish(beast::error_code&)
|
||||
finish(boost::beast::error_code&)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class writer
|
||||
{
|
||||
std::string body_string_;
|
||||
|
||||
public:
|
||||
using const_buffers_type =
|
||||
boost::asio::const_buffer;
|
||||
|
||||
template<bool isRequest, class Fields>
|
||||
explicit
|
||||
writer(boost::beast::http::message<isRequest,
|
||||
json_body, Fields> const& msg)
|
||||
: body_string_(to_string(msg.body()))
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
init(boost::beast::error_code& ec)
|
||||
{
|
||||
ec.assign(0, ec.category());
|
||||
}
|
||||
|
||||
boost::optional<std::pair<const_buffers_type, bool>>
|
||||
get(boost::beast::error_code& ec)
|
||||
{
|
||||
ec.assign(0, ec.category());
|
||||
return {{const_buffers_type{
|
||||
body_string_.data(), body_string_.size()}, false}};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // ripple
|
||||
|
||||
@@ -21,17 +21,17 @@
|
||||
#define RIPPLE_SERVER_HANDOFF_H_INCLUDED
|
||||
|
||||
#include <ripple/server/Writer.h>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/dynamic_body.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/dynamic_body.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
using http_request_type =
|
||||
beast::http::request<beast::http::dynamic_body>;
|
||||
boost::beast::http::request<boost::beast::http::dynamic_body>;
|
||||
|
||||
using http_response_type =
|
||||
beast::http::response<beast::http::dynamic_body>;
|
||||
boost::beast::http::response<boost::beast::http::dynamic_body>;
|
||||
|
||||
/** Used to indicate the result of a server connection handoff. */
|
||||
struct Handoff
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
#include <ripple/basics/BasicConfig.h>
|
||||
#include <ripple/beast/net/IPEndpoint.h>
|
||||
#include <beast/core/string.hpp>
|
||||
#include <beast/websocket/option.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/beast/websocket/option.hpp>
|
||||
#include <boost/asio/ip/address.hpp>
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
@@ -42,7 +42,7 @@ struct Port
|
||||
std::string name;
|
||||
boost::asio::ip::address ip;
|
||||
std::uint16_t port = 0;
|
||||
std::set<std::string, beast::iless> protocol;
|
||||
std::set<std::string, boost::beast::iless> protocol;
|
||||
std::vector<beast::IP::Address> admin_ip;
|
||||
std::vector<beast::IP::Address> secure_gateway_ip;
|
||||
std::string user;
|
||||
@@ -53,7 +53,7 @@ struct Port
|
||||
std::string ssl_cert;
|
||||
std::string ssl_chain;
|
||||
std::string ssl_ciphers;
|
||||
beast::websocket::permessage_deflate pmd_options;
|
||||
boost::beast::websocket::permessage_deflate pmd_options;
|
||||
std::shared_ptr<boost::asio::ssl::context> context;
|
||||
|
||||
// How many incoming connections are allowed on this
|
||||
@@ -83,7 +83,7 @@ struct ParsedPort
|
||||
explicit ParsedPort() = default;
|
||||
|
||||
std::string name;
|
||||
std::set<std::string, beast::iless> protocol;
|
||||
std::set<std::string, boost::beast::iless> protocol;
|
||||
std::string user;
|
||||
std::string password;
|
||||
std::string admin_user;
|
||||
@@ -92,7 +92,7 @@ struct ParsedPort
|
||||
std::string ssl_cert;
|
||||
std::string ssl_chain;
|
||||
std::string ssl_ciphers;
|
||||
beast::websocket::permessage_deflate pmd_options;
|
||||
boost::beast::websocket::permessage_deflate pmd_options;
|
||||
int limit = 0;
|
||||
std::uint16_t ws_queue_limit;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <ripple/server/Writer.h>
|
||||
#include <ripple/server/WSSession.h>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <ripple/beast/net/IPEndpoint.h>
|
||||
#include <ripple/beast/utility/Journal.h>
|
||||
#include <functional>
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
#define RIPPLE_SERVER_SIMPLEWRITER_H_INCLUDED
|
||||
|
||||
#include <ripple/server/Writer.h>
|
||||
#include <beast/core/multi_buffer.hpp>
|
||||
#include <beast/core/ostream.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/write.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
#include <boost/beast/core/ostream.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/write.hpp>
|
||||
#include <utility>
|
||||
|
||||
namespace ripple {
|
||||
@@ -32,15 +32,14 @@ namespace ripple {
|
||||
/// Deprecated: Writer that serializes a HTTP/1 message
|
||||
class SimpleWriter : public Writer
|
||||
{
|
||||
beast::multi_buffer sb_;
|
||||
boost::beast::multi_buffer sb_;
|
||||
|
||||
public:
|
||||
template<bool isRequest, class Body, class Headers>
|
||||
template<bool isRequest, class Body, class Fields>
|
||||
explicit
|
||||
SimpleWriter(beast::http::message<
|
||||
isRequest, Body, Headers> const& msg)
|
||||
SimpleWriter(boost::beast::http::message<isRequest, Body, Fields> const& msg)
|
||||
{
|
||||
beast::ostream(sb_) << msg;
|
||||
boost::beast::ostream(sb_) << msg;
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ripple/server/Handoff.h>
|
||||
#include <ripple/server/Port.h>
|
||||
#include <ripple/server/Writer.h>
|
||||
#include <beast/core/buffer_prefix.hpp>
|
||||
#include <boost/beast/core/buffers_prefix.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/logic/tribool.hpp>
|
||||
@@ -98,7 +98,7 @@ public:
|
||||
n_ = sb_.size();
|
||||
done = true;
|
||||
}
|
||||
auto const pb = beast::buffer_prefix(n_, sb_.data());
|
||||
auto const pb = boost::beast::buffers_prefix(n_, sb_.data());
|
||||
std::vector<boost::asio::const_buffer> vb (
|
||||
std::distance(pb.begin(), pb.end()));
|
||||
std::copy(pb.begin(), pb.end(), std::back_inserter(vb));
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
#include <ripple/server/impl/io_list.h>
|
||||
#include <ripple/beast/net/IPAddressConversion.h>
|
||||
#include <ripple/beast/asio/ssl_error.h> // for is_short_read?
|
||||
#include <beast/http/read.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/parser.hpp>
|
||||
#include <beast/http/dynamic_body.hpp>
|
||||
#include <boost/beast/http/read.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/parser.hpp>
|
||||
#include <boost/beast/http/dynamic_body.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/ssl/stream.hpp>
|
||||
#include <boost/asio/streambuf.hpp>
|
||||
@@ -324,10 +324,10 @@ do_read(yield_context do_yield)
|
||||
complete_ = false;
|
||||
error_code ec;
|
||||
start_timer();
|
||||
beast::http::async_read(impl().stream_,
|
||||
boost::beast::http::async_read(impl().stream_,
|
||||
read_buf_, message_, do_yield[ec]);
|
||||
cancel_timer();
|
||||
if(ec == beast::http::error::end_of_stream)
|
||||
if(ec == boost::beast::http::error::end_of_stream)
|
||||
return do_close();
|
||||
if(ec)
|
||||
return fail(ec, "http::read");
|
||||
|
||||
@@ -24,10 +24,11 @@
|
||||
#include <ripple/protocol/BuildInfo.h>
|
||||
#include <ripple/beast/utility/rngfill.h>
|
||||
#include <ripple/crypto/csprng.h>
|
||||
#include <beast/websocket.hpp>
|
||||
#include <beast/core/multi_buffer.hpp>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <boost/beast/websocket.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <cassert>
|
||||
#include <functional>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -48,24 +49,24 @@ private:
|
||||
friend class BasePeer<Handler, Impl>;
|
||||
|
||||
http_request_type request_;
|
||||
beast::multi_buffer rb_;
|
||||
beast::multi_buffer wb_;
|
||||
boost::beast::multi_buffer rb_;
|
||||
boost::beast::multi_buffer wb_;
|
||||
std::list<std::shared_ptr<WSMsg>> wq_;
|
||||
bool do_close_ = false;
|
||||
beast::websocket::close_reason cr_;
|
||||
boost::beast::websocket::close_reason cr_;
|
||||
waitable_timer timer_;
|
||||
bool close_on_timer_ = false;
|
||||
bool ping_active_ = false;
|
||||
beast::websocket::ping_data payload_;
|
||||
boost::beast::websocket::ping_data payload_;
|
||||
error_code ec_;
|
||||
|
||||
std::function<void (boost::beast::websocket::frame_type , boost::beast::string_view)> control_callback_;
|
||||
public:
|
||||
template<class Body, class Headers>
|
||||
BaseWSPeer(
|
||||
Port const& port,
|
||||
Handler& handler,
|
||||
endpoint_type remote_address,
|
||||
beast::http::request<Body, Headers>&& request,
|
||||
boost::beast::http::request<Body, Headers>&& request,
|
||||
boost::asio::io_service& io_service,
|
||||
beast::Journal journal);
|
||||
|
||||
@@ -141,8 +142,8 @@ protected:
|
||||
on_ping(error_code const& ec);
|
||||
|
||||
void
|
||||
on_ping_pong(beast::websocket::frame_type kind,
|
||||
beast::string_view payload);
|
||||
on_ping_pong(boost::beast::websocket::frame_type kind,
|
||||
boost::beast::string_view payload);
|
||||
|
||||
void
|
||||
on_timer(error_code ec);
|
||||
@@ -161,7 +162,7 @@ BaseWSPeer(
|
||||
Port const& port,
|
||||
Handler& handler,
|
||||
endpoint_type remote_address,
|
||||
beast::http::request<Body, Headers>&& request,
|
||||
boost::beast::http::request<Body, Headers>&& request,
|
||||
boost::asio::io_service& io_service,
|
||||
beast::Journal journal)
|
||||
: BasePeer<Handler, Impl>(port, handler, remote_address,
|
||||
@@ -180,15 +181,17 @@ run()
|
||||
return strand_.post(std::bind(
|
||||
&BaseWSPeer::run, impl().shared_from_this()));
|
||||
impl().ws_.set_option(port().pmd_options);
|
||||
impl().ws_.control_callback(
|
||||
std::bind(&BaseWSPeer::on_ping_pong, this,
|
||||
std::placeholders::_1, std::placeholders::_2));
|
||||
// Must manage the control callback memory outside of the `control_callback` function
|
||||
control_callback_ = std::bind(
|
||||
&BaseWSPeer::on_ping_pong,
|
||||
this, std::placeholders::_1, std::placeholders::_2);
|
||||
impl().ws_.control_callback(control_callback_);
|
||||
start_timer();
|
||||
close_on_timer_ = true;
|
||||
impl().ws_.async_accept_ex(request_,
|
||||
[](auto & res)
|
||||
{
|
||||
res.set(beast::http::field::server,
|
||||
res.set(boost::beast::http::field::server,
|
||||
BuildInfo::getFullVersionString());
|
||||
},
|
||||
strand_.wrap(std::bind(&BaseWSPeer::on_ws_handshake,
|
||||
@@ -210,7 +213,7 @@ send(std::shared_ptr<WSMsg> w)
|
||||
{
|
||||
JLOG(this->j_.info()) <<
|
||||
"closing slow client";
|
||||
cr_.code = static_cast<beast::websocket::close_code>(4000);
|
||||
cr_.code = static_cast<boost::beast::websocket::close_code>(4000);
|
||||
cr_.reason = "Client is too slow.";
|
||||
wq_.erase(std::next(wq_.begin()), wq_.end());
|
||||
close();
|
||||
@@ -284,12 +287,12 @@ on_write(error_code const& ec)
|
||||
return;
|
||||
start_timer();
|
||||
if(! result.first)
|
||||
impl().ws_.async_write_frame(
|
||||
impl().ws_.async_write_some(
|
||||
result.first, result.second, strand_.wrap(std::bind(
|
||||
&BaseWSPeer::on_write, impl().shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
else
|
||||
impl().ws_.async_write_frame(
|
||||
impl().ws_.async_write_some(
|
||||
result.first, result.second, strand_.wrap(std::bind(
|
||||
&BaseWSPeer::on_write_fin, impl().shared_from_this(),
|
||||
std::placeholders::_1)));
|
||||
@@ -329,7 +332,7 @@ void
|
||||
BaseWSPeer<Handler, Impl>::
|
||||
on_read(error_code const& ec)
|
||||
{
|
||||
if(ec == beast::websocket::error::closed)
|
||||
if(ec == boost::beast::websocket::error::closed)
|
||||
return on_close({});
|
||||
if(ec)
|
||||
return fail(ec, "read");
|
||||
@@ -395,12 +398,12 @@ on_ping(error_code const& ec)
|
||||
template<class Handler, class Impl>
|
||||
void
|
||||
BaseWSPeer<Handler, Impl>::
|
||||
on_ping_pong(beast::websocket::frame_type kind,
|
||||
beast::string_view payload)
|
||||
on_ping_pong(boost::beast::websocket::frame_type kind,
|
||||
boost::beast::string_view payload)
|
||||
{
|
||||
if(kind == beast::websocket::frame_type::pong)
|
||||
if(kind == boost::beast::websocket::frame_type::pong)
|
||||
{
|
||||
beast::string_view p(payload_.begin());
|
||||
boost::beast::string_view p(payload_.begin());
|
||||
if(payload == p)
|
||||
{
|
||||
close_on_timer_ = false;
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <ripple/server/impl/PlainHTTPPeer.h>
|
||||
#include <ripple/server/impl/SSLHTTPPeer.h>
|
||||
#include <ripple/beast/asio/ssl_bundle.h>
|
||||
#include <beast/core/multi_buffer.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
#include <boost/asio/basic_waitable_timer.hpp>
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/asio/io_service.hpp>
|
||||
@@ -229,7 +229,7 @@ do_detect(boost::asio::yield_context do_yield)
|
||||
{
|
||||
bool ssl;
|
||||
error_code ec;
|
||||
beast::multi_buffer buf(16);
|
||||
boost::beast::multi_buffer buf(16);
|
||||
timer_.expires_from_now(std::chrono::seconds(15));
|
||||
std::tie(ec, ssl) = detect_ssl(socket_, buf, do_yield);
|
||||
error_code unused;
|
||||
|
||||
@@ -39,7 +39,7 @@ class PlainWSPeer
|
||||
using waitable_timer = boost::asio::basic_waitable_timer <clock_type>;
|
||||
using socket_type = boost::asio::ip::tcp::socket;
|
||||
|
||||
beast::websocket::stream<socket_type> ws_;
|
||||
boost::beast::websocket::stream<socket_type> ws_;
|
||||
|
||||
public:
|
||||
template<class Body, class Headers>
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
Port const& port,
|
||||
Handler& handler,
|
||||
endpoint_type remote_address,
|
||||
beast::http::request<Body, Headers>&& request,
|
||||
boost::beast::http::request<Body, Headers>&& request,
|
||||
socket_type&& socket,
|
||||
beast::Journal journal);
|
||||
};
|
||||
@@ -61,7 +61,7 @@ PlainWSPeer(
|
||||
Port const& port,
|
||||
Handler& handler,
|
||||
endpoint_type remote_address,
|
||||
beast::http::request<Body, Headers>&& request,
|
||||
boost::beast::http::request<Body, Headers>&& request,
|
||||
socket_type&& socket,
|
||||
beast::Journal journal)
|
||||
: BaseWSPeer<Handler, PlainWSPeer>(port, handler, remote_address,
|
||||
|
||||
@@ -188,7 +188,7 @@ parse_Port (ParsedPort& port, Section const& section, std::ostream& log)
|
||||
{
|
||||
auto const lim = get (section, "limit", "unlimited");
|
||||
|
||||
if (!beast::detail::iequals (lim, "unlimited"))
|
||||
if (!boost::beast::detail::iequals (lim, "unlimited"))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ripple/server/impl/BaseHTTPPeer.h>
|
||||
#include <ripple/server/WSSession.h>
|
||||
#include <ripple/beast/asio/ssl_bundle.h>
|
||||
#include <beast/websocket/ssl.hpp>
|
||||
#include <boost/beast/websocket/ssl.hpp>
|
||||
#include <memory>
|
||||
|
||||
namespace ripple {
|
||||
@@ -43,7 +43,7 @@ class SSLWSPeer
|
||||
boost::asio::basic_waitable_timer <clock_type>;
|
||||
|
||||
std::unique_ptr<beast::asio::ssl_bundle> ssl_bundle_;
|
||||
beast::websocket::stream<
|
||||
boost::beast::websocket::stream<
|
||||
beast::asio::ssl_bundle::stream_type&> ws_;
|
||||
|
||||
public:
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
Port const& port,
|
||||
Handler& handler,
|
||||
endpoint_type remote_endpoint,
|
||||
beast::http::request<Body, Headers>&& request,
|
||||
boost::beast::http::request<Body, Headers>&& request,
|
||||
std::unique_ptr<
|
||||
beast::asio::ssl_bundle>&& ssl_bundle,
|
||||
beast::Journal journal);
|
||||
@@ -67,7 +67,7 @@ SSLWSPeer(
|
||||
Port const& port,
|
||||
Handler& handler,
|
||||
endpoint_type remote_endpoint,
|
||||
beast::http::request<Body, Headers>&& request,
|
||||
boost::beast::http::request<Body, Headers>&& request,
|
||||
std::unique_ptr<
|
||||
beast::asio::ssl_bundle>&& ssl_bundle,
|
||||
beast::Journal journal)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <ripple/protocol/SecretKey.h>
|
||||
#include <ripple/protocol/Sign.h>
|
||||
#include <ripple/protocol/STExchange.h>
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/utility/in_place_factory.hpp>
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
Serializer s;
|
||||
st.add(s);
|
||||
|
||||
return beast::detail::base64_encode (std::string(
|
||||
return boost::beast::detail::base64_encode (std::string(
|
||||
static_cast<char const*> (s.data()), s.size()));
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
Serializer s;
|
||||
st.add(s);
|
||||
|
||||
return beast::detail::base64_encode (std::string(
|
||||
return boost::beast::detail::base64_encode (std::string(
|
||||
static_cast<char const*> (s.data()), s.size()));
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <ripple/core/Config.h>
|
||||
#include <ripple/core/ConfigSections.h>
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace ripple {
|
||||
@@ -91,7 +91,7 @@ public:
|
||||
derivePublicKey(KeyType::secp256k1, tokenSecretKey);
|
||||
|
||||
auto const m = Manifest::make_Manifest(
|
||||
beast::detail::base64_decode(tokenManifest));
|
||||
boost::beast::detail::base64_decode(tokenManifest));
|
||||
BEAST_EXPECT(m);
|
||||
NodeID const tokenNodeID = calcNodeID(m->masterKey);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <ripple/basics/Slice.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <ripple/app/misc/ValidatorList.h>
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
derivePublicKey(KeyType::ed25519, secret);
|
||||
auto const signingKeys = randomKeyPair(KeyType::secp256k1);
|
||||
return { masterPublic, signingKeys.first,
|
||||
beast::detail::base64_encode(makeManifestString (
|
||||
boost::beast::detail::base64_encode(makeManifestString (
|
||||
masterPublic, secret, signingKeys.first, signingKeys.second, 1)) };
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ private:
|
||||
|
||||
data.pop_back();
|
||||
data += "]}";
|
||||
return beast::detail::base64_encode(data);
|
||||
return boost::beast::detail::base64_encode(data);
|
||||
}
|
||||
|
||||
std::string
|
||||
@@ -120,7 +120,7 @@ private:
|
||||
std::string const& blob,
|
||||
std::pair<PublicKey, SecretKey> const& keys)
|
||||
{
|
||||
auto const data = beast::detail::base64_decode (blob);
|
||||
auto const data = boost::beast::detail::base64_decode (blob);
|
||||
return strHex(sign(
|
||||
keys.first, keys.second, makeSlice(data)));
|
||||
}
|
||||
@@ -374,7 +374,7 @@ private:
|
||||
auto const publisherPublic =
|
||||
derivePublicKey(KeyType::ed25519, publisherSecret);
|
||||
auto const pubSigningKeys1 = randomKeyPair(KeyType::secp256k1);
|
||||
auto const manifest1 = beast::detail::base64_encode(makeManifestString (
|
||||
auto const manifest1 = boost::beast::detail::base64_encode(makeManifestString (
|
||||
publisherPublic, publisherSecret,
|
||||
pubSigningKeys1.first, pubSigningKeys1.second, 1));
|
||||
|
||||
@@ -425,7 +425,7 @@ private:
|
||||
}
|
||||
|
||||
// do not use list from untrusted publisher
|
||||
auto const untrustedManifest = beast::detail::base64_encode(
|
||||
auto const untrustedManifest = boost::beast::detail::base64_encode(
|
||||
makeManifestString (
|
||||
randomMasterKey(), publisherSecret,
|
||||
pubSigningKeys1.first, pubSigningKeys1.second, 1));
|
||||
@@ -472,7 +472,7 @@ private:
|
||||
|
||||
// apply list with new publisher key updated by manifest
|
||||
auto const pubSigningKeys2 = randomKeyPair(KeyType::secp256k1);
|
||||
auto manifest2 = beast::detail::base64_encode(makeManifestString (
|
||||
auto manifest2 = boost::beast::detail::base64_encode(makeManifestString (
|
||||
publisherPublic, publisherSecret,
|
||||
pubSigningKeys2.first, pubSigningKeys2.second, 2));
|
||||
|
||||
@@ -496,7 +496,7 @@ private:
|
||||
// do not apply list with revoked publisher key
|
||||
// applied list is removed due to revoked publisher key
|
||||
auto const signingKeysMax = randomKeyPair(KeyType::secp256k1);
|
||||
auto maxManifest = beast::detail::base64_encode(makeManifestString (
|
||||
auto maxManifest = boost::beast::detail::base64_encode(makeManifestString (
|
||||
publisherPublic, publisherSecret,
|
||||
pubSigningKeys2.first, pubSigningKeys2.second,
|
||||
std::numeric_limits<std::uint32_t>::max ()));
|
||||
@@ -792,7 +792,7 @@ private:
|
||||
std::vector<std::string> emptyCfgKeys;
|
||||
auto const publisherKeys = randomKeyPair(KeyType::secp256k1);
|
||||
auto const pubSigningKeys = randomKeyPair(KeyType::secp256k1);
|
||||
auto const manifest = beast::detail::base64_encode (
|
||||
auto const manifest = boost::beast::detail::base64_encode (
|
||||
makeManifestString (
|
||||
publisherKeys.first, publisherKeys.second,
|
||||
pubSigningKeys.first, pubSigningKeys.second, 1));
|
||||
@@ -963,7 +963,7 @@ private:
|
||||
auto const publisherPublic =
|
||||
derivePublicKey(KeyType::ed25519, publisherSecret);
|
||||
auto const pubSigningKeys = randomKeyPair(KeyType::secp256k1);
|
||||
auto const manifest = beast::detail::base64_encode(makeManifestString (
|
||||
auto const manifest = boost::beast::detail::base64_encode(makeManifestString (
|
||||
publisherPublic, publisherSecret,
|
||||
pubSigningKeys.first, pubSigningKeys.second, 1));
|
||||
|
||||
@@ -1073,7 +1073,7 @@ private:
|
||||
auto const publisherPublic =
|
||||
derivePublicKey(KeyType::ed25519, publisherSecret);
|
||||
auto const pubSigningKeys = randomKeyPair(KeyType::secp256k1);
|
||||
auto const manifest = beast::detail::base64_encode(makeManifestString (
|
||||
auto const manifest = boost::beast::detail::base64_encode(makeManifestString (
|
||||
publisherPublic, publisherSecret,
|
||||
pubSigningKeys.first, pubSigningKeys.second, 1));
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <ripple/app/misc/ValidatorSite.h>
|
||||
#include <ripple/basics/Slice.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
@@ -29,6 +28,7 @@
|
||||
#include <test/jtx.h>
|
||||
#include <test/jtx/TrustedPublisherServer.h>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
Serializer s;
|
||||
st.add(s);
|
||||
|
||||
return beast::detail::base64_encode (std::string(
|
||||
return boost::beast::detail::base64_encode (std::string(
|
||||
static_cast<char const*> (s.data()), s.size()));
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <ripple/protocol/STAmount.h>
|
||||
#include <ripple/protocol/STObject.h>
|
||||
#include <ripple/protocol/STTx.h>
|
||||
#include <beast/core/detail/type_traits.hpp>
|
||||
#include <boost/beast/core/detail/type_traits.hpp>
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
@@ -713,7 +713,7 @@ protected:
|
||||
FN const&... fN)
|
||||
{
|
||||
maybe_invoke(stx, f,
|
||||
beast::detail::is_invocable<F,
|
||||
boost::beast::detail::is_invocable<F,
|
||||
void(Env&, STTx const&)>());
|
||||
invoke(stx, fN...);
|
||||
}
|
||||
@@ -747,7 +747,7 @@ protected:
|
||||
FN const&... fN)
|
||||
{
|
||||
maybe_invoke(jt, f,
|
||||
beast::detail::is_invocable<F,
|
||||
boost::beast::detail::is_invocable<F,
|
||||
void(Env&, JTx&)>());
|
||||
invoke(jt, fN...);
|
||||
}
|
||||
|
||||
@@ -19,14 +19,13 @@
|
||||
#ifndef RIPPLE_TEST_TRUSTED_PUBLISHER_SERVER_H_INCLUDED
|
||||
#define RIPPLE_TEST_TRUSTED_PUBLISHER_SERVER_H_INCLUDED
|
||||
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <ripple/protocol/PublicKey.h>
|
||||
#include <ripple/protocol/SecretKey.h>
|
||||
#include <ripple/protocol/Sign.h>
|
||||
#include <ripple/basics/strHex.h>
|
||||
#include <boost/asio.hpp>
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <beast/http.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/http.hpp>
|
||||
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
@@ -37,8 +36,8 @@ class TrustedPublisherServer
|
||||
using address_type = boost::asio::ip::address;
|
||||
using socket_type = boost::asio::ip::tcp::socket;
|
||||
|
||||
using req_type = beast::http::request<beast::http::string_body>;
|
||||
using resp_type = beast::http::response<beast::http::string_body>;
|
||||
using req_type = boost::beast::http::request<boost::beast::http::string_body>;
|
||||
using resp_type = boost::beast::http::response<boost::beast::http::string_body>;
|
||||
using error_code = boost::system::error_code;
|
||||
|
||||
socket_type sock_;
|
||||
@@ -78,7 +77,7 @@ public:
|
||||
}
|
||||
data.pop_back();
|
||||
data += "]}";
|
||||
std::string blob = beast::detail::base64_encode(data);
|
||||
std::string blob = boost::beast::detail::base64_encode(data);
|
||||
|
||||
list_ = "{\"blob\":\"" + blob + "\"";
|
||||
|
||||
@@ -155,35 +154,35 @@ private:
|
||||
do_peer(int id, socket_type&& sock0)
|
||||
{
|
||||
socket_type sock(std::move(sock0));
|
||||
beast::multi_buffer sb;
|
||||
boost::beast::multi_buffer sb;
|
||||
error_code ec;
|
||||
for (;;)
|
||||
{
|
||||
req_type req;
|
||||
beast::http::read(sock, sb, req, ec);
|
||||
boost::beast::http::read(sock, sb, req, ec);
|
||||
if (ec)
|
||||
break;
|
||||
auto path = req.target().to_string();
|
||||
if (path != "/validators")
|
||||
{
|
||||
resp_type res;
|
||||
res.result(beast::http::status::not_found);
|
||||
res.version = req.version;
|
||||
res.result(boost::beast::http::status::not_found);
|
||||
res.version(req.version());
|
||||
res.insert("Server", "TrustedPublisherServer");
|
||||
res.insert("Content-Type", "text/html");
|
||||
res.body = "The file '" + path + "' was not found";
|
||||
res.body() = "The file '" + path + "' was not found";
|
||||
res.prepare_payload();
|
||||
write(sock, res, ec);
|
||||
if (ec)
|
||||
break;
|
||||
}
|
||||
resp_type res;
|
||||
res.result(beast::http::status::ok);
|
||||
res.version = req.version;
|
||||
res.result(boost::beast::http::status::ok);
|
||||
res.version(req.version());
|
||||
res.insert("Server", "TrustedPublisherServer");
|
||||
res.insert("Content-Type", "application/json");
|
||||
|
||||
res.body = list_;
|
||||
res.body() = list_;
|
||||
try
|
||||
{
|
||||
res.prepare_payload();
|
||||
@@ -191,11 +190,11 @@ private:
|
||||
catch (std::exception const& e)
|
||||
{
|
||||
res = {};
|
||||
res.result(beast::http::status::internal_server_error);
|
||||
res.version = req.version;
|
||||
res.result(boost::beast::http::status::internal_server_error);
|
||||
res.version(req.version());
|
||||
res.insert("Server", "TrustedPublisherServer");
|
||||
res.insert("Content-Type", "text/html");
|
||||
res.body = std::string{"An internal error occurred"} + e.what();
|
||||
res.body() = std::string{"An internal error occurred"} + e.what();
|
||||
res.prepare_payload();
|
||||
}
|
||||
write(sock, res, ec);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include <test/jtx/WSClient.h>
|
||||
#include <test/jtx.h>
|
||||
#include <ripple/beast/unit_test.h>
|
||||
#include <beast/core/handler_alloc.hpp>
|
||||
|
||||
namespace ripple {
|
||||
namespace test {
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
#include <ripple/json/to_string.h>
|
||||
#include <ripple/protocol/JsonFields.h>
|
||||
#include <ripple/server/Port.h>
|
||||
#include <beast/http/message.hpp>
|
||||
#include <beast/http/dynamic_body.hpp>
|
||||
#include <beast/http/string_body.hpp>
|
||||
#include <beast/http/read.hpp>
|
||||
#include <beast/http/write.hpp>
|
||||
#include <boost/beast/http/message.hpp>
|
||||
#include <boost/beast/http/dynamic_body.hpp>
|
||||
#include <boost/beast/http/string_body.hpp>
|
||||
#include <boost/beast/http/read.hpp>
|
||||
#include <boost/beast/http/write.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <string>
|
||||
|
||||
@@ -73,8 +73,8 @@ class JSONRPCClient : public AbstractClient
|
||||
boost::asio::ip::tcp::endpoint ep_;
|
||||
boost::asio::io_service ios_;
|
||||
boost::asio::ip::tcp::socket stream_;
|
||||
beast::multi_buffer bin_;
|
||||
beast::multi_buffer bout_;
|
||||
boost::beast::multi_buffer bin_;
|
||||
boost::beast::multi_buffer bout_;
|
||||
unsigned rpc_version_;
|
||||
|
||||
public:
|
||||
@@ -103,14 +103,14 @@ public:
|
||||
invoke(std::string const& cmd,
|
||||
Json::Value const& params) override
|
||||
{
|
||||
using namespace beast::http;
|
||||
using namespace boost::beast::http;
|
||||
using namespace boost::asio;
|
||||
using namespace std::string_literals;
|
||||
|
||||
request<string_body> req;
|
||||
req.method(beast::http::verb::post);
|
||||
req.method(boost::beast::http::verb::post);
|
||||
req.target("/");
|
||||
req.version = 11;
|
||||
req.version(11);
|
||||
req.insert("Content-Type", "application/json; charset=UTF-8");
|
||||
req.insert("Host", ep_);
|
||||
{
|
||||
@@ -127,7 +127,7 @@ public:
|
||||
Json::Value& ja = jr[jss::params] = Json::arrayValue;
|
||||
ja.append(params);
|
||||
}
|
||||
req.body = to_string(jr);
|
||||
req.body() = to_string(jr);
|
||||
}
|
||||
req.prepare_payload();
|
||||
write(stream_, req);
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
|
||||
Json::Reader jr;
|
||||
Json::Value jv;
|
||||
jr.parse(buffer_string(res.body.data()), jv);
|
||||
jr.parse(buffer_string(res.body().data()), jv);
|
||||
if(jv["result"].isMember("error"))
|
||||
jv["error"] = jv["result"]["error"];
|
||||
if(jv["result"].isMember("status"))
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
#include <ripple/json/to_string.h>
|
||||
#include <ripple/protocol/JsonFields.h>
|
||||
#include <ripple/server/Port.h>
|
||||
#include <beast/core/multi_buffer.hpp>
|
||||
#include <beast/websocket.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
#include <boost/beast/websocket.hpp>
|
||||
|
||||
#include <condition_variable>
|
||||
|
||||
@@ -92,8 +92,8 @@ class WSClientImpl : public WSClient
|
||||
boost::asio::io_service::strand strand_;
|
||||
std::thread thread_;
|
||||
boost::asio::ip::tcp::socket stream_;
|
||||
beast::websocket::stream<boost::asio::ip::tcp::socket&> ws_;
|
||||
beast::multi_buffer rb_;
|
||||
boost::beast::websocket::stream<boost::asio::ip::tcp::socket&> ws_;
|
||||
boost::beast::multi_buffer rb_;
|
||||
|
||||
bool peerClosed_ = false;
|
||||
|
||||
@@ -109,13 +109,17 @@ class WSClientImpl : public WSClient
|
||||
|
||||
unsigned rpc_version_;
|
||||
|
||||
void cleanup()
|
||||
void
|
||||
cleanup()
|
||||
{
|
||||
ios_.post(strand_.wrap([this] {
|
||||
error_code ec;
|
||||
if (!peerClosed_)
|
||||
ws_.close({}, ec);
|
||||
stream_.close(ec);
|
||||
{
|
||||
ws_.async_close({}, strand_.wrap([&](error_code ec) {
|
||||
stream_.cancel(ec);
|
||||
}));
|
||||
}
|
||||
}));
|
||||
work_ = boost::none;
|
||||
thread_.join();
|
||||
@@ -173,7 +177,7 @@ public:
|
||||
else
|
||||
jp[jss::command] = cmd;
|
||||
auto const s = to_string(jp);
|
||||
ws_.write_frame(true, buffer(s));
|
||||
ws_.write_some(true, buffer(s));
|
||||
}
|
||||
|
||||
auto jv = findMsg(5s,
|
||||
@@ -259,7 +263,7 @@ private:
|
||||
{
|
||||
if(ec)
|
||||
{
|
||||
if(ec == beast::websocket::error::closed)
|
||||
if(ec == boost::beast::websocket::error::closed)
|
||||
peerClosed_ = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <nudb/create.hpp>
|
||||
#include <nudb/detail/format.hpp>
|
||||
#include <nudb/xxhasher.hpp>
|
||||
#include <beast/core/string.hpp>
|
||||
#include <boost/beast/core/string.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
std::map <std::string, std::string, beast::iless>
|
||||
std::map <std::string, std::string, boost::beast::iless>
|
||||
parse_args(std::string const& s)
|
||||
{
|
||||
// <key> '=' <value>
|
||||
@@ -273,7 +273,7 @@ parse_args(std::string const& s)
|
||||
, boost::regex_constants::optimize
|
||||
);
|
||||
std::map <std::string,
|
||||
std::string, beast::iless> map;
|
||||
std::string, boost::beast::iless> map;
|
||||
auto const v = beast::rfc2616::split(
|
||||
s.begin(), s.end(), ',');
|
||||
for (auto const& kv : v)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <ripple/json/json_value.h>
|
||||
#include <ripple/protocol/JsonFields.h>
|
||||
#include <ripple/protocol/Sign.h>
|
||||
#include <beast/core/detail/base64.hpp>
|
||||
#include <boost/beast/core/detail/base64.hpp>
|
||||
#include <test/jtx.h>
|
||||
#include <test/jtx/TrustedPublisherServer.h>
|
||||
|
||||
@@ -75,7 +75,7 @@ class ValidatorRPC_test : public beast::unit_test::suite
|
||||
Serializer s;
|
||||
st.add(s);
|
||||
|
||||
return beast::detail::base64_encode(
|
||||
return boost::beast::detail::base64_encode(
|
||||
std::string(static_cast<char const*>(s.data()), s.size()));
|
||||
}
|
||||
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
#include <test/jtx/JSONRPCClient.h>
|
||||
#include <ripple/app/misc/NetworkOPs.h>
|
||||
#include <ripple/app/ledger/LedgerMaster.h>
|
||||
#include <beast/http.hpp>
|
||||
#include <boost/beast/http.hpp>
|
||||
#include <beast/test/yield_to.hpp>
|
||||
#include <beast/websocket/detail/mask.hpp>
|
||||
#include <beast/core/multi_buffer.hpp>
|
||||
#include <boost/beast/websocket/detail/mask.hpp>
|
||||
#include <boost/beast/core/multi_buffer.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
@@ -41,7 +41,7 @@ namespace test {
|
||||
class ServerStatus_test :
|
||||
public beast::unit_test::suite, public beast::test::enable_yield_to
|
||||
{
|
||||
class myFields : public beast::http::fields {};
|
||||
class myFields : public boost::beast::http::fields {};
|
||||
|
||||
auto makeConfig(
|
||||
std::string const& proto,
|
||||
@@ -87,21 +87,21 @@ class ServerStatus_test :
|
||||
uint16_t port)
|
||||
{
|
||||
using namespace boost::asio;
|
||||
using namespace beast::http;
|
||||
using namespace boost::beast::http;
|
||||
request<string_body> req;
|
||||
|
||||
req.target("/");
|
||||
req.version = 11;
|
||||
req.version(11);
|
||||
req.insert("Host", host + ":" + std::to_string(port));
|
||||
req.insert("User-Agent", "test");
|
||||
req.method(beast::http::verb::get);
|
||||
req.method(boost::beast::http::verb::get);
|
||||
req.insert("Upgrade", "websocket");
|
||||
beast::websocket::detail::maskgen maskgen;
|
||||
beast::websocket::detail::sec_ws_key_type key;
|
||||
beast::websocket::detail::make_sec_ws_key(key, maskgen);
|
||||
boost::beast::websocket::detail::maskgen maskgen;
|
||||
boost::beast::websocket::detail::sec_ws_key_type key;
|
||||
boost::beast::websocket::detail::make_sec_ws_key(key, maskgen);
|
||||
req.insert("Sec-WebSocket-Key", key);
|
||||
req.insert("Sec-WebSocket-Version", "13");
|
||||
req.insert(beast::http::field::connection, "upgrade");
|
||||
req.insert(boost::beast::http::field::connection, "upgrade");
|
||||
return req;
|
||||
}
|
||||
|
||||
@@ -112,24 +112,24 @@ class ServerStatus_test :
|
||||
myFields const& fields)
|
||||
{
|
||||
using namespace boost::asio;
|
||||
using namespace beast::http;
|
||||
using namespace boost::beast::http;
|
||||
request<string_body> req;
|
||||
|
||||
req.target("/");
|
||||
req.version = 11;
|
||||
req.version(11);
|
||||
for(auto const& f : fields)
|
||||
req.insert(f.name(), f.value());
|
||||
req.insert("Host", host + ":" + std::to_string(port));
|
||||
req.insert("User-Agent", "test");
|
||||
if(body.empty())
|
||||
{
|
||||
req.method(beast::http::verb::get);
|
||||
req.method(boost::beast::http::verb::get);
|
||||
}
|
||||
else
|
||||
{
|
||||
req.method(beast::http::verb::post);
|
||||
req.method(boost::beast::http::verb::post);
|
||||
req.insert("Content-Type", "application/json; charset=UTF-8");
|
||||
req.body = body;
|
||||
req.body() = body;
|
||||
}
|
||||
req.prepare_payload();
|
||||
|
||||
@@ -139,18 +139,18 @@ class ServerStatus_test :
|
||||
void
|
||||
doRequest(
|
||||
boost::asio::yield_context& yield,
|
||||
beast::http::request<beast::http::string_body>&& req,
|
||||
boost::beast::http::request<boost::beast::http::string_body>&& req,
|
||||
std::string const& host,
|
||||
uint16_t port,
|
||||
bool secure,
|
||||
beast::http::response<beast::http::string_body>& resp,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& resp,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
using namespace boost::asio;
|
||||
using namespace beast::http;
|
||||
using namespace boost::beast::http;
|
||||
io_service& ios = get_io_service();
|
||||
ip::tcp::resolver r{ios};
|
||||
beast::multi_buffer sb;
|
||||
boost::beast::multi_buffer sb;
|
||||
|
||||
auto it =
|
||||
r.async_resolve(
|
||||
@@ -169,7 +169,7 @@ class ServerStatus_test :
|
||||
ss.async_handshake(ssl::stream_base::client, yield[ec]);
|
||||
if(ec)
|
||||
return;
|
||||
beast::http::async_write(ss, req, yield[ec]);
|
||||
boost::beast::http::async_write(ss, req, yield[ec]);
|
||||
if(ec)
|
||||
return;
|
||||
async_read(ss, sb, resp, yield[ec]);
|
||||
@@ -182,7 +182,7 @@ class ServerStatus_test :
|
||||
async_connect(sock, it, yield[ec]);
|
||||
if(ec)
|
||||
return;
|
||||
beast::http::async_write(sock, req, yield[ec]);
|
||||
boost::beast::http::async_write(sock, req, yield[ec]);
|
||||
if(ec)
|
||||
return;
|
||||
async_read(sock, sb, resp, yield[ec]);
|
||||
@@ -198,7 +198,7 @@ class ServerStatus_test :
|
||||
test::jtx::Env& env,
|
||||
boost::asio::yield_context& yield,
|
||||
bool secure,
|
||||
beast::http::response<beast::http::string_body>& resp,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& resp,
|
||||
boost::system::error_code& ec)
|
||||
{
|
||||
auto const port = env.app().config()["port_ws"].
|
||||
@@ -221,7 +221,7 @@ class ServerStatus_test :
|
||||
test::jtx::Env& env,
|
||||
boost::asio::yield_context& yield,
|
||||
bool secure,
|
||||
beast::http::response<beast::http::string_body>& resp,
|
||||
boost::beast::http::response<boost::beast::http::string_body>& resp,
|
||||
boost::system::error_code& ec,
|
||||
std::string const& body = "",
|
||||
myFields const& fields = {})
|
||||
@@ -383,21 +383,21 @@ class ServerStatus_test :
|
||||
//non-secure request
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
doWSRequest(env, yield, false, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::unauthorized);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::unauthorized);
|
||||
}
|
||||
|
||||
//secure request
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
doWSRequest(env, yield, true, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::unauthorized);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::unauthorized);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -416,21 +416,21 @@ class ServerStatus_test :
|
||||
//non-secure request
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
doHTTPRequest(env, yield, false, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::ok);
|
||||
}
|
||||
|
||||
//secure request
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
doHTTPRequest(env, yield, true, resp, ec);
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::ok);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ class ServerStatus_test :
|
||||
testcase("Partial WS upgrade request");
|
||||
using namespace jtx;
|
||||
using namespace boost::asio;
|
||||
using namespace beast::http;
|
||||
using namespace boost::beast::http;
|
||||
Env env {*this, envconfig([](std::unique_ptr<Config> cfg)
|
||||
{
|
||||
cfg->section("port_ws").set("protocol", "ws2");
|
||||
@@ -462,7 +462,7 @@ class ServerStatus_test :
|
||||
|
||||
io_service& ios = get_io_service();
|
||||
ip::tcp::resolver r{ios};
|
||||
beast::multi_buffer sb;
|
||||
boost::beast::multi_buffer sb;
|
||||
|
||||
auto it =
|
||||
r.async_resolve(
|
||||
@@ -497,7 +497,7 @@ class ServerStatus_test :
|
||||
using namespace jtx;
|
||||
Env env {*this, makeConfig(server_protocol)};
|
||||
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
boost::system::error_code ec;
|
||||
if(boost::starts_with(client_protocol, "h"))
|
||||
{
|
||||
@@ -539,23 +539,23 @@ class ServerStatus_test :
|
||||
|
||||
Json::Value jr;
|
||||
jr[jss::method] = "server_info";
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
boost::system::error_code ec;
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr));
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
|
||||
myFields auth;
|
||||
auth.insert("Authorization", "");
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
|
||||
auth.set("Authorization", "Basic NOT-VALID");
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
|
||||
auth.set("Authorization", "Basic " + beast::detail::base64_encode("me:badpass"));
|
||||
auth.set("Authorization", "Basic " + boost::beast::detail::base64_encode("me:badpass"));
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
|
||||
auto const user = env.app().config().section("port_rpc").
|
||||
get<std::string>("user").value();
|
||||
@@ -565,14 +565,14 @@ class ServerStatus_test :
|
||||
// try with the correct user/pass, but not encoded
|
||||
auth.set("Authorization", "Basic " + user + ":" + pass);
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
|
||||
// finally if we use the correct user/pass encoded, we should get a 200
|
||||
auth.set("Authorization", "Basic " +
|
||||
beast::detail::base64_encode(user + ":" + pass));
|
||||
boost::beast::detail::base64_encode(user + ":" + pass));
|
||||
doHTTPRequest(env, yield, secure, resp, ec, to_string(jr), auth);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
BEAST_EXPECT(! resp.body.empty());
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::ok);
|
||||
BEAST_EXPECT(! resp.body().empty());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -582,7 +582,7 @@ class ServerStatus_test :
|
||||
|
||||
using namespace test::jtx;
|
||||
using namespace boost::asio;
|
||||
using namespace beast::http;
|
||||
using namespace boost::beast::http;
|
||||
Env env {*this, envconfig([&](std::unique_ptr<Config> cfg) {
|
||||
(*cfg)["port_rpc"].set("limit", to_string(limit));
|
||||
return cfg;
|
||||
@@ -606,7 +606,7 @@ class ServerStatus_test :
|
||||
ip::tcp::resolver::query{ip, to_string(port)}, yield[ec]);
|
||||
BEAST_EXPECT(! ec);
|
||||
|
||||
std::vector<std::pair<ip::tcp::socket, beast::multi_buffer>> clients;
|
||||
std::vector<std::pair<ip::tcp::socket, boost::beast::multi_buffer>> clients;
|
||||
int connectionCount {1}; //starts at 1 because the Env already has one
|
||||
//for JSONRPCCLient
|
||||
|
||||
@@ -619,7 +619,7 @@ class ServerStatus_test :
|
||||
while (connectionCount < testTo)
|
||||
{
|
||||
clients.emplace_back(
|
||||
std::make_pair(ip::tcp::socket {ios}, beast::multi_buffer{}));
|
||||
std::make_pair(ip::tcp::socket {ios}, boost::beast::multi_buffer{}));
|
||||
async_connect(clients.back().first, it, yield[ec]);
|
||||
BEAST_EXPECT(! ec);
|
||||
auto req = makeHTTPRequest(ip, port, to_string(jr), {});
|
||||
@@ -634,7 +634,7 @@ class ServerStatus_test :
|
||||
int readCount = 0;
|
||||
for (auto& c : clients)
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
async_read(c.first, c.second, resp, yield[ec]);
|
||||
++readCount;
|
||||
// expect the reads to fail for the clients that connected at or
|
||||
@@ -658,11 +658,11 @@ class ServerStatus_test :
|
||||
get<std::uint16_t>("port").value();
|
||||
auto const ip = env.app().config()["port_ws"].
|
||||
get<std::string>("ip").value();
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
boost::system::error_code ec;
|
||||
doRequest(
|
||||
yield, makeWSUpgrade(ip, port), ip, port, true, resp, ec);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::switching_protocols);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::switching_protocols);
|
||||
BEAST_EXPECT(resp.find("Upgrade") != resp.end() &&
|
||||
resp["Upgrade"] == "websocket");
|
||||
BEAST_EXPECT(resp.find("Connection") != resp.end() &&
|
||||
@@ -681,14 +681,14 @@ class ServerStatus_test :
|
||||
get<std::uint16_t>("port").value();
|
||||
auto const ip = env.app().config()["port_ws"].
|
||||
get<std::string>("ip").value();
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
boost::system::error_code ec;
|
||||
// body content is required here to avoid being
|
||||
// detected as a status request
|
||||
doRequest(yield,
|
||||
makeHTTPRequest(ip, port, "foo", {}), ip, port, false, resp, ec);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.body == "Forbidden\r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::forbidden);
|
||||
BEAST_EXPECT(resp.body() == "Forbidden\r\n");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -698,7 +698,7 @@ class ServerStatus_test :
|
||||
|
||||
using namespace test::jtx;
|
||||
using namespace boost::asio;
|
||||
using namespace beast::http;
|
||||
using namespace boost::beast::http;
|
||||
Env env {*this};
|
||||
|
||||
auto const port = env.app().config()["port_ws"].
|
||||
@@ -721,17 +721,17 @@ class ServerStatus_test :
|
||||
if(! BEAST_EXPECT(! ec))
|
||||
return;
|
||||
|
||||
beast::websocket::stream<boost::asio::ip::tcp::socket&> ws{sock};
|
||||
boost::beast::websocket::stream<boost::asio::ip::tcp::socket&> ws{sock};
|
||||
ws.handshake(ip + ":" + to_string(port), "/");
|
||||
|
||||
// helper lambda, used below
|
||||
auto sendAndParse = [&](std::string const& req) -> Json::Value
|
||||
{
|
||||
ws.async_write_frame(true, buffer(req), yield[ec]);
|
||||
ws.async_write_some(true, buffer(req), yield[ec]);
|
||||
if(! BEAST_EXPECT(! ec))
|
||||
return Json::objectValue;
|
||||
|
||||
beast::multi_buffer sb;
|
||||
boost::beast::multi_buffer sb;
|
||||
ws.async_read(sb, yield[ec]);
|
||||
if(! BEAST_EXPECT(! ec))
|
||||
return Json::objectValue;
|
||||
@@ -740,7 +740,7 @@ class ServerStatus_test :
|
||||
Json::Reader jr;
|
||||
if(! BEAST_EXPECT(jr.parse(
|
||||
boost::lexical_cast<std::string>(
|
||||
beast::buffers(sb.data())), resp)))
|
||||
boost::beast::buffers(sb.data())), resp)))
|
||||
return Json::objectValue;
|
||||
sb.consume(sb.size());
|
||||
return resp;
|
||||
@@ -782,7 +782,7 @@ class ServerStatus_test :
|
||||
testcase("Status request over WS and RPC with/without Amendment Block");
|
||||
using namespace jtx;
|
||||
using namespace boost::asio;
|
||||
using namespace beast::http;
|
||||
using namespace boost::beast::http;
|
||||
Env env {*this, validator( envconfig([](std::unique_ptr<Config> cfg)
|
||||
{
|
||||
cfg->section("port_rpc").set("protocol", "http");
|
||||
@@ -823,9 +823,9 @@ class ServerStatus_test :
|
||||
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::ok);
|
||||
BEAST_EXPECT(
|
||||
resp.body.find("connectivity is working.") != std::string::npos);
|
||||
resp.body().find("connectivity is working.") != std::string::npos);
|
||||
|
||||
// mark the Network as Amendment Blocked, but still won't fail until
|
||||
// ELB is enabled (next step)
|
||||
@@ -855,9 +855,9 @@ class ServerStatus_test :
|
||||
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::ok);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::ok);
|
||||
BEAST_EXPECT(
|
||||
resp.body.find("connectivity is working.") != std::string::npos);
|
||||
resp.body().find("connectivity is working.") != std::string::npos);
|
||||
|
||||
env.app().config().ELB_SUPPORT = true;
|
||||
|
||||
@@ -872,11 +872,11 @@ class ServerStatus_test :
|
||||
|
||||
if(! BEAST_EXPECTS(! ec, ec.message()))
|
||||
return;
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::internal_server_error);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::internal_server_error);
|
||||
BEAST_EXPECT(
|
||||
resp.body.find("cannot accept clients:") != std::string::npos);
|
||||
resp.body().find("cannot accept clients:") != std::string::npos);
|
||||
BEAST_EXPECT(
|
||||
resp.body.find("Server version too old") != std::string::npos);
|
||||
resp.body().find("Server version too old") != std::string::npos);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -889,103 +889,103 @@ class ServerStatus_test :
|
||||
|
||||
boost::system::error_code ec;
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
doHTTPRequest(env, yield, false, resp, ec, "{}");
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "Unable to parse request: \r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "Unable to parse request: \r\n");
|
||||
}
|
||||
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
Json::Value jv;
|
||||
jv["invalid"] = 1;
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "Null method\r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "Null method\r\n");
|
||||
}
|
||||
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
Json::Value jv(Json::arrayValue);
|
||||
jv.append("invalid");
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "Unable to parse request: \r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "Unable to parse request: \r\n");
|
||||
}
|
||||
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
Json::Value jv(Json::arrayValue);
|
||||
Json::Value j;
|
||||
j["invalid"] = 1;
|
||||
jv.append(j);
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "Unable to parse request: \r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "Unable to parse request: \r\n");
|
||||
}
|
||||
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
Json::Value jv;
|
||||
jv[jss::method] = "batch";
|
||||
jv[jss::params] = 2;
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "Malformed batch request\r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "Malformed batch request\r\n");
|
||||
}
|
||||
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
Json::Value jv;
|
||||
jv[jss::method] = "batch";
|
||||
jv[jss::params] = Json::objectValue;
|
||||
jv[jss::params]["invalid"] = 3;
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "Malformed batch request\r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "Malformed batch request\r\n");
|
||||
}
|
||||
|
||||
Json::Value jv;
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
jv[jss::method] = Json::nullValue;
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "Null method\r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "Null method\r\n");
|
||||
}
|
||||
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
jv[jss::method] = 1;
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "method is not string\r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "method is not string\r\n");
|
||||
}
|
||||
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
jv[jss::method] = "";
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "method is empty\r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "method is empty\r\n");
|
||||
}
|
||||
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
jv[jss::method] = "some_method";
|
||||
jv[jss::params] = "params";
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "params unparseable\r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "params unparseable\r\n");
|
||||
}
|
||||
|
||||
{
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
jv[jss::params] = Json::arrayValue;
|
||||
jv[jss::params][0u] = "not an object";
|
||||
doHTTPRequest(env, yield, false, resp, ec, to_string(jv));
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body == "params unparseable\r\n");
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::bad_request);
|
||||
BEAST_EXPECT(resp.body() == "params unparseable\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1003,12 +1003,12 @@ class ServerStatus_test :
|
||||
//raise the fee so that the server is considered overloaded
|
||||
env.app().getFeeTrack().raiseLocalFee();
|
||||
|
||||
beast::http::response<beast::http::string_body> resp;
|
||||
boost::beast::http::response<boost::beast::http::string_body> resp;
|
||||
boost::system::error_code ec;
|
||||
doHTTPRequest(env, yield, false, resp, ec);
|
||||
BEAST_EXPECT(resp.result() == beast::http::status::internal_server_error);
|
||||
BEAST_EXPECT(resp.result() == boost::beast::http::status::internal_server_error);
|
||||
std::regex body {"Server cannot accept clients"};
|
||||
BEAST_EXPECT(std::regex_search(resp.body, body));
|
||||
BEAST_EXPECT(std::regex_search(resp.body(), body));
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef TEST_UNIT_TEST_MULTI_RUNNER_H
|
||||
#define TEST_UNIT_TEST_MULTI_RUNNER_H
|
||||
|
||||
#include <beast/include/beast/core/static_string.hpp>
|
||||
#include <boost/beast/core/static_string.hpp>
|
||||
#include <beast/unit_test/global_suites.hpp>
|
||||
#include <beast/unit_test/runner.hpp>
|
||||
|
||||
@@ -78,7 +78,7 @@ struct suite_results
|
||||
|
||||
struct results
|
||||
{
|
||||
using static_string = beast::static_string<256>;
|
||||
using static_string = boost::beast::static_string<256>;
|
||||
// results may be stored in shared memory. Use `static_string` to ensure
|
||||
// pointers from different memory spaces do not co-mingle
|
||||
using run_time = std::pair<static_string, typename clock_type::duration>;
|
||||
|
||||
Reference in New Issue
Block a user