Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow disabling HTTPS through the config file #17972

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Common/Net/HTTPRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "Common/StringUtils.h"
#include "Common/Log.h"
#include "Common/System/OSD.h"
#include "Common/System/System.h"

namespace http {

Expand Down Expand Up @@ -37,7 +38,7 @@ bool RequestManager::IsHttpsUrl(const std::string &url) {

std::shared_ptr<Request> RequestManager::StartDownload(const std::string &url, const Path &outfile, ProgressBarMode mode, const char *acceptMime) {
std::shared_ptr<Request> dl;
if (IsHttpsUrl(url)) {
if (IsHttpsUrl(url) && System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) {
#ifndef HTTPS_NOT_AVAILABLE
dl.reset(new HTTPSRequest(RequestMethod::GET, url, "", "", outfile, mode));
#else
Expand All @@ -64,7 +65,7 @@ std::shared_ptr<Request> RequestManager::StartDownloadWithCallback(
const std::string &name,
const char *acceptMime) {
std::shared_ptr<Request> dl;
if (IsHttpsUrl(url)) {
if (IsHttpsUrl(url) && System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) {
#ifndef HTTPS_NOT_AVAILABLE
dl.reset(new HTTPSRequest(RequestMethod::GET, url, "", "", outfile, mode, name));
#else
Expand All @@ -91,7 +92,7 @@ std::shared_ptr<Request> RequestManager::AsyncPostWithCallback(
std::function<void(Request &)> callback,
const std::string &name) {
std::shared_ptr<Request> dl;
if (IsHttpsUrl(url)) {
if (IsHttpsUrl(url) && System_GetPropertyBool(SYSPROP_SUPPORTS_HTTPS)) {
#ifndef HTTPS_NOT_AVAILABLE
dl.reset(new HTTPSRequest(RequestMethod::POST, url, postData, postMime, Path(), mode, name));
#else
Expand Down
1 change: 1 addition & 0 deletions Core/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ static const ConfigSetting generalSettings[] = {
ConfigSetting("DiscordPresence", &g_Config.bDiscordPresence, true, CfgFlag::DEFAULT), // Or maybe it makes sense to have it per-game? Race conditions abound...
ConfigSetting("UISound", &g_Config.bUISound, false, CfgFlag::DEFAULT),

ConfigSetting("DisableHTTPS", &g_Config.bDisableHTTPS, false, CfgFlag::DONT_SAVE),
ConfigSetting("AutoLoadSaveState", &g_Config.iAutoLoadSaveState, 0, CfgFlag::PER_GAME),
ConfigSetting("EnableCheats", &g_Config.bEnableCheats, false, CfgFlag::PER_GAME | CfgFlag::REPORT),
ConfigSetting("CwCheatRefreshRate", &g_Config.iCwCheatRefreshRate, 77, CfgFlag::PER_GAME),
Expand Down
2 changes: 2 additions & 0 deletions Core/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ struct Config {
bool bPreloadFunctions;
uint32_t uJitDisableFlags;

bool bDisableHTTPS;

bool bSeparateSASThread;
int iIOTimingMethod;
int iLockedCPUSpeed;
Expand Down
2 changes: 1 addition & 1 deletion SDL/SDLMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ bool System_GetPropertyBool(SystemProperty prop) {
return true; // FileUtil.cpp: OpenFileInEditor
#ifndef HTTPS_NOT_AVAILABLE
case SYSPROP_SUPPORTS_HTTPS:
return true;
return !g_Config.bDisableHTTPS;
#endif
#if PPSSPP_PLATFORM(MAC)
case SYSPROP_HAS_FOLDER_BROWSER:
Expand Down
5 changes: 2 additions & 3 deletions Windows/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ bool System_GetPropertyBool(SystemProperty prop) {
case SYSPROP_SUPPORTS_OPEN_FILE_IN_EDITOR:
return true; // FileUtil.cpp: OpenFileInEditor
case SYSPROP_SUPPORTS_HTTPS:
return true;
return !g_Config.bDisableHTTPS;
default:
return false;
}
Expand Down Expand Up @@ -597,7 +597,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string

case SystemRequestType::SHOW_FILE_IN_FOLDER:
W32Util::ShowFileInFolder(param1);
break;
return true;

case SystemRequestType::TOGGLE_FULLSCREEN_STATE:
{
Expand All @@ -620,7 +620,6 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
return true;
}
case SystemRequestType::CREATE_GAME_SHORTCUT:
// This is not actually working, but ported it to the request framework anyway.
return W32Util::CreateDesktopShortcut(param1, param2);
default:
return false;
Expand Down
2 changes: 1 addition & 1 deletion android/jni/app-android.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ bool System_GetPropertyBool(SystemProperty prop) {
return deviceType != DEVICE_TYPE_VR;
#ifndef HTTPS_NOT_AVAILABLE
case SYSPROP_SUPPORTS_HTTPS:
return true;
return !g_Config.bDisableHTTPS;
#endif
default:
return false;
Expand Down