9#ifndef CPPSERVER_HTTP_HTTPS_CLIENT_H 
   10#define CPPSERVER_HTTP_HTTPS_CLIENT_H 
   34    using SSLClient::SSLClient;
 
   93    size_t SendRequestBody(std::string_view body, 
const CppCommon::Timespan& timeout) { 
return Send(body, timeout); }
 
  101    size_t SendRequestBody(
const void* buffer, 
size_t size, 
const CppCommon::Timespan& timeout) { 
return Send(buffer, size, timeout); }
 
  130    void onReceived(
const void* buffer, 
size_t size) 
override;
 
 
  181    std::shared_ptr<Asio::TCPResolver>& 
resolver() noexcept { 
return _resolver; }
 
  182    const std::shared_ptr<Asio::TCPResolver>& 
resolver() const noexcept { 
return _resolver; }
 
  184    std::shared_ptr<Asio::Timer>& 
timeout() noexcept { 
return _timeout; }
 
  185    const std::shared_ptr<Asio::Timer>& 
timeout() const noexcept { 
return _timeout; }
 
  207    std::future<HTTPResponse> 
SendHeadRequest(std::string_view url, 
const CppCommon::Timespan& 
timeout = CppCommon::Timespan::minutes(1))
 
 
  215    std::future<HTTPResponse> 
SendGetRequest(std::string_view url, 
const CppCommon::Timespan& 
timeout = CppCommon::Timespan::minutes(1))
 
 
  224    std::future<HTTPResponse> 
SendPostRequest(std::string_view url, std::string_view content, 
const CppCommon::Timespan& 
timeout = CppCommon::Timespan::minutes(1))
 
 
  233    std::future<HTTPResponse> 
SendPutRequest(std::string_view url, std::string_view content, 
const CppCommon::Timespan& 
timeout = CppCommon::Timespan::minutes(1))
 
 
  241    std::future<HTTPResponse> 
SendDeleteRequest(std::string_view url, 
const CppCommon::Timespan& 
timeout = CppCommon::Timespan::minutes(1))
 
 
  249    std::future<HTTPResponse> 
SendOptionsRequest(std::string_view url, 
const CppCommon::Timespan& 
timeout = CppCommon::Timespan::minutes(1))
 
 
  257    std::future<HTTPResponse> 
SendTraceRequest(std::string_view url, 
const CppCommon::Timespan& 
timeout = CppCommon::Timespan::minutes(1))
 
 
  267    std::shared_ptr<Asio::TCPResolver> _resolver;
 
  268    std::shared_ptr<Asio::Timer> _timeout;
 
  269    std::promise<HTTPResponse> _promise;
 
  272    void SetPromiseError(
const std::string& error);
 
 
virtual size_t Send(const void *buffer, size_t size)
Send data to the server (synchronous)
 
virtual bool SendAsync(const void *buffer, size_t size)
Send data to the server (asynchronous)
 
HTTPRequest & MakePutRequest(std::string_view url, std::string_view content, std::string_view content_type="text/plain; charset=UTF-8")
Make PUT request.
 
HTTPRequest & MakeHeadRequest(std::string_view url)
Make HEAD request.
 
HTTPRequest & MakeDeleteRequest(std::string_view url)
Make DELETE request.
 
HTTPRequest & MakePostRequest(std::string_view url, std::string_view content, std::string_view content_type="text/plain; charset=UTF-8")
Make POST request.
 
HTTPRequest & MakeOptionsRequest(std::string_view url)
Make OPTIONS request.
 
HTTPRequest & MakeGetRequest(std::string_view url)
Make GET request.
 
HTTPRequest & MakeTraceRequest(std::string_view url)
Make TRACE request.
 
const std::string & cache() const noexcept
Get the HTTP request cache content.
 
std::future< HTTPResponse > SendDeleteRequest(std::string_view url, const CppCommon::Timespan &timeout=CppCommon::Timespan::minutes(1))
Send DELETE request.
 
std::future< HTTPResponse > SendHeadRequest(std::string_view url, const CppCommon::Timespan &timeout=CppCommon::Timespan::minutes(1))
Send HEAD request.
 
const std::shared_ptr< Asio::Timer > & timeout() const noexcept
 
void onDisconnected() override
Handle client disconnected notification.
 
std::shared_ptr< Asio::Timer > & timeout() noexcept
Get the timeout check timer.
 
void onReceivedResponse(const HTTPResponse &response) override
Handle HTTP response received notification.
 
void onReceivedResponseError(const HTTPResponse &response, const std::string &error) override
Handle HTTP response error notification.
 
std::future< HTTPResponse > SendGetRequest(std::string_view url, const CppCommon::Timespan &timeout=CppCommon::Timespan::minutes(1))
Send GET request.
 
std::future< HTTPResponse > SendPostRequest(std::string_view url, std::string_view content, const CppCommon::Timespan &timeout=CppCommon::Timespan::minutes(1))
Send POST request.
 
std::future< HTTPResponse > SendPutRequest(std::string_view url, std::string_view content, const CppCommon::Timespan &timeout=CppCommon::Timespan::minutes(1))
Send PUT request.
 
std::future< HTTPResponse > SendOptionsRequest(std::string_view url, const CppCommon::Timespan &timeout=CppCommon::Timespan::minutes(1))
Send OPTIONS request.
 
std::future< HTTPResponse > SendRequest(const CppCommon::Timespan &timeout=CppCommon::Timespan::minutes(1))
Send HTTP request.
 
std::shared_ptr< Asio::TCPResolver > & resolver() noexcept
Get the TCP resolver.
 
const std::shared_ptr< Asio::TCPResolver > & resolver() const noexcept
 
void onHandshaked() override
Handle session handshaked notification.
 
std::future< HTTPResponse > SendTraceRequest(std::string_view url, const CppCommon::Timespan &timeout=CppCommon::Timespan::minutes(1))
Send TRACE request.
 
HTTPSClient(HTTPSClient &&)=delete
 
HTTPSClient(const HTTPSClient &)=delete
 
HTTPResponse _response
HTTP response.
 
size_t SendRequestBody(const void *buffer, size_t size, const CppCommon::Timespan &timeout)
Send the HTTP request body with timeout (synchronous)
 
virtual void onReceivedResponseError(const HTTPResponse &response, const std::string &error)
Handle HTTP response error notification.
 
HTTPRequest _request
HTTP request.
 
size_t SendRequestBody(std::string_view body)
Send the HTTP request body (synchronous)
 
size_t SendRequest(const HTTPRequest &request)
Send the HTTP request (synchronous)
 
const HTTPRequest & request() const noexcept
 
void onDisconnected() override
Handle client disconnected notification.
 
size_t SendRequest(const HTTPRequest &request, const CppCommon::Timespan &timeout)
Send the HTTP request with timeout (synchronous)
 
bool SendRequestAsync()
Send the current HTTP request (asynchronous)
 
virtual ~HTTPSClient()=default
 
HTTPRequest & request() noexcept
Get the HTTP request.
 
virtual void onReceivedResponse(const HTTPResponse &response)
Handle HTTP response received notification.
 
size_t SendRequest()
Send the current HTTP request (synchronous)
 
size_t SendRequestBody(std::string_view body, const CppCommon::Timespan &timeout)
Send the HTTP request body with timeout (synchronous)
 
HTTPSClient & operator=(const HTTPSClient &)=delete
 
bool SendRequestAsync(const HTTPRequest &request)
Send the HTTP request (asynchronous)
 
bool SendRequestBodyAsync(std::string_view body)
Send the HTTP request body (asynchronous)
 
bool SendRequestBodyAsync(const void *buffer, size_t size)
Send the HTTP request body (asynchronous)
 
HTTPSClient & operator=(HTTPSClient &&)=delete
 
virtual void onReceivedResponseHeader(const HTTPResponse &response)
Handle HTTP response header received notification.
 
void onReceived(const void *buffer, size_t size) override
Handle buffer received notification.
 
size_t SendRequest(const CppCommon::Timespan &timeout)
Send the current HTTP request with timeout (synchronous)
 
size_t SendRequestBody(const void *buffer, size_t size)
Send the HTTP request body (synchronous)
 
HTTP response definition.
 
C++ Server project definitions.