Files
AnyPS5/docs/dev/debt/libSceHttpCache.md
RyanIsAinmDomandClaude Opus 5.5 ddc70eef7c feat(libSceHttpCache): answer cache-info, RemoveTag and pool response checks as firmware 13.42 does
Firmware 13.42 returns 0x817a0014 from ClearCacheInfo, and from
UnregisterCacheInfoUrl with a non-null URL, while no cache-info object
exists; that holds here because EnableCacheInfo throws. RemoveTag gets
its signature and checks and throws past them. The pool forms return
0x817a0012 for a found response with a pool but no response, keeping
the lookup's update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 15:37:31 -05:00

28 lines
6.9 KiB
Markdown

# libSceHttpCache technical debt
### Unknown function info
- [libSceHttpCache additional exports](../../../core/libs/prx/libSceHttpCache/Export.cpp) - these name/NID pairs are present in the inspected export inventory. Parameter lists, return types and behavior are unverified. Parameterless `int` declarations are import-resolution placeholders, not verified ABI prototypes; every entry throws through `NotImplemented_nid_no_patch`. No runtime functionality is implemented.
The inventory label is not authenticated retail-firmware provenance. The inspected image contains raw module-parameter words `0x13590001` at +0x10 and `0x13600007` at +0x14. Using the [published static ELF membership procedure](https://github.com/boykopovar/AnyPS5/pull/12367#issuecomment-6470603298), its 34 unique function NIDs have sorted-LF SHA-256 `7a05b0dd86d73e5eade84050580639fb242533a7f114ef96ffde7d259bde84e0`; the entry below is present. This digest identifies the function-NID set, not the whole binary or its ABI. An independent review on [this PR](https://github.com/boykopovar/AnyPS5/pull/11934#pullrequestreview) corroborated these identities using a separately reported 13.42 reference; that does not establish matching binaries, prototypes or behavior.
| Name | NID |
| --- | --- |
| `sceHttpCacheEnableCacheInfo` | `dIQhFL4sKBo` |
| `sceHttpCacheUnregisterCacheInfoUrl` | `3JQc1T-fvmc` |
- [sceHttpCacheDebugSetUrl, sceHttpCacheSystemSendStatistics, sceHttpCacheSystemTerm and sceHttpCacheSystemShutdown](../../../core/libs/prx/libSceHttpCache/Export.cpp): the supplied implementations return zero without reading arguments. No callers have yet established whether their public prototypes include unused arguments.
- [`sceHttpCacheClearCacheInfo` and `sceHttpCacheRemoveTag`](../../../core/libs/prx/libSceHttpCache/Export.cpp): signatures unverified; parameterless declarations that throw through `NotImplemented_nid_no_patch`. The pointer types of [`sceHttpCacheClearAllUserTags`](../../../core/libs/prx/libSceHttpCache/Export.cpp) (a list of at most 20 entries, taken as user ids) and [`sceHttpCacheRegisterCacheInfoUrl`](../../../core/libs/prx/libSceHttpCache/Export.cpp) are inferred from the checks.
### Functional
- [sceHttpCacheSystemInit and sceHttpCacheSystemClearAll](../../../core/libs/prx/libSceHttpCache/Export.cpp) - the wrappers at `0x2d570` and `0x2d680` in the 11.00 system module `libSceHttpCache.sprx` (SHA-256 `0d825d639b642a73b3ae7d7e0217f602104609d388cf8e0ae83ba50a8a2c2fd1`) validate a non-null path of at most 0x400 bytes, return `0x817a0012` on failure, pass it to their delegate and return 0 without checking its result. `SystemInit` validates the copied path and returns 0 without storing it. `SystemClearAll` validates and then throws through `NotImplemented_nid_no_patch`, because the delegate's effect on the per-application caches is not established. The host copies it once through `CopyGuestString_nid_no_patch`, so an invalid pointer or an unterminated string across an unreadable page returns `0x817a0012` instead of faulting. The wrappers' path conversion is not reproduced, so non-ASCII or invalid UTF-8 paths may be accepted, and the console's on-disk layout is not modelled. `SystemShutdown`, `SystemTerm` and `SystemSendStatistics` return 0 as their wrappers do.
- [libSceHttpCache](../../../core/libs/prx/libSceHttpCache/Export.cpp) - cached responses live in process memory, keyed by user, URL and `User-Agent` value, instead of the console's per-user files, so they are lost when the process exits; they survive `Term`. Request states, freshness, revalidation and header rules follow firmware 13.60, read from disassembly, not measured on a console. A `public` response stored while cache sharing is on, which the console files under the store shared by all users, throws through `NotImplemented_nid_no_patch`, as do a lookup and a `ClearAll` by another user while such an entry exists, since whether they reach the shared store was not read. The console's debug request header that adds cache state to responses is not reproduced. Header numbers the firmware's `stoul` or `stol` rejects, a null URL in `Retrieve` (the firmware dereferences it) and an empty header list to return throw.
- [libSceHttpCache](../../../core/libs/prx/libSceHttpCache/Export.cpp) - `SetQuota` and a non-null `RegisterCacheInfoUrl` throw through `NotImplemented_nid_no_patch` once their arguments pass; `RemoveTag`, `ClearCacheInfo` and both `WithMemoryPool` forms have unresolved signatures and throw outright. Cached entries carry the tag of the request that stored them: `CreateRequestWithTag` records a tag of up to 31 bytes with the same user and cache checks as `CreateRequest`, and rejects a null, empty or longer tag with `0x817a0012`; `Clear` erases the stored entries of one user that carry the same tag, and `ClearAllUserTags` erases every tagged entry of the listed users while untagged entries survive. A null, empty or longer tag is `0x817a0012`, an unknown cache is `0x817a0011`, and a system or unregistered user clears nothing and succeeds, as `ClearAll` does. Whether the console keys a tag to a user, replaces a tag on a later store of the same key, or rejects tags at these lengths has not been measured; the tag lifetime is this host's choice. `Init` ignores its pool size, so the pool allocation failure is not reproduced, and storing never fails, so the console's file errors are not reproduced.
- [libSceHttpCache](../../../core/libs/prx/libSceHttpCache/Export.cpp) - the freshness lifetime is `Expires` minus `Date`, or a tenth of `Date` minus `Last-Modified`, computed on unsigned ticks without comparing them first, and an entry is fresh while its age is below that lifetime, as in firmware 13.60, read from disassembly, not measured on a console. An `Expires` earlier than `Date`, or a `Last-Modified` later than `Date`, therefore wraps to a lifetime that never runs out, so the entry keeps being returned as a hit instead of going stale as RFC 9111 asks; this is kept to match the console.
- [sceHttpCacheReadData, sceHttpCacheRetrieve, sceHttpCacheRevalidate, sceHttpCacheSetData and sceHttpCacheSetQuota](../../../core/libs/prx/libSceHttpCache/Export.cpp) (libSceHttpCache) - probing guest input and output pointers via `GuestCopyIn_nid_no_patch`, `GuestCopyOut_nid_no_patch`, and `CopyGuestString_nid_no_patch` (preserving `errno`), bounding `sceHttpCacheSetData` chunks at 64 MiB and `sceHttpCacheSetQuota` entries at 4096, and returning `0x817a0012` (`ErrorInvalidValue`) on unreadable, unwritable, or oversized arguments (with `sceHttpCacheRetrieve` rolling back state and store changes if copying outputs fails) is a host-safety fallback; console behaviour on unmapped memory or oversized counts is unmeasured.
- [Unidentified export `Y3bCbdeHzNg`](../../../core/libs/prx/libSceHttpCache/Export.cpp) appears in the 3.20 and later version-labelled inventories. Its name, parameters, return type and behavior are unverified. The no-parameter import-resolution declaration throws through `NotImplemented_nid_no_patch`.