Use absolute path of cert location
This commit is contained in:
@@ -346,6 +346,8 @@ void FileManager::init()
|
||||
for(int i=0;i<(int)dirs.size(); i++)
|
||||
pushMusicSearchPath(dirs[i]);
|
||||
}
|
||||
m_cert_location = m_file_system->getAbsolutePath(
|
||||
getAsset("addons.supertuxkart.net.pem").c_str()).c_str();
|
||||
} // init
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -99,6 +99,8 @@ private:
|
||||
/** Directory where user-defined grand prix are stored. */
|
||||
std::string m_gp_dir;
|
||||
|
||||
std::string m_cert_location;
|
||||
|
||||
std::vector<TextureSearchPath> m_texture_search_path;
|
||||
|
||||
std::vector<std::string>
|
||||
@@ -225,6 +227,7 @@ public:
|
||||
{
|
||||
return m_subdir_name[SHADER];
|
||||
}
|
||||
const std::string& getCertLocation() const { return m_cert_location; }
|
||||
}; // FileManager
|
||||
|
||||
extern FileManager* file_manager;
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
namespace Online
|
||||
{
|
||||
std::string HTTPRequest::m_cert_location;
|
||||
struct curl_slist* HTTPRequest::m_http_header = NULL;
|
||||
const std::string API::USER_PATH = "user/";
|
||||
const std::string API::SERVER_PATH = "server/";
|
||||
@@ -96,11 +95,6 @@ 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");
|
||||
}
|
||||
if (m_http_header == NULL)
|
||||
{
|
||||
m_http_header = curl_slist_append(m_http_header,
|
||||
@@ -191,12 +185,13 @@ namespace Online
|
||||
assert(m_http_header != NULL);
|
||||
curl_easy_setopt(m_curl_session, CURLOPT_HTTPHEADER,
|
||||
m_http_header);
|
||||
const std::string& ci = file_manager->getCertLocation();
|
||||
CURLcode error = curl_easy_setopt(m_curl_session, CURLOPT_CAINFO,
|
||||
m_cert_location.c_str());
|
||||
ci.c_str());
|
||||
if (error != CURLE_OK)
|
||||
{
|
||||
Log::error("HTTPRequest", "Error setting CAINFO to '%s'",
|
||||
m_cert_location.c_str());
|
||||
ci.c_str());
|
||||
Log::error("HTTPRequest", "Error: '%s'.", error,
|
||||
curl_easy_strerror(error));
|
||||
}
|
||||
|
||||
@@ -71,8 +71,6 @@ namespace Online
|
||||
/** String to store the received data in. */
|
||||
std::string m_string_buffer;
|
||||
|
||||
static std::string m_cert_location;
|
||||
|
||||
static struct curl_slist* m_http_header;
|
||||
protected:
|
||||
bool m_disable_sending_log;
|
||||
|
||||
Reference in New Issue
Block a user