feat(http): add opt-in Windows HTTP and HTTPS transport #3994

Closed
aadi-varc wants to merge 4 commits from upstream-pr/3994 into main
aadi-varc commented 2026-10-11 20:51:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by aadi-varc on 2026-10-11T20:51:07Z.


What

Blocked by upstream policy; preserved for forks. Upstream explicitly decided that a host-backed libSceHttp is not wanted on main, and closed #3844 as not planned (decision). This PR remains open pending the author’s decision to withdraw it; it is not ready for upstream acceptance under the stated policy. The complete, rebased feature remains available on aadi-varc/AnyPS5:codex/http-winhttp-fork-only.

The fork adds an experimental Windows WinHTTP transport enabled with APS5_HTTP_NETWORK=1. The default remains offline, and libSceHttp2 remains offline. This is a Windows fork feature; it does not change upstream’s offline policy.

Exports dispatch to separate offline and network implementations. The offline implementation retains current main's epoll waits, context teardown and CA-list behavior. Four commits separate handle/state management, WinHTTP transport, export dispatch, and tests/documentation.

The backend supports binary blocking requests, response headers/status/length, chunked responses, optional GZIP decoding, redirects, timeouts, concurrent independent requests and cancellation. Automatic redirects with Authorization, Proxy-Authorization or Cookie headers throw before sending. Deleting a parent invalidates and cancels descendants.

HTTPS uses Windows trust and certificate checks. Certificate-loading/CA-list APIs, epoll, enabled nonblocking operations, nonnull request-status callbacks, proxy/authentication/cookie support, explicit TLS versions and chunked uploads throw when requested. USAGE.md warns that custom-certificate initialization can stop a title before its first request. Console semantics and remaining gaps are recorded in docs/dev/debt/libSceHttp.md.

No third-party code is added. The localhost integration test generates disposable credentials with OpenSSL. Missing Python or OpenSSL reports CTest skip code 77; certificate-generation errors, timeouts and guest failures remain failures. These changes address the four implementation/reviewability points in the draft feedback.

Tested

Windows 10.0.26300 x86-64, WinLibs GCC 15.2.0 r7, Release, Python 3.12.14. Current head: 2636a48, rebased onto main 3864da595.

  • Resolved the new core/libs/CMakeLists.txt conflict by preserving upstream’s nid_shared_strings test and the HTTP offline test’s explicit environment. Documented the fork-only policy in USAGE.md.
  • Rebuilt the four HTTP/offline targets and updated dependencies. guest_offline_imports, guest_http, guest_http_response_header and guest_http_network all passed with APS5_HTTP_NETWORK=1 in the parent shell (2.67 seconds total), including real HTTP/HTTPS loopback requests. Conventions, whitespace and test-registration checks passed.
  • HTTP runtime sources remain identical to previously validated b889391, which passed the full Windows project build and five relevant tests, including patched_libraries (8.31 seconds total). The full project build was not repeated for the subsequent rebases and test-environment/documentation changes.
  • The readiness audit covered handle ownership, hierarchical deletion, concurrent cancellation, WinHTTP callback lifetime, export ABI, offline compatibility and the test harness. No blocking runtime defect was found. Missing Python/OpenSSL produce explicit CTest skips; other test failures are propagated.
  • No commercial title, PS5 hardware, Linux or macOS runtime validation. Native request-handle closure failure explicitly terminates; this exceptional OS path was not reproduced. Full upstream CI still requires a maintainer; passing checks would not override the stated policy.

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 libSceHttp technical debt
  • 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 (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: none (no title bring-up validated)
  • AI-assisted: yes (Codex)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4822253375 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3994). Originally posted by [aadi-varc](https://github.com/aadi-varc) on 2026-10-11T20:51:07Z. --- ### What **Blocked by upstream policy; preserved for forks.** Upstream explicitly decided that a host-backed `libSceHttp` is not wanted on `main`, and closed #3844 as not planned ([decision](https://github.com/boykopovar/AnyPS5/issues/3844#issuecomment-6115108934)). This PR remains open pending the author’s decision to withdraw it; it is not ready for upstream acceptance under the stated policy. The complete, rebased feature remains available on [aadi-varc/AnyPS5:codex/http-winhttp-fork-only](https://github.com/aadi-varc/AnyPS5/tree/codex/http-winhttp-fork-only). The fork adds an experimental Windows WinHTTP transport enabled with `APS5_HTTP_NETWORK=1`. The default remains offline, and `libSceHttp2` remains offline. This is a Windows fork feature; it does not change upstream’s offline policy. Exports dispatch to separate offline and network implementations. The offline implementation retains current main's epoll waits, context teardown and CA-list behavior. Four commits separate handle/state management, WinHTTP transport, export dispatch, and tests/documentation. The backend supports binary blocking requests, response headers/status/length, chunked responses, optional GZIP decoding, redirects, timeouts, concurrent independent requests and cancellation. Automatic redirects with Authorization, Proxy-Authorization or Cookie headers throw before sending. Deleting a parent invalidates and cancels descendants. HTTPS uses Windows trust and certificate checks. Certificate-loading/CA-list APIs, epoll, enabled nonblocking operations, nonnull request-status callbacks, proxy/authentication/cookie support, explicit TLS versions and chunked uploads throw when requested. `USAGE.md` warns that custom-certificate initialization can stop a title before its first request. Console semantics and remaining gaps are recorded in `docs/dev/debt/libSceHttp.md`. No third-party code is added. The localhost integration test generates disposable credentials with OpenSSL. Missing Python or OpenSSL reports CTest skip code 77; certificate-generation errors, timeouts and guest failures remain failures. These changes address the four implementation/reviewability points in the draft feedback. ### Tested Windows 10.0.26300 x86-64, WinLibs GCC 15.2.0 r7, Release, Python 3.12.14. Current head: `2636a48`, rebased onto main `3864da595`. - Resolved the new `core/libs/CMakeLists.txt` conflict by preserving upstream’s `nid_shared_strings` test and the HTTP offline test’s explicit environment. Documented the fork-only policy in `USAGE.md`. - Rebuilt the four HTTP/offline targets and updated dependencies. `guest_offline_imports`, `guest_http`, `guest_http_response_header` and `guest_http_network` all passed with `APS5_HTTP_NETWORK=1` in the parent shell (2.67 seconds total), including real HTTP/HTTPS loopback requests. Conventions, whitespace and test-registration checks passed. - HTTP runtime sources remain identical to previously validated `b889391`, which passed the full Windows project build and five relevant tests, including `patched_libraries` (8.31 seconds total). The full project build was not repeated for the subsequent rebases and test-environment/documentation changes. - The readiness audit covered handle ownership, hierarchical deletion, concurrent cancellation, WinHTTP callback lifetime, export ABI, offline compatibility and the test harness. No blocking runtime defect was found. Missing Python/OpenSSL produce explicit CTest skips; other test failures are propagated. - No commercial title, PS5 hardware, Linux or macOS runtime validation. Native request-handle closure failure explicitly terminates; this exceptional OS path was not reproduced. Full upstream CI still requires a maintainer; passing checks would not override the stated policy. ### Checklist - [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 [libSceHttp technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/debt/libSceHttp.md#silent-stubs) - [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 (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none (no title bring-up validated) - [x] AI-assisted: yes (Codex)
TideOPL commented 2026-10-11 22:03:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by TideOPL on 2026-10-11T22:03:24Z.


Some design feedback, since the draft asks for it:

  • Two bodies per export: every export now has two bodies selected by APS5_HTTP_NETWORK, and the offline branch keeps its (void)x lines after an early return in about 40 functions. A dispatch table, or moving the offline bodies into the same HttpNetwork namespace, would keep Export.cpp readable.
  • Throwing calls when enabled: with the backend on, sceHttpsLoadCert, sceHttpCreateEpoll, sceHttpSetNonblock and a non-null sceHttpSetRequestStatusCallback always throw. Many titles call sceHttpsLoadCert during init, so in practice the opt-in will abort most HTTPS titles before their first request. That follows the throw rule, but it's worth stating in USAGE.md so people know what to expect.
  • Test dependencies: guest_http_network needs Python plus an OpenSSL found next to Git for Windows. Please have it report a skip (SKIP_RETURN_CODE) rather than fail when either is missing, because CI images may have neither.
  • One large commit: about 1250 lines in one commit. Splitting it (handle and state bookkeeping, the WinHTTP transport, tests) would make it much easier to review.
  • Whether online HTTP is in scope at all is the maintainers' call.

I haven't run it yet. I'm on Windows, so I can test the WinHTTP path once it's out of draft if that helps.

AI-assisted: yes. Written with AI assistance (Claude Code); I reviewed it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114324478 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3994#issuecomment-6114324478). Originally posted by [TideOPL](https://github.com/TideOPL) on 2026-10-11T22:03:24Z. --- Some design feedback, since the draft asks for it: - **Two bodies per export:** every export now has two bodies selected by `APS5_HTTP_NETWORK`, and the offline branch keeps its `(void)x` lines after an early return in about 40 functions. A dispatch table, or moving the offline bodies into the same `HttpNetwork` namespace, would keep `Export.cpp` readable. - **Throwing calls when enabled:** with the backend on, `sceHttpsLoadCert`, `sceHttpCreateEpoll`, `sceHttpSetNonblock` and a non-null `sceHttpSetRequestStatusCallback` always throw. Many titles call `sceHttpsLoadCert` during init, so in practice the opt-in will abort most HTTPS titles before their first request. That follows the throw rule, but it's worth stating in USAGE.md so people know what to expect. - **Test dependencies:** `guest_http_network` needs Python plus an OpenSSL found next to Git for Windows. Please have it report a skip (`SKIP_RETURN_CODE`) rather than fail when either is missing, because CI images may have neither. - **One large commit:** about 1250 lines in one commit. Splitting it (handle and state bookkeeping, the WinHTTP transport, tests) would make it much easier to review. - Whether online HTTP is in scope at all is the maintainers' call. I haven't run it yet. I'm on Windows, so I can test the WinHTTP path once it's out of draft if that helps. AI-assisted: yes. Written with AI assistance (Claude Code); I reviewed it.
github-actions[bot] commented 2026-10-12 20:47:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T20:47:37Z.


Progress report (d539606 → 5d23525)

📈 System libraries: 86.39% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libSceHttp sceHttpSetCookieEnabled
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132341351 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3994#issuecomment-6132341351). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-12T20:47:37Z. --- <!-- progress-report --> ### Progress report (d539606 → 5d23525) 📈 **System libraries**: 86.39% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libSceHttp | `sceHttpSetCookieEnabled` | </details>
coltken95 commented 2026-10-13 00:38:26 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by coltken95 on 2026-10-13T00:38:26Z.


A real-world case for this transport beyond libSceHttp: OliSe Player (PPSA01153, open source, Marice/OliSePlayer) downloads every tune through libSceHttp2 (sceHttp2CreateRequestWithURL, sceHttp2SendRequest, sceHttp2GetStatusCode, sceHttp2ReadData, blocking, plain http:// URLs from modarchive.org and modland.com). On Linux with main it runs and renders, but sceHttp2SendRequest returns the offline error, so it logs radio: DOWNLOAD FAILED (-2) and plays nothing.

Would a Linux implementation of ITransport, and routing libSceHttp2 blocking requests through the same transport, be welcome as follow-ups once this lands? I can test both with OliSe on Linux (CachyOS, RTX 2070).

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135400642 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3994#issuecomment-6135400642). Originally posted by [coltken95](https://github.com/coltken95) on 2026-10-13T00:38:26Z. --- A real-world case for this transport beyond `libSceHttp`: OliSe Player (PPSA01153, open source, [Marice/OliSePlayer](https://github.com/Marice/OliSePlayer)) downloads every tune through `libSceHttp2` (`sceHttp2CreateRequestWithURL`, `sceHttp2SendRequest`, `sceHttp2GetStatusCode`, `sceHttp2ReadData`, blocking, plain `http://` URLs from modarchive.org and modland.com). On Linux with `main` it runs and renders, but `sceHttp2SendRequest` returns the offline error, so it logs `radio: DOWNLOAD FAILED (-2)` and plays nothing. Would a Linux implementation of `ITransport`, and routing `libSceHttp2` blocking requests through the same transport, be welcome as follow-ups once this lands? I can test both with OliSe on Linux (CachyOS, RTX 2070). AI-assisted: yes
011010 commented 2026-10-13 16:10:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by 011010 on 2026-10-13T16:10:51Z.


Since #3844 was closed with "a host-backed libSceHttp is not wanted on main", could you confirm the direction for a Linux/macOS transport, given this PR is Windows-only?

I'd like to add the POSIX side and can build on the Transport.hpp/Network.hpp split introduced here, keeping the same opt-in model (default offline, APS5_HTTP_NETWORK=1). Three questions:

  • Is a POSIX transport welcome on main at all, or should online HTTP stay fork-only?
  • If welcome, should it build on this PR's abstraction (i.e. depend on #3994), or be independent of it?
  • Preferred backend: libcurl as a submodule, the system's libcurl, or raw sockets plus a TLS library?

Happy to wait until #3994 settles before writing anything.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6149899214 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3994#issuecomment-6149899214). Originally posted by [011010](https://github.com/011010) on 2026-10-13T16:10:51Z. --- Since #3844 was closed with *"a host-backed `libSceHttp` is not wanted on main"*, could you confirm the direction for a **Linux/macOS** transport, given this PR is Windows-only? I'd like to add the POSIX side and can build on the `Transport.hpp`/`Network.hpp` split introduced here, keeping the same opt-in model (default offline, `APS5_HTTP_NETWORK=1`). Three questions: - Is a POSIX transport welcome on `main` at all, or should online HTTP stay fork-only? - If welcome, should it build on this PR's abstraction (i.e. depend on #3994), or be independent of it? - Preferred backend: libcurl as a submodule, the system's libcurl, or raw sockets plus a TLS library? Happy to wait until #3994 settles before writing anything.
github-actions[bot] commented 2026-10-15 11:13:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T11:13:22Z.


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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6314 docs/user/USAGE.md L84
PR 6649 docs/dev/debt/libSceHttp.md L20

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.

Pull request Shared files not compared
PR 674 docs/dev/BUILD.md
PR 1835 docs/dev/BUILD.md
PR 4891 docs/user/USAGE.md
PR 5021 core/libs/CMakeLists.txt
docs/dev/BUILD.md
docs/user/USAGE.md
PR 5390 docs/user/USAGE.md
PR 5925 docs/user/USAGE.md
PR 6044 core/libs/CMakeLists.txt
core/libs/prx/libSceHttp/CMakeLists.txt
PR 6222 core/libs/CMakeLists.txt
PR 6447 core/libs/prx/libSceHttp/Export.cpp
docs/dev/debt/libSceHttp.md
PR 6879 docs/dev/BUILD.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6190714795 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3994#issuecomment-6190714795). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-15T11:13:22Z. --- <!-- pr-overlap --> 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**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | [PR 6314](https://www.github.com/boykopovar/AnyPS5/pull/6314) | `docs/user/USAGE.md` [L84](https://github.com/boykopovar/AnyPS5/blob/4272979b31aa9e76878e84ca76b4a71fa6e1d5f9/docs/user/USAGE.md#L84) | | | | [PR 6649](https://www.github.com/boykopovar/AnyPS5/pull/6649) | `docs/dev/debt/libSceHttp.md` [L20](https://github.com/boykopovar/AnyPS5/blob/4272979b31aa9e76878e84ca76b4a71fa6e1d5f9/docs/dev/debt/libSceHttp.md#L20) | | | 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. | Pull request | Shared files not compared | |---|---| | [PR 674](https://www.github.com/boykopovar/AnyPS5/pull/674) | `docs/dev/BUILD.md` | | [PR 1835](https://www.github.com/boykopovar/AnyPS5/pull/1835) | `docs/dev/BUILD.md` | | [PR 4891](https://www.github.com/boykopovar/AnyPS5/pull/4891) | `docs/user/USAGE.md` | | [PR 5021](https://www.github.com/boykopovar/AnyPS5/pull/5021) | `core/libs/CMakeLists.txt`<br>`docs/dev/BUILD.md`<br>`docs/user/USAGE.md` | | [PR 5390](https://www.github.com/boykopovar/AnyPS5/pull/5390) | `docs/user/USAGE.md` | | [PR 5925](https://www.github.com/boykopovar/AnyPS5/pull/5925) | `docs/user/USAGE.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/CMakeLists.txt`<br>`core/libs/prx/libSceHttp/CMakeLists.txt` | | [PR 6222](https://www.github.com/boykopovar/AnyPS5/pull/6222) | `core/libs/CMakeLists.txt` | | [PR 6447](https://www.github.com/boykopovar/AnyPS5/pull/6447) | `core/libs/prx/libSceHttp/Export.cpp`<br>`docs/dev/debt/libSceHttp.md` | | [PR 6879](https://www.github.com/boykopovar/AnyPS5/pull/6879) | `docs/dev/BUILD.md` |
oneandonlydean commented 2026-10-17 00:03:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T00:03:19Z.


Closing: #3844 is closed as not planned, since a host-backed libSceHttp isn't wanted on main and forks can adapt the online libraries, and this PR implements that transport. A fork is the right home for it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6227032392 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3994#issuecomment-6227032392). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-17T00:03:19Z. --- Closing: #3844 is closed as not planned, since a host-backed libSceHttp isn't wanted on main and forks can adapt the online libraries, and this PR implements that transport. A fork is the right home for it.

Pull request closed

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!3994
No description provided.