rpcsx/rpcs3/rpcs3qt/curl_handle.cpp

34 lines
797 B
C++
Raw Normal View History

#include "curl_handle.h"
#include "Emu/system_utils.hpp"
2021-08-28 16:11:53 +02:00
#include "util/logs.hpp"
2020-03-26 21:48:56 +01:00
#ifdef _WIN32
#include "Utilities/StrUtil.h"
#endif
2021-08-28 16:11:53 +02:00
LOG_CHANNEL(network_log, "NET");
curl_handle::curl_handle(QObject* parent) : QObject(parent)
{
m_curl = curl_easy_init();
#ifdef _WIN32
// This shouldn't be needed on linux
const std::string path_to_cert = rpcs3::utils::get_exe_dir() + "cacert.pem";
2020-03-26 21:48:56 +01:00
const std::string ansi_path = utf8_path_to_ansi_path(path_to_cert);
2021-08-28 16:11:53 +02:00
const CURLcode err = curl_easy_setopt(m_curl, CURLOPT_CAINFO, ansi_path.data());
if (err != CURLE_OK) network_log.error("curl_easy_setopt(CURLOPT_CAINFO, %s) error: %s", ansi_path, curl_easy_strerror(err));
#endif
}
curl_handle::~curl_handle()
{
curl_easy_cleanup(m_curl);
}
2021-04-07 23:05:18 +02:00
CURL* curl_handle::get_curl() const
{
return m_curl;
}