#include <LibcurlHTTPCall.h>
LibCurl-based implementation of tenduke::http::HTTPCall.
|
|
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 | restrictProtocols () |
| | Restricts the CURL-call to protocols http and https, without following redirects.
|
| virtual void | configureTLS () |
| | Enables TLS certificate verification of the CURL-call: the certificate chain and the host name are verified.
|
|
virtual void | setUrl () |
| | Sets URL to the CURL-call.
|
|
|
const std::shared_ptr< const tenduke::http::HTTPRequest > | request |
| | 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 | verbose |
| | If true, configure libcurl to provide verbose output.
|
|
const std::size_t | maxResponseBodySize |
| | Maximum size of the response body in bytes.
|
◆ LibCurlHTTPCall()
Constructs new instance.
- Parameters
-
| request | - |
| userAgent | - |
| urls | - |
| verbose | - |
| maxResponseBodySize | maximum size of the response body in bytes, a larger response is aborted |
◆ configureTLS()
| void tenduke::http::curl::LibCurlHTTPCall::configureTLS |
( |
| ) |
|
|
protectedvirtual |
Enables TLS certificate verification of the CURL-call: the certificate chain and the host name are verified.
On Windows, the CA certificates of the Windows certificate store are used.
- Exceptions
-
| tenduke::http::HTTPRequestException | if libcurl does not accept the configuration |
◆ execute()
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::HTTPRequestException | when 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.
◆ restrictProtocols()
| void tenduke::http::curl::LibCurlHTTPCall::restrictProtocols |
( |
| ) |
|
|
protectedvirtual |
Restricts the CURL-call to protocols http and https, without following redirects.
- Exceptions
-
| tenduke::http::HTTPRequestException | if libcurl does not accept the restriction |
◆ setRequestHeaders()
| void tenduke::http::curl::LibCurlHTTPCall::setRequestHeaders |
( |
| ) |
|
|
protectedvirtual |
Sets request headers to the CURL-call.
- Exceptions
-
| tenduke::http::HTTPRequestException | if a header name or value is not valid, e.g. contains CR or LF |
The documentation for this class was generated from the following files:
- core/services/default/src/http/LibcurlHTTPCall.h
- core/services/default/src/http/LibcurlHTTPCall.cpp