6 #ifndef KAGOME_OFFCHAIN_HTTPREQUEST 7 #define KAGOME_OFFCHAIN_HTTPREQUEST 9 #include <boost/asio/io_context.hpp> 10 #include <boost/asio/ip/tcp.hpp> 11 #include <boost/asio/ssl/context.hpp> 12 #include <boost/asio/ssl/stream.hpp> 13 #include <boost/beast/core.hpp> 14 #include <boost/beast/core/tcp_stream.hpp> 15 #include <boost/beast/http.hpp> 16 #include <boost/beast/ssl/ssl_stream.hpp> 24 class HttpRequest final :
public std::enable_shared_from_this<HttpRequest> {
38 std::string_view value);
42 std::optional<std::chrono::milliseconds> deadline_opt);
48 std::optional<std::chrono::milliseconds> deadline);
69 using SslStream = boost::beast::ssl_stream<TcpStream>;
72 boost::variant<TcpStreamPtr, SslStreamPtr>
stream_;
83 boost::beast::http::request<boost::beast::http::string_body>
request_;
84 boost::beast::http::response_parser<boost::beast::http::string_body>
86 boost::beast::http::response<boost::beast::http::string_body>
response_;
95 #endif // KAGOME_OFFCHAIN_HTTPREQUEST
Class represents arbitrary (including empty) byte buffer.
boost::beast::http::response< boost::beast::http::string_body > response_
std::unique_ptr< TcpStream > TcpStreamPtr
std::string errorMessage() const
boost::beast::http::response_parser< boost::beast::http::string_body > parser_
HttpRequest(HttpRequest &&) noexcept=delete
HttpStatus status() const
bool init(HttpMethod method, std::string_view uri, common::Buffer meta)
std::string error_message_
boost::beast::ssl_stream< TcpStream > SslStream
boost::asio::io_context io_context_
uint16_t HttpStatus
HTTP status codes that can get returned by certain Offchain funcs. 0: the specified request identifie...
bool adding_headers_is_allowed_
std::vector< std::pair< std::string, std::string > > getResponseHeaders() const
boost::asio::steady_timer deadline_timer_
boost::beast::flat_buffer buffer_
Result< Success, Failure > addRequestHeader(std::string_view name, std::string_view value)
std::unique_ptr< SslStream > SslStreamPtr
std::shared_ptr< soralog::Logger > Logger
Result< uint32_t, HttpError > readResponseBody(common::Buffer &chunk, std::optional< std::chrono::milliseconds > deadline)
boost::asio::ip::tcp::resolver resolver_
boost::asio::ip::tcp::resolver::iterator resolver_iterator_
boost::beast::tcp_stream TcpStream
Result< Success, HttpError > writeRequestBody(const common::Buffer &chunk, std::optional< std::chrono::milliseconds > deadline_opt)
boost::asio::ssl::context ssl_ctx_
boost::variant< TcpStreamPtr, SslStreamPtr > stream_
boost::beast::http::request< boost::beast::http::string_body > request_