Repository navigation
feat(http2): add synchronous HTTP/2 transport over TLS - #10167
Conversation
Progress report (518d36e → d07024f)📉 System libraries: 50.81% (-0.25%, -31 reverted functions)
|
| Library | Name |
|---|---|
| libSceHttp2 | sceHttp2AbortRequest |
| libSceHttp2 | sceHttp2AddRequestHeader |
| libSceHttp2 | sceHttp2CookieFlush |
| libSceHttp2 | sceHttp2CreateRequestWithURL |
| libSceHttp2 | sceHttp2CreateTemplate |
| libSceHttp2 | sceHttp2GetAllResponseHeaders |
| libSceHttp2 | sceHttp2GetMemoryPoolStats |
| libSceHttp2 | sceHttp2GetResponseContentLength |
| libSceHttp2 | sceHttp2GetStatusCode |
| libSceHttp2 | sceHttp2Init |
| libSceHttp2 | sceHttp2ReadData |
| libSceHttp2 | sceHttp2ReadDataAsync |
| libSceHttp2 | sceHttp2SendRequest |
| libSceHttp2 | sceHttp2SetAuthEnabled |
| libSceHttp2 | sceHttp2SetAutoRedirect |
| libSceHttp2 | sceHttp2SetConnectTimeOut |
| libSceHttp2 | sceHttp2SetConnectionWaitTimeOut |
| libSceHttp2 | sceHttp2SetCookieBox |
| libSceHttp2 | sceHttp2SetInflateGZIPEnabled |
| libSceHttp2 | sceHttp2SetMinSslVersion |
| libSceHttp2 | sceHttp2SetRecvTimeOut |
| libSceHttp2 | sceHttp2SetRedirectCallback |
| libSceHttp2 | sceHttp2SetRequestContentLength |
| libSceHttp2 | sceHttp2SetRequestNoContentLength |
| libSceHttp2 | sceHttp2SetResolveRetry |
| libSceHttp2 | sceHttp2SetResolveTimeOut |
| libSceHttp2 | sceHttp2SetSendTimeOut |
| libSceHttp2 | sceHttp2SetSslCallback |
| libSceHttp2 | sceHttp2SetTimeOut |
| libSceHttp2 | sceHttp2SslDisableOption |
| libSceHttp2 | sceHttp2SslEnableOption |
Changed libraries (implemented exports)
| Library | Before | After | Change |
|---|---|---|---|
| libSceHttp2 | 36/62 (58.06%) | 5/62 (8.06%) | -50.00 pp |
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed exact head 98dda7cbedc567bedeaff4e255e7fce793b4d10f. One HTTP/2 behavior is missing: a peer may send a final response before consuming the request body (for example, reject a large upload with 413). In Request::Send, if the server ends the stream while uploadOffset < uploadSize, End sets ended and the next loop iteration fails Require(!state->ended, "response ended before upload completed"). So a valid final response is turned into an exception rather than making its status/body available. The 42 loopback scenarios cover a flow-control-blocked upload that is stalled/cancelled, but I found no early-final-response case. Please handle the peer’s final response/stream close without treating it as a transport failure, and add a server fixture that returns a final status before releasing the blocked upload; assert SendRequest and status/read behavior.
|
The PR body says validation was refreshed on main |
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Hi @Felipebmaitan, two of my PRs touch the
Would you be OK with both going first? I will do the port myself: once they land I can send you a patch that moves the flags, headers and callbacks into your Http2::Settings, so you don't have to resolve the conflicts alone. I already merged #10534 with your branch locally and it compiles. The combined behaviour would be:
If you'd rather land first, I'll mark #10534 and #10536 Depends on: #10167 and rebase both onto it after merge. |
|
Title evidence for the cleartext / HTTP/1.x path this PR leaves throwing. These are data points for the debt entry, not a request to change scope here. OliSe Player (PPSA01153, open source, catalog 02.001.000) fetches everything through libSceHttp2 over plain That server only speaks HTTP/1.1 on port 80. With a raw socket today, an HTTP/2 connection preface gets Ten catalog titles import AI-assisted: yes (Claude Code) |
|
More title evidence, this time for TLS trust rather than cleartext: three catalog titles use libSceHttp2 over
None calls I hit the same gap in libSceHttp with PokeMMO (#9834, comment above). The fix there, p3n1cillin/AnyPS5@6ababa9f6b, adds a libSceSsl hook, AI-assisted: yes (Claude Code) |
|
Native Windows results for this PR, and three things the catalog titles above would hit. Windows 11, WinLibs GCC 15.2.0, Release, full build of head 98dda7c merged onto I used a native probe that makes RetroArch's updater request: 1.
On 2. DNS fails on Windows before anything starts Winsock. With the proxy flag at 0, the same request throws 3. No trust anchors. With Winsock started, the same GET throws
With that change, on the main merge above, both GETs return 200 over h2: AI-assisted: yes (Claude Code) |
adriadam10
left a comment
There was a problem hiding this comment.
Thanks for the transport work. Points to address before this can merge:
Transport.cpp:571: a peer that ends the stream with a final response before consuming the upload (e.g. 413) makesSendthrow "response ended before upload completed". This is the open request from @MarcZX10 on this head. Treat the peer's final response as a valid result (status/headers/body readable, stop uploading) and add a loopback fixture that returns a final status while the upload is blocked, assertingSendRequestand status/read.Export.cpp:125:sceHttp2CreateTemplatethrows foris_auto_proxy_conf != 0. Titles that use libSceHttp2 (RetroArch PPSA99169, PS5LM PPSA99575, Porpoise PPSA99764, OliSe PPSA01153, per @p3n1cillin) all pass 1, so they now abort at template creation wheremainonly failed the send. AnyPS5 has no system proxy, so accepting the flag and connecting directly looks like the right behaviour; please decide and record it indocs/dev/debt/libSceHttp2.md.- TLS trust: every libSceSsl context starts with no trust anchors, and those titles install no SSL callback, so real HTTPS fails with
TLS failed. @p3n1cillin reports a working approach (system CA list per connection) in their comment; please handle default trust or state in the debt file why it is out of scope. - Windows: DNS fails with "console error mapping is unknown" if nothing has called
WSAStartupyet (libSceNet only does it on its first socket call). Ensure Winsock is started before resolving. - The branch conflicts with
main(Export.cpp,GuestHttp2.cpp,GuestMemoryPoolStats.cpp, after the canonical-header refactor) and depends on #9598, which is still open. Please rebase once that is settled and rerun the HTTP/2, pool-stats and SSL tests.
98dda7c to
d07024f
Compare
|
@adriadam10 Updated in d07024f, rebased onto main 518d36e.
Validation on Windows 11 / WinLibs GCC 15.2.0 Release: full all-target build passed; 70/70 selected tests passed, zero skipped (HTTP2, SSL, networking, pool stats, existing libSceHttp regressions, patched libraries and public headers). Both new regressions passed 20 consecutive runs each on the submitted head. Against the previous transport source, the same fixtures fail at the blocked early response and fresh-process DNS; the fixed source was restored and recompiled before green validation. Conventions, registration, main-sync and whitespace checks pass. No Linux, title or console run is claimed. The PR body now carries the updated contracts, exact validation and remaining limits. |
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
Thanks for the update and for listing #10534 and #10536 in the overlap review. A quick follow-up on the merge order I asked about earlier: would you be OK with #10536 and then #10534 landing before #10167, or would you rather land first? Both are small and already merge cleanly with main. Since d07024f, the overlap with #10534 is down to AI-assisted: yes (Claude Code) |
|
Checked the new head against each point of the previous review: early final responses (413 while the upload is flow-control blocked; status/body/EOF readable, upload stops; loopback fixture incl. NO_ERROR reset and rejection of a reset before a complete response), |
|
Current-main Hamster Playground (PPSA06652, 01.009.000) bring-up evidence: on main The libSceHttp2 sources in this integration are byte-for-byte unchanged from that main. A bounded debugger run confirms handle ID3, non-null callback and non-null user argument. The installed guest callback returns -1. The title previously reached the house on the older c466-based integration, whose redirect setter was still an unconditional success stub; that earlier success did not establish callback semantics. A small CPU-only, no-network reproducer creates valid template/request IDs and registers a rejecting callback on each. Both throw the same exception on current main. Reproducer source, build command, outputs and exact pins. SHA256: Before the native launch, the four graphics/import fixtures passed with actual Khronos validation, no VUIDs/skips/missing layer. The normal title run exits134; both saves/configuration and the kernel import setting are restored, with no native process left. The debugger run is diagnostic only and its launcher exit is not counted as a game pass. No Windows or FPS result is claimed. Implemented follow-up: #11575. Its real redirect tests pass, and the native follow-up clears this registration stop before hitting the separate SSL callback setter gap. Exact new evidence is attached there. |
What
Sending a libSceHttp2 request currently never contacts a server. This adds a synchronous HTTPS request path for version 3 with strict ALPN
h2, using nghttp2 1.70.0 pinned as a source-built submodule.SendRequestuploads until completion or an early final response and receives final response headers;ReadDatastreams the response with bounded buffering and HTTP/2 flow control. Status and Content-Length come from the peer. Request headers and supported settings are copied from the template.Final responses stop the upload without discarding response status, Content-Length or body. Response END_STREAM is tracked independently of the request half, and a NO_ERROR reset is accepted only after a complete response, following RFC 9113 section 8.1. Automatic proxy flags 0 and 1 connect directly, matching libSceNetCtl's advertised proxy-off configuration; other values throw. On Windows the transport starts networking through libSceNet before submitting DNS work.
Contexts enforce a connection cap. Request/template/context deletion cancels active I/O, waits for the operation to quiesce, and releases socket/TLS resources before returning. Abort and resolve/connect/send/receive/overall deadlines stop blocked operations, including an upload waiting for WINDOW_UPDATE. DNS has two host workers and an eight-job queue; abandoning a request does not cancel libc's underlying lookup. A small
SslRead_nid_no_patchbridge keeps the short SSL read import compatible with Windows NID patching.Async send/read/wait and equeue completion remain unimplemented: the old immediate offline completion used an unknown event type. Raw response-header serialization, HTTP/1.x and ALPN fallback, cleartext HTTP/2, connection reuse/multiplexing, CONNECT, trailers, automatic redirect/authentication handling, cookie storage, gzip inflation and additional TLS controls also throw. Unknown console error mappings throw instead of returning guessed SCE errors. HTTP allocations are not charged to the context pool, so the live-context pool-stats query throws rather than reporting zero usage. These limits are recorded in
docs/dev/debt/libSceHttp2.md.Default TLS trust remains a limitation: fresh libSceSsl contexts have no roots. This branch verifies against explicitly loaded authorities and does not disable checks to make public HTTPS succeed. Shared system-root loading belongs to #11134 and the stacked #11145; the reason for keeping it out of this slice is now explicit in the debt file. Stock callers that load no roots are not unblocked by this PR alone.
Contract evidence:
No PS5 hardware, new dumps, title run or console measurements were used. Public compatibility contracts and loopback fixtures are the evidence for this slice.
Overlap review: #9598 still changes the same teardown functions and remains a sequencing dependency. This transport removes the offline completion queues, so its allocation-failure test cannot be applied unchanged; the combined branch has not been built. #11145 is already stacked on this PR and covers proxy, DNS and default trust: this update folds in the proxy/DNS fixes with targeted regressions; the follow-up must drop those overlapping hunks when rebased and retain its system-root work. #11134 supplies the same SSL trust hook for libSceHttp and duplicates the identical SSL read bridge; the later merge must retain a single bridge definition. #10534 and #10536 modify cookie/option bookkeeping; #11470 adds WebSocket handling. These open changes are not included here. The refreshed overlap scan reports those same HTTP2 changes; its comparison against this PR's old published head is a self-comparison after rebase. Manual inspection of #674, #1835, #5021, #9536 and #9571 found independent imgui, capstone/pyelftools/ps5link and libressl submodule entries, with no nghttp2 duplication. The scan used main
a6bd8f957f; the final main refresh changes no files in this PR. There is still merge coordination to finish before merging these open changes. This work stays separate from NGS2 #10127.Tested
Windows 11 Pro 10.0.26200; WinLibs GCC 15.2.0 r7, Ninja Release, BUILD_TESTING=ON, bundled dependencies, a dedicated worktree build.
Validated source head:
d07024f3cfc90862431c7992a1b8d35dd6384472; main base:518d36eaec0ac37870a17b465bedb5551be91b42. The canonical-header conflicts were resolved, retaining main's public declarations and using those headers in the transport and tests.The original 42 transport scenarios remain covered, including phase/overall deadlines, cancellation and concurrent request/template/context teardown. The bookkeeping test also accepts proxy flag 1, rejects unsupported flag values, and checks that unsupported async operations do not manufacture equeue events. All transport fixtures use controlled loopback endpoints and existing synthetic certificates. No external service is a test dependency. No Linux, console or title run is claimed. The earlier full-suite result in the PR history belongs to the older base; this update does not present it as validation of the rebased head.
Commands (supported WinLibs and Git for Windows on PATH):
Checklist
main; no other open PR implements the same functions (known shared implementations and merge sequencing are disclosed in Overlap review above)NotImplemented_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)