feat(http2): add synchronous HTTP/2 transport over TLS #10167
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10167"
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 Felipebmaitan on 2026-10-23T11:54:44Z.
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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T11:56:31Z.
Review: DISMISSED
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). InRequest::Send, if the server ends the stream whileuploadOffset < uploadSize,Endsetsendedand the next loop iteration failsRequire(!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; assertSendRequestand status/read behavior.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-26T15:11:02Z.
Review: CHANGES_REQUESTED
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 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.WSAStartupyet (libSceNet only does it on its first socket call). Ensure Winsock is started before resolving.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.