Bitcoin Core 31.99.0
P2P Digital Currency
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
HTTPClient Class Reference

Simple synchronous HTTP client using Sock class. More...

Classes

struct  RecvEOF
 

Public Member Functions

HTTPResponse Post (const std::string &endpoint, std::span< const std::pair< std::string, std::string > > headers, const std::string &body)
 

Static Public Member Functions

static HTTPClient Connect (const std::string &host, uint16_t port, std::chrono::seconds timeout)
 

Private Member Functions

 HTTPClient (std::unique_ptr< Sock > &&socket, const std::string &host, std::chrono::seconds timeout)
 
bool SendRequest (std::string_view request)
 
HTTPResponse ReadResponse ()
 
std::optional< std::string > Recv (std::chrono::time_point< std::chrono::steady_clock > deadline)
 

Private Attributes

std::unique_ptr< Sockm_socket
 
std::string m_host
 
std::chrono::seconds m_timeout
 

Detailed Description

Simple synchronous HTTP client using Sock class.

Definition at line 836 of file bitcoin-cli.cpp.

Constructor & Destructor Documentation

◆ HTTPClient()

HTTPClient::HTTPClient ( std::unique_ptr< Sock > &&  socket,
const std::string &  host,
std::chrono::seconds  timeout 
)
inlineprivate

Definition at line 853 of file bitcoin-cli.cpp.

Member Function Documentation

◆ Connect()

HTTPClient HTTPClient::Connect ( const std::string &  host,
uint16_t  port,
std::chrono::seconds  timeout 
)
static

Definition at line 860 of file bitcoin-cli.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Post()

HTTPResponse HTTPClient::Post ( const std::string &  endpoint,
std::span< const std::pair< std::string, std::string > >  headers,
const std::string &  body 
)

Definition at line 879 of file bitcoin-cli.cpp.

Here is the call graph for this function:

◆ ReadResponse()

HTTPResponse HTTPClient::ReadResponse ( )
private

Definition at line 937 of file bitcoin-cli.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Recv()

std::optional< std::string > HTTPClient::Recv ( std::chrono::time_point< std::chrono::steady_clock >  deadline)
private

Definition at line 1121 of file bitcoin-cli.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SendRequest()

bool HTTPClient::SendRequest ( std::string_view  request)
private

Definition at line 907 of file bitcoin-cli.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_host

std::string HTTPClient::m_host
private

Definition at line 850 of file bitcoin-cli.cpp.

◆ m_socket

std::unique_ptr<Sock> HTTPClient::m_socket
private

Definition at line 849 of file bitcoin-cli.cpp.

◆ m_timeout

std::chrono::seconds HTTPClient::m_timeout
private

Definition at line 851 of file bitcoin-cli.cpp.


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