mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-12 11:36:08 -05:00
Add header support to http action
This commit is contained in:
@@ -32,6 +32,14 @@ Curlhelper::~Curlhelper()
|
||||
}
|
||||
}
|
||||
|
||||
curl_slist *Curlhelper::SlistAppend(curl_slist *list, const char *string)
|
||||
{
|
||||
if (!_initialized) {
|
||||
return nullptr;
|
||||
}
|
||||
return _slistAppend(list, string);
|
||||
}
|
||||
|
||||
CURLcode Curlhelper::Perform()
|
||||
{
|
||||
if (!_initialized) {
|
||||
@@ -88,10 +96,11 @@ bool Curlhelper::Resolve()
|
||||
{
|
||||
_init = (initFunction)_lib->resolve("curl_easy_init");
|
||||
_setopt = (setOptFunction)_lib->resolve("curl_easy_setopt");
|
||||
_slistAppend = (slistAppendFunction)_lib->resolve("curl_slist_append");
|
||||
_perform = (performFunction)_lib->resolve("curl_easy_perform");
|
||||
_cleanup = (cleanupFunction)_lib->resolve("curl_easy_cleanup");
|
||||
|
||||
if (_init && _setopt && _perform && _cleanup) {
|
||||
if (_init && _setopt && _slistAppend && _perform && _cleanup) {
|
||||
blog(LOG_INFO, "[adv-ss] curl loaded successfully");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
typedef CURL *(*initFunction)(void);
|
||||
typedef void (*cleanupFunction)(CURL *);
|
||||
typedef CURLcode (*setOptFunction)(CURL *, CURLoption, ...);
|
||||
typedef struct curl_slist *(*slistAppendFunction)(struct curl_slist *list,
|
||||
const char *string);
|
||||
typedef CURLcode (*performFunction)(CURL *);
|
||||
|
||||
class Curlhelper {
|
||||
@@ -13,6 +15,8 @@ public:
|
||||
~Curlhelper();
|
||||
|
||||
template<typename... Args> CURLcode SetOpt(CURLoption, Args...);
|
||||
struct curl_slist *SlistAppend(struct curl_slist *list,
|
||||
const char *string);
|
||||
CURLcode Perform();
|
||||
bool Initialized() { return _initialized; }
|
||||
|
||||
@@ -22,6 +26,7 @@ private:
|
||||
|
||||
initFunction _init = nullptr;
|
||||
setOptFunction _setopt = nullptr;
|
||||
slistAppendFunction _slistAppend = nullptr;
|
||||
performFunction _perform = nullptr;
|
||||
cleanupFunction _cleanup = nullptr;
|
||||
CURL *_curl = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user