fix(libSceHttp): accept transformed HTTP source responses #18270

Merged
Ondra97 merged 1 commit from upstream-pr/18270 into main 2026-11-12 11:37:53 +00:00
Ondra97 commented 2026-11-11 01:21:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-11-11T01:21:29Z.


What

The shared host HTTP source client refuses 203 Non-Authoritative Information as a failed request, even though it carries a successful complete representation from a transforming proxy. This prevents opening such sources and refuses valid complete responses during range completion or an unconditional snapshot fallback.

Classify 203 through the existing complete-200 path, as described by RFC 9110 section 15.3.4. This reuses all existing body framing, size, ETag, Last-Modified and trailer checks. The host source API exposes bytes and size, rather than an HTTP status code. Update the existing debt entry's complete-response wording.

Run the existing representation-integrity matrix a second time with every complete 200 fixture sent as 203. The added CTest has a separate working directory, so it can run alongside the normal client test. It covers direct/full snapshots, chunked and close-delimited framing, unconditional fallback, validated later responses, changed/missing validators, malformed responses, failed-read state preservation and retry.

Tested

Windows 11 Pro 26300, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, ANYPS5_RELINKER_ONLY=OFF, ANYPS5_ENABLE_SPIRV_TOOLS=ON. CPU: AMD Ryzen 9 7900X. RAM: 31.66 GiB usable. GPU: NVIDIA GeForce RTX 4070 Ti SUPER; the selected tests do not exercise it.

Base: baed587febd793dc5a2c49240637e0e6bc222829. Tested fix: 57452d7cc5c710e39044369c9d785b24a0be0885.

The new guest_http_client_203 test failed against unchanged production code, reporting refused validated responses and failed snapshot opens. It passed after the fix, and the existing client test continued to pass. The tests exercise the actual exported host client through loopback servers.

The full production libraries, relinker and selected executables built successfully. All 11 selected CTests passed, zero failed or skipped, each below 30 seconds. This includes both client modes, HTTP API/header/options/diagnostic tests, AvPlayer HTTP and transport tests, patched-module integration, all 407 patched libraries loading and the public-header audit of 407 libraries and 33,863 exports. The Windows test runtime copy was refreshed with the existing CopyRuntimeFiles.cmake helper and checked against the rebuilt library.

The fix is independent of #18248's empty-source Content-Range parsing. A local, uncommitted composition with its exact head 3cd55326910d752860725e4aa1b8d8dbd3028adb merged cleanly (tree 558021ab2ae9247ab2bd8178d84b4fbbfe790b85) and both client tests passed in parallel, including the empty-source regressions. After restoring this standalone head, both tests passed again. No console, title or external transforming-proxy run was performed.

Commands from the source checkout, with the supported toolchain on PATH and the local full build in ../b:

cmake --build ../b --target relinker libs guest_http_tests guest_http_response_header_tests guest_http_options_tests guest_http_dbg_printf_tests guest_http_client_tests guest_avplayer_tests avplayer_http_transport_tests avplayer_http_patched_modules_tests patched_libraries_tests --parallel 10
cmake -DDEST_DIR=../b/tests -P cmake/CopyRuntimeFiles.cmake ../b/core/libs/libs/unpatched/libSceHttp.prx
ctest --test-dir ../b -R '^(guest_http|guest_http_response_header|guest_http_options|guest_http_dbg_printf|guest_http_client(_203)?|guest_avplayer_http|avplayer_http_transport|avplayer_http_patched_modules|public_headers|patched_libraries)$' --parallel 4 -V --no-tests=error
python tools/check_conventions.py --base origin/main
python tools/pr_overlap.py --base main --branch codex/fix-http-transformed-responses --repo boykopovar/AnyPS5 --jobs 4
git diff --check origin/main...HEAD

Conventions and whitespace checks passed. The overlap tool checked 2,009 open PRs and exited 2 for uncomparable shared files in #9834, #11134 and #14212. Manual exact-head comparison found:

  • #9834 974dfd5adeacd42557add90af180f96d06742d88 and #11134 35c09d332f3e86b6846ba05a25f662e25e8b7de9 add the separate Sony request transport and its targets. They change neither Client.cpp nor these shared-client fixtures, and their debt changes do not touch the shared-host entry updated here.
  • #14212 6b4941bfe250142672c12b48b7b6c706b9691452 adds blank separators in this debt file and leaves the shared-host entry's content unchanged.

No function or semantic overlap, or ordering dependency, was found. The separately comparable #18248 composition is recorded above.

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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5251974090 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18270). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-11-11T01:21:29Z. --- ### What The shared host HTTP source client refuses `203 Non-Authoritative Information` as a failed request, even though it carries a successful complete representation from a transforming proxy. This prevents opening such sources and refuses valid complete responses during range completion or an unconditional snapshot fallback. Classify 203 through the existing complete-200 path, as described by [RFC 9110 section 15.3.4](https://www.rfc-editor.org/rfc/rfc9110.html#section-15.3.4). This reuses all existing body framing, size, ETag, Last-Modified and trailer checks. The host source API exposes bytes and size, rather than an HTTP status code. Update the existing debt entry's complete-response wording. Run the existing representation-integrity matrix a second time with every complete 200 fixture sent as 203. The added CTest has a separate working directory, so it can run alongside the normal client test. It covers direct/full snapshots, chunked and close-delimited framing, unconditional fallback, validated later responses, changed/missing validators, malformed responses, failed-read state preservation and retry. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 Pro 26300, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, `ANYPS5_RELINKER_ONLY=OFF`, `ANYPS5_ENABLE_SPIRV_TOOLS=ON`. CPU: AMD Ryzen 9 7900X. RAM: 31.66 GiB usable. GPU: NVIDIA GeForce RTX 4070 Ti SUPER; the selected tests do not exercise it. Base: `baed587febd793dc5a2c49240637e0e6bc222829`. Tested fix: `57452d7cc5c710e39044369c9d785b24a0be0885`. The new `guest_http_client_203` test failed against unchanged production code, reporting refused validated responses and failed snapshot opens. It passed after the fix, and the existing client test continued to pass. The tests exercise the actual exported host client through loopback servers. The full production libraries, relinker and selected executables built successfully. All 11 selected CTests passed, zero failed or skipped, each below 30 seconds. This includes both client modes, HTTP API/header/options/diagnostic tests, AvPlayer HTTP and transport tests, patched-module integration, all 407 patched libraries loading and the public-header audit of 407 libraries and 33,863 exports. The Windows test runtime copy was refreshed with the existing `CopyRuntimeFiles.cmake` helper and checked against the rebuilt library. The fix is independent of #18248's empty-source Content-Range parsing. A local, uncommitted composition with its exact head `3cd55326910d752860725e4aa1b8d8dbd3028adb` merged cleanly (tree `558021ab2ae9247ab2bd8178d84b4fbbfe790b85`) and both client tests passed in parallel, including the empty-source regressions. After restoring this standalone head, both tests passed again. No console, title or external transforming-proxy run was performed. Commands from the source checkout, with the supported toolchain on `PATH` and the local full build in `../b`: ```powershell cmake --build ../b --target relinker libs guest_http_tests guest_http_response_header_tests guest_http_options_tests guest_http_dbg_printf_tests guest_http_client_tests guest_avplayer_tests avplayer_http_transport_tests avplayer_http_patched_modules_tests patched_libraries_tests --parallel 10 cmake -DDEST_DIR=../b/tests -P cmake/CopyRuntimeFiles.cmake ../b/core/libs/libs/unpatched/libSceHttp.prx ctest --test-dir ../b -R '^(guest_http|guest_http_response_header|guest_http_options|guest_http_dbg_printf|guest_http_client(_203)?|guest_avplayer_http|avplayer_http_transport|avplayer_http_patched_modules|public_headers|patched_libraries)$' --parallel 4 -V --no-tests=error python tools/check_conventions.py --base origin/main python tools/pr_overlap.py --base main --branch codex/fix-http-transformed-responses --repo boykopovar/AnyPS5 --jobs 4 git diff --check origin/main...HEAD ``` Conventions and whitespace checks passed. The overlap tool checked 2,009 open PRs and exited 2 for uncomparable shared files in #9834, #11134 and #14212. Manual exact-head comparison found: - #9834 `974dfd5adeacd42557add90af180f96d06742d88` and #11134 `35c09d332f3e86b6846ba05a25f662e25e8b7de9` add the separate Sony request transport and its targets. They change neither `Client.cpp` nor these shared-client fixtures, and their debt changes do not touch the shared-host entry updated here. - #14212 `6b4941bfe250142672c12b48b7b6c706b9691452` adds blank separators in this debt file and leaves the shared-host entry's content unchanged. No function or semantic overlap, or ordering dependency, was found. The separately comparable #18248 composition is recorded above. ### 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 - [x] AI-assisted: yes
PrivacyOnion commented 2026-11-11 01:32:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T01:32:58Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 57452d7cc5:

  • Conventions: tools/check_conventions.py passed; git diff --check clean.
  • Build: guest_http_client_tests built cleanly.
  • CTest (guest_http_client, guest_http_client_203):
    1/2 Test #3067: guest_http_client_203 ............   Passed    2.23 sec
    2/2 Test #3066: guest_http_client ................   Passed    3.58 sec
    100% tests passed, 0 tests failed out of 2
    
  • Negative control: with core/libs/prx/libSceHttp/src/Client.cpp reverted to main and the new tests kept, the suite fails:
    1/2 Test #3067: guest_http_client_203 ............***Failed    2.29 sec
    2/2 Test #3066: guest_http_client ................   Passed    3.57 sec
    50% tests passed, 1 tests failed out of 2
    
    Restoring the change makes it pass again.
  • Code reading:
    • core/libs/prx/libSceHttp/src/Client.cpp (HttpClientState::Fetch): Verified that mapping status == 203 to 200 occurs after handling 1xx informational responses and prior to redirect (3xx) and refusal checks, correctly routing transformed proxy responses through existing complete-representation logic (Content-Length, chunked framing, close-delimited reading, and ETag/Last-Modified identity verification).
    • core/libs/prx/libSceHttp/src/Client.cpp & docs/dev/debt/libSceHttp.md (AGENTS.md Compliance): Verified zero comments added to C++ or Python code, no title-specific IDs or magic values introduced, and verified that docs/dev/debt/libSceHttp.md was updated to document complete 200 or 203 response buffering.
    • core/libs/tests/GuestHttpClient.cpp (main, CheckRepresentations): Verified safe CLI argument validation ensuring short-circuit evaluation prevents out-of-bounds argv access, and verified comprehensive validation of representation integrity under --transformed mode.
    • core/libs/prx/libSceHttp/CMakeLists.txt & core/libs/tests/AvPlayerHttpServer.py: Verified test isolation through separate WORKING_DIRECTORY for guest_http_client_203, proper WIN32 DLL PATH environment configuration, and verification of server assertions across chunked, fallback, and validated responses.
    • core/libs/prx/libSceHttp/src/Client.cpp (Concurrency & Resource Management): Verified proper lifetime and cancellation handling via std::atomic_bool stopped, robust RAII socket cleanup in Connection, and absence of memory leaks, integer overflows, or unhandled exceptions.
  • Note: the AI-assisted checkbox can stay.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5852366564 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18270#pullrequestreview-5852366564). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-11T01:32:58Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `57452d7cc5`: - **Conventions**: `tools/check_conventions.py` passed; `git diff --check` clean. - **Build**: `guest_http_client_tests` built cleanly. - **CTest** (`guest_http_client`, `guest_http_client_203`): ``` 1/2 Test #3067: guest_http_client_203 ............ Passed 2.23 sec 2/2 Test #3066: guest_http_client ................ Passed 3.58 sec 100% tests passed, 0 tests failed out of 2 ``` - **Negative control**: with `core/libs/prx/libSceHttp/src/Client.cpp` reverted to `main` and the new tests kept, the suite fails: ``` 1/2 Test #3067: guest_http_client_203 ............***Failed 2.29 sec 2/2 Test #3066: guest_http_client ................ Passed 3.57 sec 50% tests passed, 1 tests failed out of 2 ``` Restoring the change makes it pass again. - **Code reading**: - core/libs/prx/libSceHttp/src/Client.cpp (HttpClientState::Fetch): Verified that mapping status == 203 to 200 occurs after handling 1xx informational responses and prior to redirect (3xx) and refusal checks, correctly routing transformed proxy responses through existing complete-representation logic (Content-Length, chunked framing, close-delimited reading, and ETag/Last-Modified identity verification). - core/libs/prx/libSceHttp/src/Client.cpp & docs/dev/debt/libSceHttp.md (AGENTS.md Compliance): Verified zero comments added to C++ or Python code, no title-specific IDs or magic values introduced, and verified that docs/dev/debt/libSceHttp.md was updated to document complete 200 or 203 response buffering. - core/libs/tests/GuestHttpClient.cpp (main, CheckRepresentations): Verified safe CLI argument validation ensuring short-circuit evaluation prevents out-of-bounds argv access, and verified comprehensive validation of representation integrity under --transformed mode. - core/libs/prx/libSceHttp/CMakeLists.txt & core/libs/tests/AvPlayerHttpServer.py: Verified test isolation through separate WORKING_DIRECTORY for guest_http_client_203, proper WIN32 DLL PATH environment configuration, and verification of server assertions across chunked, fallback, and validated responses. - core/libs/prx/libSceHttp/src/Client.cpp (Concurrency & Resource Management): Verified proper lifetime and cancellation handling via std::atomic_bool stopped, robust RAII socket cleanup in Connection, and absence of memory leaks, integer overflows, or unhandled exceptions. - Note: the AI-assisted checkbox can stay. Looks Good To Me
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!18270
No description provided.