feat(libSceHttp): keep options per template, connection and request and implement their getters #8245

Merged
YossiYad merged 8 commits from upstream-pr/8245 into main 2026-10-21 12:04:16 +00:00
YossiYad commented 2026-10-20 06:46:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-20T06:46:27Z.


What

libSceHttp handed out template, connection and request ids but kept nothing about them, so its option setters dropped their values and the matching getters threw. Each template, connection and request now keeps its options in src/Options.cpp, copied from its parent when it is created (a template from its context), as in shadPS4. With that, 12 exports are implemented:

  • sceHttpGetAutoRedirect reads what sceHttpSetAutoRedirect sets (default: follow redirects).
  • sceHttpGetNonblock, sceHttpTryGetNonblock and sceHttpTrySetNonblock read and set the flag of sceHttpSetNonblock (default: blocking); the Try forms do what the plain ones do, as in shadPS4.
  • sceHttpSetAcceptEncodingGZIPEnabled and sceHttpGetAcceptEncodingGZIPEnabled set and read the gzip request option (default: off). sceHttpSetDefaultAcceptEncodingGZIPEnabled(ctx, enable) sets the value later templates of that context start with; shadPS4 keeps one value for the whole library, and the debt entry says this differs.
  • sceHttpGetEpoll returns the epoll and argument sceHttpSetEpoll binds; sceHttpUnsetEpoll clears them.
  • sceHttpCacheRedirectedConnectionEnabled, sceHttpsEnableOptionPrivate and sceHttpsDisableOptionPrivate check their arguments (the private SSL mask 0x2dff first, then the id) and return 0, and sceHttpAbortRequestForce does what sceHttpAbortRequest does. No request reaches the network, so they keep nothing; they are listed under Silent stubs.

Getters return ERROR_INVALID_VALUE (0x804311FE) for a null output before they look at the id, and ERROR_INVALID_ID (0x80431100) for an id that is not a live template, connection or request, also after it is deleted. The setters touched here (sceHttpSetAutoRedirect, sceHttpSetNonblock, sceHttpSetEpoll, sceHttpUnsetEpoll) now return ERROR_INVALID_ID for such an id instead of 0. Every option call returns ERROR_BEFORE_INIT (0x80431001) first when no context is open, and the last sceHttpTerm ends every object's options. sceHttpSetEpoll returns ERROR_INVALID_ID for a handle that is not a live epoll. Creation stays as permissive as it was: a connection or request whose parent id is unknown starts from the defaults.

None of this is measured on a PS5; the defaults, signatures and check order are shadPS4's (PS4), and the two debt entries in docs/dev/debt/libSceHttp.md say so.

Tested

Linux (Fedora 44, GCC, Ninja, -DBUILD_TESTING=ON), based on main 1ed63f63c2:

  • New guest_http_options (core/libs/tests/GuestHttpOptions.cpp): defaults, inheritance from template to connection to request, that a later change to a parent leaves existing children alone, the per-context gzip default across two contexts and after sceHttpTerm, the epoll binding and its clearing, the SSL mask, and the error codes and their order, the option calls after the last sceHttpTerm and after a new sceHttpInit, and sceHttpSetEpoll with a handle that is not an epoll. Each feature commit was checked against a mutation of its own code: a setter that drops its value, children that start from the defaults instead of the parent, sceHttpTrySetNonblock as a no-op, templates that ignore their context's gzip default, sceHttpUnsetEpoll as a no-op, and the public SSL mask 0x20ff in place of the private one. Each fails the test.
  • guest_http, guest_http_response_header and guest_http2 still pass.
  • Full ctest: 1668 of 1673 pass. The 5 failures (application_heap_scripting, application_heap_lazy, agc_driver_bda_device, agc_driver_guest_memory_lifetime, agc_driver_tessellation) fail the same way on main on this machine.
  • Seven catalog titles that import sceHttpSetAutoRedirect (PPSA85300, PPSA94002, PPSA98001, PPSA99000, PPSA99009, PPSA99169, PPSA99666) ran for 20 s each on an RX 7700 XT with a local print in the option setter: ProsperoStore (PPSA99000) made 8 setter calls, all on live ids, and none of the seven stops. The other six made no setter call in that time.
  • tools/progress.py --compare: libraries 66.62% to 66.81%, 12 functions implemented, none lost.
  • tools/check_conventions.py --base upstream/main passes. tools/pr_overlap.py finds no overlap; it could not compare libSceHttp/CMakeLists.txt with #6044, which conflicts with main and moves test registrations.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (CPU library); the title runs used an AMD RX 7700 XT, RADV, Fedora 44
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4932071023 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8245). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-20T06:46:27Z. --- ### What libSceHttp handed out template, connection and request ids but kept nothing about them, so its option setters dropped their values and the matching getters threw. Each template, connection and request now keeps its options in `src/Options.cpp`, copied from its parent when it is created (a template from its context), as in [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/a808e76/src/core/libraries/network/http.cpp). With that, 12 exports are implemented: - `sceHttpGetAutoRedirect` reads what `sceHttpSetAutoRedirect` sets (default: follow redirects). - `sceHttpGetNonblock`, `sceHttpTryGetNonblock` and `sceHttpTrySetNonblock` read and set the flag of `sceHttpSetNonblock` (default: blocking); the Try forms do what the plain ones do, as in shadPS4. - `sceHttpSetAcceptEncodingGZIPEnabled` and `sceHttpGetAcceptEncodingGZIPEnabled` set and read the gzip request option (default: off). `sceHttpSetDefaultAcceptEncodingGZIPEnabled(ctx, enable)` sets the value later templates of that context start with; shadPS4 keeps one value for the whole library, and the debt entry says this differs. - `sceHttpGetEpoll` returns the epoll and argument `sceHttpSetEpoll` binds; `sceHttpUnsetEpoll` clears them. - `sceHttpCacheRedirectedConnectionEnabled`, `sceHttpsEnableOptionPrivate` and `sceHttpsDisableOptionPrivate` check their arguments (the private SSL mask `0x2dff` first, then the id) and return 0, and `sceHttpAbortRequestForce` does what `sceHttpAbortRequest` does. No request reaches the network, so they keep nothing; they are listed under Silent stubs. Getters return `ERROR_INVALID_VALUE` (`0x804311FE`) for a null output before they look at the id, and `ERROR_INVALID_ID` (`0x80431100`) for an id that is not a live template, connection or request, also after it is deleted. The setters touched here (`sceHttpSetAutoRedirect`, `sceHttpSetNonblock`, `sceHttpSetEpoll`, `sceHttpUnsetEpoll`) now return `ERROR_INVALID_ID` for such an id instead of 0. Every option call returns `ERROR_BEFORE_INIT` (`0x80431001`) first when no context is open, and the last `sceHttpTerm` ends every object's options. `sceHttpSetEpoll` returns `ERROR_INVALID_ID` for a handle that is not a live epoll. Creation stays as permissive as it was: a connection or request whose parent id is unknown starts from the defaults. None of this is measured on a PS5; the defaults, signatures and check order are shadPS4's (PS4), and the two debt entries in `docs/dev/debt/libSceHttp.md` say so. ### Tested Linux (Fedora 44, GCC, Ninja, `-DBUILD_TESTING=ON`), based on `main` `1ed63f63c2`: - New `guest_http_options` (`core/libs/tests/GuestHttpOptions.cpp`): defaults, inheritance from template to connection to request, that a later change to a parent leaves existing children alone, the per-context gzip default across two contexts and after `sceHttpTerm`, the epoll binding and its clearing, the SSL mask, and the error codes and their order, the option calls after the last `sceHttpTerm` and after a new `sceHttpInit`, and `sceHttpSetEpoll` with a handle that is not an epoll. Each feature commit was checked against a mutation of its own code: a setter that drops its value, children that start from the defaults instead of the parent, `sceHttpTrySetNonblock` as a no-op, templates that ignore their context's gzip default, `sceHttpUnsetEpoll` as a no-op, and the public SSL mask `0x20ff` in place of the private one. Each fails the test. - `guest_http`, `guest_http_response_header` and `guest_http2` still pass. - Full `ctest`: 1668 of 1673 pass. The 5 failures (`application_heap_scripting`, `application_heap_lazy`, `agc_driver_bda_device`, `agc_driver_guest_memory_lifetime`, `agc_driver_tessellation`) fail the same way on `main` on this machine. - Seven catalog titles that import `sceHttpSetAutoRedirect` (PPSA85300, PPSA94002, PPSA98001, PPSA99000, PPSA99009, PPSA99169, PPSA99666) ran for 20 s each on an RX 7700 XT with a local print in the option setter: ProsperoStore (PPSA99000) made 8 setter calls, all on live ids, and none of the seven stops. The other six made no setter call in that time. - `tools/progress.py --compare`: libraries 66.62% to 66.81%, 12 functions implemented, none lost. - `tools/check_conventions.py --base upstream/main` passes. `tools/pr_overlap.py` finds no overlap; it could not compare `libSceHttp/CMakeLists.txt` with #6044, which conflicts with `main` and moves test registrations. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (CPU library); the title runs used an AMD RX 7700 XT, RADV, Fedora 44 - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-20 06:47:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T06:47:13Z.


Progress report (65c393a → 0406a1b)

📈 System libraries: 53.37% (+0.14%, +12 implemented functions)

✅ 12 implemented
Library Name
libSceHttp sceHttpAbortRequestForce
libSceHttp sceHttpCacheRedirectedConnectionEnabled
libSceHttp sceHttpGetAcceptEncodingGZIPEnabled
libSceHttp sceHttpGetAutoRedirect
libSceHttp sceHttpGetEpoll
libSceHttp sceHttpGetNonblock
libSceHttp sceHttpSetAcceptEncodingGZIPEnabled
libSceHttp sceHttpSetDefaultAcceptEncodingGZIPEnabled
libSceHttp sceHttpTryGetNonblock
libSceHttp sceHttpTrySetNonblock
libSceHttp sceHttpsDisableOptionPrivate
libSceHttp sceHttpsEnableOptionPrivate
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6285127579 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8245#issuecomment-6285127579). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T06:47:13Z. --- <!-- progress-report --> ### Progress report (65c393a → 0406a1b) 📈 **System libraries**: 53.37% (+0.14%, +12 implemented functions) <details> <summary>✅ 12 implemented</summary> | Library | Name | | - | - | | libSceHttp | `sceHttpAbortRequestForce` | | libSceHttp | `sceHttpCacheRedirectedConnectionEnabled` | | libSceHttp | `sceHttpGetAcceptEncodingGZIPEnabled` | | libSceHttp | `sceHttpGetAutoRedirect` | | libSceHttp | `sceHttpGetEpoll` | | libSceHttp | `sceHttpGetNonblock` | | libSceHttp | `sceHttpSetAcceptEncodingGZIPEnabled` | | libSceHttp | `sceHttpSetDefaultAcceptEncodingGZIPEnabled` | | libSceHttp | `sceHttpTryGetNonblock` | | libSceHttp | `sceHttpTrySetNonblock` | | libSceHttp | `sceHttpsDisableOptionPrivate` | | libSceHttp | `sceHttpsEnableOptionPrivate` | </details>
github-actions[bot] commented 2026-10-20 06:52:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-20T06:52:50Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 8620 docs/dev/debt/libSceHttp.md L5
PR 9058 docs/dev/debt/libSceHttp.md L8-9

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 6044 core/libs/prx/libSceHttp/CMakeLists.txt
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6285205548 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8245#issuecomment-6285205548). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-20T06:52:50Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 8620](https://www.github.com/boykopovar/AnyPS5/pull/8620) | `docs/dev/debt/libSceHttp.md` [L5](https://github.com/boykopovar/AnyPS5/blob/3e91c8edf57bdf51671db0063115e38ab2ddc85e/docs/dev/debt/libSceHttp.md#L5) | | | | [PR 9058](https://www.github.com/boykopovar/AnyPS5/pull/9058) | `docs/dev/debt/libSceHttp.md` [L8-9](https://github.com/boykopovar/AnyPS5/blob/3e91c8edf57bdf51671db0063115e38ab2ddc85e/docs/dev/debt/libSceHttp.md#L8-L9) | | | Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/prx/libSceHttp/CMakeLists.txt` |
nikowolf123 commented 2026-10-20 20:40:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-20T20:40:32Z.


I built this PR's Export.cpp and src/Options.cpp standalone (g++ 15.2, Linux) and compared them with the shadPS4 commit the PR cites.

1. No BEFORE_INIT check, and objects outlive the last sceHttpTerm. RemoveHttpContext only drops the context's gzip default. None of the new getters and setters (for example sceHttpGetAutoRedirect) checks that a context is alive.

  • After ctx = sceHttpInit(...), t = sceHttpCreateTemplate(ctx, ...), c = sceHttpCreateConnectionWithURL(t, ...) and sceHttpTerm(ctx), sceHttpGetAutoRedirect(t, &v) returns 0 with v = 1, and sceHttpSetNonblock(c, 1) returns 0.
  • After a new sceHttpInit, sceHttpSetAutoRedirect(t, 0) still returns 0.
  • Before any init, sceHttpGetNonblock(1, nullptr) and sceHttpsEnableOptionPrivate(1, 0x4000) return 0x804311FE.

In shadPS4, each of these calls checks g_state.inited first (L2939-L2942, L2441-L2444, L2642-L2645). The sceHttpTerm that ends the last context also clears templates, connections and requests (L2146-L2175). So these calls return 0x80431001, and 0x80431100 after the new init.

The debt entry says the checks run in shadPS4's order, and this PR's sceHttpSetDefaultAcceptEncodingGZIPEnabled already returns BEFORE_INIT. g_contextAcceptEncodingGzip holds the same ids as g_contexts, so this is enough:

void RemoveHttpContext(int contextId) {
    std::lock_guard lock(g_optionsMutex);
    g_contextAcceptEncodingGzip.erase(contextId);
    if (g_contextAcceptEncodingGzip.empty()) g_objectOptions.clear();
}

bool HttpInitialised() {
    std::lock_guard lock(g_optionsMutex);
    return !g_contextAcceptEncodingGzip.empty();
}

Then put if (!HttpInitialised()) return ERROR_BEFORE_INIT; first in each export in Options.cpp, and in sceHttpSetAutoRedirect, sceHttpSetNonblock and sceHttpUnsetEpoll. With this change, guest_http_options still passes and the calls above return 0x80431001, or 0x80431100 after the new init. A test case of Init, CreateTemplate, Term and then a getter would cover it.

2. sceHttpSetEpoll does not check the handle. Export.cpp L315-L317 stores any eh. sceHttpSetEpoll(req, nullptr, &m) and sceHttpSetEpoll(req, (HttpEpollHandle)0x1234, &m) both return 0, and sceHttpGetEpoll then reports 0x1234. After sceHttpDestroyEpoll(ctx, eh), sceHttpSetEpoll(req, eh, &m) returns 0, and sceHttpGetEpoll hands back the freed handle. shadPS4 returns INVALID_ID when the handle is not a live epoll, before it looks at the id (L2378-L2382). FindEpoll is already in the same file:

int APS5_VABI sceHttpSetEpoll(int id, HttpEpollHandle eh, void* user_arg) {
    std::lock_guard lock(g_stateMutex);
    if (g_contexts.empty()) return ERROR_BEFORE_INIT;
    if (!FindEpoll(eh)) return ERROR_INVALID_ID;
    return SetHttpEpollBinding(id, eh, user_arg) ? 0 : ERROR_INVALID_ID;
}

sceHttpUnsetEpoll also returns 0 for template and connection ids, while shadPS4 looks only at requests (L2404-L2408). If that is kept, the debt entry should say so.

3. Stale "unknown signature" entries. In docs/dev/debt/libSceHttp.md, lines 35, 39-42, 45, 57-58, 62-64 and 72 still list the 12 functions this PR implements as "unknown signature". Nine of them link Export.cpp, although they now live in src/Options.cpp. CONTRIBUTING.md says a pull request that closes a gap removes its entry, as a84a2b1240 and fd5eb8458b did. To fix this, delete the 12 lines and say in the "HTTP object options" entry that the signatures come from shadPS4, as the PR body does.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6300996623 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8245#issuecomment-6300996623). Originally posted by [nikowolf123](https://github.com/nikowolf123) on 2026-10-20T20:40:32Z. --- I built this PR's `Export.cpp` and `src/Options.cpp` standalone (g++ 15.2, Linux) and compared them with the shadPS4 commit the PR cites. **1. No `BEFORE_INIT` check, and objects outlive the last `sceHttpTerm`.** [`RemoveHttpContext`](https://github.com/boykopovar/AnyPS5/blob/0a69b383d11a2a89b56d9226f1f0f4a80b820a28/core/libs/prx/libSceHttp/src/Options.cpp#L23-L26) only drops the context's gzip default. None of the new getters and setters (for example [`sceHttpGetAutoRedirect`](https://github.com/boykopovar/AnyPS5/blob/0a69b383d11a2a89b56d9226f1f0f4a80b820a28/core/libs/prx/libSceHttp/src/Options.cpp#L80-L86)) checks that a context is alive. - After `ctx = sceHttpInit(...)`, `t = sceHttpCreateTemplate(ctx, ...)`, `c = sceHttpCreateConnectionWithURL(t, ...)` and `sceHttpTerm(ctx)`, `sceHttpGetAutoRedirect(t, &v)` returns 0 with `v = 1`, and `sceHttpSetNonblock(c, 1)` returns 0. - After a new `sceHttpInit`, `sceHttpSetAutoRedirect(t, 0)` still returns 0. - Before any init, `sceHttpGetNonblock(1, nullptr)` and `sceHttpsEnableOptionPrivate(1, 0x4000)` return `0x804311FE`. In shadPS4, each of these calls checks `g_state.inited` first ([L2939-L2942](https://github.com/shadps4-emu/shadPS4/blob/a808e7626e3c7de8d0f0fda6a91f620b42f6c762/src/core/libraries/network/http.cpp#L2939-L2942), [L2441-L2444](https://github.com/shadps4-emu/shadPS4/blob/a808e7626e3c7de8d0f0fda6a91f620b42f6c762/src/core/libraries/network/http.cpp#L2441-L2444), [L2642-L2645](https://github.com/shadps4-emu/shadPS4/blob/a808e7626e3c7de8d0f0fda6a91f620b42f6c762/src/core/libraries/network/http.cpp#L2642-L2645)). The `sceHttpTerm` that ends the last context also clears templates, connections and requests ([L2146-L2175](https://github.com/shadps4-emu/shadPS4/blob/a808e7626e3c7de8d0f0fda6a91f620b42f6c762/src/core/libraries/network/http.cpp#L2146-L2175)). So these calls return `0x80431001`, and `0x80431100` after the new init. The [debt entry](https://github.com/boykopovar/AnyPS5/blob/0a69b383d11a2a89b56d9226f1f0f4a80b820a28/docs/dev/debt/libSceHttp.md#L6) says the checks run in shadPS4's order, and this PR's [`sceHttpSetDefaultAcceptEncodingGZIPEnabled`](https://github.com/boykopovar/AnyPS5/blob/0a69b383d11a2a89b56d9226f1f0f4a80b820a28/core/libs/prx/libSceHttp/Export.cpp#L774-L778) already returns `BEFORE_INIT`. `g_contextAcceptEncodingGzip` holds the same ids as `g_contexts`, so this is enough: ```cpp void RemoveHttpContext(int contextId) { std::lock_guard lock(g_optionsMutex); g_contextAcceptEncodingGzip.erase(contextId); if (g_contextAcceptEncodingGzip.empty()) g_objectOptions.clear(); } bool HttpInitialised() { std::lock_guard lock(g_optionsMutex); return !g_contextAcceptEncodingGzip.empty(); } ``` Then put `if (!HttpInitialised()) return ERROR_BEFORE_INIT;` first in each export in `Options.cpp`, and in `sceHttpSetAutoRedirect`, `sceHttpSetNonblock` and `sceHttpUnsetEpoll`. With this change, `guest_http_options` still passes and the calls above return `0x80431001`, or `0x80431100` after the new init. A test case of Init, CreateTemplate, Term and then a getter would cover it. **2. `sceHttpSetEpoll` does not check the handle.** [Export.cpp L315-L317](https://github.com/boykopovar/AnyPS5/blob/0a69b383d11a2a89b56d9226f1f0f4a80b820a28/core/libs/prx/libSceHttp/Export.cpp#L315-L317) stores any `eh`. `sceHttpSetEpoll(req, nullptr, &m)` and `sceHttpSetEpoll(req, (HttpEpollHandle)0x1234, &m)` both return 0, and `sceHttpGetEpoll` then reports `0x1234`. After `sceHttpDestroyEpoll(ctx, eh)`, `sceHttpSetEpoll(req, eh, &m)` returns 0, and `sceHttpGetEpoll` hands back the freed handle. shadPS4 returns `INVALID_ID` when the handle is not a live epoll, before it looks at the id ([L2378-L2382](https://github.com/shadps4-emu/shadPS4/blob/a808e7626e3c7de8d0f0fda6a91f620b42f6c762/src/core/libraries/network/http.cpp#L2378-L2382)). `FindEpoll` is already in the same file: ```cpp int APS5_VABI sceHttpSetEpoll(int id, HttpEpollHandle eh, void* user_arg) { std::lock_guard lock(g_stateMutex); if (g_contexts.empty()) return ERROR_BEFORE_INIT; if (!FindEpoll(eh)) return ERROR_INVALID_ID; return SetHttpEpollBinding(id, eh, user_arg) ? 0 : ERROR_INVALID_ID; } ``` [`sceHttpUnsetEpoll`](https://github.com/boykopovar/AnyPS5/blob/0a69b383d11a2a89b56d9226f1f0f4a80b820a28/core/libs/prx/libSceHttp/Export.cpp#L397-L399) also returns 0 for template and connection ids, while shadPS4 looks only at requests ([L2404-L2408](https://github.com/shadps4-emu/shadPS4/blob/a808e7626e3c7de8d0f0fda6a91f620b42f6c762/src/core/libraries/network/http.cpp#L2404-L2408)). If that is kept, the debt entry should say so. **3. Stale "unknown signature" entries.** In [docs/dev/debt/libSceHttp.md](https://github.com/boykopovar/AnyPS5/blob/0a69b383d11a2a89b56d9226f1f0f4a80b820a28/docs/dev/debt/libSceHttp.md#L35), lines 35, 39-42, 45, 57-58, 62-64 and 72 still list the 12 functions this PR implements as "unknown signature". Nine of them link `Export.cpp`, although they now live in `src/Options.cpp`. [CONTRIBUTING.md](https://github.com/boykopovar/AnyPS5/blob/0a69b383d11a2a89b56d9226f1f0f4a80b820a28/CONTRIBUTING.md#L73) says a pull request that closes a gap removes its entry, as a84a2b1240 and fd5eb8458b did. To fix this, delete the 12 lines and say in the "HTTP object options" entry that the signatures come from shadPS4, as the PR body does.
YossiYad commented 2026-10-21 06:36:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by YossiYad on 2026-10-21T06:36:56Z.


@nikowolf123 thanks for building it against shadPS4, all three points were right. Fixed in ede012406 and 0406a1b54:

  1. RemoveHttpContext clears every object's options when the last context goes, and the option calls in Options.cpp, sceHttpSetAutoRedirect, sceHttpSetNonblock and sceHttpUnsetEpoll return BEFORE_INIT first, as you suggested. The new CheckTermEndsOptions creates a template and a connection, terminates the context, expects 0x80431001 from every option call (also with a null output, and with the outputs left untouched), and then 0x80431100 for the same ids after a new sceHttpInit.
  2. sceHttpSetEpoll takes g_stateMutex, returns BEFORE_INIT with no context and INVALID_ID when FindEpoll doesn't know the handle. The epoll test now tries a null handle, 0x1234 and a destroyed epoll, and checks the binding stays unset. I kept sceHttpUnsetEpoll taking template and connection ids, and the debt entry now says shadPS4 looks only at requests.
  3. The 12 "unknown signature" lines are gone, and the "HTTP object options" entry says the signatures, the defaults and the check order (BEFORE_INIT first, the last sceHttpTerm ending every object's options) come from shadPS4. I also cut the clause that described the new INVALID_ID results.

I checked that the test fails without the clear on the last sceHttpTerm, without the init checks and without the FindEpoll check. guest_http, guest_http_options, guest_http_response_header and guest_http2 pass, and check_conventions has no findings.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309738859 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8245#issuecomment-6309738859). Originally posted by [YossiYad](https://github.com/YossiYad) on 2026-10-21T06:36:56Z. --- @nikowolf123 thanks for building it against shadPS4, all three points were right. Fixed in `ede012406` and `0406a1b54`: 1. `RemoveHttpContext` clears every object's options when the last context goes, and the option calls in `Options.cpp`, `sceHttpSetAutoRedirect`, `sceHttpSetNonblock` and `sceHttpUnsetEpoll` return `BEFORE_INIT` first, as you suggested. The new `CheckTermEndsOptions` creates a template and a connection, terminates the context, expects `0x80431001` from every option call (also with a null output, and with the outputs left untouched), and then `0x80431100` for the same ids after a new `sceHttpInit`. 2. `sceHttpSetEpoll` takes `g_stateMutex`, returns `BEFORE_INIT` with no context and `INVALID_ID` when `FindEpoll` doesn't know the handle. The epoll test now tries a null handle, `0x1234` and a destroyed epoll, and checks the binding stays unset. I kept `sceHttpUnsetEpoll` taking template and connection ids, and the debt entry now says shadPS4 looks only at requests. 3. The 12 "unknown signature" lines are gone, and the "HTTP object options" entry says the signatures, the defaults and the check order (`BEFORE_INIT` first, the last `sceHttpTerm` ending every object's options) come from shadPS4. I also cut the clause that described the new `INVALID_ID` results. I checked that the test fails without the clear on the last `sceHttpTerm`, without the init checks and without the `FindEpoll` check. `guest_http`, `guest_http_options`, `guest_http_response_header` and `guest_http2` pass, and `check_conventions` has no findings.
nikowolf123 commented 2026-10-21 06:39:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nikowolf123 on 2026-10-21T06:39:20Z.


Checked 0406a1b54. All three fixes are in:

  • every option call returns BEFORE_INIT before looking at its arguments, and the last sceHttpTerm clears every object's options (RemoveHttpContext);
  • sceHttpSetEpoll returns BEFORE_INIT with no context and INVALID_ID for an epoll handle that FindEpoll doesn't know;
  • the 12 "unknown signature" lines are gone.

CheckTermEndsOptions pins the term and re-init sequence. Nothing further from me.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6309773749 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8245#issuecomment-6309773749). Originally posted by [nikowolf123](https://github.com/nikowolf123) on 2026-10-21T06:39:20Z. --- Checked 0406a1b54. All three fixes are in: - every option call returns `BEFORE_INIT` before looking at its arguments, and the last `sceHttpTerm` clears every object's options (`RemoveHttpContext`); - `sceHttpSetEpoll` returns `BEFORE_INIT` with no context and `INVALID_ID` for an epoll handle that `FindEpoll` doesn't know; - the 12 "unknown signature" lines are gone. `CheckTermEndsOptions` pins the term and re-init sequence. Nothing further from me.
adriadam10 commented 2026-10-21 12:04:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-21T12:04:53Z.


Checked the option storage and lock order, the error codes and check order against the cited shadPS4 commit, the debt entries, and that guest_http_options is registered and pins values the old stubs could not return (including the term/re-init sequence nikowolf123 asked for); merged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6315456206 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8245#issuecomment-6315456206). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-21T12:04:53Z. --- Checked the option storage and lock order, the error codes and check order against the cited shadPS4 commit, the debt entries, and that `guest_http_options` is registered and pins values the old stubs could not return (including the term/re-init sequence nikowolf123 asked for); merged.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!8245
No description provided.