fix: Crash on exit
This commit is contained in:
parent
3cb8e37182
commit
969a37877a
@ -61,21 +61,8 @@ namespace hex {
|
|||||||
T m_data;
|
T m_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpRequest(std::string method, std::string url) : m_method(std::move(method)), m_url(std::move(url)) {
|
HttpRequest(std::string method, std::string url);
|
||||||
AT_FIRST_TIME {
|
~HttpRequest();
|
||||||
curl_global_init(CURL_GLOBAL_ALL);
|
|
||||||
};
|
|
||||||
|
|
||||||
AT_FINAL_CLEANUP {
|
|
||||||
curl_global_cleanup();
|
|
||||||
};
|
|
||||||
|
|
||||||
this->m_curl = curl_easy_init();
|
|
||||||
}
|
|
||||||
|
|
||||||
~HttpRequest() {
|
|
||||||
curl_easy_cleanup(this->m_curl);
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpRequest(const HttpRequest&) = delete;
|
HttpRequest(const HttpRequest&) = delete;
|
||||||
HttpRequest& operator=(const HttpRequest&) = delete;
|
HttpRequest& operator=(const HttpRequest&) = delete;
|
||||||
|
@ -31,9 +31,6 @@ namespace hex::log {
|
|||||||
|
|
||||||
template<typename... T>
|
template<typename... T>
|
||||||
[[maybe_unused]] void print(const fmt::text_style &ts, const std::string &level, const std::string &fmt, auto... args) {
|
[[maybe_unused]] void print(const fmt::text_style &ts, const std::string &level, const std::string &fmt, auto... args) {
|
||||||
static std::mutex logMutex;
|
|
||||||
std::scoped_lock lock(logMutex);
|
|
||||||
|
|
||||||
auto dest = getDestination();
|
auto dest = getDestination();
|
||||||
|
|
||||||
printPrefix(dest, ts, level);
|
printPrefix(dest, ts, level);
|
||||||
|
@ -5,6 +5,22 @@ namespace hex {
|
|||||||
std::string HttpRequest::s_caCertData;
|
std::string HttpRequest::s_caCertData;
|
||||||
std::string HttpRequest::s_proxyUrl;
|
std::string HttpRequest::s_proxyUrl;
|
||||||
|
|
||||||
|
HttpRequest::HttpRequest(std::string method, std::string url) : m_method(std::move(method)), m_url(std::move(url)) {
|
||||||
|
AT_FIRST_TIME {
|
||||||
|
curl_global_init(CURL_GLOBAL_ALL);
|
||||||
|
};
|
||||||
|
|
||||||
|
AT_FINAL_CLEANUP {
|
||||||
|
curl_global_cleanup();
|
||||||
|
};
|
||||||
|
|
||||||
|
this->m_curl = curl_easy_init();
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpRequest::~HttpRequest() {
|
||||||
|
curl_easy_cleanup(this->m_curl);
|
||||||
|
}
|
||||||
|
|
||||||
void HttpRequest::setDefaultConfig() {
|
void HttpRequest::setDefaultConfig() {
|
||||||
curl_easy_setopt(this->m_curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
|
curl_easy_setopt(this->m_curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2TLS);
|
||||||
curl_easy_setopt(this->m_curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
|
curl_easy_setopt(this->m_curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user