mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-09 04:16:34 +00:00
NETWORKING: Try loading the CA bundle from DATA_PATH
This commit is contained in:
parent
47b67342d6
commit
6fa7322a6a
@ -26,6 +26,7 @@
|
|||||||
#include "backends/networking/curl/connectionmanager.h"
|
#include "backends/networking/curl/connectionmanager.h"
|
||||||
#include "backends/networking/curl/networkreadstream.h"
|
#include "backends/networking/curl/networkreadstream.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
|
#include "common/fs.h"
|
||||||
#include "common/system.h"
|
#include "common/system.h"
|
||||||
#include "common/timer.h"
|
#include "common/timer.h"
|
||||||
|
|
||||||
@ -98,6 +99,29 @@ uint32 ConnectionManager::getCloudRequestsPeriodInMicroseconds() {
|
|||||||
return TIMER_INTERVAL * CLOUD_PERIOD;
|
return TIMER_INTERVAL * CLOUD_PERIOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *ConnectionManager::getCaCertPath() {
|
||||||
|
#if defined(DATA_PATH)
|
||||||
|
static enum {
|
||||||
|
kNotInitialized,
|
||||||
|
kFileNotFound,
|
||||||
|
kFileExists
|
||||||
|
} state = kNotInitialized;
|
||||||
|
|
||||||
|
if (state == kNotInitialized) {
|
||||||
|
Common::FSNode node(DATA_PATH"/cacert.pem");
|
||||||
|
state = node.exists() ? kFileExists : kFileNotFound;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == kFileExists) {
|
||||||
|
return DATA_PATH"/cacert.pem";
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//private goes here:
|
//private goes here:
|
||||||
|
|
||||||
void connectionsThread(void *ignored) {
|
void connectionsThread(void *ignored) {
|
||||||
|
@ -118,6 +118,9 @@ public:
|
|||||||
Common::String urlEncode(Common::String s) const;
|
Common::String urlEncode(Common::String s) const;
|
||||||
|
|
||||||
static uint32 getCloudRequestsPeriodInMicroseconds();
|
static uint32 getCloudRequestsPeriodInMicroseconds();
|
||||||
|
|
||||||
|
/** Return the path to the CA certificates bundle. */
|
||||||
|
static const char *getCaCertPath();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Shortcut for accessing the connection manager. */
|
/** Shortcut for accessing the connection manager. */
|
||||||
|
@ -91,6 +91,11 @@ void NetworkReadStream::init(const char *url, curl_slist *headersList, const byt
|
|||||||
curl_easy_setopt(_easy, CURLOPT_SSL_VERIFYPEER, 0);
|
curl_easy_setopt(_easy, CURLOPT_SSL_VERIFYPEER, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char *caCertPath = ConnMan.getCaCertPath();
|
||||||
|
if (caCertPath) {
|
||||||
|
curl_easy_setopt(_easy, CURLOPT_CAINFO, caCertPath);
|
||||||
|
}
|
||||||
|
|
||||||
#if LIBCURL_VERSION_NUM >= 0x072000
|
#if LIBCURL_VERSION_NUM >= 0x072000
|
||||||
// CURLOPT_XFERINFOFUNCTION introduced in libcurl 7.32.0
|
// CURLOPT_XFERINFOFUNCTION introduced in libcurl 7.32.0
|
||||||
// CURLOPT_PROGRESSFUNCTION is used as a backup plan in case older version is used
|
// CURLOPT_PROGRESSFUNCTION is used as a backup plan in case older version is used
|
||||||
@ -149,6 +154,11 @@ void NetworkReadStream::init(const char *url, curl_slist *headersList, Common::H
|
|||||||
curl_easy_setopt(_easy, CURLOPT_SSL_VERIFYPEER, 0);
|
curl_easy_setopt(_easy, CURLOPT_SSL_VERIFYPEER, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const char *caCertPath = ConnMan.getCaCertPath();
|
||||||
|
if (caCertPath) {
|
||||||
|
curl_easy_setopt(_easy, CURLOPT_CAINFO, caCertPath);
|
||||||
|
}
|
||||||
|
|
||||||
#if LIBCURL_VERSION_NUM >= 0x072000
|
#if LIBCURL_VERSION_NUM >= 0x072000
|
||||||
// CURLOPT_XFERINFOFUNCTION introduced in libcurl 7.32.0
|
// CURLOPT_XFERINFOFUNCTION introduced in libcurl 7.32.0
|
||||||
// CURLOPT_PROGRESSFUNCTION is used as a backup plan in case older version is used
|
// CURLOPT_PROGRESSFUNCTION is used as a backup plan in case older version is used
|
||||||
|
Loading…
x
Reference in New Issue
Block a user