Files
spark/src/lib/io/http/CurlHandle.cpp
T
John Colvin f9db93e41a Add simple HTTPClient
The binance depth stream must be bootstrapped with a depth snapshot,
which is retrieved via an HTTP GET request
2021-11-19 16:20:45 -05:00

22 lines
438 B
C++

#include "CurlHandle.h"
#include <curl/curl.h>
#include <stdexcept>
namespace bts::http {
CurlHandle::CurlHandle() {
const auto eCode = curl_global_init(CURL_GLOBAL_ALL);
if (eCode != CURLE_OK) {
throw std::runtime_error{"Error initializing libCURL"};
}
}
CurlHandle::~CurlHandle() { curl_global_cleanup(); }
CurlHandle &CurlHandle::instance() {
static CurlHandle inst{};
return inst;
}
} // namespace bts::http