diff --git a/Core/HLE/sceNet.cpp b/Core/HLE/sceNet.cpp index 060c9e2bdc..e105c453bc 100644 --- a/Core/HLE/sceNet.cpp +++ b/Core/HLE/sceNet.cpp @@ -31,6 +31,7 @@ #include "Common/Serialize/SerializeFuncs.h" #include "Common/Serialize/SerializeMap.h" #include "Common/Data/Format/JSONReader.h" +#include "Common/System/System.h" #include "Core/HLE/HLE.h" #include "Core/HLE/ErrorCodes.h" #include "Core/HLE/FunctionWrappers.h" @@ -382,10 +383,15 @@ bool LoadAutoDNS(std::string_view json) { std::shared_ptr g_infraDL; -static const std::string_view jsonUrl = "https://metadata.ppsspp.org/infra-dns.json"; +static constexpr std::string_view jsonUrlHttp = "http://metadata.ppsspp.org/infra-dns.json"; +static constexpr std::string_view jsonUrlHttps = "https://metadata.ppsspp.org/infra-dns.json"; + +static std::string_view GetInfraDNSUrl() { + return System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS) ? jsonUrlHttps : jsonUrlHttp; +} void DeleteAutoDNSCacheFile() { - File::Delete(g_DownloadManager.UrlToCachePath(jsonUrl)); + File::Delete(g_DownloadManager.UrlToCachePath(GetInfraDNSUrl())); } void StartInfraJsonDownload() { @@ -399,7 +405,7 @@ void StartInfraJsonDownload() { if (!g_Config.bDontDownloadInfraJson) { const char * const acceptMime = "application/json, text/*; q=0.9, */*; q=0.8"; - g_infraDL = g_DownloadManager.StartDownload(jsonUrl, Path(), http::RequestFlags::Cached24H, acceptMime); + g_infraDL = g_DownloadManager.StartDownload(GetInfraDNSUrl(), Path(), http::RequestFlags::Cached24H, acceptMime); } } @@ -444,7 +450,7 @@ bool PollInfraJsonDownload(std::string *jsonOutput) { // First, fall back to cache if it exists. Could build this functionality into the download manager // but it would be a bit awkward. std::string json; - if (File::ReadBinaryFileToString(g_DownloadManager.UrlToCachePath(jsonUrl), &json) && !json.empty()) { + if (File::ReadBinaryFileToString(g_DownloadManager.UrlToCachePath(GetInfraDNSUrl()), &json) && !json.empty()) { WARN_LOG(Log::sceNet, "Failed to download infra-dns.json, falling back to cached file"); *jsonOutput = json; LoadAutoDNS(*jsonOutput);