mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 19:15:54 +00:00
Move HttpsClient to ripple_net
This commit is contained in:
@@ -358,6 +358,12 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_net\client\ripple_HttpsClient.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_net\ripple_net.cpp" />
|
||||
<ClCompile Include="..\..\modules\ripple_sqlite\ripple_sqlite.c" />
|
||||
<ClCompile Include="..\..\modules\ripple_websocket\autosocket\ripple_AutoSocket.cpp">
|
||||
@@ -398,12 +404,6 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\cpp\ripple\HttpsClient.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\cpp\ripple\Interpreter.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
@@ -1391,6 +1391,7 @@
|
||||
<ClInclude Include="..\..\modules\ripple_json\ripple_json.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_leveldb\ripple_leveldb.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_net\basics\ripple_HTTPRequest.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_net\client\ripple_HttpsClient.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_net\ripple_net.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_sqlite\ripple_sqlite.h" />
|
||||
<ClInclude Include="..\..\modules\ripple_websocket\autosocket\ripple_AutoSocket.h" />
|
||||
@@ -1399,7 +1400,6 @@
|
||||
<ClInclude Include="..\..\src\cpp\ripple\CallRPC.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\ChangeTransactor.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\Contract.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\HttpsClient.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\Interpreter.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\Ledger.h" />
|
||||
<ClInclude Include="..\..\src\cpp\ripple\LedgerMaster.h" />
|
||||
|
||||
@@ -672,9 +672,6 @@
|
||||
<ClCompile Include="..\..\src\cpp\ripple\ripple_Validations.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\_misc</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\cpp\ripple\HttpsClient.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\cpp\ripple\SNTPClient.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClCompile>
|
||||
@@ -852,6 +849,9 @@
|
||||
<ClCompile Include="..\..\src\cpp\ripple\RPCServer.cpp">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\modules\ripple_net\client\ripple_HttpsClient.cpp">
|
||||
<Filter>[1] Ripple\ripple_net\client</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\Subtrees\sqlite\sqlite3.h">
|
||||
@@ -1401,9 +1401,6 @@
|
||||
<ClInclude Include="..\..\src\cpp\ripple\ripple_SerializedTransaction.h">
|
||||
<Filter>[1] Ripple\ripple_app\_misc</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\cpp\ripple\HttpsClient.h">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\cpp\ripple\SNTPClient.h">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClInclude>
|
||||
@@ -1584,6 +1581,9 @@
|
||||
<ClInclude Include="..\..\src\cpp\ripple\RPCServer.h">
|
||||
<Filter>[1] Ripple\ripple_app\_network</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\modules\ripple_net\client\ripple_HttpsClient.h">
|
||||
<Filter>[1] Ripple\ripple_net\client</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\..\src\cpp\ripple\ripple.proto" />
|
||||
|
||||
@@ -153,7 +153,6 @@ namespace ripple
|
||||
#include "src/cpp/ripple/CallRPC.h"
|
||||
#include "src/cpp/ripple/Transactor.h"
|
||||
#include "src/cpp/ripple/ChangeTransactor.h"
|
||||
#include "src/cpp/ripple/HttpsClient.h"
|
||||
#include "src/cpp/ripple/ripple_TransactionAcquire.h"
|
||||
#include "src/cpp/ripple/ripple_DisputedTx.h"
|
||||
#include "src/cpp/ripple/ripple_LedgerConsensus.h"
|
||||
@@ -378,7 +377,6 @@ static DH* handleTmpDh (SSL* ssl, int is_export, int iKeyLength)
|
||||
|
||||
#include "src/cpp/ripple/ripple_LedgerConsensus.cpp"
|
||||
#include "src/cpp/ripple/LedgerMaster.cpp"
|
||||
#include "src/cpp/ripple/HttpsClient.cpp"
|
||||
|
||||
#include "src/cpp/ripple/ripple_InfoSub.cpp"
|
||||
#include "src/cpp/ripple/ripple_OrderBook.cpp"
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
|
||||
SETUP_LOG (HttpsClient)
|
||||
|
||||
// VFALCO NOTE Why use theConfig.SSL_CONTEXT instead of just passing it?
|
||||
// TODO Remove all theConfig deps from this file
|
||||
//
|
||||
HttpsClient::HttpsClient (boost::asio::io_service& io_service,
|
||||
const unsigned short port,
|
||||
std::size_t responseMax)
|
||||
@@ -313,11 +316,18 @@ void HttpsClient::handleHeader (const boost::system::error_code& ecResult, std::
|
||||
mResponseMax = size;
|
||||
}
|
||||
|
||||
if (mResponseMax == 0) // no body wanted or available
|
||||
if (mResponseMax == 0)
|
||||
{
|
||||
// no body wanted or available
|
||||
invokeComplete (ecResult, mStatus);
|
||||
else if (mBody.size () >= mResponseMax) // we got the whole thing
|
||||
}
|
||||
else if (mBody.size () >= mResponseMax)
|
||||
{
|
||||
// we got the whole thing
|
||||
invokeComplete (ecResult, mStatus, mBody);
|
||||
}
|
||||
else
|
||||
{
|
||||
mSocket.async_read (
|
||||
mResponse.prepare (mResponseMax - mBody.size ()),
|
||||
boost::asio::transfer_all (),
|
||||
@@ -325,6 +335,7 @@ void HttpsClient::handleHeader (const boost::system::error_code& ecResult, std::
|
||||
shared_from_this (),
|
||||
boost::asio::placeholders::error,
|
||||
boost::asio::placeholders::bytes_transferred));
|
||||
}
|
||||
}
|
||||
|
||||
void HttpsClient::handleData (const boost::system::error_code& ecResult, std::size_t bytes_transferred)
|
||||
@@ -4,12 +4,11 @@
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#ifndef _HTTPS_CLIENT_
|
||||
#define _HTTPS_CLIENT_
|
||||
#ifndef RIPPLE_HTTPSCLIENT_H_INCLUDED
|
||||
#define RIPPLE_HTTPSCLIENT_H_INCLUDED
|
||||
|
||||
//
|
||||
// Async https client.
|
||||
//
|
||||
/** Provides an asynchronous HTTPS client implementation.
|
||||
*/
|
||||
|
||||
class HttpsClient
|
||||
: public boost::enable_shared_from_this <HttpsClient>
|
||||
@@ -22,29 +21,36 @@ public:
|
||||
std::size_t responseMax
|
||||
);
|
||||
|
||||
// VFALCO NOTE Putting "https" is redundant, the class is
|
||||
// already called HttpsClient.
|
||||
//
|
||||
// VFALCO TODO Rename these to request, get, and next.
|
||||
//
|
||||
void httpsRequest (
|
||||
bool bSSL,
|
||||
std::deque<std::string> deqSites,
|
||||
FUNCTION_TYPE<void (boost::asio::streambuf& sb, const std::string& strHost)> build,
|
||||
FUNCTION_TYPE <void (boost::asio::streambuf& sb, const std::string& strHost)> build,
|
||||
boost::posix_time::time_duration timeout,
|
||||
FUNCTION_TYPE<bool (const boost::system::error_code& ecResult, int iStatus, const std::string& strData)> complete);
|
||||
FUNCTION_TYPE <bool (const boost::system::error_code& ecResult, int iStatus, const std::string& strData)> complete);
|
||||
|
||||
void httpsGet (
|
||||
bool bSSL,
|
||||
std::deque<std::string> deqSites,
|
||||
const std::string& strPath,
|
||||
boost::posix_time::time_duration timeout,
|
||||
FUNCTION_TYPE<bool (const boost::system::error_code& ecResult, int iStatus, const std::string& strData)> complete);
|
||||
FUNCTION_TYPE <bool (const boost::system::error_code& ecResult, int iStatus, const std::string& strData)> complete);
|
||||
|
||||
// VFALCO TODO These statics all belong in some HttpsClientOperations class
|
||||
//
|
||||
static void httpsGet (
|
||||
bool bSSL,
|
||||
boost::asio::io_service& io_service,
|
||||
std::deque<std::string> deqSites,
|
||||
std::deque <std::string> deqSites,
|
||||
const unsigned short port,
|
||||
const std::string& strPath,
|
||||
std::size_t responseMax,
|
||||
boost::posix_time::time_duration timeout,
|
||||
FUNCTION_TYPE<bool (const boost::system::error_code& ecResult, int iStatus, const std::string& strData)> complete);
|
||||
FUNCTION_TYPE <bool (const boost::system::error_code& ecResult, int iStatus, const std::string& strData)> complete);
|
||||
|
||||
static void httpsGet (
|
||||
bool bSSL,
|
||||
@@ -54,17 +60,17 @@ public:
|
||||
const std::string& strPath,
|
||||
std::size_t responseMax,
|
||||
boost::posix_time::time_duration timeout,
|
||||
FUNCTION_TYPE<bool (const boost::system::error_code& ecResult, int iStatus, const std::string& strData)> complete);
|
||||
FUNCTION_TYPE <bool (const boost::system::error_code& ecResult, int iStatus, const std::string& strData)> complete);
|
||||
|
||||
static void httpsRequest (
|
||||
bool bSSL,
|
||||
boost::asio::io_service& io_service,
|
||||
std::string strSite,
|
||||
const unsigned short port,
|
||||
FUNCTION_TYPE<void (boost::asio::streambuf& sb, const std::string& strHost)> build,
|
||||
FUNCTION_TYPE <void (boost::asio::streambuf& sb, const std::string& strHost)> build,
|
||||
std::size_t responseMax,
|
||||
boost::posix_time::time_duration timeout,
|
||||
FUNCTION_TYPE<bool (const boost::system::error_code& ecResult, int iStatus, const std::string& strData)> complete);
|
||||
FUNCTION_TYPE <bool (const boost::system::error_code& ecResult, int iStatus, const std::string& strData)> complete);
|
||||
|
||||
static void sendSMS (boost::asio::io_service& io_service, const std::string& strText);
|
||||
|
||||
@@ -119,4 +125,4 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
// vim:ts=4
|
||||
|
||||
@@ -14,9 +14,14 @@
|
||||
|
||||
#include "ripple_net.h"
|
||||
|
||||
// VFALCO TODO Remove this dependency on theConfig
|
||||
#include "../modules/ripple_core/ripple_core.h" // theConfig for HttpsClient
|
||||
|
||||
namespace ripple
|
||||
{
|
||||
|
||||
#include "basics/ripple_HTTPRequest.cpp"
|
||||
|
||||
#include "client/ripple_HttpsClient.cpp"
|
||||
|
||||
}
|
||||
|
||||
@@ -22,11 +22,15 @@
|
||||
|
||||
#include "../ripple_basics/ripple_basics.h"
|
||||
|
||||
#include "../ripple_websocket/ripple_websocket.h"
|
||||
|
||||
namespace ripple
|
||||
{
|
||||
|
||||
#include "basics/ripple_HTTPRequest.h"
|
||||
|
||||
#include "client/ripple_HttpsClient.h"
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user