10Duke Scale C++ Client
Loading...
Searching...
No Matches
tenduke::http::curl::LibCurlHTTPCall Class Reference

#include <LibcurlHTTPCall.h>

Detailed Description

LibCurl-based implementation of tenduke::http::HTTPCall.

Inheritance diagram for tenduke::http::curl::LibCurlHTTPCall:
tenduke::http::HTTPCall

Public Member Functions

 LibCurlHTTPCall (std::shared_ptr< const tenduke::http::HTTPRequest > request, std::string userAgent, bool blindlyTrustSSLCertificates=false, bool verbose=false)
 Constructs new instance.
 
std::unique_ptr< tenduke::http::HTTPResponseexecute () override
 Executes the call synchronously.
 

Protected Member Functions

virtual void setRequestBody ()
 Sets request body to the CURL-call.
 
virtual void setRequestHeaders ()
 Sets request headers to the CURL-call.
 
virtual void setRequestMethod ()
 Sets request method to the CURL-call.
 
virtual void setUrl ()
 Sets URL to the CURL-call.
 

Protected Attributes

const std::shared_ptr< const tenduke::http::HTTPRequestrequest
 The request.
 
const std::unique_ptr< CURL, decltype(curl_easy_cleanup) * > curlHandle
 libcurl-handle for the request.
 
struct curl_slist * curlHeaders
 libcurl header-list.
 
const std::string userAgent
 Useragent-string to use.
 
bool blindlyTrustSSLCertificates
 If true, configure libcurl to blindly trust all SSL certificates.
 
bool verbose
 If true, configure libcurl to provide verbose output.
 

Constructor & Destructor Documentation

◆ LibCurlHTTPCall()

tenduke::http::curl::LibCurlHTTPCall::LibCurlHTTPCall ( std::shared_ptr< const tenduke::http::HTTPRequest request,
std::string  userAgent,
bool  blindlyTrustSSLCertificates = false,
bool  verbose = false 
)

Constructs new instance.

Parameters
request-
userAgent-
blindlyTrustSSLCertificates-
verbose-

Member Function Documentation

◆ execute()

std::unique_ptr< xdhttp::HTTPResponse > tenduke::http::curl::LibCurlHTTPCall::execute ( )
overridevirtual

Executes the call synchronously.

NOTE: This is blocking call.

Returns
HTTP-response.
Exceptions
tenduke::net::NetworkingException(or subclasses) when the call fails for various networking reasons like "no such host", "network timeout", "networking connection broken" and so on. Some of these are transient and thus re-triable, some indicate configuration error.
tenduke::net::HTTPRequestExceptionwhen the call fails for various reasons, see documentation for the exception for details. NOTE HTTPCall does not throw exception if the request technically succeeds, but the server returns HTTP status code >= 400. It is responsibility of the caller to interpret the status code and act accordingly.

Implements tenduke::http::HTTPCall.


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