20 #ifndef RIPPLE_NET_SSLHTTPDOWNLOADER_H_INCLUDED
21 #define RIPPLE_NET_SSLHTTPDOWNLOADER_H_INCLUDED
23 #include <ripple/basics/Log.h>
24 #include <ripple/core/Config.h>
25 #include <ripple/net/HTTPClientSSLContext.h>
27 #include <boost/asio/connect.hpp>
28 #include <boost/asio/io_service.hpp>
29 #include <boost/asio/ip/tcp.hpp>
30 #include <boost/asio/spawn.hpp>
31 #include <boost/asio/ssl/error.hpp>
32 #include <boost/asio/ssl/stream.hpp>
33 #include <boost/beast/core.hpp>
34 #include <boost/beast/http.hpp>
35 #include <boost/beast/version.hpp>
36 #include <boost/filesystem.hpp>
51 boost::asio::io_service& io_service,
54 bool isPaused =
false);
62 boost::filesystem::path
const& dstPath,
73 using parser = boost::beast::http::basic_parser<false>;
79 boost::filesystem::path dstPath,
81 boost::system::error_code
const& ec,
89 boost::asio::ssl::stream<boost::asio::ip::tcp::socket>>
stream_;
102 boost::filesystem::path dstPath,
104 boost::asio::yield_context yield);
109 boost::filesystem::path dstPath,
111 boost::system::error_code & ec) = 0;
116 boost::filesystem::path
const& dstPath) = 0;
boost::beast::http::basic_parser< false > parser
virtual uint64_t size(std::shared_ptr< parser > p)=0
virtual ~SSLHTTPDownloader()=default
boost::asio::io_service::strand strand_
virtual bool checkPath(boost::filesystem::path const &dstPath)=0
void do_session(std::string host, std::string port, std::string target, int version, boost::filesystem::path dstPath, std::function< void(boost::filesystem::path)> complete, boost::asio::yield_context yield)
bool fail(boost::filesystem::path dstPath, std::function< void(boost::filesystem::path)> const &complete, boost::system::error_code const &ec, std::string const &errMsg, std::shared_ptr< parser > parser=nullptr)
virtual void closeBody(std::shared_ptr< parser > p)=0
boost::beast::flat_buffer read_buf_
std::atomic< bool > isStopped_
A generic endpoint for log messages.
virtual std::shared_ptr< parser > getParser(boost::filesystem::path dstPath, std::function< void(boost::filesystem::path)> complete, boost::system::error_code &ec)=0
SSLHTTPDownloader(boost::asio::io_service &io_service, beast::Journal j, Config const &config, bool isPaused=false)
bool download(std::string const &host, std::string const &port, std::string const &target, int version, boost::filesystem::path const &dstPath, std::function< void(boost::filesystem::path)> complete)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
boost::optional< boost::asio::ssl::stream< boost::asio::ip::tcp::socket > > stream_
std::condition_variable c_
HTTPClientSSLContext ssl_ctx_
boost::system::error_code error_code
Provides an asynchronous HTTPS file downloader.