1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 06:23:04 +01:00

Update dependencies for Windows and remove certificates

This commit is contained in:
Ted John
2016-10-16 16:03:15 +01:00
parent 9635fbaa77
commit 5b9f7904ea
5 changed files with 5 additions and 4085 deletions

View File

@@ -37,7 +37,6 @@ void http_dispose() { }
#include <curl/curl.h>
#define MIME_TYPE_APPLICATION_JSON "application/json"
#define DEFAULT_CA_BUNDLE_PATH "curl-ca-bundle.crt"
#define OPENRCT2_USER_AGENT "OpenRCT2/" OPENRCT2_VERSION
typedef struct read_buffer {
@@ -52,22 +51,9 @@ typedef struct write_buffer {
size_t capacity;
} write_buffer;
#ifdef __WINDOWS__
static utf8 _caBundlePath[MAX_PATH];
#endif
void http_init()
{
curl_global_init(CURL_GLOBAL_DEFAULT);
#ifdef __WINDOWS__
// Find SSL certificate bundle
platform_get_exe_path(_caBundlePath, sizeof(_caBundlePath));
Path::Append(_caBundlePath, sizeof(_caBundlePath), DEFAULT_CA_BUNDLE_PATH);
if (!platform_file_exists(_caBundlePath)) {
String::Set(_caBundlePath, sizeof(_caBundlePath), DEFAULT_CA_BUNDLE_PATH);
}
#endif
}
void http_dispose()
@@ -152,10 +138,6 @@ http_json_response *http_request_json(const http_json_request *request)
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, true);
curl_easy_setopt(curl, CURLOPT_USERAGENT, OPENRCT2_USER_AGENT);
#ifdef __WINDOWS__
// On GNU/Linux (and macOS), curl will use the system certs by default
curl_easy_setopt(curl, CURLOPT_CAINFO, _caBundlePath);
#endif
curl_easy_setopt(curl, CURLOPT_URL, request->url);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &writeBuffer);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, http_request_write_func);