Fix #3066 by make sure cert location is handled in main thread
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
|
||||
namespace Online
|
||||
{
|
||||
std::string HTTPRequest::m_cert_location;
|
||||
const std::string API::USER_PATH = "user/";
|
||||
const std::string API::SERVER_PATH = "server/";
|
||||
|
||||
@@ -94,6 +95,11 @@ namespace Online
|
||||
m_parameters = "";
|
||||
m_curl_code = CURLE_OK;
|
||||
m_progress.setAtomic(0);
|
||||
if (m_cert_location.empty())
|
||||
{
|
||||
m_cert_location =
|
||||
file_manager->getAsset("addons.supertuxkart.net.pem");
|
||||
}
|
||||
} // init
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
@@ -179,13 +185,13 @@ namespace Online
|
||||
chunk = curl_slist_append(chunk, "Host: addons.supertuxkart.net");
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_HTTPHEADER, chunk);
|
||||
CURLcode error = curl_easy_setopt(m_curl_session, CURLOPT_CAINFO,
|
||||
file_manager->getAsset("addons.supertuxkart.net.pem").c_str());
|
||||
m_cert_location.c_str());
|
||||
if (error != CURLE_OK)
|
||||
{
|
||||
Log::error("HTTPRequest", "Error setting CAINFO to '%s'",
|
||||
file_manager->getAsset("addons.supertuxkart.net.pem").c_str());
|
||||
Log::error("HTTPRequest", "Error %d: '%s'.", error,
|
||||
curl_easy_strerror(error));
|
||||
m_cert_location.c_str());
|
||||
Log::error("HTTPRequest", "Error: '%s'.", error,
|
||||
curl_easy_strerror(error));
|
||||
}
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_SSL_VERIFYPEER, 1L);
|
||||
#ifdef __APPLE__
|
||||
|
||||
@@ -71,6 +71,7 @@ namespace Online
|
||||
/** String to store the received data in. */
|
||||
std::string m_string_buffer;
|
||||
|
||||
static std::string m_cert_location;
|
||||
protected:
|
||||
virtual void prepareOperation() OVERRIDE;
|
||||
virtual void operation() OVERRIDE;
|
||||
|
||||
Reference in New Issue
Block a user