1#ifndef TENDUKE_HTTP_LIBCURLHTTPCALL_H
2#define TENDUKE_HTTP_LIBCURLHTTPCALL_H
4#include "http/HTTPCall.h"
5#include "http/HTTPRequest.h"
6#include "http/HTTPResponse.h"
30 std::multimap<std::string, std::string> &headers
49 std::shared_ptr<const tenduke::http::HTTPRequest>
request,
51 const ::tenduke::net::URLs &urls,
59 std::unique_ptr<tenduke::http::HTTPResponse>
execute()
override;
97 const std::shared_ptr<const tenduke::http::HTTPRequest>
request;
100 const std::unique_ptr<CURL,
decltype(curl_easy_cleanup) *>
curlHandle;
115 const ::tenduke::net::URLs &urls;
HTTP-call which executes the request and returns HTTPResponse.
Definition HTTPCall.h:15
virtual void configureTLS()
Enables TLS certificate verification of the CURL-call: the certificate chain and the host name are ve...
Definition LibcurlHTTPCall.cpp:337
virtual void restrictProtocols()
Restricts the CURL-call to protocols http and https, without following redirects.
Definition LibcurlHTTPCall.cpp:312
virtual void setRequestMethod()
Sets request method to the CURL-call.
Definition LibcurlHTTPCall.cpp:372
virtual void setRequestBody()
Sets request body to the CURL-call.
Definition LibcurlHTTPCall.cpp:381
const std::unique_ptr< CURL, decltype(curl_easy_cleanup) * > curlHandle
libcurl-handle for the request.
Definition LibcurlHTTPCall.h:100
bool verbose
If true, configure libcurl to provide verbose output.
Definition LibcurlHTTPCall.h:110
virtual void setUrl()
Sets URL to the CURL-call.
Definition LibcurlHTTPCall.cpp:362
const std::shared_ptr< const tenduke::http::HTTPRequest > request
The request.
Definition LibcurlHTTPCall.h:97
virtual void setRequestHeaders()
Sets request headers to the CURL-call.
Definition LibcurlHTTPCall.cpp:392
struct curl_slist * curlHeaders
libcurl header-list.
Definition LibcurlHTTPCall.h:103
std::unique_ptr< tenduke::http::HTTPResponse > execute() override
Executes the call synchronously.
Definition LibcurlHTTPCall.cpp:207
const std::size_t maxResponseBodySize
Maximum size of the response body in bytes.
Definition LibcurlHTTPCall.h:113
LibCurlHTTPCall(std::shared_ptr< const tenduke::http::HTTPRequest > request, std::string userAgent, const ::tenduke::net::URLs &urls, bool verbose=false, std::size_t maxResponseBodySize=DEFAULT_MAX_RESPONSE_BODY_SIZE)
Constructs new instance.
Definition LibcurlHTTPCall.cpp:125
const std::string userAgent
Useragent-string to use.
Definition LibcurlHTTPCall.h:107
Implementation of HTTP-client using libcurl.
Definition LibcurlHTTPCall.h:15
void parseResponseHeaderLine(const char *line, std::size_t len, std::multimap< std::string, std::string > &headers)
Parses one response header line received from libcurl and adds the header to headers.
Definition LibcurlHTTPCall.cpp:74
HTTP-related services.
Definition BadRequest.h:6
const std::size_t DEFAULT_MAX_RESPONSE_BODY_SIZE
Default maximum size of a response body in bytes (10 MiB).
Definition HTTPRequest.h:21
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4