fix(libSceHttp2): return the console's codes for HTTP/2 stream errors, TLS deadlines and deleted requests #18824

Merged
kali113 merged 11 commits from upstream-pr/18824 into main 2026-11-21 16:47:55 +00:00
kali113 commented 2026-11-12 11:33:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by kali113 on 2026-11-12T11:33:16Z.


What

Follow-up to #17735 (merged): the cases its debt entry still listed as throwing, now measured on a PS5 payload, firmware 13.590.001, against servers on the LAN (raw output kept; addresses redacted below).

Case Console Before
HTTP/2 GOAWAY before the response headers, error code e = 0 to 13 (last stream 0) send 0x817B120A + e throws
HTTP/2 GOAWAY NO_ERROR with the request's stream as last, then close send 0x817B120A throws at the close
HTTP/2 RST_STREAM before the headers, e = 0 to 13 send 0x817B122A + e throws
HTTP/2 RST_STREAM CANCEL after the headers and 5 of 100 body bytes send 0, read 0x817B1232 throws
HTTP/2 peer closes after the request send 0x817B1064 throws
HTTP/2 peer closes after the headers and 5 of 100 body bytes read 0x80410136 throws
TLS reset after the request (HTTPS/1.1 and HTTP/2) send 0x817B1064 throws
TLS send timeout, server not reading an 8 MiB POST (HTTPS/1.1 and HTTP/2) 0x817B1223 throws
Stalled TLS handshake, 1 s receive timeout (HTTP/1.1 and HTTP/2 templates) 0x817B1222 at about 1.2 s throws at the connect deadline
Stalled TLS handshake, 1 s connect or send timeout still running at 40 s throws at 1 s
HTTP/2 upload the server never reads, 1 s receive timeout 0x817B1222 ran to the send timeout
HTTPS/1.1 body of 5 of 100 bytes, then close reads 5, then 0 throws
Chunked body cut mid-chunk or before the last chunk (http:// and HTTPS/1.1) read 0x817B1064 throws
Request deleted during a send, a read, a POST or a TLS handshake; template deleted during a send 0x817B1080 throws
GOAWAY / RST_STREAM codes 0 to 13, run twice identical

Changes:

  • Transport.cpp:
    • GOAWAY and RST_STREAM before the headers map to 0x817B120A + e and 0x817B122A + e for e of 0 to 13. They are keyed on a received frame, so streams nghttp2 closes itself still throw. A received RST_STREAM CANCEL after the headers fails the next read with 0x817B1232.
    • An HTTP/2 end of stream returns 0x817B1064 before the headers and 0x80410136 after them. A TLS reset before the headers returns 0x817B1064.
    • The TLS send timeout returns 0x817B1223. The handshake is bounded by the receive timeout, and an HTTP/2 upload ends at whichever of the send and receive timeouts comes first.
    • The short-body rule now applies to HTTPS/1.1, and a cut chunked body returns 0x817B1064.
    • Deleting a request or its template during an operation returns 0x817B1080.
  • Still throwing, as unmeasured: GOAWAY and RST_STREAM codes above 13, other RST_STREAM codes after the headers, GOAWAY after the headers, a TLS reset after the headers, sceHttp2Term during an operation, deleting a request from its own SSL callback, an invalid chunk size, and resolve timeouts. Resolve timeouts were measured but are not modelled. With no DNS answer, the console failed with 0x804101E2 after 30 s with the default or a 1 s timeout, also with retry 0, sending queries at 0, 2, 6 and 14 s. With a 5 s timeout it sent them at 0, 5, 15, 35 and 75 s and returned nothing in 90 s. This is now in the deadlines debt entry.
  • One known difference, recorded in the debt entry: with 5 body bytes already received, the console's first 64-byte read returned the error (or waited out the receive timeout). Here a closed connection or a cut chunked body returns those 5 bytes first. The probe servers closed with a TCP FIN and no TLS close_notify.
  • docs/dev/debt/libSceHttp2.md: the measured-failures and deadline entries are rewritten, and there is a new HTTP/2 stream-errors entry.

Overlaps (from tools/pr_overlap.py): #11630, #15221, #16231 and #18378 touch neighbouring lines. These are the Mode enum, ReleaseOwnedHandles and the chunk-size line, and none of them implements these cases. #14212 and #17938 conflict with main and could not be compared.

Tested

  • Linux (Docker, Ubuntu image, GCC, Release): ctest -R '^guest_http2' passes 14 of 14, run twice. The new cases cover GOAWAY and RST_STREAM codes 0 to 14 (14 throws), peer close before and after the headers, RST_STREAM CANCEL after the headers, the handshake bounded by the receive timeout but not by connect or send, the HTTP/2 upload receive timeout, the HTTPS/1.1 send timeout and reset, the HTTPS/1.1 short body, and cut chunked bodies over http:// and TLS.
  • Negative control: with main's Transport.cpp, Transport.hpp and Export.cpp and the new tests, guest_http2_transport and guest_http2_http1 abort at the first new case.
  • python3 tools/check_conventions.py --base origin/main passes.
  • One test change is not a new case: Http1Cancellation gives its receive-timeout check 400 ms instead of 80 ms. The receive timeout now bounds the TLS handshake, as on the console, and with 80 ms the TLS handshake failed in the emulated (x86-64 on arm64) Docker build. The cancellation tests also accept 0x817B1080 for a deleted request or template, and still accept 0x817B1100 when the deletion lands before the call starts.
  • Windows: JJenkx ran 00e3206939. guest_http2_transport aborted in CloseBody because the test server's close went out as a TCP reset on Windows. 1bb8e206c4 makes that server send a FIN. Not re-run on Windows yet.

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 (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5276599071 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18824). Originally posted by [kali113](https://github.com/kali113) on 2026-11-12T11:33:16Z. --- ### What Follow-up to #17735 (merged): the cases its debt entry still listed as throwing, now measured on a PS5 payload, firmware 13.590.001, against servers on the LAN (raw output kept; addresses redacted below). | Case | Console | Before | |---|---|---| | HTTP/2 GOAWAY before the response headers, error code e = 0 to 13 (last stream 0) | send `0x817B120A + e` | throws | | HTTP/2 GOAWAY NO_ERROR with the request's stream as last, then close | send `0x817B120A` | throws at the close | | HTTP/2 RST_STREAM before the headers, e = 0 to 13 | send `0x817B122A + e` | throws | | HTTP/2 RST_STREAM CANCEL after the headers and 5 of 100 body bytes | send 0, read `0x817B1232` | throws | | HTTP/2 peer closes after the request | send `0x817B1064` | throws | | HTTP/2 peer closes after the headers and 5 of 100 body bytes | read `0x80410136` | throws | | TLS reset after the request (HTTPS/1.1 and HTTP/2) | send `0x817B1064` | throws | | TLS send timeout, server not reading an 8 MiB POST (HTTPS/1.1 and HTTP/2) | `0x817B1223` | throws | | Stalled TLS handshake, 1 s receive timeout (HTTP/1.1 and HTTP/2 templates) | `0x817B1222` at about 1.2 s | throws at the connect deadline | | Stalled TLS handshake, 1 s connect or send timeout | still running at 40 s | throws at 1 s | | HTTP/2 upload the server never reads, 1 s receive timeout | `0x817B1222` | ran to the send timeout | | HTTPS/1.1 body of 5 of 100 bytes, then close | reads 5, then 0 | throws | | Chunked body cut mid-chunk or before the last chunk (`http://` and HTTPS/1.1) | read `0x817B1064` | throws | | Request deleted during a send, a read, a POST or a TLS handshake; template deleted during a send | `0x817B1080` | throws | | GOAWAY / RST_STREAM codes 0 to 13, run twice | identical | | Changes: - `Transport.cpp`: - GOAWAY and RST_STREAM before the headers map to `0x817B120A + e` and `0x817B122A + e` for e of 0 to 13. They are keyed on a received frame, so streams nghttp2 closes itself still throw. A received RST_STREAM CANCEL after the headers fails the next read with `0x817B1232`. - An HTTP/2 end of stream returns `0x817B1064` before the headers and `0x80410136` after them. A TLS reset before the headers returns `0x817B1064`. - The TLS send timeout returns `0x817B1223`. The handshake is bounded by the receive timeout, and an HTTP/2 upload ends at whichever of the send and receive timeouts comes first. - The short-body rule now applies to HTTPS/1.1, and a cut chunked body returns `0x817B1064`. - Deleting a request or its template during an operation returns `0x817B1080`. - Still throwing, as unmeasured: GOAWAY and RST_STREAM codes above 13, other RST_STREAM codes after the headers, GOAWAY after the headers, a TLS reset after the headers, `sceHttp2Term` during an operation, deleting a request from its own SSL callback, an invalid chunk size, and resolve timeouts. Resolve timeouts were measured but are not modelled. With no DNS answer, the console failed with `0x804101E2` after 30 s with the default or a 1 s timeout, also with retry 0, sending queries at 0, 2, 6 and 14 s. With a 5 s timeout it sent them at 0, 5, 15, 35 and 75 s and returned nothing in 90 s. This is now in the deadlines debt entry. - One known difference, recorded in the debt entry: with 5 body bytes already received, the console's first 64-byte read returned the error (or waited out the receive timeout). Here a closed connection or a cut chunked body returns those 5 bytes first. The probe servers closed with a TCP FIN and no TLS close_notify. - `docs/dev/debt/libSceHttp2.md`: the measured-failures and deadline entries are rewritten, and there is a new HTTP/2 stream-errors entry. Overlaps (from `tools/pr_overlap.py`): #11630, #15221, #16231 and #18378 touch neighbouring lines. These are the `Mode` enum, `ReleaseOwnedHandles` and the chunk-size line, and none of them implements these cases. #14212 and #17938 conflict with `main` and could not be compared. ### Tested - Linux (Docker, Ubuntu image, GCC, Release): `ctest -R '^guest_http2'` passes 14 of 14, run twice. The new cases cover GOAWAY and RST_STREAM codes 0 to 14 (14 throws), peer close before and after the headers, RST_STREAM CANCEL after the headers, the handshake bounded by the receive timeout but not by connect or send, the HTTP/2 upload receive timeout, the HTTPS/1.1 send timeout and reset, the HTTPS/1.1 short body, and cut chunked bodies over `http://` and TLS. - Negative control: with `main`'s `Transport.cpp`, `Transport.hpp` and `Export.cpp` and the new tests, `guest_http2_transport` and `guest_http2_http1` abort at the first new case. - `python3 tools/check_conventions.py --base origin/main` passes. - One test change is not a new case: `Http1Cancellation` gives its receive-timeout check 400 ms instead of 80 ms. The receive timeout now bounds the TLS handshake, as on the console, and with 80 ms the TLS handshake failed in the emulated (x86-64 on arm64) Docker build. The cancellation tests also accept `0x817B1080` for a deleted request or template, and still accept `0x817B1100` when the deletion lands before the call starts. - Windows: JJenkx ran `00e3206939`. `guest_http2_transport` aborted in `CloseBody` because the test server's close went out as a TCP reset on Windows. `1bb8e206c4` makes that server send a FIN. Not re-run on Windows yet. ### 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 (Claude Code)
copilot-pull-request-reviewer[bot] commented 2026-11-12 11:33:38 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-12T11:33:38Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5873680411 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/18824#pullrequestreview-5873680411). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-12T11:33:38Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
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!18824
No description provided.