mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Remove obsolete classes, disable unused code, and tidy up:
* Removed MultiSocket. Code that previously used the MultiSocket now uses a combination of boost::asio coroutines and CRTP. * Sitefiles headers rolled up and directory flattened. * Disabled Sitefiles use of deprecated HTTPClient. * Validators headers tidied up. * Disabled Validators use of deprecated HTTPClient.
This commit is contained in:
@@ -3228,14 +3228,6 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\rpc\Status.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\api\Listener.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\api\Manager.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\api\Section.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\api\SiteFile.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\impl\Logic.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\sitefiles\impl\Manager.cpp">
|
||||
@@ -3244,11 +3236,11 @@
|
||||
<ClCompile Include="..\..\src\ripple\sitefiles\impl\Section.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\impl\Site.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\sitefiles\impl\SiteFile.cpp">
|
||||
<ExcludedFromBuild>True</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\Sitefiles.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\bignum_error.h">
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\CAutoBN_CTX.h">
|
||||
@@ -3419,8 +3411,6 @@
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\unity\sitefiles.cpp">
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\unity\sitefiles.h">
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\unity\snappy.cpp">
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='debug|x64'">..\..\src\snappy\config;..\..\src\snappy\snappy;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='release|x64'">..\..\src\snappy\config;..\..\src\snappy\snappy;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
|
||||
@@ -457,9 +457,6 @@
|
||||
<Filter Include="ripple\sitefiles">
|
||||
<UniqueIdentifier>{CB0AC82D-AEA3-F41C-847F-D6ECA4971891}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ripple\sitefiles\api">
|
||||
<UniqueIdentifier>{6CF7CC29-14E2-50C4-6480-38DA08CCA125}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="ripple\sitefiles\impl">
|
||||
<UniqueIdentifier>{1D95DF26-0788-BD2C-2864-8B038A51FD58}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -4425,18 +4422,6 @@
|
||||
<ClInclude Include="..\..\src\ripple\rpc\Status.h">
|
||||
<Filter>ripple\rpc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\api\Listener.h">
|
||||
<Filter>ripple\sitefiles\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\api\Manager.h">
|
||||
<Filter>ripple\sitefiles\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\api\Section.h">
|
||||
<Filter>ripple\sitefiles\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\api\SiteFile.h">
|
||||
<Filter>ripple\sitefiles\api</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\impl\Logic.h">
|
||||
<Filter>ripple\sitefiles\impl</Filter>
|
||||
</ClInclude>
|
||||
@@ -4446,12 +4431,12 @@
|
||||
<ClCompile Include="..\..\src\ripple\sitefiles\impl\Section.cpp">
|
||||
<Filter>ripple\sitefiles\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\impl\Site.h">
|
||||
<Filter>ripple\sitefiles\impl</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\sitefiles\impl\SiteFile.cpp">
|
||||
<Filter>ripple\sitefiles\impl</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\sitefiles\Sitefiles.h">
|
||||
<Filter>ripple\sitefiles</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\ripple\sslutil\bignum_error.h">
|
||||
<Filter>ripple\sslutil</Filter>
|
||||
</ClInclude>
|
||||
@@ -4680,9 +4665,6 @@
|
||||
<ClCompile Include="..\..\src\ripple\unity\sitefiles.cpp">
|
||||
<Filter>ripple\unity</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\..\src\ripple\unity\sitefiles.h">
|
||||
<Filter>ripple\unity</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\..\src\ripple\unity\snappy.cpp">
|
||||
<Filter>ripple\unity</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -1,132 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_COMMON_MULTISOCKET_H_INCLUDED
|
||||
#define RIPPLE_COMMON_MULTISOCKET_H_INCLUDED
|
||||
|
||||
#include <beast/asio/abstract_socket.h>
|
||||
#include <beast/asio/IPAddressConversion.h>
|
||||
#include <beast/module/asio/protocol/PrefilledReadStream.h>
|
||||
#include <beast/asio/socket_wrapper.h>
|
||||
#include <beast/net/IPEndpoint.h>
|
||||
#include <beast/module/asio/protocol/HandshakeDetectLogicPROXY.h>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <boost/asio/ssl/context.hpp>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
/** An abstract_socket that can handshake with multiple protocols. */
|
||||
class MultiSocket
|
||||
: public beast::asio::abstract_socket
|
||||
{
|
||||
public:
|
||||
// immutable flags
|
||||
struct Flag
|
||||
{
|
||||
enum Bit
|
||||
{
|
||||
peer = 0, // no handshaking. remaining flags ignored.
|
||||
client_role = 1, // operate in client role
|
||||
server_role = 2, // operate in server role
|
||||
|
||||
proxy = 4, // client: will send PROXY handshake
|
||||
// server: PROXY handshake required
|
||||
|
||||
ssl = 8, // client: will use ssl
|
||||
// server: will allow, but not require ssl
|
||||
|
||||
ssl_required = 16 // client: ignored
|
||||
// server: will require ssl (ignores ssl flag)
|
||||
};
|
||||
|
||||
Flag (int flags = 0) noexcept
|
||||
: m_flags (flags)
|
||||
{
|
||||
}
|
||||
|
||||
Flag& operator= (int mask) noexcept
|
||||
{
|
||||
m_flags = mask;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator== (Flag const& other) const noexcept
|
||||
{
|
||||
return m_flags == other.m_flags;
|
||||
}
|
||||
|
||||
inline bool set (int mask) const noexcept
|
||||
{
|
||||
return (m_flags & mask) == mask;
|
||||
}
|
||||
|
||||
inline bool any_set (int mask) const noexcept
|
||||
{
|
||||
return (m_flags & mask) != 0;
|
||||
}
|
||||
|
||||
Flag with (int mask) const noexcept
|
||||
{
|
||||
return Flag (m_flags | mask);
|
||||
}
|
||||
|
||||
Flag without (int mask) const noexcept
|
||||
{
|
||||
return Flag (m_flags & ~mask);
|
||||
}
|
||||
|
||||
int asBits () const noexcept
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
private:
|
||||
int m_flags;
|
||||
};
|
||||
|
||||
typedef beast::asio::HandshakeDetectLogicPROXY::ProxyInfo ProxyInfo;
|
||||
|
||||
// Note that this returns the original flags
|
||||
virtual Flag getFlags () = 0;
|
||||
|
||||
virtual beast::IP::Endpoint local_endpoint() = 0;
|
||||
virtual beast::IP::Endpoint remote_endpoint() = 0;
|
||||
virtual ProxyInfo getProxyInfo () = 0;
|
||||
|
||||
/** Returns a pointer to the SSL handle or nullptr if no SSL. */
|
||||
virtual SSL* ssl_handle () = 0;
|
||||
|
||||
// Caller owns the socket
|
||||
// VFALCO TODO return std::unique_ptr
|
||||
static MultiSocket* New (
|
||||
boost::asio::ip::tcp::socket& socket,
|
||||
boost::asio::ssl::context& ssl_context,
|
||||
int flags = 0);
|
||||
|
||||
// Caller owns the io_service
|
||||
// VFALCO TODO return std::unique_ptr
|
||||
static MultiSocket* New (
|
||||
boost::asio::io_service& io_service,
|
||||
boost::asio::ssl::context& ssl_context,
|
||||
int flags = 0);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,49 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
//#include <ripple/common/impl/MultiSocketType.h>
|
||||
//#include <ripple/common/RippleSSLContext.h>
|
||||
//#include <beast/unit_test/suite.h>
|
||||
//#include <cassert>
|
||||
|
||||
#include <ripple/common/impl/MultiSocketImpl.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
MultiSocket* MultiSocket::New (
|
||||
boost::asio::ip::tcp::socket& socket,
|
||||
boost::asio::ssl::context& ssl_context,
|
||||
int flags)
|
||||
{
|
||||
return new MultiSocketImpl <boost::asio::ip::tcp::socket&> (
|
||||
ssl_context, flags, socket);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
MultiSocket* MultiSocket::New (
|
||||
boost::asio::io_service& io_service,
|
||||
boost::asio::ssl::context& ssl_context,
|
||||
int flags)
|
||||
{
|
||||
return new MultiSocketImpl <boost::asio::ip::tcp::socket> (
|
||||
ssl_context, flags, io_service);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,293 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "../impl/MultiSocketImpl.h"
|
||||
|
||||
#include "../RippleSSLContext.h"
|
||||
|
||||
#include "../../beast/beast/unit_test/suite.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
class MultiSocket_test : public beast::unit_test::suite
|
||||
{
|
||||
public:
|
||||
class MultiSocketDetails : public beast::asio::TestPeerDetails
|
||||
{
|
||||
public:
|
||||
typedef int arg_type;
|
||||
|
||||
MultiSocketDetails (int flags)
|
||||
: m_flags (flags)
|
||||
{
|
||||
}
|
||||
|
||||
static std::string getArgName (arg_type arg)
|
||||
{
|
||||
std::string s;
|
||||
|
||||
if (arg & MultiSocket::Flag::client_role)
|
||||
s += "client,";
|
||||
|
||||
if (arg & MultiSocket::Flag::server_role)
|
||||
s += "server,";
|
||||
|
||||
if (arg & MultiSocket::Flag::ssl)
|
||||
s += "ssl,";
|
||||
|
||||
if (arg & MultiSocket::Flag::ssl_required)
|
||||
s += "ssl_required,";
|
||||
|
||||
if (arg & MultiSocket::Flag::proxy)
|
||||
s += "proxy,";
|
||||
|
||||
if (!s.empty ())
|
||||
{
|
||||
s = std::string ("(") +
|
||||
s.substr (0, s.length () - 1) +
|
||||
std::string (")");
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static boost::asio::ssl::context& getSSLContext ()
|
||||
{
|
||||
struct ContextHolder
|
||||
{
|
||||
ContextHolder ()
|
||||
: context (RippleSSLContext::createAnonymous (
|
||||
"ALL:!LOW:!EXP:!MD5:@STRENGTH"))
|
||||
{
|
||||
// VFALCO NOTE Not sure if this is needed?
|
||||
context->get().set_verify_mode (
|
||||
boost::asio::ssl::verify_none);
|
||||
}
|
||||
|
||||
std::unique_ptr <RippleSSLContext> context;
|
||||
};
|
||||
|
||||
static ContextHolder holder;
|
||||
|
||||
return holder.context->get ();
|
||||
}
|
||||
|
||||
std::string name () const
|
||||
{
|
||||
return getArgName (m_flags);
|
||||
}
|
||||
|
||||
arg_type getFlags () const noexcept
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
protected:
|
||||
arg_type m_flags;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
template <class Protocol>
|
||||
class MultiSocketDetailsType : public MultiSocketDetails
|
||||
{
|
||||
protected:
|
||||
typedef Protocol protocol_type;
|
||||
typedef typename protocol_type::socket socket_type;
|
||||
typedef typename protocol_type::acceptor acceptor_type;
|
||||
typedef typename protocol_type::endpoint endpoint_type;
|
||||
typedef typename protocol_type::resolver resolver_type;
|
||||
|
||||
public:
|
||||
typedef socket_type native_socket_type;
|
||||
typedef acceptor_type native_acceptor_type;
|
||||
|
||||
MultiSocketDetailsType (arg_type flags)
|
||||
: MultiSocketDetails (flags)
|
||||
, m_socket (get_io_service ())
|
||||
, m_acceptor (get_io_service ())
|
||||
, m_multiSocket (MultiSocketDetails::getSSLContext (),
|
||||
flags, m_socket)
|
||||
, m_acceptor_wrapper (m_acceptor)
|
||||
{
|
||||
}
|
||||
|
||||
beast::asio::abstract_socket&
|
||||
get_socket ()
|
||||
{
|
||||
return m_multiSocket;
|
||||
}
|
||||
|
||||
beast::asio::abstract_socket&
|
||||
get_acceptor ()
|
||||
{
|
||||
return m_acceptor_wrapper;
|
||||
}
|
||||
|
||||
socket_type&
|
||||
get_native_socket ()
|
||||
{
|
||||
return m_socket;
|
||||
}
|
||||
|
||||
acceptor_type&
|
||||
get_native_acceptor ()
|
||||
{
|
||||
return m_acceptor;
|
||||
}
|
||||
|
||||
endpoint_type
|
||||
get_endpoint (beast::asio::PeerRole role)
|
||||
{
|
||||
if (role == beast::asio::PeerRole::server)
|
||||
return endpoint_type (boost::asio::ip::tcp::v6 (), 1052);
|
||||
else
|
||||
return endpoint_type (boost::asio::ip::address_v6 ().from_string ("::1"), 1052);
|
||||
}
|
||||
|
||||
protected:
|
||||
socket_type m_socket;
|
||||
acceptor_type m_acceptor;
|
||||
MultiSocketImpl <socket_type&> m_multiSocket;
|
||||
beast::asio::socket_wrapper <acceptor_type&> m_acceptor_wrapper;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
template <typename Protocol, typename ClientArg, typename ServerArg>
|
||||
void runProxy (ClientArg const& clientArg, ServerArg const& serverArg)
|
||||
{
|
||||
beast::asio::PeerTest::run <MultiSocketDetailsType <Protocol>,
|
||||
beast::asio::TestPeerLogicProxyClient,
|
||||
beast::asio::TestPeerLogicSyncServer> (
|
||||
clientArg, serverArg, timeoutSeconds).report (*this);
|
||||
|
||||
beast::asio::PeerTest::run <MultiSocketDetailsType <Protocol>,
|
||||
beast::asio::TestPeerLogicProxyClient,
|
||||
beast::asio::TestPeerLogicAsyncServer> (
|
||||
clientArg, serverArg, timeoutSeconds).report (*this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
template <typename Protocol, typename ClientArg, typename ServerArg>
|
||||
void run (ClientArg const& clientArg, ServerArg const& serverArg)
|
||||
{
|
||||
beast::asio::PeerTest::run <MultiSocketDetailsType <Protocol>,
|
||||
beast::asio::TestPeerLogicSyncClient,
|
||||
beast::asio::TestPeerLogicSyncServer>
|
||||
(clientArg, serverArg, timeoutSeconds).report (*this);
|
||||
|
||||
beast::asio::PeerTest::run <MultiSocketDetailsType <Protocol>,
|
||||
beast::asio::TestPeerLogicAsyncClient,
|
||||
beast::asio::TestPeerLogicSyncServer>
|
||||
(clientArg, serverArg, timeoutSeconds).report (*this);
|
||||
|
||||
beast::asio::PeerTest::run <MultiSocketDetailsType <Protocol>,
|
||||
beast::asio::TestPeerLogicSyncClient,
|
||||
beast::asio::TestPeerLogicAsyncServer>
|
||||
(clientArg, serverArg, timeoutSeconds).report (*this);
|
||||
|
||||
beast::asio::PeerTest::run <MultiSocketDetailsType <Protocol>,
|
||||
beast::asio::TestPeerLogicAsyncClient,
|
||||
beast::asio::TestPeerLogicAsyncServer>
|
||||
(clientArg, serverArg, timeoutSeconds).report (*this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
template <typename Protocol>
|
||||
void testProxyFlags (int extraClientFlags, int extraServerFlags)
|
||||
{
|
||||
assert (! MultiSocket::Flag (extraClientFlags).any_set (
|
||||
MultiSocket::Flag::client_role | MultiSocket::Flag::server_role));
|
||||
|
||||
runProxy <Protocol> (MultiSocket::Flag::client_role | extraClientFlags,
|
||||
MultiSocket::Flag::server_role | extraServerFlags);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
template <typename Protocol>
|
||||
void testFlags (int extraClientFlags, int extraServerFlags)
|
||||
{
|
||||
assert (! MultiSocket::Flag (extraClientFlags).any_set (
|
||||
MultiSocket::Flag::client_role | MultiSocket::Flag::server_role));
|
||||
|
||||
run <Protocol> (MultiSocket::Flag::client_role | extraClientFlags,
|
||||
MultiSocket::Flag::server_role | extraServerFlags);
|
||||
}
|
||||
|
||||
template <typename Protocol>
|
||||
void testProtocol ()
|
||||
{
|
||||
// Simple tests
|
||||
run <Protocol> (0,
|
||||
0);
|
||||
|
||||
run <Protocol> (MultiSocket::Flag::client_role,
|
||||
0);
|
||||
|
||||
run <Protocol> (0, MultiSocket::Flag::server_role);
|
||||
|
||||
run <Protocol> (MultiSocket::Flag::client_role,
|
||||
MultiSocket::Flag::server_role);
|
||||
|
||||
testFlags <Protocol> (MultiSocket::Flag::ssl,
|
||||
MultiSocket::Flag::ssl_required);
|
||||
// SSL-Detect tests
|
||||
testFlags <Protocol> (0,
|
||||
MultiSocket::Flag::ssl);
|
||||
|
||||
testFlags <Protocol> (MultiSocket::Flag::ssl,
|
||||
MultiSocket::Flag::ssl);
|
||||
|
||||
// PROXY Handshake tests
|
||||
testProxyFlags <Protocol> (MultiSocket::Flag::proxy,
|
||||
MultiSocket::Flag::proxy);
|
||||
|
||||
testProxyFlags <Protocol> (MultiSocket::Flag::proxy | MultiSocket::Flag::ssl,
|
||||
MultiSocket::Flag::proxy | MultiSocket::Flag::ssl_required);
|
||||
|
||||
// PROXY + SSL-Detect tests
|
||||
testProxyFlags <Protocol> (MultiSocket::Flag::proxy,
|
||||
MultiSocket::Flag::proxy | MultiSocket::Flag::ssl);
|
||||
|
||||
testProxyFlags <Protocol> (MultiSocket::Flag::proxy | MultiSocket::Flag::ssl,
|
||||
MultiSocket::Flag::proxy | MultiSocket::Flag::ssl);
|
||||
}
|
||||
|
||||
void run ()
|
||||
{
|
||||
testProtocol <boost::asio::ip::tcp> ();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
enum
|
||||
{
|
||||
timeoutSeconds = 10
|
||||
};
|
||||
};
|
||||
|
||||
BEAST_DEFINE_TESTSUITE(MultiSocket,common,ripple);
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <ripple/overlay/Overlay.h>
|
||||
|
||||
#include <ripple/resource/api/Manager.h>
|
||||
#include <ripple/sitefiles/api/Manager.h>
|
||||
#include <ripple/sitefiles/Sitefiles.h>
|
||||
#include <ripple/common/Resolver.h>
|
||||
|
||||
#include <beast/threads/Stoppable.h>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#define RIPPLE_PEERFINDER_MANAGER_H_INCLUDED
|
||||
|
||||
#include <ripple/peerfinder/Slot.h>
|
||||
#include <ripple/sitefiles/api/Manager.h>
|
||||
#include <ripple/sitefiles/Sitefiles.h>
|
||||
#include <beast/chrono/abstract_clock.h>
|
||||
#include <beast/module/core/files/File.h>
|
||||
|
||||
|
||||
137
src/ripple/sitefiles/Sitefiles.h
Normal file
137
src/ripple/sitefiles/Sitefiles.h
Normal file
@@ -0,0 +1,137 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SITEFILES_SITEFILES_H_INCLUDED
|
||||
#define RIPPLE_SITEFILES_SITEFILES_H_INCLUDED
|
||||
|
||||
#include <beast/threads/Stoppable.h>
|
||||
#include <beast/utility/PropertyStream.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
/** A Site File section.
|
||||
Each section has a name, an associative map of key/value pairs,
|
||||
and a vector of zero or more free-form data strings.
|
||||
*/
|
||||
// VFALCO NOTE This could use ripple::Section instead, which
|
||||
// seems to offer the same functionality
|
||||
//
|
||||
class Section
|
||||
{
|
||||
public:
|
||||
typedef std::map <std::string, std::string> MapType;
|
||||
typedef std::vector <std::string> DataType;
|
||||
|
||||
Section(int = 0); // dummy argument for emplace()
|
||||
|
||||
// Observers
|
||||
std::string const& get (std::string const& key) const;
|
||||
std::string const& operator[] (std::string const& key) const;
|
||||
DataType const& data() const;
|
||||
|
||||
// Modifiers
|
||||
void set (std::string const& key, std::string const& value);
|
||||
std::string& operator[] (std::string const& key);
|
||||
void push_back (std::string const& data);
|
||||
|
||||
private:
|
||||
MapType m_map;
|
||||
DataType m_data;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
class SiteFile
|
||||
{
|
||||
public:
|
||||
SiteFile (int = 0); // dummy argument for emplace
|
||||
|
||||
typedef std::map <std::string, Section> SectionsType;
|
||||
|
||||
/** Retrieve a section by name. */
|
||||
/** @{ */
|
||||
Section const& get (std::string const& name) const;
|
||||
Section const& operator[] (std::string const& key) const;
|
||||
/** @} */
|
||||
|
||||
/** Retrieve or create a section with the specified name. */
|
||||
Section& insert (std::string const& name);
|
||||
|
||||
private:
|
||||
SectionsType m_sections;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** SiteFiles listeners receive notifications on new files and sections.
|
||||
Calls are made on an implementation-defined, unspecified thread.
|
||||
Subclasses implementations should not perform blocking i/o or take
|
||||
a long time.
|
||||
*/
|
||||
class Listener
|
||||
{
|
||||
public:
|
||||
/** Called every time a new site file is retrieved.
|
||||
Notifications for Site files retrieved before a listener was added will
|
||||
be sent at the time the listener is added.
|
||||
*/
|
||||
virtual void onSiteFileFetch (
|
||||
std::string const& name, SiteFile const& siteFile) = 0;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** Fetches and maintains a collection of ripple.txt files from domains. */
|
||||
class Manager
|
||||
: public beast::Stoppable
|
||||
, public beast::PropertyStream::Source
|
||||
{
|
||||
protected:
|
||||
explicit Manager (Stoppable& parent);
|
||||
|
||||
public:
|
||||
/** Create a new Manager. */
|
||||
static Manager* New (beast::Stoppable& parent, beast::Journal journal);
|
||||
|
||||
/** Destroy the object.
|
||||
Any pending fetch operations are aborted.
|
||||
*/
|
||||
virtual ~Manager() = default;
|
||||
|
||||
/** Adds a listener. */
|
||||
virtual void addListener (Listener& listener) = 0;
|
||||
|
||||
/** Remove a listener. */
|
||||
virtual void removeListener (Listener& listener) = 0;
|
||||
|
||||
/** Add a URL leading to a ripple.txt file.
|
||||
This call does not block. The URL will be fetched asynchronously.
|
||||
Parsing errors are reported to the journal.
|
||||
*/
|
||||
virtual void addURL (std::string const& urlstr) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,7 +0,0 @@
|
||||
# SiteFiles TODO
|
||||
|
||||
- Use it in more places
|
||||
|
||||
- Process the local file
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SITEFILES_LISTENER_H_INCLUDED
|
||||
#define RIPPLE_SITEFILES_LISTENER_H_INCLUDED
|
||||
|
||||
#include <ripple/sitefiles/api/SiteFile.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
/** SiteFiles listeners receive notifications on new files and sections.
|
||||
Calls are made on an implementation-defined, unspecified thread.
|
||||
Subclasses implementations should not perform blocking i/o or take
|
||||
a long time.
|
||||
*/
|
||||
class Listener
|
||||
{
|
||||
public:
|
||||
/** Called every time a new site file is retrieved.
|
||||
Notifications for Site files retrieved before a listener was added will
|
||||
be sent at the time the listener is added.
|
||||
*/
|
||||
virtual void onSiteFileFetch (
|
||||
std::string const& name, SiteFile const& siteFile) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,64 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SITEFILES_MANAGER_H_INCLUDED
|
||||
#define RIPPLE_SITEFILES_MANAGER_H_INCLUDED
|
||||
|
||||
#include <ripple/sitefiles/api/Listener.h>
|
||||
|
||||
#include <beast/threads/Stoppable.h>
|
||||
#include <beast/utility/PropertyStream.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
/** Fetches and maintains a collection of ripple.txt files from domains. */
|
||||
class Manager
|
||||
: public beast::Stoppable
|
||||
, public beast::PropertyStream::Source
|
||||
{
|
||||
protected:
|
||||
explicit Manager (Stoppable& parent);
|
||||
|
||||
public:
|
||||
/** Create a new Manager. */
|
||||
static Manager* New (beast::Stoppable& parent, beast::Journal journal);
|
||||
|
||||
/** Destroy the object.
|
||||
Any pending fetch operations are aborted.
|
||||
*/
|
||||
virtual ~Manager() = default;
|
||||
|
||||
/** Adds a listener. */
|
||||
virtual void addListener (Listener& listener) = 0;
|
||||
|
||||
/** Remove a listener. */
|
||||
virtual void removeListener (Listener& listener) = 0;
|
||||
|
||||
/** Add a URL leading to a ripple.txt file.
|
||||
This call does not block. The URL will be fetched asynchronously.
|
||||
Parsing errors are reported to the journal.
|
||||
*/
|
||||
virtual void addURL (std::string const& urlstr) = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,59 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SITEFILES_SECTION_H_INCLUDED
|
||||
#define RIPPLE_SITEFILES_SECTION_H_INCLUDED
|
||||
|
||||
#include <ripple/common/UnorderedContainers.h>
|
||||
#include <vector>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
/** A Site File section.
|
||||
Each section has a name, an associative map of key/value pairs,
|
||||
and a vector of zero or more free-form data strings.
|
||||
*/
|
||||
class Section
|
||||
{
|
||||
public:
|
||||
typedef hash_map <std::string, std::string> MapType;
|
||||
typedef std::vector <std::string> DataType;
|
||||
|
||||
Section(int = 0); // dummy argument for emplace()
|
||||
|
||||
// Observers
|
||||
std::string const& get (std::string const& key) const;
|
||||
std::string const& operator[] (std::string const& key) const;
|
||||
DataType const& data() const;
|
||||
|
||||
// Modifiers
|
||||
void set (std::string const& key, std::string const& value);
|
||||
std::string& operator[] (std::string const& key);
|
||||
void push_back (std::string const& data);
|
||||
|
||||
private:
|
||||
MapType m_map;
|
||||
DataType m_data;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,53 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SITEFILES_SITEFILE_H_INCLUDED
|
||||
#define RIPPLE_SITEFILES_SITEFILE_H_INCLUDED
|
||||
|
||||
#include <ripple/common/UnorderedContainers.h>
|
||||
#include <ripple/sitefiles/api/Section.h>
|
||||
#include <string>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
class SiteFile
|
||||
{
|
||||
public:
|
||||
SiteFile (int = 0); // dummy argument for emplace
|
||||
|
||||
typedef hash_map <std::string, Section> SectionsType;
|
||||
|
||||
/** Retrieve a section by name. */
|
||||
/** @{ */
|
||||
Section const& get (std::string const& name) const;
|
||||
Section const& operator[] (std::string const& key) const;
|
||||
/** @} */
|
||||
|
||||
/** Retrieve or create a section with the specified name. */
|
||||
Section& insert (std::string const& name);
|
||||
|
||||
private:
|
||||
SectionsType m_sections;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -20,9 +20,12 @@
|
||||
#ifndef RIPPLE_SITEFILES_LOGIC_H_INCLUDED
|
||||
#define RIPPLE_SITEFILES_LOGIC_H_INCLUDED
|
||||
|
||||
#include <ripple/common/UnorderedContainers.h>
|
||||
|
||||
#include <beast/http/URL.h>
|
||||
#include <beast/module/asio/http/HTTPResponse.h> // DEPRECATED
|
||||
#include <boost/regex.hpp>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
@@ -62,7 +65,7 @@ class Logic
|
||||
{
|
||||
public:
|
||||
typedef std::set <Listener*> Listeners;
|
||||
typedef hash_map <beast::URL, SiteFile> SiteFiles;
|
||||
typedef std::map <beast::URL, SiteFile> SiteFiles;
|
||||
|
||||
struct State
|
||||
{
|
||||
@@ -78,11 +81,9 @@ public:
|
||||
|
||||
SharedState m_state;
|
||||
beast::Journal m_journal;
|
||||
std::unique_ptr <beast::asio::HTTPClientBase> m_client;
|
||||
|
||||
explicit Logic (beast::Journal journal)
|
||||
: m_journal (journal)
|
||||
, m_client (beast::asio::HTTPClientBase::New (journal))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -118,6 +119,15 @@ public:
|
||||
|
||||
void addURL (std::string const& urlstr)
|
||||
{
|
||||
// VFALCO This is commented out because the HTTPClient
|
||||
// implementation is now obsolete. A new HTTP client
|
||||
// that uses the latest best practices (asio coroutines,
|
||||
// beast::http::message and beast::http::parser) should
|
||||
// be used.
|
||||
//
|
||||
// NOTE SiteFiles is currently an unused module.
|
||||
//
|
||||
#if 0
|
||||
auto url = beast::parse_URL (urlstr);
|
||||
|
||||
if (!url.first)
|
||||
@@ -142,6 +152,7 @@ public:
|
||||
beast::HTTPResponse const& response (*result.second);
|
||||
|
||||
processResponse (url.second, response);
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/sitefiles/Sitefiles.h>
|
||||
#include <ripple/sitefiles/impl/Logic.h>
|
||||
#include <beast/module/core/core.h>
|
||||
#include <functional>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/sitefiles/api/Section.h>
|
||||
#include <ripple/sitefiles/Sitefiles.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <ripple/sitefiles/api/Section.h>
|
||||
#include <ripple/sitefiles/Sitefiles.h>
|
||||
|
||||
namespace ripple {
|
||||
namespace SiteFiles {
|
||||
|
||||
@@ -24,10 +24,7 @@
|
||||
#include <ripple/unity/rpcx.h>
|
||||
#include <ripple/unity/websocket.h>
|
||||
#include <ripple/unity/resource.h>
|
||||
#include <ripple/unity/sitefiles.h>
|
||||
|
||||
#include <ripple/http/Server.h>
|
||||
|
||||
#include <ripple/app/main/CollectorManager.cpp>
|
||||
#include <ripple/app/main/NodeStoreScheduler.cpp>
|
||||
#include <ripple/app/main/IoServicePool.cpp>
|
||||
|
||||
@@ -18,17 +18,6 @@
|
||||
//==============================================================================
|
||||
|
||||
#include <BeastConfig.h>
|
||||
|
||||
#include <ripple/unity/sitefiles.h>
|
||||
|
||||
#include <beast/module/asio/asio.h> // HTTPClientBase
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <ripple/sitefiles/impl/Site.h>
|
||||
#include <ripple/sitefiles/impl/Logic.h>
|
||||
#include <ripple/sitefiles/impl/Manager.cpp>
|
||||
#include <ripple/sitefiles/impl/Section.cpp>
|
||||
#include <ripple/sitefiles/impl/SiteFile.cpp>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of rippled: https://github.com/ripple/rippled
|
||||
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef RIPPLE_SITEFILES_H_INCLUDED
|
||||
#define RIPPLE_SITEFILES_H_INCLUDED
|
||||
|
||||
#include <ripple/sitefiles/api/SiteFile.h>
|
||||
#include <ripple/sitefiles/api/Listener.h>
|
||||
#include <ripple/sitefiles/api/Manager.h>
|
||||
|
||||
#endif
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/module/asio/asio.h>
|
||||
#include <memory>
|
||||
|
||||
namespace ripple {
|
||||
@@ -27,10 +26,22 @@ class SourceURLImp
|
||||
: public SourceURL
|
||||
, public beast::LeakChecked <SourceURLImp>
|
||||
{
|
||||
private:
|
||||
beast::URL m_url;
|
||||
|
||||
// VFALCO This is turned off because the HTTPClient
|
||||
// implementation is now obsolete. A new HTTP client
|
||||
// that uses the latest best practices (asio coroutines,
|
||||
// beast::http::message and beast::http::parser) should
|
||||
// be used.
|
||||
#if 0
|
||||
std::unique_ptr <beast::asio::HTTPClientBase> m_client;
|
||||
#endif
|
||||
|
||||
public:
|
||||
explicit SourceURLImp (beast::URL const& url)
|
||||
: m_url (url)
|
||||
, m_client (beast::asio::HTTPClientBase::New ())
|
||||
//, m_client (beast::asio::HTTPClientBase::New ())
|
||||
{
|
||||
}
|
||||
|
||||
@@ -58,11 +69,12 @@ public:
|
||||
|
||||
void cancel ()
|
||||
{
|
||||
m_client->cancel ();
|
||||
//m_client->cancel ();
|
||||
}
|
||||
|
||||
void fetch (Results& results, beast::Journal journal)
|
||||
{
|
||||
#if 0
|
||||
auto httpResult (m_client->get (m_url));
|
||||
|
||||
if (httpResult.first == 0)
|
||||
@@ -77,11 +89,8 @@ public:
|
||||
"HTTP GET to " << m_url <<
|
||||
" failed: '" << httpResult.first.message () << "'";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
beast::URL m_url;
|
||||
std::unique_ptr <beast::asio::HTTPClientBase> m_client;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/module/core/text/LexicalCast.h>
|
||||
#include <beast/utility/Debug.h>
|
||||
#include <boost/regex.hpp>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include <beast/module/core/maths/Random.h>
|
||||
#include <beast/unit_test/suite.h>
|
||||
|
||||
namespace ripple {
|
||||
|
||||
Reference in New Issue
Block a user