Kagome
Polkadot Runtime Engine in C++17
|
#include <http_request.hpp>
Public Member Functions | |
HttpRequest (HttpRequest &&) noexcept=delete | |
HttpRequest (const HttpRequest &)=delete | |
HttpRequest (RequestId id) | |
RequestId | id () const |
HttpStatus | status () const |
bool | init (HttpMethod method, std::string_view uri, common::Buffer meta) |
Result< Success, Failure > | addRequestHeader (std::string_view name, std::string_view value) |
Result< Success, HttpError > | writeRequestBody (const common::Buffer &chunk, std::optional< std::chrono::milliseconds > deadline_opt) |
std::vector< std::pair< std::string, std::string > > | getResponseHeaders () const |
Result< uint32_t, HttpError > | readResponseBody (common::Buffer &chunk, std::optional< std::chrono::milliseconds > deadline) |
std::string | errorMessage () const |
Private Types | |
using | TcpStream = boost::beast::tcp_stream |
using | SslStream = boost::beast::ssl_stream< TcpStream > |
using | TcpStreamPtr = std::unique_ptr< TcpStream > |
using | SslStreamPtr = std::unique_ptr< SslStream > |
Private Member Functions | |
void | resolve () |
void | connect () |
void | handshake () |
void | sendRequest () |
void | recvResponse () |
void | done () |
Private Attributes | |
boost::asio::io_context | io_context_ |
int16_t | id_ |
boost::asio::ip::tcp::resolver | resolver_ |
boost::asio::ssl::context | ssl_ctx_ |
boost::variant< TcpStreamPtr, SslStreamPtr > | stream_ |
common::Uri | uri_ |
bool | adding_headers_is_allowed_ = true |
bool | request_has_sent_ = false |
bool | secure_ = false |
uint16_t | status_ = 0 |
std::string | error_message_ |
boost::beast::flat_buffer | buffer_ |
boost::asio::steady_timer | deadline_timer_ |
boost::asio::ip::tcp::resolver::iterator | resolver_iterator_ |
boost::beast::http::request< boost::beast::http::string_body > | request_ |
boost::beast::http::response_parser< boost::beast::http::string_body > | parser_ |
boost::beast::http::response< boost::beast::http::string_body > | response_ |
bool | request_is_ready_ = false |
bool | connected_ = false |
log::Logger | log_ |
Definition at line 24 of file http_request.hpp.
|
private |
Definition at line 69 of file http_request.hpp.
|
private |
Definition at line 71 of file http_request.hpp.
|
private |
Definition at line 68 of file http_request.hpp.
|
private |
Definition at line 70 of file http_request.hpp.
|
deletenoexcept |
|
delete |
kagome::offchain::HttpRequest::HttpRequest | ( | RequestId | id | ) |
Definition at line 22 of file http_request.cpp.
Result< Success, Failure > kagome::offchain::HttpRequest::addRequestHeader | ( | std::string_view | name, |
std::string_view | value | ||
) |
Definition at line 379 of file http_request.cpp.
|
private |
Definition at line 158 of file http_request.cpp.
|
private |
Definition at line 349 of file http_request.cpp.
|
inline |
Definition at line 50 of file http_request.hpp.
std::vector< std::pair< std::string, std::string > > kagome::offchain::HttpRequest::getResponseHeaders | ( | ) | const |
Definition at line 429 of file http_request.cpp.
|
private |
Definition at line 211 of file http_request.cpp.
RequestId kagome::offchain::HttpRequest::id | ( | ) | const |
Definition at line 371 of file http_request.cpp.
bool kagome::offchain::HttpRequest::init | ( | HttpMethod | method, |
std::string_view | uri, | ||
common::Buffer | meta | ||
) |
Definition at line 47 of file http_request.cpp.
Result< uint32_t, HttpError > kagome::offchain::HttpRequest::readResponseBody | ( | common::Buffer & | chunk, |
std::optional< std::chrono::milliseconds > | deadline | ||
) |
Definition at line 438 of file http_request.cpp.
|
private |
Definition at line 303 of file http_request.cpp.
|
private |
Definition at line 110 of file http_request.cpp.
|
private |
Definition at line 246 of file http_request.cpp.
HttpStatus kagome::offchain::HttpRequest::status | ( | ) | const |
Definition at line 375 of file http_request.cpp.
Result< Success, HttpError > kagome::offchain::HttpRequest::writeRequestBody | ( | const common::Buffer & | chunk, |
std::optional< std::chrono::milliseconds > | deadline_opt | ||
) |
Definition at line 392 of file http_request.cpp.
|
private |
Definition at line 75 of file http_request.hpp.
|
private |
Definition at line 80 of file http_request.hpp.
|
private |
Definition at line 88 of file http_request.hpp.
|
private |
Definition at line 81 of file http_request.hpp.
|
private |
Definition at line 79 of file http_request.hpp.
|
private |
Definition at line 63 of file http_request.hpp.
|
private |
Definition at line 62 of file http_request.hpp.
|
private |
Definition at line 90 of file http_request.hpp.
|
private |
Definition at line 85 of file http_request.hpp.
|
private |
Definition at line 83 of file http_request.hpp.
|
private |
Definition at line 76 of file http_request.hpp.
|
private |
Definition at line 87 of file http_request.hpp.
|
private |
Definition at line 65 of file http_request.hpp.
|
private |
Definition at line 82 of file http_request.hpp.
|
private |
Definition at line 86 of file http_request.hpp.
|
private |
Definition at line 77 of file http_request.hpp.
|
private |
Definition at line 66 of file http_request.hpp.
|
private |
Definition at line 78 of file http_request.hpp.
|
private |
Definition at line 72 of file http_request.hpp.
|
private |
Definition at line 74 of file http_request.hpp.