Skip to content

fix(http): keep ranged reads on one source representation - #15965

Open
nikhilpanchal1 wants to merge 1 commit into
boykopovar:mainfrom
nikhilpanchal1:fix/http-range-representation-integrity
Open

nikhilpanchal1 wants to merge 1 commit into
boykopovar:mainfrom
nikhilpanchal1:fix/http-range-representation-integrity

Conversation

@nikhilpanchal1

Copy link
Copy Markdown
Contributor

What

A later range read could silently combine bytes from different versions of an HTTP source: after sending If-Range, the client accepted a same-size 200 response that omitted its validator.

Keep reads on one representation. A later full response must repeat the selected strong validator; valid conditional 206 responses may omit it. Before exposing an unvalidated partial source, fetch one complete unconditional response. Reject later redirects to another resource and preserve cache, position, size and destination on failure. This follows RFC 9110 If-Range and combining parts.

No competing implementation found. Recorded merge previews with #15920, #15925 and #15662 are clean; their refreshed heads are unchanged. Base-conflicted #9834, #11134 and #14212 share the debt file; their patches and discussions were checked manually and do not change this host-client gap. The refreshed new or changed PR heads touch none of this PR's five files.

Tested

Debian 13 x86-64, GCC 14.2, CMake 4.4.4, Ninja, Release, bundled dependencies. Base: 8bfe082f60d66a9152d357c8e72d7564dddbace7; tested head: 5bf58636576b7b236144bc4e2b20b333bd4cae82. Current main is 1882108b45b31ae837cf8a3350b0e374fcfc4194, seven documentation-only commits ahead of that base. The published branch is unchanged and has not been rebased or retested on the new base.

  • Full runtime libs build: 406/406 patched libraries produced.
  • All 12 focused HTTP/AvPlayer CTests pass three times, with no skips. Includes 42 client representation scenarios, 13 FFmpeg AVIO scenarios, synthetic media playback and normally NID-patched module consumers.
  • Actual baseline shared library: existing upstream suite passes; the new 42-case suite fails 22 cases. Removing each safeguard and accepting either validator instead of the selected one makes the tests fail.
  • ASan/UBSan: standalone production-client harnesses pass (unused unsupported-path throw shim, not full-runtime instrumentation); an independent sequence test checks 6,000 operations, 1,760 HTTP requests and 53,949,909 bytes, including 158 rejected invalid responses and successful retries.
  • Source conventions and whitespace checks passed on the tested head. The first checklist item below is now pending.

Broader HTTP2/cache testing remains incomplete: five transport modes abort on unavailable process_vm_readv, cache aborts on unavailable process_vm_writev, and guest_http2_early_response hits a server-stage deadline. These paths were stopped without retries or workarounds. No whole-suite, Windows/macOS execution, console or real-title claim.

Checklist

  • Based on current main; no other open PR implements the same functions — pending rebase onto 1882108b45b31ae837cf8a3350b0e374fcfc4194; no competing implementation found
  • 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

@JJenkx

JJenkx commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Windows check of head 5bf5863657, merged onto main 1e24993fa3 (fcca38e8f6, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.

  • avplayer_http_transport and guest_http_client pass in 3 of 3 runs, none skipped.

AI-assisted: yes.

@ahmadmuj ahmadmuj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked head 5bf58636576b7b236144bc4e2b20b333bd4cae82, PR base 1882108b45b31ae837cf8a3350b0e374fcfc4194.

guest_http_client and an independent raw-loopback probe pass through the actual libSceHttp exports: 245 cases, 717 requests. The probe checks all 221 valid single-byte opaque tags, empty/multi-byte tags, and exact If-Range bytes. Backslash and obs-text survive unchanged, consistent with RFC 9110.

Conditional 206 omission and matching 200 responses pass. Rejected responses preserve the destination, position, size and cached bytes; valid retries pass. Mutations that reject backslash/obs-text or accept an embedded space fail the probe.

The HTTP module from main 94a913f1a064c693305ac9d2fee12b383609e348 accepts changed bytes from a same-size 200 without a validator; this head rejects them. That control reuses head runtime dependencies. The 200 rejection enforces this client's snapshot policy, not a general RFC requirement.

No issue found in this scope. Linux/WSL only; no full-suite, HTTP2, console or title testing.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants