join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::BasicHttpSecureClient< Protocol > Class Template Reference

basic HTTPS client. More...

#include <httpclient.hpp>

Inheritance diagram for join::BasicHttpSecureClient< Protocol >:
Collaboration diagram for join::BasicHttpSecureClient< Protocol >:

Public Types

using Endpoint = typename Protocol::Endpoint
 
- Public Types inherited from join::BasicHttpClient< Protocol >
using Endpoint = typename Protocol::Endpoint
 

Public Member Functions

 BasicHttpSecureClient (const char *host, uint16_t port=443, bool keepAlive=true)
 create the basic HTTPS client instance.
 
 BasicHttpSecureClient (const std::string &host, uint16_t port=443, bool keepAlive=true)
 create the basic HTTPS client instance.
 
 BasicHttpSecureClient (const BasicHttpSecureClient &other)=delete
 create the basic HTTPS client instance by copy.
 
BasicHttpSecureClientoperator= (const BasicHttpSecureClient &other)=delete
 assign the basic HTTPS client instance by copy.
 
 BasicHttpSecureClient (BasicHttpSecureClient &&other)
 create the basic HTTPS client instance by move.
 
BasicHttpSecureClientoperator= (BasicHttpSecureClient &&other)
 assign the basic HTTPS client instance by move.
 
virtual ~BasicHttpSecureClient ()=default
 destroy the basic HTTPS client instance.
 
std::string scheme () const override
 get HTTP scheme.
 
- Public Member Functions inherited from join::BasicHttpClient< Protocol >
 BasicHttpClient (const char *host, uint16_t port=80, bool keepAlive=true)
 create the basic HTTP client instance.
 
 BasicHttpClient (const std::string &host, uint16_t port=80, bool keepAlive=true)
 create the basic HTTP client instance.
 
 BasicHttpClient (const BasicHttpClient &other)=delete
 create the basic HTTP client instance by copy.
 
BasicHttpClientoperator= (const BasicHttpClient &other)=delete
 assign the basic HTTP client instance by copy.
 
 BasicHttpClient (BasicHttpClient &&other)
 create the basic HTTP client instance by move.
 
BasicHttpClientoperator= (BasicHttpClient &&other)
 assign the basic HTTP client instance by move.
 
virtual ~BasicHttpClient ()
 destroy the basic HTTP client instance.
 
void close () override
 close the connection.
 
const std::string & host () const
 get host.
 
uint16_t port () const
 get port.
 
std::string authority () const
 get authority.
 
std::string url () const
 get URL.
 
bool keepAlive () const
 checks if HTTP keep alive is supported.
 
void keepAlive (bool keep)
 enable/disable HTTP keep alive support.
 
std::chrono::seconds keepAliveTimeout () const
 get HTTP keep alive timeout.
 
int keepAliveMax () const
 get HTTP keep alive max.
 
int send (HttpRequest &request)
 send HTTP request.
 
int receive (HttpResponse &response)
 receive HTTP response.
 

Protected Member Functions

void reconnect (const Endpoint &endpoint) override
 perform reconnection to the given endpoint.
 
- Protected Member Functions inherited from join::BasicHttpClient< Protocol >
void setEncoding (const std::vector< std::string > &encodings)
 set stream encoding.
 
void clearEncoding ()
 clear stream encoding.
 
bool expired () const
 check if HTTP keep alive is expired.
 
bool needReconnection ()
 check if client must reconnect.
 

Additional Inherited Members

- Protected Attributes inherited from join::BasicHttpClient< Protocol >
std::streambuf * _streambuf = nullptr
 HTTP stream buffer.
 
bool _wrapped = false
 HTTP stream status.
 
std::chrono::time_point< std::chrono::steady_clock > _timestamp
 HTTP timestamp.
 
std::string _host
 HTTP host.
 
uint16_t _port
 HTTP port.
 
bool _keep
 HTTP keep alive.
 
std::chrono::seconds _keepTimeout
 HTTP keep alive timeout.
 
int _keepMax = -1
 HTTP keep alive max.
 

Detailed Description

template<class Protocol>
class join::BasicHttpSecureClient< Protocol >

basic HTTPS client.

Member Typedef Documentation

◆ Endpoint

template<class Protocol >
using join::BasicHttpSecureClient< Protocol >::Endpoint = typename Protocol::Endpoint

Constructor & Destructor Documentation

◆ BasicHttpSecureClient() [1/4]

template<class Protocol >
join::BasicHttpSecureClient< Protocol >::BasicHttpSecureClient ( const char * host,
uint16_t port = 443,
bool keepAlive = true )
inline

create the basic HTTPS client instance.

Parameters
hosthost.
portport (default: 443).
keepAliveuse a persistent connection.

◆ BasicHttpSecureClient() [2/4]

template<class Protocol >
join::BasicHttpSecureClient< Protocol >::BasicHttpSecureClient ( const std::string & host,
uint16_t port = 443,
bool keepAlive = true )
inline

create the basic HTTPS client instance.

Parameters
hosthost.
portport (default: 443).
keepAliveuse a persistent connection.

◆ BasicHttpSecureClient() [3/4]

template<class Protocol >
join::BasicHttpSecureClient< Protocol >::BasicHttpSecureClient ( const BasicHttpSecureClient< Protocol > & other)
delete

create the basic HTTPS client instance by copy.

Parameters
otherrequest to copy.

◆ BasicHttpSecureClient() [4/4]

template<class Protocol >
join::BasicHttpSecureClient< Protocol >::BasicHttpSecureClient ( BasicHttpSecureClient< Protocol > && other)
inline

create the basic HTTPS client instance by move.

Parameters
otherrequest to move.

◆ ~BasicHttpSecureClient()

template<class Protocol >
virtual join::BasicHttpSecureClient< Protocol >::~BasicHttpSecureClient ( )
virtualdefault

destroy the basic HTTPS client instance.

Member Function Documentation

◆ operator=() [1/2]

template<class Protocol >
BasicHttpSecureClient & join::BasicHttpSecureClient< Protocol >::operator= ( BasicHttpSecureClient< Protocol > && other)
inline

assign the basic HTTPS client instance by move.

Parameters
otherrequest to move.
Returns
a reference of the current object.

◆ operator=() [2/2]

template<class Protocol >
BasicHttpSecureClient & join::BasicHttpSecureClient< Protocol >::operator= ( const BasicHttpSecureClient< Protocol > & other)
delete

assign the basic HTTPS client instance by copy.

Parameters
otherrequest to copy.
Returns
a reference of the current object.

◆ reconnect()

template<class Protocol >
void join::BasicHttpSecureClient< Protocol >::reconnect ( const Endpoint & endpoint)
inlineoverrideprotectedvirtual

perform reconnection to the given endpoint.

Parameters
endpointendpoint to connect to.

Reimplemented from join::BasicHttpClient< Protocol >.

◆ scheme()

template<class Protocol >
std::string join::BasicHttpSecureClient< Protocol >::scheme ( ) const
inlineoverridevirtual

get HTTP scheme.

Returns
htpp or https.

Reimplemented from join::BasicHttpClient< Protocol >.


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