fix(libSceHttp): compare repeated Content-Length values numerically #18332
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18332"
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-11T09:24:29Z.
What
Compare repeated Content-Length field lines numerically when their text differs. For example,
Content-Length: 16followed byContent-Length: 016, or a single value followed by an equivalent list, reaches the existing shared length parser instead of failing the duplicate-header guard. Keep the first value for the body reader. Inconsistent or malformed lengths still reject, and other fields retain their existing duplicate checks. This is the optional recovery described by RFC 9110 section 8.6 and RFC 9112 section 6.3.The real loopback HTTP fixture covers exact/OWS duplicates, zero padding in both orders, single/list combinations, different list spellings and three field lines. Refusals cover inconsistent, empty, signed, overflowing and suffixed values, disagreement in the last field, and conflicting ETags. A late contradictory range response must preserve the read destination, source size, position and existing cached bytes.
Merge current upstream
mainthrough an ordinary merge, preserving its date normalization, HTTP 203 handling, unknown-range fallback and chunk parser. #18292 is already merged as8b279d5993ad32b5e1a10fe6d2ac65c0e6907186, an ancestor of this branch, so no open prerequisite remains. #18346 follows this PR; its transfer-coding change remains separate.Tested
Windows 11 Pro 26300; AMD Ryzen 9 7900X, 31.66 GiB usable RAM; NVIDIA GeForce RTX 4070 Ti SUPER present, GPU not exercised. WinLibs MinGW-w64 GCC 15.2.0 UCRT POSIX SEH r7, CMake 4.3.1, Ninja 1.13.2, Python 3.14.7. Release,
BUILD_TESTING=ON,ANYPS5_RELINKER_ONLY=OFF,ANYPS5_ENABLE_SPIRV_TOOLS=ON, bundled source dependencies, at most three compiler jobs. FFmpeg uses the existing package for pinnedffmpeg-core9ac4cfd195f192ed8b08566f49c28dbb48d08341.Original public head:
67b3f6b3ce63a4494cb3150a103ff5e40485e590. Merged upstream main:0ee60f4e976ce05bce66bcf64b9ff51dcff9b92d. Runtime-tested merge head:841d17c961d05117c1b407275813a0cd3e2e13d0, treee6fc43b359113aa4e1038b1c8e28ace3f93aa86d.A new negative control uses the exact production
Client.cppfrom that main with this PR's expanded real HTTP tests. The production source blob was checked against main (c8138c1c5cf33bf028cbf88af3ef9479ba17255e). The registeredguest_http_clienttest fails with CTest exit 8 and 21 equivalent-field refusals. The fixed source is then restored and rebuilt.The exact final head built the relevant full-runtime production dependency closure, relinker and selected test executables. All 14 selected CTests passed, zero failed or skipped, each below 30 seconds (longest 24.18 seconds). The direct and actually loaded patched-module client runs both report 45/45 equivalent cases, 72/72 invalid cases refused and 1/1 late conflict refused. The same runs also exercise main's date, representation, range and cache behavior. HTTP 203, fixed-clock date parsing, chunk-size compatibility, URI locale, HTTP exports/options/headers/diagnostics, AvPlayer HTTP transport, public headers and the debt-length gate pass. The public-header audit covers 413 libraries and 34,501 exports.
Commands from the source checkout, with the WinLibs toolchain on
PATHand this task's private full-runtime build in../build:The six directly staged runtime providers are refreshed from this build before CTest. The patched-module test makes a fresh stage using the production NID patcher, checks the imports/providers and actually loads both AvPlayer modules. Independent SHA-256 checks matched all six direct-stage providers to the built modules, and all six NID-patched providers plus two allocator DLLs to independently prepared fresh copies.
libSceHttp.prxbuilt/direct-stage SHA-256:f89dd6cf6e40a26edefab7ee54d963bcade5f57be80640ff73fde58c35c7332e; patched-stage SHA-256:5c25c4f6f8b42d9c05420bcebe3707fc91b29d70cb3dbcd352977d280ec2a1d0. The generated runtime revision records the final commit andAPS5_REPORT_MODIFIED=0.Conventions and whitespace checks pass. In a separate validation clone with its own
.git,python tools/pr_overlap.py --base main --branch codex/review18332-main-20261113 --repo boykopovar/AnyPS5 --jobs 3fetched 1,501 open PR heads and probed 1,500 candidates after excluding this PR's included old head. The sole shared-file candidate (#18346) merged cleanly into the same main; the tool exited 0 with no reported overlap and no incomplete comparisons. The final head was also combined locally with #18346 at8202f9c05d5ffa9061451f6c7207cb0a24e7aed8, producing tree24e7968115c49ce6139badc784ef37ebf1b61225. All four direct-client, HTTP 203, fixed-clock date and patched-module CTests passed without skips. Both direct and patched-module runs retain 45/45 equivalent lengths, 72/72 invalid lengths refused and 1/1 late length refusal, plus 9/9 transfer controls, 27/27 invalid transfer fields refused and 1/1 late transfer refusal. The exact standalone final tree was then restored, rebuilt, and all 14 standalone CTests passed again. The successor branch was not changed.These are focused Windows runtime tests, not a full repository test run. No new Linux runtime, title or GPU run was performed. PrivacyOnion's Linux red/green approval and JJenkx's Windows report cover the original head, not this merge. MarcZX10's review explicitly has no required changes; its optional chunked-plus-Content-Length suggestion is outside this merge repair.
Hosted full-build validation is pending for the updated head. New full PR builds require a maintainer to dispatch
build.ymlwithpr=18332; my upstream account has READ permission. The earlier head's checks and reviews do not validate this merge head.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-11T15:55:36Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
67b3f6b3ce: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:13:59Z.
Review: COMMENTED
Reviewed the Content-Length list fix — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
67b3f6b3ce63a4494cb3150a103ff5e40485e590.searchandcaton the changed helper, the framing branch and the new test fixture.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceHttp/src/Client.cpp:460: whenTransfer-Encoding: chunkedis present, the body takes the chunked branch andContent-Lengthis never parsed. A single Content-Length field that is a conflicting list is therefore still accepted with chunked framing. This predates the change: the old code also ignored a single conflicting value there. The new merge check does refuse two conflicting Content-Length fields, so the gap is only the list form. The fixture has no chunked-plus-list case. Optional: reject Content-Length alongside chunked, or add a fixture case.Sources
Not verified
app0/payload.binis 100000 bytes, which the fixture's size checks depend on.Readhelper compares bytes against the payload, so the cached-data claim is only partly confirmed.Files
core/libs/prx/libSceHttp/src/Client.cpp,core/libs/tests/AvPlayerHttpServer.py,core/libs/tests/GuestHttpClient.cpp.To get this to a good state
Nothing is required.
Optional: decide whether a Content-Length list next to chunked framing should be rejected, and add a fixture case for it.