mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Move a utility function
This commit is contained in:
1 parent
32799755e6
commit
d4bd7c604c
3 files changed
+15
-12
No files matched your search
@@ -7,6 +7,7 @@
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/System/OSD.h"
|
||||
#include "Common/System/System.h"
|
||||
|
||||
#include "Common/Net/SocketCompat.h"
|
||||
#include "Common/Net/Resolve.h"
|
||||
@@ -633,4 +634,14 @@ void HTTPRequest::Do() {
|
||||
completed_ = true;
|
||||
}
|
||||
|
||||
std::string RemoveHttpsIfNeeded(std::string_view url) {
|
||||
if (!System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) {
|
||||
// Try with http. Needed on Linux installs currently.
|
||||
if (startsWith(url, "https://")) {
|
||||
return "http://" + std::string(url.substr(8));
|
||||
}
|
||||
}
|
||||
return std::string(url);
|
||||
}
|
||||
|
||||
} // namespace http
|
||||
@@ -142,4 +142,6 @@ public:
|
||||
bool Failed() const override { return false; }
|
||||
};
|
||||
|
||||
std::string RemoveHttpsIfNeeded(std::string_view url);
|
||||
|
||||
} // namespace http
|
||||
@@ -51,16 +51,6 @@ static int ParsePortValue(const rapidjson::Value &v) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
static std::string RemoveHttpsIfNeeded(std::string_view url) {
|
||||
if (!System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) {
|
||||
// Try with http. Needed on Linux installs currently.
|
||||
if (startsWith(url, "https://")) {
|
||||
return "http://" + std::string(url.substr(8));
|
||||
}
|
||||
}
|
||||
return std::string(url);
|
||||
}
|
||||
|
||||
std::vector<AdhocGame> ParseStatusXML(const std::string& xmlInput) {
|
||||
pugi::xml_document doc;
|
||||
pugi::xml_parse_result result = doc.load_string(xmlInput.c_str());
|
||||
@@ -301,9 +291,9 @@ AdhocServerInfoScreen::AdhocServerInfoScreen(const AdhocServerListEntry &entry)
|
||||
|
||||
std::string dataUrl;
|
||||
if (!entry.dataJsonUrl.empty()) {
|
||||
dataUrl = RemoveHttpsIfNeeded(entry.dataJsonUrl);
|
||||
dataUrl = http::RemoveHttpsIfNeeded(entry.dataJsonUrl);
|
||||
} else if (!entry.statusXmlUrl.empty()) {
|
||||
dataUrl = RemoveHttpsIfNeeded(entry.statusXmlUrl);
|
||||
dataUrl = http::RemoveHttpsIfNeeded(entry.statusXmlUrl);
|
||||
}
|
||||
|
||||
if (!dataUrl.empty()) {
|
||||
|
||||
Reference in new issue
Block a user