feat(http2): serialize HTTP/2 response and trailing headers #12305

Merged
edubox merged 5 commits from upstream-pr/12305 into main 2026-11-06 11:41:52 +00:00
edubox commented 2026-10-28 08:35:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by edubox on 2026-10-28T08:35:31Z.


What

sceHttp2GetAllResponseHeaders threw for every request. It now serializes the decoded HTTP/2 header block as HTTP/2.0 <code> HTTP2 NO PHRASE\r\n, then one <name>: <value>\r\n line per header with the lowercase name HTTP/2 reports, a consumed :status pseudo-header and a final \r\n. It also exports sceHttp2GetAllTrailingHeaders (CjxqMyx2-pU): the trailer HEADERS frame is collected separately and serialized as one <name>: <value> line per field plus a final , without a status line. Both buffers live until the request is deleted; a null out pointer, an unavailable response or a response without trailers still throws.

Evidence for the contract: the decrypted firmware 11.00 libSceHttp2.prx from a retail console. sceHttp2GetAllResponseHeaders (0x15e0) calls the helper at 0x5210, which returns the block built by the serializer; the status line is strlcpy("HTTP/2.0") + " " + status + " " + "HTTP2 NO PHRASE" + "\r\n", :status is consumed, each other header is appended as name: value\r\n with the name nghttp2 reports, and a final \r\n is added. sceHttp2GetAllTrailingHeaders (0x16b0) returns its cached block through the helper at 0x5340; the console's exact trailer serialization was not measured, so it follows the response serializer without the status line and the debt entry records that. This replaces the previous HTTP/1.1 status line and local reason table, which were guesses.

Tested

Linux x86-64 (CachyOS), GCC 16.2.1, Release: ctest --test-dir build -R '^guest_http2' passes 8/8 (guest_http2_transport 7.0 s, guest_http2_redirects 11.9 s). The transport fixture now asserts the HTTP/2.0 status line, the HTTP2 NO PHRASE reason, the lowercase header block, and a nghttp2_submit_trailer response's `x-trailer: yes
x-trailer-two: 2

block;check_conventions.py --base origin/mainandgit diff --checkare clean. Rebased ontomain a4eca2a056; the focused tests pass 8/8 on the refreshed head bf96b8a0f5`, and the response and trailer serialization entries are in the debt file.

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:5047554532 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12305). Originally posted by [edubox](https://github.com/edubox) on 2026-10-28T08:35:31Z. --- ### What `sceHttp2GetAllResponseHeaders` threw for every request. It now serializes the decoded HTTP/2 header block as `HTTP/2.0 <code> HTTP2 NO PHRASE\r\n`, then one `<name>: <value>\r\n` line per header with the lowercase name HTTP/2 reports, a consumed `:status` pseudo-header and a final `\r\n`. It also exports `sceHttp2GetAllTrailingHeaders` (`CjxqMyx2-pU`): the trailer HEADERS frame is collected separately and serialized as one `<name>: <value> ` line per field plus a final ` `, without a status line. Both buffers live until the request is deleted; a null out pointer, an unavailable response or a response without trailers still throws. Evidence for the contract: the decrypted firmware 11.00 `libSceHttp2.prx` from a retail console. `sceHttp2GetAllResponseHeaders` (`0x15e0`) calls the helper at `0x5210`, which returns the block built by the serializer; the status line is `strlcpy("HTTP/2.0")` + `" "` + status + `" "` + `"HTTP2 NO PHRASE"` + `"\r\n"`, `:status` is consumed, each other header is appended as `name: value\r\n` with the name nghttp2 reports, and a final `\r\n` is added. `sceHttp2GetAllTrailingHeaders` (`0x16b0`) returns its cached block through the helper at `0x5340`; the console's exact trailer serialization was not measured, so it follows the response serializer without the status line and the debt entry records that. This replaces the previous HTTP/1.1 status line and local reason table, which were guesses. ### Tested Linux x86-64 (CachyOS), GCC 16.2.1, Release: `ctest --test-dir build -R '^guest_http2'` passes 8/8 (`guest_http2_transport` 7.0 s, `guest_http2_redirects` 11.9 s). The transport fixture now asserts the `HTTP/2.0` status line, the `HTTP2 NO PHRASE` reason, the lowercase header block, and a `nghttp2_submit_trailer` response's `x-trailer: yes x-trailer-two: 2 ` block; `check_conventions.py --base origin/main` and `git diff --check` are clean. Rebased onto `main` `a4eca2a056`; the focused tests pass 8/8 on the refreshed head `bf96b8a0f5`, and the response and trailer serialization entries are in the debt file. ### 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
MarcZX10 commented 2026-10-28 08:46:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T08:46:18Z.

Review: COMMENTED


The implementation is coherent with the local parse helpers, and the updated Windows job plus conventions, eligibility, intake, and report checks pass. The author reports the focused Linux tests; hosted Linux is skipped. One test improvement would strengthen the central claim: guest_http2_transport currently checks the status-line prefix, a representative header and the CRLF terminator, but does not pass the returned block through sceHttpParseStatusLine and sceHttpParseResponseHeader. I have not approved: the exact PS5 HTTP/2 serialization (including status-line version/reason phrase and pseudo-header handling) is still explicitly unverified, and the current tests establish only the chosen local format.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5679946106 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12305#pullrequestreview-5679946106). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T08:46:18Z. **Review:** COMMENTED --- The implementation is coherent with the local parse helpers, and the updated Windows job plus conventions, eligibility, intake, and report checks pass. The author reports the focused Linux tests; hosted Linux is skipped. One test improvement would strengthen the central claim: `guest_http2_transport` currently checks the status-line prefix, a representative header and the CRLF terminator, but does not pass the returned block through `sceHttpParseStatusLine` and `sceHttpParseResponseHeader`. I have not approved: the exact PS5 HTTP/2 serialization (including status-line version/reason phrase and pseudo-header handling) is still explicitly unverified, and the current tests establish only the chosen local format.
MarcZX10 commented 2026-10-28 09:10:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T09:10:57Z.

Review: CHANGES_REQUESTED


The added round-trip through sceHttpParseStatusLine and sceHttpParseResponseHeader shows that the chosen local string format is self-consistent, but it does not establish that sceHttp2GetAllResponseHeaders returns this HTTP/1.1 status line, local reason phrase, lowercase field names, or excludes HTTP/2 pseudo-headers on the PS5. The PR and debt entry still state that the console format is unknown. Under AGENTS.md, keep unknown generic behavior throwing until the contract is supported by console observation, SDK documentation, or a reliable implementation that models this export; alternatively, provide that evidence and tests for the established format. The current checks are queued after the rebase. No approval.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5680211097 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12305#pullrequestreview-5680211097). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T09:10:57Z. **Review:** CHANGES_REQUESTED --- The added round-trip through `sceHttpParseStatusLine` and `sceHttpParseResponseHeader` shows that the chosen local string format is self-consistent, but it does not establish that `sceHttp2GetAllResponseHeaders` returns this HTTP/1.1 status line, local reason phrase, lowercase field names, or excludes HTTP/2 pseudo-headers on the PS5. The PR and debt entry still state that the console format is unknown. Under `AGENTS.md`, keep unknown generic behavior throwing until the contract is supported by console observation, SDK documentation, or a reliable implementation that models this export; alternatively, provide that evidence and tests for the established format. The current checks are queued after the rebase. No approval.
MarcZX10 commented 2026-10-28 09:40:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T09:40:43Z.

Review: CHANGES_REQUESTED


The Windows workflow now fails during CMake configure on this PR’s change at core/libs/prx/libSceHttp2/CMakeLists.txt:60: set_tests_properties called with incorrect number of arguments. The ENVIRONMENT_MODIFICATION property has a second value without a property key; combine both PATH edits into one semicolon-separated value or make a second complete property call, then rerun Windows CI. Existing blockers also remain: the PR still lacks evidence for the PS5 response-header serialization contract (the local round-trip proves only self-consistency of the chosen format), and the overlap with #11950 still needs merge-order coordination in the checklist. I have not approved.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5680588268 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12305#pullrequestreview-5680588268). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T09:40:43Z. **Review:** CHANGES_REQUESTED --- The Windows workflow now fails during CMake configure on this PR’s change at `core/libs/prx/libSceHttp2/CMakeLists.txt:60`: `set_tests_properties called with incorrect number of arguments`. The `ENVIRONMENT_MODIFICATION` property has a second value without a property key; combine both PATH edits into one semicolon-separated value or make a second complete property call, then rerun Windows CI. Existing blockers also remain: the PR still lacks evidence for the PS5 response-header serialization contract (the local round-trip proves only self-consistency of the chosen format), and the overlap with #11950 still needs merge-order coordination in the checklist. I have not approved.
adriadam10 commented 2026-10-28 11:36:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-28T11:36:55Z.

Review: CHANGES_REQUESTED


Thanks for the rebase and for fixing the Windows ENVIRONMENT_MODIFICATION configure error. The remaining blocker is the same one @MarcZX10 raised:

  • core/libs/prx/libSceHttp2/Transport.cpp:455-457: the status line (HTTP/1.1, the local Reason() table), the lowercase names and leaving out pseudo-headers are all guesses. docs/dev/debt/libSceHttp2.md:35 says so too. The round-trip through sceHttpParseStatusLine/sceHttpParseResponseHeader only shows the block agrees with our own parser.
  • The cited shadPS4 sceHttp2GetAllResponseHeaders is marked (STUBBED) and just calls its HTTP/1 function, so it is not evidence of the PS5 block. KytyPS5 returns a null block with size 0 and prosper reports the response as unavailable; neither shows a format.
  • The PPSA02195 run was "with other local changes", with no result for this change alone.

Generic behaviour whose format is unknown keeps throwing (AGENTS.md). To land this, please give evidence of the real block: a capture or log from a console or a PS5 title showing the bytes, SDK documentation, or a reference that measured it. Then the test should pin those bytes (reason phrase, header case, no :status). Also:

  • Depends on says none, but #11950 changes the same response-header hunk in Transport.cpp. Agree the merge order with its author and record it.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5681975192 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12305#pullrequestreview-5681975192). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-28T11:36:55Z. **Review:** CHANGES_REQUESTED --- Thanks for the rebase and for fixing the Windows `ENVIRONMENT_MODIFICATION` configure error. The remaining blocker is the same one @MarcZX10 raised: - `core/libs/prx/libSceHttp2/Transport.cpp:455-457`: the status line (`HTTP/1.1`, the local `Reason()` table), the lowercase names and leaving out pseudo-headers are all guesses. `docs/dev/debt/libSceHttp2.md:35` says so too. The round-trip through `sceHttpParseStatusLine`/`sceHttpParseResponseHeader` only shows the block agrees with our own parser. - The cited shadPS4 `sceHttp2GetAllResponseHeaders` is marked `(STUBBED)` and just calls its HTTP/1 function, so it is not evidence of the PS5 block. KytyPS5 returns a null block with size 0 and prosper reports the response as unavailable; neither shows a format. - The PPSA02195 run was "with other local changes", with no result for this change alone. Generic behaviour whose format is unknown keeps throwing (AGENTS.md). To land this, please give evidence of the real block: a capture or log from a console or a PS5 title showing the bytes, SDK documentation, or a reference that measured it. Then the test should pin those bytes (reason phrase, header case, no `:status`). Also: - `Depends on` says none, but #11950 changes the same response-header hunk in `Transport.cpp`. Agree the merge order with its author and record it.
MarcZX10 commented 2026-10-29 08:34:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:34:42Z.

Review: APPROVED


Re-reviewed exact head 942c78cd668d2e8b4cd4d0150b1eb094418ccd70 against current upstream/main 4c7d275bef89d309313d16bc2bc05d37a1b50be2. The added firmware 11.00 libSceHttp2.prx evidence now grounds the HTTP/2.0 <status> HTTP2 NO PHRASE line, pseudo-header handling, lowercase header names and CRLF framing; this resolves the earlier unsupported-format concern. The #11950-first order is agreed with its author and #12305 records the dependency. The author reports all seven focused HTTP/2 tests passing on this head, and hosted Windows and conventions checks pass. My current-main merge preview is clean; git diff --check and conventions pass. I found no remaining blocker.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5694858043 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12305#pullrequestreview-5694858043). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T08:34:42Z. **Review:** APPROVED --- Re-reviewed exact head `942c78cd668d2e8b4cd4d0150b1eb094418ccd70` against current `upstream/main` `4c7d275bef89d309313d16bc2bc05d37a1b50be2`. The added firmware 11.00 `libSceHttp2.prx` evidence now grounds the `HTTP/2.0 <status> HTTP2 NO PHRASE` line, pseudo-header handling, lowercase header names and CRLF framing; this resolves the earlier unsupported-format concern. The #11950-first order is agreed with its author and #12305 records the dependency. The author reports all seven focused HTTP/2 tests passing on this head, and hosted Windows and conventions checks pass. My current-main merge preview is clean; `git diff --check` and conventions pass. I found no remaining blocker.
MarcZX10 commented 2026-10-31 12:18:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T12:18:01Z.

Review: APPROVED


Re-checked — new head, looks good

The exact-head rebase preserves the previously reviewed firmware-backed header serialization; I found no new blocking issue.

What I ran

Reviewed head f9f902b27f300ea781e129058204869b5e15914d against PR base b8f0a6b2025605b78eb70646bda79f458a577c82 and live main at the same SHA. The current-main merge preview is clean. Environment: Linux x86-64, Python 3.11.2; no local build or C++ tests were run.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 12305
python3 tools/pr_stack_check.py 12305 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-stack-12305
gh pr view 12305 -R boykopovar/AnyPS5 --json statusCheckRollup

Results

Check Result
Diff check and conventions Passed on the exact head
Current-main merge preview Clean
Hosted checks Windows, conventions, portability, labels, eligibility and report passed; Linux product and specialized jobs were skipped
Focused guest_http2 tests Author reports 7/7 passing on the rebased head; not independently run here
Precheck helper checks ABI audit and test-quality helper could not run because those local helper scripts are absent from the isolated PR checkout; the precheck itself does not build
Unedited local output
All conventions checks passed.

git diff --check produced no output and exited 0. The stack report says All heads unchanged: True, both current-main merge previews are clean, and the dependency order is #11950 → #12305.

Negative control

Assertion Code change for control Result
The serialization matches the console format Remove the serialization change and rerun the focused test Not run; no local build was performed.

Findings

Blocking

None found on this head.

Non-blocking

  • The declared prerequisite #11950 remains open, and its current head 77c3d1d37901f4ca83a87a7b19cf654e30de80a4 is not included in this branch. The PR records the intended landing order and overlapping files. Keep #11950 first, then rebase and recheck this PR before merging.

Sources

Not verified

I did not run a local build, focused tests, or a negative control. Linux hosted product tests are skipped by workflow policy.

To get this to a good state

Keep the documented #11950-first order. After #11950 lands, rebase this branch and rerun the focused tests on the resulting head; I will recheck that head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5722680024 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12305#pullrequestreview-5722680024). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T12:18:01Z. **Review:** APPROVED --- # Re-checked — new head, looks good The exact-head rebase preserves the previously reviewed firmware-backed header serialization; I found no new blocking issue. ## What I ran Reviewed head `f9f902b27f300ea781e129058204869b5e15914d` against PR base `b8f0a6b2025605b78eb70646bda79f458a577c82` and live `main` at the same SHA. The current-main merge preview is clean. Environment: Linux x86-64, Python 3.11.2; no local build or C++ tests were run. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 12305 python3 tools/pr_stack_check.py 12305 --repo boykopovar/AnyPS5 --output-dir /tmp/anyps5-stack-12305 gh pr view 12305 -R boykopovar/AnyPS5 --json statusCheckRollup ``` ## Results | Check | Result | |---|---| | Diff check and conventions | Passed on the exact head | | Current-main merge preview | Clean | | Hosted checks | Windows, conventions, portability, labels, eligibility and report passed; Linux product and specialized jobs were skipped | | Focused `guest_http2` tests | Author reports 7/7 passing on the rebased head; not independently run here | | Precheck helper checks | ABI audit and test-quality helper could not run because those local helper scripts are absent from the isolated PR checkout; the precheck itself does not build | <details><summary>Unedited local output</summary> ```text All conventions checks passed. ``` `git diff --check` produced no output and exited 0. The stack report says `All heads unchanged: True`, both current-main merge previews are `clean`, and the dependency order is `#11950 → #12305`. </details> ## Negative control | Assertion | Code change for control | Result | |---|---|---| | The serialization matches the console format | Remove the serialization change and rerun the focused test | Not run; no local build was performed. | ## Findings ### Blocking None found on this head. ### Non-blocking - The declared prerequisite #11950 remains open, and its current head `77c3d1d37901f4ca83a87a7b19cf654e30de80a4` is not included in this branch. The PR records the intended landing order and overlapping files. Keep #11950 first, then rebase and recheck this PR before merging. ## Sources - [Reviewed HTTP/2 serializer and test at this exact head](https://github.com/boykopovar/AnyPS5/tree/f9f902b27f300ea781e129058204869b5e15914d/core/libs/prx/libSceHttp2) - [PR dependency and firmware 11.00 evidence summary](https://github.com/boykopovar/AnyPS5/blob/f9f902b27f300ea781e129058204869b5e15914d/docs/dev/debt/libSceHttp2.md) ## Not verified I did not run a local build, focused tests, or a negative control. Linux hosted product tests are skipped by workflow policy. ## To get this to a good state Keep the documented #11950-first order. After #11950 lands, rebase this branch and rerun the focused tests on the resulting head; I will recheck that head.
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!12305
No description provided.