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>
50 boost::asio::io_service& io_service,
60 boost::filesystem::path
const& dstPath,
69 using parser = boost::beast::http::basic_parser<false>;
75 boost::filesystem::path dstPath,
77 boost::system::error_code
const& ec,
84 boost::optional<boost::asio::ssl::stream<boost::asio::ip::tcp::socket>>
100 boost::filesystem::path dstPath,
102 boost::asio::yield_context yield);
106 boost::filesystem::path dstPath,
108 boost::system::error_code& ec) = 0;
111 checkPath(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)
virtual void closeBody(std::shared_ptr< parser > p)=0
SSLHTTPDownloader(boost::asio::io_service &io_service, beast::Journal j, Config const &config)
boost::beast::flat_buffer read_buf_
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
void 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)
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
std::atomic< bool > cancelDownloads_
Provides an asynchronous HTTPS file downloader.