From be59a9e7e9c123cc4ba0768fe7a5bff9a70b7340 Mon Sep 17 00:00:00 2001 From: Phi1ow <331962174+Phi1ow@users.noreply.github.com> Date: Sun, 4 Oct 2026 22:04:13 +0200 Subject: [PATCH] feat(http): implement sceHttpCreateRequest2, sceHttpsEnableOption, sceHttpsLoadCert and sceHttpGetLastErrno Four more libSceHttp exports, following the library's existing "no network emulated" model: - sceHttpCreateRequest2 -> a new handle, like sceHttpCreateRequestWithURL2 - sceHttpsEnableOption -> 0, the counterpart of the existing sceHttpsDisableOption - sceHttpsLoadCert -> 0 (certificates are accepted and ignored; no TLS is performed) - sceHttpGetLastErrno -> 0 (no request reaches the network, so no errno is recorded); a null output pointer returns ERROR_INVALID_VALUE, like the other getters in this file Signatures follow the public OpenOrbis SDK headers. GuestHttp is extended to cover the four functions; the new assertions fail without the change (the symbols are undefined). --- core/libs/prx/libSceHttp/Export.cpp | 32 +++++++++++++++++++++++++++++ core/libs/tests/GuestHttp.cpp | 12 +++++++++++ 2 files changed, 44 insertions(+) diff --git a/core/libs/prx/libSceHttp/Export.cpp b/core/libs/prx/libSceHttp/Export.cpp index 7c3bd6db7..ef0874b74 100644 --- a/core/libs/prx/libSceHttp/Export.cpp +++ b/core/libs/prx/libSceHttp/Export.cpp @@ -257,4 +257,36 @@ int APS5_VABI sceHttpUnknown01(void) { NotImplemented_nid_no_patch("vO4B-42ef-k"); return 0; } + +int APS5_VABI sceHttpCreateRequest2(int conn_id, const char* method, const char* path, uint64_t content_length) { + (void)conn_id; + (void)method; + (void)path; + (void)content_length; + return g_nextHandle.fetch_add(1, std::memory_order_relaxed); +} + +int APS5_VABI sceHttpsEnableOption(int id, uint32_t ssl_flags) { + (void)id; + (void)ssl_flags; + return 0; +} + +int APS5_VABI sceHttpsLoadCert(int http_ctx_id, int num, void* ca_list, void* cert, void* key) { + (void)http_ctx_id; + (void)num; + (void)ca_list; + (void)cert; + (void)key; + return 0; +} + +int APS5_VABI sceHttpGetLastErrno(int request_id, int* errno_out) { + (void)request_id; + if (errno_out == nullptr) { + return ERROR_INVALID_VALUE; + } + *errno_out = 0; + return 0; +} } diff --git a/core/libs/tests/GuestHttp.cpp b/core/libs/tests/GuestHttp.cpp index a772f65fd..fa1ae4a63 100644 --- a/core/libs/tests/GuestHttp.cpp +++ b/core/libs/tests/GuestHttp.cpp @@ -12,6 +12,10 @@ int APS5_VABI sceHttpUriEscape(char*, std::size_t*, std::size_t, const char*); int APS5_VABI sceHttpCreateEpoll(int, HttpEpollHandle*); int APS5_VABI sceHttpDestroyEpoll(int, HttpEpollHandle); int APS5_VABI sceHttpReadData(int, void*, std::size_t); +int APS5_VABI sceHttpCreateRequest2(int, const char*, const char*, std::uint64_t); +int APS5_VABI sceHttpsEnableOption(int, std::uint32_t); +int APS5_VABI sceHttpsLoadCert(int, int, void*, void*, void*); +int APS5_VABI sceHttpGetLastErrno(int, int*); } static void Require(bool value) { if (!value) std::abort(); } @@ -91,4 +95,12 @@ int main() { char data[16]; Require(sceHttpReadData(1, data, sizeof(data)) == network); + + Require(sceHttpCreateRequest2(1, "GET", "/", 0) > 0); + Require(sceHttpsEnableOption(1, 0) == 0); + Require(sceHttpsLoadCert(1, 0, nullptr, nullptr, nullptr) == 0); + int httpErrno = -1; + Require(sceHttpGetLastErrno(1, &httpErrno) == 0); + Require(httpErrno == 0); + Require(sceHttpGetLastErrno(1, nullptr) == invalidValue); }