diff --git a/Builds/VisualStudio2012/RippleD.vcxproj b/Builds/VisualStudio2012/RippleD.vcxproj index 61d1ed51b5..d4aaa82fa6 100644 --- a/Builds/VisualStudio2012/RippleD.vcxproj +++ b/Builds/VisualStudio2012/RippleD.vcxproj @@ -358,6 +358,12 @@ true true + + true + true + true + true + @@ -398,12 +404,6 @@ true true - - true - true - true - true - true true @@ -1391,6 +1391,7 @@ + @@ -1399,7 +1400,6 @@ - diff --git a/Builds/VisualStudio2012/RippleD.vcxproj.filters b/Builds/VisualStudio2012/RippleD.vcxproj.filters index dd0434c6bf..cd62d5c79f 100644 --- a/Builds/VisualStudio2012/RippleD.vcxproj.filters +++ b/Builds/VisualStudio2012/RippleD.vcxproj.filters @@ -672,9 +672,6 @@ [1] Ripple\ripple_app\_misc - - [1] Ripple\ripple_app\_network - [1] Ripple\ripple_app\_network @@ -852,6 +849,9 @@ [1] Ripple\ripple_app\_network + + [1] Ripple\ripple_net\client + @@ -1401,9 +1401,6 @@ [1] Ripple\ripple_app\_misc - - [1] Ripple\ripple_app\_network - [1] Ripple\ripple_app\_network @@ -1584,6 +1581,9 @@ [1] Ripple\ripple_app\_network + + [1] Ripple\ripple_net\client + diff --git a/modules/ripple_app/ripple_app.cpp b/modules/ripple_app/ripple_app.cpp index 80f2b6165a..520c4240d6 100644 --- a/modules/ripple_app/ripple_app.cpp +++ b/modules/ripple_app/ripple_app.cpp @@ -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" diff --git a/src/cpp/ripple/HttpsClient.cpp b/modules/ripple_net/client/ripple_HttpsClient.cpp similarity index 97% rename from src/cpp/ripple/HttpsClient.cpp rename to modules/ripple_net/client/ripple_HttpsClient.cpp index c90979fd89..793d3acd7d 100644 --- a/src/cpp/ripple/HttpsClient.cpp +++ b/modules/ripple_net/client/ripple_HttpsClient.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) diff --git a/src/cpp/ripple/HttpsClient.h b/modules/ripple_net/client/ripple_HttpsClient.h similarity index 76% rename from src/cpp/ripple/HttpsClient.h rename to modules/ripple_net/client/ripple_HttpsClient.h index 0a121f45cc..ad2f21e989 100644 --- a/src/cpp/ripple/HttpsClient.h +++ b/modules/ripple_net/client/ripple_HttpsClient.h @@ -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 @@ -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 deqSites, - FUNCTION_TYPE build, + FUNCTION_TYPE build, boost::posix_time::time_duration timeout, - FUNCTION_TYPE complete); + FUNCTION_TYPE complete); void httpsGet ( bool bSSL, std::deque deqSites, const std::string& strPath, boost::posix_time::time_duration timeout, - FUNCTION_TYPE complete); + FUNCTION_TYPE complete); + // VFALCO TODO These statics all belong in some HttpsClientOperations class + // static void httpsGet ( bool bSSL, boost::asio::io_service& io_service, - std::deque deqSites, + std::deque deqSites, const unsigned short port, const std::string& strPath, std::size_t responseMax, boost::posix_time::time_duration timeout, - FUNCTION_TYPE complete); + FUNCTION_TYPE 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 complete); + FUNCTION_TYPE complete); static void httpsRequest ( bool bSSL, boost::asio::io_service& io_service, std::string strSite, const unsigned short port, - FUNCTION_TYPE build, + FUNCTION_TYPE build, std::size_t responseMax, boost::posix_time::time_duration timeout, - FUNCTION_TYPE complete); + FUNCTION_TYPE complete); static void sendSMS (boost::asio::io_service& io_service, const std::string& strText); @@ -119,4 +125,4 @@ private: }; #endif -// vim:ts=4 + diff --git a/modules/ripple_net/ripple_net.cpp b/modules/ripple_net/ripple_net.cpp index 64fa6c7d7b..e7fe87cd1b 100644 --- a/modules/ripple_net/ripple_net.cpp +++ b/modules/ripple_net/ripple_net.cpp @@ -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" + } diff --git a/modules/ripple_net/ripple_net.h b/modules/ripple_net/ripple_net.h index 38dd906d33..67e6024b57 100644 --- a/modules/ripple_net/ripple_net.h +++ b/modules/ripple_net/ripple_net.h @@ -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