|
join 1.0
lightweight network framework library
|
basic HTTP client. More...
#include <httpclient.hpp>


Public Types | |
| using | Endpoint = typename Protocol::Endpoint |
Public Member Functions | |
| 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. | |
| BasicHttpClient & | operator= (const BasicHttpClient &other)=delete |
| assign the basic HTTP client instance by copy. | |
| BasicHttpClient (BasicHttpClient &&other) | |
| create the basic HTTP client instance by move. | |
| BasicHttpClient & | operator= (BasicHttpClient &&other) |
| assign the basic HTTP client instance by move. | |
| virtual | ~BasicHttpClient () |
| destroy the basic HTTP client instance. | |
| void | close () override |
| close the connection. | |
| virtual std::string | scheme () const |
| get HTTP scheme. | |
| 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 | 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. | |
| virtual void | reconnect (const Endpoint &endpoint) |
| perform reconnection to the given endpoint. | |
Protected Attributes | |
| 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. | |
basic HTTP client.
| using join::BasicHttpClient< Protocol >::Endpoint = typename Protocol::Endpoint |
|
inline |
create the basic HTTP client instance.
| host | host. |
| port | port (default: 80). |
| keepAlive | use a persistent connection. |
|
inline |
create the basic HTTP client instance.
| host | host. |
| port | port (default: 80). |
| keepAlive | use a persistent connection. |
|
delete |
create the basic HTTP client instance by copy.
| other | request to copy. |
|
inline |
create the basic HTTP client instance by move.
| other | request to move. |
|
inlinevirtual |
destroy the basic HTTP client instance.
|
inline |
get authority.
|
inlineprotected |
clear stream encoding.
|
inlineoverride |
close the connection.
| std::ios_base::failure. |
|
inlineprotected |
check if HTTP keep alive is expired.
|
inline |
get host.
|
inline |
checks if HTTP keep alive is supported.
|
inline |
enable/disable HTTP keep alive support.
| keep | true if supported, false otherwise. |
|
inline |
get HTTP keep alive max.
|
inline |
get HTTP keep alive timeout.
|
inlineprotected |
check if client must reconnect.
|
inline |
assign the basic HTTP client instance by move.
| other | request to move. |
|
delete |
assign the basic HTTP client instance by copy.
| other | request to copy. |
|
inline |
get port.
|
inline |
receive HTTP response.
| response | HTTP response received. |
|
inlineprotectedvirtual |
perform reconnection to the given endpoint.
| endpoint | endpoint to connect to. |
Reimplemented in join::BasicHttpSecureClient< Protocol >.
|
inlinevirtual |
|
inline |
send HTTP request.
| request | HTTP request to send. |
|
inlineprotected |
set stream encoding.
| encodings | encodings applied to the stream. |
|
inline |
get URL.
|
protected |
HTTP host.
|
protected |
HTTP keep alive.
|
protected |
HTTP keep alive max.
|
protected |
HTTP keep alive timeout.
|
protected |
HTTP port.
|
protected |
HTTP stream buffer.
|
protected |
HTTP timestamp.
|
protected |
HTTP stream status.