20 #ifndef RIPPLE_NET_HTTPSTREAM_H_INCLUDED
21 #define RIPPLE_NET_HTTPSTREAM_H_INCLUDED
23 #include <ripple/core/Config.h>
24 #include <ripple/net/HTTPClientSSLContext.h>
26 #include <boost/asio/spawn.hpp>
27 #include <boost/asio/strand.hpp>
28 #include <boost/beast/core.hpp>
29 #include <boost/beast/http.hpp>
36 using request = boost::beast::http::request<boost::beast::http::empty_body>;
37 using parser = boost::beast::http::basic_parser<false>;
41 [[nodiscard]]
virtual boost::asio::ip::tcp::socket&
44 [[nodiscard]]
virtual bool
49 boost::asio::yield_context& yield) = 0;
54 boost::asio::yield_context& yield,
55 boost::system::error_code& ec) = 0;
59 boost::beast::flat_buffer& buf,
61 boost::asio::yield_context& yield,
62 boost::system::error_code& ec) = 0;
66 boost::beast::flat_buffer& buf,
68 boost::asio::yield_context& yield,
69 boost::system::error_code& ec) = 0;
77 boost::asio::io_service::strand& strand,
82 boost::asio::ip::tcp::socket&
90 boost::asio::yield_context& yield)
override;
95 boost::asio::yield_context& yield,
96 boost::system::error_code& ec)
override;
100 boost::beast::flat_buffer& buf,
102 boost::asio::yield_context& yield,
103 boost::system::error_code& ec)
override;
107 boost::beast::flat_buffer& buf,
109 boost::asio::yield_context& yield,
110 boost::system::error_code& ec)
override;
114 boost::optional<boost::asio::ssl::stream<boost::asio::ip::tcp::socket>>
122 RawStream(boost::asio::io_service::strand& strand);
126 boost::asio::ip::tcp::socket&
134 boost::asio::yield_context& yield)
override;
139 boost::asio::yield_context& yield,
140 boost::system::error_code& ec)
override;
144 boost::beast::flat_buffer& buf,
146 boost::asio::yield_context& yield,
147 boost::system::error_code& ec)
override;
151 boost::beast::flat_buffer& buf,
153 boost::asio::yield_context& yield,
154 boost::system::error_code& ec)
override;
157 boost::optional<boost::asio::ip::tcp::socket>
stream_;
163 #endif // RIPPLE_NET_HTTPSTREAM_H