Move a utility function

This commit is contained in:
Henrik Rydgård
2026-05-05 15:36:30 +02:00
parent 32799755e6
commit d4bd7c604c
3 changed files with 15 additions and 12 deletions
+11
View File
@@ -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