10Duke Scale C++ Client
Loading...
Searching...
No Matches
LibcurlHTTPCall.h
1#ifndef TENDUKE_HTTP_LIBCURLHTTPCALL_H
2#define TENDUKE_HTTP_LIBCURLHTTPCALL_H
3
4#include "http/HTTPCall.h"
5#include "http/HTTPRequest.h"
6#include "http/HTTPResponse.h"
7
8#include <curl/curl.h>
9
10namespace tenduke { namespace http { namespace curl {
11
12
17{
18public:
27 std::shared_ptr<const tenduke::http::HTTPRequest> request,
28 std::string userAgent,
29 bool blindlyTrustSSLCertificates = false,
30 bool verbose = false
31 );
32 ~LibCurlHTTPCall() override;
33
34// tenduke::http::HTTPCall interface
35public:
36 std::unique_ptr<tenduke::http::HTTPResponse> execute() override;
37
38protected:
42 virtual void setRequestBody();
43
47 virtual void setRequestHeaders();
48
52 virtual void setRequestMethod();
53
57 virtual void setUrl();
58
60 const std::shared_ptr<const tenduke::http::HTTPRequest> request;
61
63 const std::unique_ptr<CURL, decltype(curl_easy_cleanup) *> curlHandle;
64
66 struct curl_slist *curlHeaders;
67 //char curlErrorMessage[CURL_ERROR_SIZE];
68
70 const std::string userAgent;
71
74
76 bool verbose;
77};
78
79
80}}}
81
82#endif // TENDUKE_HTTP_LIBCURLHTTPCALL_H
HTTP-call which executes the request and returns HTTPResponse.
Definition HTTPCall.h:15
LibCurl-based implementation of tenduke::http::HTTPCall.
Definition LibcurlHTTPCall.h:17
virtual void setRequestMethod()
Sets request method to the CURL-call.
Definition LibcurlHTTPCall.cpp:272
virtual void setRequestBody()
Sets request body to the CURL-call.
Definition LibcurlHTTPCall.cpp:281
const std::unique_ptr< CURL, decltype(curl_easy_cleanup) * > curlHandle
libcurl-handle for the request.
Definition LibcurlHTTPCall.h:63
bool verbose
If true, configure libcurl to provide verbose output.
Definition LibcurlHTTPCall.h:76
virtual void setUrl()
Sets URL to the CURL-call.
Definition LibcurlHTTPCall.cpp:263
const std::shared_ptr< const tenduke::http::HTTPRequest > request
The request.
Definition LibcurlHTTPCall.h:60
virtual void setRequestHeaders()
Sets request headers to the CURL-call.
Definition LibcurlHTTPCall.cpp:292
bool blindlyTrustSSLCertificates
If true, configure libcurl to blindly trust all SSL certificates.
Definition LibcurlHTTPCall.h:73
struct curl_slist * curlHeaders
libcurl header-list.
Definition LibcurlHTTPCall.h:66
std::unique_ptr< tenduke::http::HTTPResponse > execute() override
Executes the call synchronously.
Definition LibcurlHTTPCall.cpp:191
const std::string userAgent
Useragent-string to use.
Definition LibcurlHTTPCall.h:70
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7