mirror of
https://github.com/Xahau/xahaud.git
synced 2025-11-21 11:05:51 +00:00
Compare commits
22 Commits
sha-optimi
...
strict-bui
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d187658ae | ||
|
|
94dbb2398f | ||
|
|
0c2cab76c9 | ||
|
|
77f9415e51 | ||
|
|
fa7406fe1e | ||
|
|
84eee588d3 | ||
|
|
03569dbb11 | ||
|
|
cb77121e20 | ||
|
|
c55a97c51a | ||
|
|
fc0be9c416 | ||
|
|
aaccf9b5b2 | ||
|
|
17af075665 | ||
|
|
e6b362c832 | ||
|
|
5b2b915955 | ||
|
|
e801ead39d | ||
|
|
78a96dd633 | ||
|
|
b3984c166d | ||
|
|
945f737706 | ||
|
|
8360ff8bc2 | ||
|
|
c1274d2a12 | ||
|
|
4aa79b6100 | ||
|
|
6a4c563ced |
@@ -44,7 +44,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
# TBD:
|
# TBD:
|
||||||
# Boost_USE_DEBUG_RUNTIME: When ON, uses Boost libraries linked against the
|
# Boost_USE_DEBUG_RUNTIME: When ON, uses Boost libraries linked against the
|
||||||
find_package(Boost 1.86 REQUIRED
|
find_package(Boost 1.70 REQUIRED
|
||||||
COMPONENTS
|
COMPONENTS
|
||||||
chrono
|
chrono
|
||||||
container
|
container
|
||||||
|
|||||||
@@ -2,92 +2,34 @@
|
|||||||
NIH dep: openssl
|
NIH dep: openssl
|
||||||
#]===================================================================]
|
#]===================================================================]
|
||||||
|
|
||||||
# Include modules
|
#[===============================================[
|
||||||
include(ExternalProject)
|
OPENSSL_ROOT_DIR is the only variable that
|
||||||
include(CheckCCompilerFlag)
|
FindOpenSSL honors for locating, so convert any
|
||||||
|
OPENSSL_ROOT vars to this
|
||||||
check_c_compiler_flag("-mavx512f" COMPILER_SUPPORTS_AVX512)
|
#]===============================================]
|
||||||
option(ENABLE_AVX512 "Enable AVX512 instructions" ${COMPILER_SUPPORTS_AVX512})
|
if (NOT DEFINED OPENSSL_ROOT_DIR)
|
||||||
|
if (DEFINED ENV{OPENSSL_ROOT})
|
||||||
set(OPENSSL_NISTP "")
|
set (OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT})
|
||||||
set(OPENSSL_AVX512 "")
|
elseif (HOMEBREW)
|
||||||
|
execute_process (COMMAND ${HOMEBREW} --prefix openssl
|
||||||
if(APPLE)
|
OUTPUT_VARIABLE OPENSSL_ROOT_DIR
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
set(OPENSSL_PLATFORM "darwin64-arm64-cc")
|
endif ()
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
|
file (TO_CMAKE_PATH "${OPENSSL_ROOT_DIR}" OPENSSL_ROOT_DIR)
|
||||||
set(OPENSSL_PLATFORM "darwin64-x86_64-cc")
|
endif ()
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Unsupported macOS architecture: ${CMAKE_SYSTEM_PROCESSOR}")
|
|
||||||
endif()
|
|
||||||
elseif(UNIX AND NOT APPLE)
|
|
||||||
set(OPENSSL_PLATFORM "linux-x86_64")
|
|
||||||
set(OPENSSL_NISTP "enable-ec_nistp_64_gcc_128")
|
|
||||||
set(OPENSSL_AVX512 "-march=skylake-avx512")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Unsupported platform")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
ExternalProject_Add(openssl_src
|
|
||||||
PREFIX ${nih_cache_path}
|
|
||||||
GIT_REPOSITORY https://github.com/openssl/openssl.git
|
|
||||||
GIT_TAG OpenSSL_1_1_1u
|
|
||||||
CONFIGURE_COMMAND
|
|
||||||
${nih_cache_path}/src/openssl_src/Configure
|
|
||||||
-DBUILD_SHARED_LIBS=OFF
|
|
||||||
-DBUILD_STATIC_LIBS=ON
|
|
||||||
${OPENSSL_PLATFORM}
|
|
||||||
${OPENSSL_NISTP}
|
|
||||||
${OPENSSL_AVX512}
|
|
||||||
enable-rmd160
|
|
||||||
no-ssl2
|
|
||||||
LOG_BUILD ON
|
|
||||||
LOG_CONFIGURE ON
|
|
||||||
LOG_DOWNLOAD ON
|
|
||||||
BUILD_IN_SOURCE 1
|
|
||||||
BUILD_COMMAND $(MAKE)
|
|
||||||
TEST_COMMAND ""
|
|
||||||
INSTALL_COMMAND ""
|
|
||||||
BUILD_BYPRODUCTS
|
|
||||||
<BINARY_DIR>/libssl.a
|
|
||||||
<BINARY_DIR>/libcrypto.a
|
|
||||||
)
|
|
||||||
|
|
||||||
ExternalProject_Get_Property (openssl_src BINARY_DIR)
|
|
||||||
set (openssl_src_BINARY_DIR "${BINARY_DIR}")
|
|
||||||
|
|
||||||
add_library (OpenSSL::SSL STATIC IMPORTED GLOBAL)
|
|
||||||
add_library (OpenSSL::Crypto STATIC IMPORTED GLOBAL)
|
|
||||||
|
|
||||||
add_dependencies(OpenSSL::SSL openssl_src)
|
|
||||||
add_dependencies(OpenSSL::Crypto openssl_src)
|
|
||||||
execute_process(
|
|
||||||
COMMAND
|
|
||||||
mkdir -p "${openssl_src_BINARY_DIR}/include"
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(OpenSSL::SSL PROPERTIES
|
|
||||||
IMPORTED_LOCATION_DEBUG
|
|
||||||
"${openssl_src_BINARY_DIR}/libssl.a"
|
|
||||||
IMPORTED_LOCATION_RELEASE
|
|
||||||
"${openssl_src_BINARY_DIR}/libssl.a"
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES
|
|
||||||
"${openssl_src_BINARY_DIR}/include"
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(OpenSSL::Crypto PROPERTIES
|
|
||||||
IMPORTED_LOCATION_DEBUG
|
|
||||||
"${openssl_src_BINARY_DIR}/libcrypto.a"
|
|
||||||
IMPORTED_LOCATION_RELEASE
|
|
||||||
"${openssl_src_BINARY_DIR}/libcrypto.a"
|
|
||||||
INTERFACE_INCLUDE_DIRECTORIES
|
|
||||||
"${openssl_src_BINARY_DIR}/include"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
if (static)
|
||||||
|
set (OPENSSL_USE_STATIC_LIBS ON)
|
||||||
|
endif ()
|
||||||
|
set (OPENSSL_MSVC_STATIC_RT ON)
|
||||||
|
find_package (OpenSSL 1.1.1 REQUIRED)
|
||||||
target_link_libraries (ripple_libs
|
target_link_libraries (ripple_libs
|
||||||
INTERFACE
|
INTERFACE
|
||||||
OpenSSL::SSL
|
OpenSSL::SSL
|
||||||
OpenSSL::Crypto)
|
OpenSSL::Crypto)
|
||||||
|
# disable SSLv2...this can also be done when building/configuring OpenSSL
|
||||||
|
set_target_properties(OpenSSL::SSL PROPERTIES
|
||||||
|
INTERFACE_COMPILE_DEFINITIONS OPENSSL_NO_SSL2)
|
||||||
#[=========================================================[
|
#[=========================================================[
|
||||||
https://gitlab.kitware.com/cmake/cmake/issues/16885
|
https://gitlab.kitware.com/cmake/cmake/issues/16885
|
||||||
depending on how openssl is built, it might depend
|
depending on how openssl is built, it might depend
|
||||||
@@ -104,9 +46,3 @@ if (TARGET ZLIB::ZLIB)
|
|||||||
INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
|
INTERFACE_LINK_LIBRARIES ZLIB::ZLIB)
|
||||||
set (has_zlib TRUE)
|
set (has_zlib TRUE)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if(ENABLE_AVX512 AND COMPILER_SUPPORTS_AVX512 AND NOT APPLE)
|
|
||||||
add_compile_options(-mavx512f)
|
|
||||||
add_compile_options(-march=skylake-avx512)
|
|
||||||
endif()
|
|
||||||
add_link_options(-lssl -lcrypto)
|
|
||||||
@@ -90,11 +90,11 @@ echo "-- Install Cmake 3.23.1 --" &&
|
|||||||
pwd &&
|
pwd &&
|
||||||
( wget -nc -q https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.tar.gz; echo "" ) &&
|
( wget -nc -q https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.tar.gz; echo "" ) &&
|
||||||
tar -xzf cmake-3.23.1-linux-x86_64.tar.gz -C /hbb/ &&
|
tar -xzf cmake-3.23.1-linux-x86_64.tar.gz -C /hbb/ &&
|
||||||
echo "-- Install Boost 1.86.0 --" &&
|
echo "-- Install Boost 1.75.0 --" &&
|
||||||
pwd &&
|
pwd &&
|
||||||
( wget -nc -q https://boostorg.jfrog.io/artifactory/main/release/1.86.0/source/boost_1_86_0.tar.gz; echo "" ) &&
|
( wget -nc -q https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz; echo "" ) &&
|
||||||
tar -xzf boost_1_86_0.tar.gz &&
|
tar -xzf boost_1_75_0.tar.gz &&
|
||||||
cd boost_1_86_0 && ./bootstrap.sh && ./b2 link=static -j$3 && ./b2 install &&
|
cd boost_1_75_0 && ./bootstrap.sh && ./b2 link=static -j$3 && ./b2 install &&
|
||||||
cd ../ &&
|
cd ../ &&
|
||||||
echo "-- Install Protobuf 3.20.0 --" &&
|
echo "-- Install Protobuf 3.20.0 --" &&
|
||||||
pwd &&
|
pwd &&
|
||||||
@@ -127,9 +127,9 @@ echo "-- Build WasmEdge --" &&
|
|||||||
cd WasmEdge-0.11.2 &&
|
cd WasmEdge-0.11.2 &&
|
||||||
( mkdir build; echo "" ) &&
|
( mkdir build; echo "" ) &&
|
||||||
cd build &&
|
cd build &&
|
||||||
export BOOST_ROOT="/usr/local/src/boost_1_86_0" &&
|
export BOOST_ROOT="/usr/local/src/boost_1_75_0" &&
|
||||||
export Boost_LIBRARY_DIRS="/usr/local/lib" &&
|
export Boost_LIBRARY_DIRS="/usr/local/lib" &&
|
||||||
export BOOST_INCLUDEDIR="/usr/local/src/boost_1_86_0" &&
|
export BOOST_INCLUDEDIR="/usr/local/src/boost_1_75_0" &&
|
||||||
export PATH=`echo $PATH | sed -E "s/devtoolset-7/devtoolset-9/g"` &&
|
export PATH=`echo $PATH | sed -E "s/devtoolset-7/devtoolset-9/g"` &&
|
||||||
cmake .. \
|
cmake .. \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ public:
|
|||||||
std::uint32_t minimumTxnInLedgerSA = 1000;
|
std::uint32_t minimumTxnInLedgerSA = 1000;
|
||||||
/// Number of transactions per ledger that fee escalation "works
|
/// Number of transactions per ledger that fee escalation "works
|
||||||
/// towards".
|
/// towards".
|
||||||
std::uint32_t targetTxnInLedger = 1000;
|
std::uint32_t targetTxnInLedger = 256;
|
||||||
/** Optional maximum allowed value of transactions per ledger before
|
/** Optional maximum allowed value of transactions per ledger before
|
||||||
fee escalation kicks in. By default, the maximum is an emergent
|
fee escalation kicks in. By default, the maximum is an emergent
|
||||||
property of network, validator, and consensus performance. This
|
property of network, validator, and consensus performance. This
|
||||||
|
|||||||
@@ -194,14 +194,8 @@ ETLSource::onResolve(
|
|||||||
{
|
{
|
||||||
boost::beast::get_lowest_layer(*ws_).expires_after(
|
boost::beast::get_lowest_layer(*ws_).expires_after(
|
||||||
std::chrono::seconds(30));
|
std::chrono::seconds(30));
|
||||||
|
|
||||||
// Use async_connect with the entire results
|
|
||||||
boost::beast::get_lowest_layer(*ws_).async_connect(
|
boost::beast::get_lowest_layer(*ws_).async_connect(
|
||||||
results,
|
results, [this](auto ec, auto ep) { onConnect(ec, ep); });
|
||||||
[this](
|
|
||||||
boost::beast::error_code ec,
|
|
||||||
boost::asio::ip::tcp::resolver::results_type::endpoint_type
|
|
||||||
ep) { onConnect(ec, ep); });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include <ripple/beast/utility/Journal.h>
|
#include <ripple/beast/utility/Journal.h>
|
||||||
#include <boost/beast/core/string.hpp>
|
#include <boost/beast/core/string.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <fstream>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|||||||
@@ -549,8 +549,7 @@ using uint128 = base_uint<128>;
|
|||||||
using uint160 = base_uint<160>;
|
using uint160 = base_uint<160>;
|
||||||
using uint256 = base_uint<256>;
|
using uint256 = base_uint<256>;
|
||||||
|
|
||||||
/*
|
template <std::size_t Bits, class Tag>
|
||||||
* template <std::size_t Bits, class Tag>
|
|
||||||
[[nodiscard]] inline constexpr std::strong_ordering
|
[[nodiscard]] inline constexpr std::strong_ordering
|
||||||
operator<=>(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
|
operator<=>(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
|
||||||
{
|
{
|
||||||
@@ -571,19 +570,6 @@ operator<=>(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
|
|||||||
return (*ret.first > *ret.second) ? std::strong_ordering::greater
|
return (*ret.first > *ret.second) ? std::strong_ordering::greater
|
||||||
: std::strong_ordering::less;
|
: std::strong_ordering::less;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
template <std::size_t Bits, class Tag>
|
|
||||||
[[nodiscard]] inline constexpr std::strong_ordering
|
|
||||||
operator<=>(base_uint<Bits, Tag> const& lhs, base_uint<Bits, Tag> const& rhs)
|
|
||||||
{
|
|
||||||
return std::lexicographical_compare_three_way(
|
|
||||||
lhs.cbegin(),
|
|
||||||
lhs.cend(),
|
|
||||||
rhs.cbegin(),
|
|
||||||
rhs.cend(),
|
|
||||||
std::compare_three_way{});
|
|
||||||
}
|
|
||||||
|
|
||||||
template <std::size_t Bits, typename Tag>
|
template <std::size_t Bits, typename Tag>
|
||||||
[[nodiscard]] inline constexpr bool
|
[[nodiscard]] inline constexpr bool
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <ripple/basics/FileUtilities.h>
|
#include <ripple/basics/FileUtilities.h>
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
@@ -42,7 +41,7 @@ getFileContents(
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ifstream fileStream(fullPath.string(), std::ios::in);
|
ifstream fileStream(fullPath, std::ios::in);
|
||||||
|
|
||||||
if (!fileStream)
|
if (!fileStream)
|
||||||
{
|
{
|
||||||
@@ -72,8 +71,7 @@ writeFileContents(
|
|||||||
using namespace boost::filesystem;
|
using namespace boost::filesystem;
|
||||||
using namespace boost::system::errc;
|
using namespace boost::system::errc;
|
||||||
|
|
||||||
std::ofstream fileStream(
|
ofstream fileStream(destPath, std::ios::out | std::ios::trunc);
|
||||||
destPath.string(), std::ios::out | std::ios::trunc);
|
|
||||||
|
|
||||||
if (!fileStream)
|
if (!fileStream)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ public:
|
|||||||
bool LEDGER_REPLAY = false;
|
bool LEDGER_REPLAY = false;
|
||||||
|
|
||||||
// Work queue limits
|
// Work queue limits
|
||||||
int MAX_TRANSACTIONS = 1000;
|
int MAX_TRANSACTIONS = 250;
|
||||||
static constexpr int MAX_JOB_QUEUE_TX = 1000;
|
static constexpr int MAX_JOB_QUEUE_TX = 1000;
|
||||||
static constexpr int MIN_JOB_QUEUE_TX = 100;
|
static constexpr int MIN_JOB_QUEUE_TX = 100;
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <ripple/app/rdb/Download.h>
|
#include <ripple/app/rdb/Download.h>
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ getFeatureValue(
|
|||||||
return {};
|
return {};
|
||||||
boost::smatch match;
|
boost::smatch match;
|
||||||
boost::regex rx(feature + "=([^;\\s]+)");
|
boost::regex rx(feature + "=([^;\\s]+)");
|
||||||
auto const value = std::string(header->value());
|
auto const value = header->value().to_string();
|
||||||
if (boost::regex_search(value, match, rx))
|
if (boost::regex_search(value, match, rx))
|
||||||
return {match[1]};
|
return {match[1]};
|
||||||
return {};
|
return {};
|
||||||
@@ -233,7 +233,7 @@ verifyHandshake(
|
|||||||
{
|
{
|
||||||
if (auto const iter = headers.find("Server-Domain"); iter != headers.end())
|
if (auto const iter = headers.find("Server-Domain"); iter != headers.end())
|
||||||
{
|
{
|
||||||
if (!isProperlyFormedTomlDomain(std::string(iter->value())))
|
if (!isProperlyFormedTomlDomain(iter->value().to_string()))
|
||||||
throw std::runtime_error("Invalid server domain");
|
throw std::runtime_error("Invalid server domain");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,8 +243,7 @@ verifyHandshake(
|
|||||||
uint32_t peer_nid = 0;
|
uint32_t peer_nid = 0;
|
||||||
if (auto const iter = headers.find("Network-ID"); iter != headers.end())
|
if (auto const iter = headers.find("Network-ID"); iter != headers.end())
|
||||||
{
|
{
|
||||||
if (!beast::lexicalCastChecked(
|
if (!beast::lexicalCastChecked(peer_nid, iter->value().to_string()))
|
||||||
peer_nid, std::string(iter->value())))
|
|
||||||
throw std::runtime_error("Invalid peer network identifier");
|
throw std::runtime_error("Invalid peer network identifier");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +255,7 @@ verifyHandshake(
|
|||||||
if (auto const iter = headers.find("Network-Time"); iter != headers.end())
|
if (auto const iter = headers.find("Network-Time"); iter != headers.end())
|
||||||
{
|
{
|
||||||
auto const netTime =
|
auto const netTime =
|
||||||
[str = std::string(iter->value())]() -> TimeKeeper::time_point {
|
[str = iter->value().to_string()]() -> TimeKeeper::time_point {
|
||||||
TimeKeeper::duration::rep val;
|
TimeKeeper::duration::rep val;
|
||||||
|
|
||||||
if (beast::lexicalCastChecked(val, str))
|
if (beast::lexicalCastChecked(val, str))
|
||||||
@@ -292,7 +291,7 @@ verifyHandshake(
|
|||||||
if (auto const iter = headers.find("Public-Key"); iter != headers.end())
|
if (auto const iter = headers.find("Public-Key"); iter != headers.end())
|
||||||
{
|
{
|
||||||
auto pk = parseBase58<PublicKey>(
|
auto pk = parseBase58<PublicKey>(
|
||||||
TokenType::NodePublic, std::string(iter->value()));
|
TokenType::NodePublic, iter->value().to_string());
|
||||||
|
|
||||||
if (pk)
|
if (pk)
|
||||||
{
|
{
|
||||||
@@ -318,7 +317,7 @@ verifyHandshake(
|
|||||||
if (iter == headers.end())
|
if (iter == headers.end())
|
||||||
throw std::runtime_error("No session signature specified");
|
throw std::runtime_error("No session signature specified");
|
||||||
|
|
||||||
auto sig = base64_decode(std::string(iter->value()));
|
auto sig = base64_decode(iter->value().to_string());
|
||||||
|
|
||||||
if (!verifyDigest(publicKey, sharedValue, makeSlice(sig), false))
|
if (!verifyDigest(publicKey, sharedValue, makeSlice(sig), false))
|
||||||
throw std::runtime_error("Failed to verify session");
|
throw std::runtime_error("Failed to verify session");
|
||||||
@@ -331,7 +330,7 @@ verifyHandshake(
|
|||||||
{
|
{
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
auto const local_ip = boost::asio::ip::address::from_string(
|
auto const local_ip = boost::asio::ip::address::from_string(
|
||||||
std::string(iter->value()), ec);
|
iter->value().to_string(), ec);
|
||||||
|
|
||||||
if (ec)
|
if (ec)
|
||||||
throw std::runtime_error("Invalid Local-IP");
|
throw std::runtime_error("Invalid Local-IP");
|
||||||
@@ -346,7 +345,7 @@ verifyHandshake(
|
|||||||
{
|
{
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
auto const remote_ip = boost::asio::ip::address::from_string(
|
auto const remote_ip = boost::asio::ip::address::from_string(
|
||||||
std::string(iter->value()), ec);
|
iter->value().to_string(), ec);
|
||||||
|
|
||||||
if (ec)
|
if (ec)
|
||||||
throw std::runtime_error("Invalid Remote-IP");
|
throw std::runtime_error("Invalid Remote-IP");
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ PeerImp::run()
|
|||||||
if (auto const iter = headers_.find("Closed-Ledger");
|
if (auto const iter = headers_.find("Closed-Ledger");
|
||||||
iter != headers_.end())
|
iter != headers_.end())
|
||||||
{
|
{
|
||||||
closed = parseLedgerHash(std::string(iter->value()));
|
closed = parseLedgerHash(iter->value().to_string());
|
||||||
|
|
||||||
if (!closed)
|
if (!closed)
|
||||||
fail("Malformed handshake data (1)");
|
fail("Malformed handshake data (1)");
|
||||||
@@ -185,7 +185,7 @@ PeerImp::run()
|
|||||||
if (auto const iter = headers_.find("Previous-Ledger");
|
if (auto const iter = headers_.find("Previous-Ledger");
|
||||||
iter != headers_.end())
|
iter != headers_.end())
|
||||||
{
|
{
|
||||||
previous = parseLedgerHash(std::string(iter->value()));
|
previous = parseLedgerHash(iter->value().to_string());
|
||||||
|
|
||||||
if (!previous)
|
if (!previous)
|
||||||
fail("Malformed handshake data (2)");
|
fail("Malformed handshake data (2)");
|
||||||
@@ -372,8 +372,8 @@ std::string
|
|||||||
PeerImp::getVersion() const
|
PeerImp::getVersion() const
|
||||||
{
|
{
|
||||||
if (inbound_)
|
if (inbound_)
|
||||||
return std::string(headers_["User-Agent"]);
|
return headers_["User-Agent"].to_string();
|
||||||
return std::string(headers_["Server"]);
|
return headers_["Server"].to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
Json::Value
|
Json::Value
|
||||||
@@ -399,7 +399,7 @@ PeerImp::json()
|
|||||||
if (auto const d = domain(); !d.empty())
|
if (auto const d = domain(); !d.empty())
|
||||||
ret[jss::server_domain] = domain();
|
ret[jss::server_domain] = domain();
|
||||||
|
|
||||||
if (auto const nid = std::string(headers_["Network-ID"]); !nid.empty())
|
if (auto const nid = headers_["Network-ID"].to_string(); !nid.empty())
|
||||||
ret[jss::network_id] = nid;
|
ret[jss::network_id] = nid;
|
||||||
|
|
||||||
ret[jss::load] = usage_.balance();
|
ret[jss::load] = usage_.balance();
|
||||||
@@ -839,7 +839,7 @@ PeerImp::name() const
|
|||||||
std::string
|
std::string
|
||||||
PeerImp::domain() const
|
PeerImp::domain() const
|
||||||
{
|
{
|
||||||
return std::string(headers_["Server-Domain"]);
|
return headers_["Server-Domain"].to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#define RIPPLE_PEERFINDER_CHECKER_H_INCLUDED
|
#define RIPPLE_PEERFINDER_CHECKER_H_INCLUDED
|
||||||
|
|
||||||
#include <ripple/beast/net/IPAddressConversion.h>
|
#include <ripple/beast/net/IPAddressConversion.h>
|
||||||
|
#include <boost/asio/detail/handler_invoke_helpers.hpp>
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_service.hpp>
|
||||||
#include <boost/asio/ip/tcp.hpp>
|
#include <boost/asio/ip/tcp.hpp>
|
||||||
#include <boost/intrusive/list.hpp>
|
#include <boost/intrusive/list.hpp>
|
||||||
|
|||||||
@@ -247,11 +247,11 @@ build_map(boost::beast::http::fields const& h)
|
|||||||
std::map<std::string, std::string> c;
|
std::map<std::string, std::string> c;
|
||||||
for (auto const& e : h)
|
for (auto const& e : h)
|
||||||
{
|
{
|
||||||
auto key(std::string(e.name_string()));
|
auto key(e.name_string().to_string());
|
||||||
std::transform(key.begin(), key.end(), key.begin(), [](auto kc) {
|
std::transform(key.begin(), key.end(), key.begin(), [](auto kc) {
|
||||||
return std::tolower(static_cast<unsigned char>(kc));
|
return std::tolower(static_cast<unsigned char>(kc));
|
||||||
});
|
});
|
||||||
c[key] = std::string(e.value());
|
c[key] = e.value().to_string();
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
{
|
{
|
||||||
auto it = h.find("X-User");
|
auto it = h.find("X-User");
|
||||||
if (it != h.end())
|
if (it != h.end())
|
||||||
user_ = std::string(it->value());
|
user_ = it->value().to_string();
|
||||||
fwdfor_ = std::string(forwardedFor(h));
|
fwdfor_ = std::string(forwardedFor(h));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ class LedgerLoad_test : public beast::unit_test::suite
|
|||||||
copy_file(
|
copy_file(
|
||||||
sd.ledgerFile,
|
sd.ledgerFile,
|
||||||
ledgerFileCorrupt,
|
ledgerFileCorrupt,
|
||||||
copy_options::overwrite_existing,
|
copy_option::overwrite_if_exists,
|
||||||
ec);
|
ec);
|
||||||
if (!BEAST_EXPECTS(!ec, ec.message()))
|
if (!BEAST_EXPECTS(!ec, ec.message()))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -29,7 +29,6 @@
|
|||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <boost/asio/ip/tcp.hpp>
|
#include <boost/asio/ip/tcp.hpp>
|
||||||
#include <boost/asio/ssl/stream.hpp>
|
#include <boost/asio/ssl/stream.hpp>
|
||||||
#include <boost/beast/core/flat_buffer.hpp>
|
|
||||||
#include <boost/beast/http.hpp>
|
#include <boost/beast/http.hpp>
|
||||||
#include <boost/beast/ssl.hpp>
|
#include <boost/beast/ssl.hpp>
|
||||||
#include <boost/beast/version.hpp>
|
#include <boost/beast/version.hpp>
|
||||||
@@ -575,7 +574,7 @@ private:
|
|||||||
if (ec)
|
if (ec)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
auto path = req.target(); //.to_string();
|
auto path = req.target().to_string();
|
||||||
res.insert("Server", "TrustedPublisherServer");
|
res.insert("Server", "TrustedPublisherServer");
|
||||||
res.version(req.version());
|
res.version(req.version());
|
||||||
res.keep_alive(req.keep_alive());
|
res.keep_alive(req.keep_alive());
|
||||||
@@ -678,8 +677,7 @@ private:
|
|||||||
// unknown request
|
// unknown request
|
||||||
res.result(boost::beast::http::status::not_found);
|
res.result(boost::beast::http::status::not_found);
|
||||||
res.insert("Content-Type", "text/html");
|
res.insert("Content-Type", "text/html");
|
||||||
res.body() =
|
res.body() = "The file '" + path + "' was not found";
|
||||||
"The file '" + std::string(path) + "' was not found";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prepare)
|
if (prepare)
|
||||||
|
|||||||
@@ -674,10 +674,10 @@ class ServerStatus_test : public beast::unit_test::suite,
|
|||||||
resp.result() == boost::beast::http::status::switching_protocols);
|
resp.result() == boost::beast::http::status::switching_protocols);
|
||||||
BEAST_EXPECT(
|
BEAST_EXPECT(
|
||||||
resp.find("Upgrade") != resp.end() &&
|
resp.find("Upgrade") != resp.end() &&
|
||||||
std::string(resp["Upgrade"]) == "websocket");
|
resp["Upgrade"] == "websocket");
|
||||||
BEAST_EXPECT(
|
BEAST_EXPECT(
|
||||||
resp.find("Connection") != resp.end() &&
|
resp.find("Connection") != resp.end() &&
|
||||||
std::string(resp["Connection"]) == "Upgrade");
|
resp["Connection"] == "upgrade");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user