tgbot-cpp
|
This class makes http requests via libcurl. More...
#include <CurlHttpClient.h>
Public Member Functions | |
CurlHttpClient () | |
~CurlHttpClient () override | |
std::string | makeRequest (const Url &url, const std::vector< HttpReqArg > &args) const override |
Sends a request to the url. | |
![]() | |
virtual | ~HttpClient ()=default |
virtual int | getRequestMaxRetries () const |
Get the maximum number of makeRequest() retries before giving up and throwing an exception. | |
virtual int | getRequestBackoff () const |
Get the makeRequest() backoff duration between retries, in seconds. | |
Public Attributes | |
std::unordered_map< std::thread::id, CURL * > | curlHandles |
Raw curl handles, each thread has its own handle. | |
std::mutex | curlHandlesMutex |
Lock for curlHandles access. | |
![]() | |
std::int32_t | _timeout = 25 |
This class makes http requests via libcurl.
Definition at line 26 of file CurlHttpClient.h.
TgBot::CurlHttpClient::CurlHttpClient | ( | ) |
|
override |
|
overridevirtual |
Sends a request to the url.
If there's no args specified, a GET request will be sent, otherwise a POST request will be sent. If at least 1 arg is marked as file, the content type of a request will be multipart/form-data, otherwise it will be application/x-www-form-urlencoded.
Implements TgBot::HttpClient.
std::unordered_map<std::thread::id, CURL*> TgBot::CurlHttpClient::curlHandles |
Raw curl handles, each thread has its own handle.
Definition at line 43 of file CurlHttpClient.h.
std::mutex TgBot::CurlHttpClient::curlHandlesMutex |
Lock for curlHandles access.
Definition at line 48 of file CurlHttpClient.h.