added destructor to requester for global cleanup

This commit is contained in:
Bob Polis 2020-10-30 11:11:30 +01:00
parent 567dbd584a
commit 191aafa32b
2 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,10 @@ requester::requester() {
curl_easy_setopt(_h.get(), CURLOPT_WRITEFUNCTION, write_data); curl_easy_setopt(_h.get(), CURLOPT_WRITEFUNCTION, write_data);
} }
requester::~requester() {
curl_global_cleanup();
}
std::string requester::get(const std::string &url) { std::string requester::get(const std::string &url) {
curl_easy_setopt(_h.get(), CURLOPT_URL, url.c_str()); curl_easy_setopt(_h.get(), CURLOPT_URL, url.c_str());
std::vector<char> buf; std::vector<char> buf;

View File

@ -20,6 +20,7 @@ class requester {
// this class is a RAII class for a curl handle // this class is a RAII class for a curl handle
requester(); requester();
~requester();
// perform a http get request // perform a http get request
std::string get(const std::string& url); std::string get(const std::string& url);