mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-06 12:45:21 +02:00
Enable HTTPS on Linux, through naett's libcurl backend
naett has had a complete libcurl backend all along; we just never built it, so Linux ran with HTTPS_NOT_AVAILABLE. That means no homebrew store over HTTPS, and RetroAchievements talking to plain http://retroachievements.org. libcurl is loaded with dlopen rather than linked, the same way we handle the Vulkan loader, so it stays a soft dependency: we need the curl headers at build time, but a build made here still starts on a machine without libcurl installed - it just reports HTTPS as unavailable, exactly like today. Distro packagers get the behavior they'd expect either way, and certificate validation comes free from the system CA store. New net::HTTPSAvailable() answers "did that work", and SDLMain folds it into SYSPROP_SUPPORTS_HTTPS, which everything downstream already degrades on. Four fixes to the backend itself, all noted in ext/naett/README-ppsspp.md: - panic() called exit(1) on a pipe or curl_multi_perform failure. Taking the emulator down because a download failed isn't acceptable - the backend now disables itself and requests complete with naettGenericError. - CURLINFO_RESPONSE_CODE writes a long into res->code, which is an int. Eight bytes into four, getting away with it only because the next field absorbs the zeroes. - curl_easy_setopt is varargs and wants a long for these options; int literals and int variables are UB on LP64. - naettPlatformCloseResponse called through a null function pointer when libcurl was missing. Found by testing that path, which segfaulted. CI needs libcurl4-openssl-dev (curl-dev on Alpine) or it would quietly keep building without HTTPS.
This commit is contained in:
+19
-1
@@ -16,6 +16,12 @@
|
||||
|
||||
#ifndef HTTPS_NOT_AVAILABLE
|
||||
#include "ext/naett-lib/naett.h"
|
||||
// Note: PPSSPP_PLATFORM(LINUX) is also set on Android, which needs no loader.
|
||||
#if PPSSPP_PLATFORM(LINUX) && !PPSSPP_PLATFORM(ANDROID)
|
||||
// On Linux, naett goes through libcurl, which we load at runtime - so HTTPS support is
|
||||
// only known once we've tried.
|
||||
#include "ext/naett-lib/src/naett_curl.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
@@ -44,13 +50,25 @@ void Init() {
|
||||
_assert_(gJvm != nullptr);
|
||||
naettInit(gJvm);
|
||||
#else
|
||||
naettInit(NULL);
|
||||
if (HTTPSAvailable()) {
|
||||
naettInit(NULL);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
g_naettInitialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
bool HTTPSAvailable() {
|
||||
#ifdef HTTPS_NOT_AVAILABLE
|
||||
return false;
|
||||
#elif PPSSPP_PLATFORM(LINUX) && !PPSSPP_PLATFORM(ANDROID)
|
||||
return naettCurlLoad() != 0;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Shutdown() {
|
||||
#ifdef _WIN32
|
||||
if (g_wsaInitialized) {
|
||||
|
||||
Reference in New Issue
Block a user