MySQL 8.0.40
Source Code Documentation
HttpClient Class Reference

#include <http_client.h>

Inheritance diagram for HttpClient:
[legend]

Public Member Functions

 HttpClient (IOContext &io_ctx, const std::string &hostname, uint16_t port)
 
virtual ~HttpClient ()
 
void make_request (HttpRequest *req, HttpMethod::type method, const std::string &uri)
 initiate a request on the bound IOContext. More...
 
void make_request_sync (HttpRequest *req, HttpMethod::type method, const std::string &uri)
 make a request and wait for the response. More...
 
 operator bool () const
 check if connection had an error. More...
 
std::string error_msg () const
 current error message. More...
 
std::string hostname () const
 hostname to connect to. More...
 
uint16_t port () const
 TCP port to connect to. More...
 

Protected Member Functions

virtual std::unique_ptr< HttpClientConnectionBasemake_connection ()
 

Protected Attributes

IOContextio_ctx_
 
const std::string hostname_
 
uint16_t port_
 
std::unique_ptr< HttpClientConnectionBaseconn_
 

Constructor & Destructor Documentation

◆ HttpClient()

HttpClient::HttpClient ( IOContext io_ctx,
const std::string &  hostname,
uint16_t  port 
)
inline

◆ ~HttpClient()

HttpClient::~HttpClient ( )
virtualdefault

Member Function Documentation

◆ error_msg()

std::string HttpClient::error_msg ( ) const

current error message.

See also
: HttpClientConnectionBase::error_msg()

◆ hostname()

std::string HttpClient::hostname ( ) const
inline

hostname to connect to.

◆ make_connection()

std::unique_ptr< HttpClientConnectionBase > HttpClient::make_connection ( )
protectedvirtual

Reimplemented in HttpsClient.

◆ make_request()

void HttpClient::make_request ( HttpRequest req,
HttpMethod::type  method,
const std::string &  uri 
)

initiate a request on the bound IOContext.

allows to send out multiple requests on different clients and wait for them in parallel.

◆ make_request_sync()

void HttpClient::make_request_sync ( HttpRequest req,
HttpMethod::type  method,
const std::string &  uri 
)

make a request and wait for the response.

◆ operator bool()

HttpClient::operator bool ( ) const

check if connection had an error.

see: error_msg()

◆ port()

uint16_t HttpClient::port ( ) const
inline

TCP port to connect to.

Member Data Documentation

◆ conn_

std::unique_ptr<HttpClientConnectionBase> HttpClient::conn_
protected

◆ hostname_

const std::string HttpClient::hostname_
protected

◆ io_ctx_

IOContext& HttpClient::io_ctx_
protected

◆ port_

uint16_t HttpClient::port_
protected

The documentation for this class was generated from the following files: