2020-03-22 17:49:33 +01:00
|
|
|
#include "curl_handle.h"
|
2021-04-21 22:12:21 +02:00
|
|
|
#include "Emu/system_utils.hpp"
|
2021-08-28 16:11:53 +02:00
|
|
|
#include "util/logs.hpp"
|
2020-03-22 17:49:33 +01:00
|
|
|
|
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");
|
|
|
|
|
|
2020-03-22 17:49:33 +01:00
|
|
|
curl_handle::curl_handle(QObject* parent) : QObject(parent)
|
|
|
|
|
{
|
|
|
|
|
m_curl = curl_easy_init();
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
// This shouldn't be needed on linux
|
2021-04-21 22:12:21 +02:00
|
|
|
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));
|
2020-03-22 17:49:33 +01:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
curl_handle::~curl_handle()
|
|
|
|
|
{
|
|
|
|
|
curl_easy_cleanup(m_curl);
|
|
|
|
|
}
|
|
|
|
|
|
2021-04-07 23:05:18 +02:00
|
|
|
CURL* curl_handle::get_curl() const
|
2020-03-22 17:49:33 +01:00
|
|
|
{
|
|
|
|
|
return m_curl;
|
|
|
|
|
}
|