feat(libSceHttp): handle unknown Content-Range lengths #18309
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18309"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-11-11T05:37:35Z.
What
Support a valid single-range response whose Content-Range complete length is
*, as described in RFC 9110 section 14.4. The reusable host HTTP source currently sends that suffix to its numeric parser and refuses the response. Its size/seek interface still needs a definite source size.Validate the returned range's start, span, non-empty body and requested length before using the existing unconditional full-response fallback. Determine the size from that complete response. The existing full-response checks verify identity and size when the source is already open, and reject a server that keeps returning partial responses. Compare the non-empty span without an overflowing
last - first + 1expression.The real loopback regressions cover initial and later unknown lengths, fixed/chunked/close framing, ETag and Last-Modified identity, and an unvalidated complete snapshot. They reject malformed bounds, empty data, invalid length suffixes, unsupported units, repeated partial/refused/short fallbacks, changed identity or size, absent identity and redirects after opening. Request-history assertions verify the fallback sequence and that malformed partial responses are refused before a full retry. Failed later reads preserve output bytes, position and size.
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.Upstream base:
527b309dd954b47fbf543d5ac6887fe90ef2c7ba. Tested head:81d7b41f6b6500e9337dad2683443017355bfdf3.Before editing production code, the new loopback matrix failed on that exact base: only the known-length control passed. All fourteen invalid cases were refused. The staged Windows runtime matched the rebuilt provider.
The production change built the full libraries, relinker and selected executables. All ten selected CTests passed, zero failed or skipped, each below 30 seconds: the reusable HTTP client, HTTP APIs/options/diagnostics/response headers, AvPlayer HTTP source and transport, patched HTTP/AvPlayer module integration, patched-library loading and the public-header audit. The new matrix also passed through the patched-module runner. All 407 patched libraries loaded; the audit checked 407 libraries and 33,863 exports.
After the combined check and final fixture placement, the exact standalone head was restored, the full production targets were rebuilt, and both directly affected integration tests passed again:
guest_http_clientandavplayer_http_patched_modules. Both exercise the 8/8 and 14/14 matrix. The staged Windows runtime was refreshed and its hash matches the rebuilt provider.A local, uncommitted composition with #18248 (
3cd55326910d752860725e4aa1b8d8dbd3028adb), #18270 (57452d7cc5c710e39044369c9d785b24a0be0885) and #18292 (e8b8026a8d2846b8535ff207b7b13033da43e958) merged cleanly, produced tree4e620e395307b2defaa9e5d6a9c2f4324ba54b20, and passed both client modes. That includes the new 8/8 accepted and 14/14 refused cases, the 203 representation matrix, empty Content-Range cases, and the equivalent/conflicting Content-Length matrix. No console or title run was performed; this is host HTTP interoperability, with no title-unblock or performance claim.Commands from the source checkout, with the supported toolchain on
PATHand the local full build in../b:Conventions and whitespace checks passed. The final overlap tool checked 2,009 open PRs, compared all three related HTTP PRs successfully, and exited 0 with no overlap. The combined runtime result is above; no ordering dependency was found.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T05:43:10Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
81d7b41f6b:tools/check_conventions.pypassed;git diff --checkclean.guest_http_client_testsbuilt cleanly.guest_http_client):core/libs/prx/libSceHttp/src/Client.cppreverted tomainand the new tests kept, the suite fails: Restoring the change makes it pass again.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-12T16:49:04Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
Head reviewed:
81d7b41f6b6500e9337dad2683443017355bfdf3, basemain. Title: "feat(libSceHttp): handle unknown Content-Range lengths".What I ran
Client.cpparound the fetch loop (lines 360 to 539) and checked the new*branch against the full-response checks.Results
Client.cpp*branchFindings
Blocking
None.
Non-blocking
core/libs/prx/libSceHttp/src/Client.cpp:478: a206with*as the complete length makes the client request the whole source. On open, that full response is kept in memory (cache = std::move(body), line 507), so a large file takes its full size in RAM. This follows the description's design. Consider saying so in the description, or adding a size limit.Not verified
Number()was not read. The refusals formissing-total,bad-totalandoverflow-spando not depend on it, because the span orlast >= totalcheck refuses them anyway.AvPlayerHttpServer.pywas read only through its changed hunks and imports.GuestHttpClient.cppwas read only through its changed hunks. The callers ofFetch(Read,Seek) and theConnectionclass were not read, so the request history in the "known" case (end byte 99999) is not confirmed against the caller.Files: 3 of 3 reviewed files read (two only by changed hunk). Excluded by rule: none.
To get this to a good state
Nothing is required.