Skip to content

Net: an opt-in bundled HTTP/3 curl stack over OpenSSL 3.5, behind CURLSTACK=1 - #1270

Closed
fraygox wants to merge 38 commits into
plxnative:mainfrom
fraygox:feat/http3-curlstack-openssl
Closed

fraygox wants to merge 38 commits into
plxnative:mainfrom
fraygox:feat/http3-curlstack-openssl

Conversation

@fraygox

@fraygox fraygox commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

What

A developer-build option that bundles a current TLS and HTTP stack for the app's libcurl: OpenSSL 3.5.9,
nghttp2 1.71.0, nghttp3 1.19.0, ngtcp2 1.26.0 (with its OpenSSL glue, crypto_ossl) and curl 8.23.0.
ci/build-curlstack.sh builds the seven libraries under -plx SONAMEs and the app dlopens them
from beside the binary.

  • Off by default and invisible without the flag. A plain make, make ipk and the existing
    cross-build job neither build, link nor package any of it; the default package's file list is
    unchanged.
  • CURLSTACK=1 builds always bind the bundled curl/OpenSSL (system libcurl as the fallback if the
    bundle is missing or any library fails to load). This gives older sets a current TLS stack
    (OpenSSL 3.5.9 instead of the firmware's 1.0.2), independent of HTTP/3.
  • HTTP/3 is a separate switch. New Settings > System > HTTP/3 (experimental): default off,
    applied at the next launch, signed-in only, shown only in a build that carries the bundle, and not
    kept across a sign-out. It decides one thing: whether strict requests set CURLOPT_ALTSVC. Off,
    nothing sets Alt-Svc and the bundled curl negotiates its default over ALPN, which is HTTP/2 (or
    HTTP/1.1 where the server only speaks that). On, curl upgrades to HTTP/3 once it has seen the
    server's Alt-Svc header.
  • A build without CURLSTACK=1 is unchanged from main.

No firmware libcurl has QUIC (7.53.1 on the oldest sets, 7.82.0 with OpenSSL 3.0.13 on a webOS 10.3
set), so a server behind a reverse proxy that advertises HTTP/3 is never reached over QUIC today.

Protocol change to be aware of. Firmware curl older than 7.62.0 defaults to HTTP/1.1 (the app never
sets CURLOPT_HTTP_VERSION); the bundled curl defaults to HTTP/2. On those sets a CURLSTACK=1 build
moves media requests from HTTP/1.1 to HTTP/2 even with the switch off. On the one set I measured, HTTP/2
seeks were slower than HTTP/1.1 without the companion change, #1289 (HTTP/2 seek CURLOPT_FRESH_CONNECT). It has
landed on main and is merged here, and an HTTP/3 answer now ends its busy mark (ConnLedger::saw_version). With #1289 alone the
bundled curl's HTTP/2 seeks were still 1.7x HTTP/1.1 on that set; 7040caec5 closes the connection a seek abandons (a bundled media
transfer that may be HTTP/2 sets CURLOPT_FORBID_REUSE before it enters the multi), which brought them to 0.92x. Benchmark details:
the first run (#1270 (comment)) and the rerun against main with #1289
(#1270 (comment)).

Make, Cargo, loader

  • Make: CURLSTACK=1 (only 1 accepted) stages the seven libraries, ships
    licenses/curlstack/curl.txt, appends --features http3-curlstack to the explicit feature flags,
    records +curlstack in pkg/.build-config, and builds in its own -curlstack target tree. A
    CURLSTACK=1 build on the stable id is refused (ALLOW_DEV_ON_STABLE=1 overrides): it is a
    developer build no release ships. ci/rust_toolchain.py's featflags() pins CURLSTACK= so a
    derivation run inside make CURLSTACK=1 ipk does not inherit it.
  • Cargo feature http3-curlstack (default off, glibc only) gates the loader (net::curlstack) and
    dynlib::Handle::open_in_deepbind. Without it net::bundled() is constant false and the
    system-curl path is main's.
  • The bind is the build's alone. net::global_init binds the bundle first, system second; the
    range transport's separate curl_multi_* table (plx_net::range_io,
    rust-modules/net/src/curlio.rs) and net::connect_only's curl_easy_send/curl_easy_recv table
    (the WebSocket's, from main's Net: the WebSocket transport over libcurl CONNECT_ONLY #1283) bind from the same handle, since an easy handle from one libcurl
    must not reach another's functions. A source scan (every_other_libcurl_table_binds_from_the_library_global_init_chose)
    pins every libcurl dynlib! table outside net.rs to bundled_curl()/load_from.
  • Alt-Svc (CURLOPT_ALTSVC/_CTRL, one cache file in the runtime directory) is set on strict
    requests of both planes only when net::alt_svc() says so: bundle bound AND switch on. Boot reads
    the stored switch from the session it already loads and installs it once, before net::global_init.
    The bind log is followed by net: HTTP/3 (experimental) is off — Alt-Svc is not set or … is on — Alt-Svc is set on strict requests.
  • Certificate verification is unchanged. Every curl the app binds is OpenSSL (firmware 1.0.x to 3.x,
    bundle 3.5), so keypin's predicates read either; SECURITY.md's pin and bundled-roots rules hold.
  • Firmware OpenSSL 1.0 keeps its lock callbacks. On webOS 5 and older the firmware libcurl brings
    OpenSSL 1.0.x into the process before main (libplayerAPIs.so.1 needs it). With the bundle bound,
    global_init finds the resident libcurl with RTLD_NOLOAD, reads its curl_version() and installs
    the callbacks there too (legacy_lock_target).

Why OpenSSL

OpenSSL's linux-armv4 assembly has ARMv8 Crypto Extension paths for AArch32 (AES, PMULL, SHA-1,
SHA-256), chosen at run time from OPENSSL_armcap_P; the library is built with no CPU flags, so the
same file runs table code on the oldest CPU and hardware instructions where present. The instructions
are emitted as raw words behind that dispatch, so every library keeps ARMv7 object attributes, which CI
checks. Nettle, the crypto library of the obvious alternative TLS stack, has no such paths on 32-bit ARM.

Measured on a webOS 10.3 set (CPU with the Crypto Extensions; OPENSSL_armcap=0x3d): EVP driver, 16 KiB
buffers, 2 s per primitive, median of three runs, app closed. Carried over from the previous revision
(package 067ffacb, whose libcrypto-plx.so.3 is byte-identical to the final one); not re-run.

Primitive (MB/s) OpenSSL 3.5.9 Nettle 3.10.2
aes-128-gcm 507.4 16.5
aes-256-gcm 438.6 15.2
chacha20-poly1305 165.5 82
sha256 498.1 55

Isolation: RTLD_DEEPBIND | RTLD_LOCAL

libplayerAPIs.so.1 (linked by every Feed build) has a NEEDED on the firmware libcurl, so that libcurl,
its nghttp2 and the firmware OpenSSL are in the global scope before main.

  • RTLD_DEEPBIND on every stack library: otherwise the bundled libcurl's calls between its own
    exported functions resolve through the PLT to the same-named system library. An earlier build did
    exactly that on-device (SIGSEGV inside the system libcurl.so.4.5.0, at a reproducible offset).
  • RTLD_LOCAL: none of the stack joins the global scope, so firmware code that binds later cannot
    pick up the bundle's symbols. The curl and multi tables dlsym through the handle, unaffected.
  • Names/files: the -plx SONAMEs come from OpenSSL's own shlib_variant, not a patchelf rename;
    --prefix/--openssldir point at a path no television has; the build is
    no-module no-legacy no-engine no-autoload-config, so it never reads the firmware's openssl.cnf.
  • Trust: curl is built --with-ca-path=/etc/ssl/certs (the hashed directory; the concatenated bundle
    beside it lacks ISRG Root X1 on webOS 5.6.2). The *.plex.direct fallback still uses the shipped
    le-roots.pem.
  • libatomic: -Wl,--as-needed drops the NEEDED libatomic.so.1 that four supported firmwares do
    not ship (1.2, 1.4, 4.4.2, 4.10.0).
  • exit: DEEPBIND would bind a stack library's exit to libc ahead of the app's exit interposer.
    None imports it; CI fails the day one does.

Packaging, licences, CI

  • Licences: OpenSSL Apache-2.0, nghttp2/nghttp3/ngtcp2 MIT, curl its own; no source obligation.
    THIRD-PARTY-NOTICES §2.8 ("CURLSTACK=1 builds only") names each file, version, licence and copyright.
    All five sources are unmodified upstream tarballs; the build's only addition is a config target
    (linux-armv4-plx).
  • ci/check-package.py decodes +curlstack: a package must carry all seven libraries and curl.txt
    with the flag and none without.
  • Five pins in ci/dependencies.json (group: curlstack, bundled: false); the shared deps cache skips
    the group (OpenSSL's tarball alone is 53 MB). The deps-cache and ffmpeg cache keys hash that file, so
    this PR invalidates them once.
  • New cross-build-curlstack job: the same artifact gates as cross-build, with the flag, plus
    ci/check-curlstack-elf.sh over the seven libraries (ELF32/ARM/soft-float, Tag_CPU_arch: v7, no CP15
    barrier, no exit import). It caches the script's keyed build tree (4.8 MB zstd), has a 30-minute
    budget (not yet measured on a runner) and is not awaited by cross-build-required. A cold build took
    168 s on an 8-core Apple M1 (carried over).

Since the last revision

This revision (to 58fd0c06b) brings the branch up to main at 8e8330ab0 and fixes what that merge and a fresh review turned up. It changes no curl option, nothing in the TLS/HTTP stack, the loader or the media transfer path; in rust-modules/net the only edit of ours is one comment.

  • 8243f655e merges main (8e8330ab0). Three conflicts, all where main's Settings work met the HTTP/3 row:
    • session.rs, prefs_tests.rs: both sides added a Setting row (HudEndTimePref, Http3Pref). Both are kept; the descriptor count is 23.
    • settings.rs: main moved the root page onto captured ScreenInputs with a receipt per pending write. The HTTP/3 switch now follows the auto sign-in switch's shape (http3_receipt, cleared once the settled session answers) instead of reading session::peek_settled(), and its tests build the page from the captured inputs.
  • 362129e97: main removed plx_machine::idle; the HTTP/3 preference write now wakes the frame through present::wake_from_worker, as main's other preference writes do. (The merge compiled nowhere without it.)
  • 2bea7f310: main's machine-shape gate certifies shared payload types against two proof files that pin every workspace manifest's hash. This PR adds the http3-curlstack feature to three Cargo.toml files, so both certificates were regenerated with their own producers and the pinned hashes updated, as main's dependency bump 6d7b48e7a did. The diff is those three manifest hashes, plus play-feed's lib_sha256, which the producer refreshed (main's entry predates a later edit to that file; this branch does not touch it).
  • b540939b5: a success-path test for the switch (a_saved_http3_write_waits_for_the_next_captured_authority), the twin of the one main has for auto sign-in.
  • a3ca73237: make check deleted a built package. print-curlstack-prune was missing from QUERY_GOALS, and ci/test_deploy_manifest.py asks for it with CURLSTACK=1, so in a checkout holding a default build the parse reset the stamp and removed pkg/plxnative and the staged libraries. CI never saw it because its runners start with no pkg/. It is a query goal now, and ci/test_arm_profile.py seeds a build and checks both curl-stack queries leave it alone (it fails against the old Makefile).
  • 237765118: the stack's build trees under vendor/ ({openssl,nghttp2,nghttp3,ngtcp2,curl}-{src,build,prefix}, openssl-stage, curl-link-shim, curlstack-built) were not in .gitignore. They are now, slashless like the FFmpeg entries, and tools/build-gc.sh classifies them as build output, which ci/test_build_gc.py requires of every new pattern. My build lane had a local info/exclude for vendor/, which is how I missed it.
  • 15bf11f2b: net::bundled_curl, net::bundled, net::http3_switch and net::alt_svc join the globals rule in ci/check-deps.sh ("When you add a registry reader, add its name to the rule in the same change"), the way devcaps::caps was added, with a harness test that plants each import shape. No machine calls them, so no ledger line is seeded and the site count is unchanged (19). Also corrects a comment in curlio.rs that said the Feed's ff::boot binds the multi table at start-up; nothing calls that on main, so it binds at the first media open, still after net::global_init.
  • 58fd0c06b: the cross-build-curlstack cache key now includes the runner's cmake and patchelf versions, which ci/build-curlstack.sh already keys its tree on. Without them a runner image update would have left every later run building cold (correct output, slow).

Two choices worth a second opinion:

  • session::set_http3_experimental is an unguarded install-scope write, like set_ui_resolution and set_language, not account-guarded like auto sign-in. The row is Install scope and plex/CLAUDE.md says Install rows are never account-bound; the "not kept across a sign-out" behaviour is on the read side.
  • Eleven of the twelve translations are still AI drafts awaiting native review (see Translations).
Earlier revisions

Merged main (3309be023, merge e31c50039; the range transport now lives in plx_net::range_io);
d7f2849cd (make: flag variables defined before the build stamp); d173650f9 + b3bbcd63d (the
Settings switch, first as a library selector); a4d613724 (final semantics above: the bundle is always
bound, the switch gates only Alt-Svc/HTTP/3); eb5516d7c (tests and comments). 9bfa93bcd merges main again (8e486d1a2). Its two conflicts were both new Settings rows, main's and this branch's, landing in the same places.

Revision to 7040caec5:

  • 7040caec5: a bundled media transfer that may be HTTP/2 closes its connection. With Net: a seek that cancels an HTTP/2 transfer dials a fresh connection #1289's rule, the bundled
    curl's HTTP/2 seeks were still 1.7x HTTP/1.1 on a webOS 5.6.2 set (254 against 148 ms, clean path, 8 Mbit/s), with up
    to four abandoned connections left open; firmware 7.61 asked for HTTP/2 under the same rule was not slowed. Such a
    transfer (origin last heard over HTTP/2, or not yet heard from while Alt-Svc cannot route the handle to QUIC; never on
    a source reopened for HLS) is now set CURLOPT_FORBID_REUSE before curl_multi_add_handle (on a transfer in progress
    curl_easy_setopt is undefined), so its connection closes with it and stop() records no busy mark: 136 ms, 0.92x
    HTTP/1.1. Firmware libcurls are unchanged. closes_after_transfer is a pure function with its own test; the redirect
    test's doc and finish_redirect_body's doc now say a hop the rule chose costs its next hop a dial.

Previous revision (to 9aaad044d):

  • afcec3dc5 merges main (93697adcf). One textual conflict, in docs/agent-reference.md's dynlib callers
    paragraph. One semantic fix the merge needed: main's net::connect_only (Net: the WebSocket transport over libcurl CONNECT_ONLY #1283) bound its table from the system
    candidates (raw::load(None)) while its easy handle comes from net::curl_easy_init, i.e. the bundle in a
    CURLSTACK=1 build. It now binds from net::bundled_curl() as curlio does.
  • e144734cc: the source scan above (it fails against raw::load(None)). ConnLedger::saw_version (from Net: a seek that cancels an HTTP/2 transfer dials a fresh connection #1289)
    ends a busy HTTP/2 mark when the origin answers over HTTP/3, so an origin Alt-Svc has moved to QUIC no longer
    dials a fresh QUIC connection per request for 120 s. An HTTP/1.1 answer keeps the mark. Docs.
  • f3e2577f8: make CURLSTACK=1 deploy was broken since f75f1eb55. The command that retires stale stack
    libraries sat inside $(if $(CURLSTACK),...), and make counts parentheses in a function's arguments, so the case
    patterns' ) ended the $(if and the shell got half a command (unexpected EOF). No gate runs deploy, and the
    earlier device runs installed the .ipk. It is now a variable, CURLSTACK_PRUNE. ci/test_deploy_manifest.py
    asks print-curlstack-prune for it and has sh -n parse the command and its remote script; against the old text
    the query fails the same way the deploy did.
  • 9aaad044d: curlio's module doc and BUSY_FOR's doc say an HTTP/3 answer ends the mark.

Gates

Head 58fd0c06b, base main at 8e8330ab0 (the merge base). Apple M1, toolchain 1.100.0, tree clean before and after (git status --short empty, and no untracked file outside what the tracked .gitignore covers). The whole set ran on 58fd0c06b.

  • make check: ==== check: 136 steps — all ok ====.
  • make check-nodef: exit 0. python3 ci/test_ci_workflows.py: Ran 99 tests … OK. python3 ci/test_deploy_manifest.py: Ran 6 tests … OK.
  • Flag off (make ARM_PROFILE=release FLAVOR=debug ipk): PASS actual IPK: 8 ELF files, all packaging assertions passed; ci/check-elf.sh: all ELF assertions passed; size budget ok.
  • Flag on (… CURLSTACK=1 …): PASS actual IPK: 15 ELF files, all packaging assertions passed; check-elf.sh passed; ci/check-curlstack-elf.sh: all curl-stack ELF assertions passed; size budget ok (18,334,440 of 20,000,000 bytes).
  • Feature tests (cargo +1.100.0 test --lib -p plx_base -p plx_net -p plx_media --features plx_net/http3-curlstack): plx_base 254 passed, plx_media 2136 passed (104 ignored), plx_net 344 passed, 0 failed.
  • tools/fwcompat.py --min-release 4.4.2 on the CURLSTACK=1 ARM binary: exit 0.
  • pr-reviewer on the combined main...head diff, repeated after each fix until it returned "No findings." (on 58fd0c06b). Each of its findings is one of the commits above.
  • Two of the new tests were run against the code without their fix and failed there: the HOST_ONLY_GOALS case against the old Makefile (print-curlstack-prune), and the .gitignore tying test with the patterns added but without the build-gc.sh line.
  • Not re-run on this head: the fw-compat-reviewer and doc-claim-auditor agents (last run on 7040caec5; no symbol, dynlib! entry, DT_NEEDED or loader line has changed since, and fwcompat.py above covers the binary). Not run locally: the font audit and webosbrew-ipk-verify (CI only).

Device verification

Not repeated on 58fd0c06b, deliberately. Nothing in this revision changes what goes over the wire or how a connection is made, kept or closed: our only edit under rust-modules/net is a comment, and what the merge brought into that crate from main is the throughput probe accepting a 200 from byte zero (#1339), a test fixture's close_notify, and tests. The runs below are on 7040caec5 and earlier and still describe the transport.

On 7040caec5: the webOS 5.6.2 set (HTTP/1.1 firmware curl, the case the fix is for), make CURLSTACK=1 deploy
(debug), switch off, a direct play from our PMS through an HTTPS reverse proxy.

  • Boot bound libcurl-plx.so.4 (libcurl/8.23.0 OpenSSL/3.5.9 …) … legacy-locks=Installed, logged HTTP/3 (experimental) is off — Alt-Svc is not set and curlio: bound libcurl-plx.so.4 curl_multi_* (7 symbols).
  • The proxy logged all 6 media-part requests as HTTP/2.0. The app held one established connection (its socket
    inodes against /proc/net/tcp) through playback and two seeks; each seek reopened in 19-20 ms (ff: seek_cb reopen … ms=19, ff: seek 177s rv=0 ms=19), and no fresh connection line was logged (the rule closes
    the connection instead of marking it busy).

Earlier, on 9aaad044d: a webOS 10.3 set, make CURLSTACK=1 deploy (debug), signed in, playing from our PMS through
an HTTPS reverse proxy.

  • Boot bound libcurl-plx.so.4 (libcurl/8.23.0 OpenSSL/3.5.9 zlib/1.2.11 nghttp2/1.71.0 ngtcp2/1.26.0 nghttp3/1.19.0; AsynchDNS=yes); threaded-tls=true legacy-locks=NotNeeded, and logged HTTP/3 (experimental) is off — Alt-Svc is not set.
  • The media plane on the bundle, first seen on a device: curlio: bound libcurl-plx.so.4 curl_multi_* (7 symbols). An H.265 direct play resumed, played (timeline playing t=1892s … t=1903s), and a seek landed
    (ff: seek_cb reopen … ok=true ms=406, ff: seek 1912s rv=0 ms=407). Net: a seek that cancels an HTTP/2 transfer dials a fresh connection #1289's rule fired on the bundle's
    HTTP/2 (curlio: fresh connection for range=… (a cached HTTP/2 connection to this origin carries a cancelled stream …)).
  • During sign-in the event log had one net: curl rc=35 — TLS handshake failed and one net: curl rc=28 — timed out before auth: reached … via https://<host>. I did not compare this with a system-libcurl boot on the same
    set, so I'm not claiming they are unrelated to the bundle.

Earlier, on a4d613724: a webOS 10.3 set, generic CURLSTACK=1 debug package, sha256
75d551eb534d34b06df1a848f1315bed64adc92f73690e79731beb4d368805bb, synthetic token against a mock server
(no account).

  • Switch off: bound libcurl-plx.so.4 (libcurl/8.23.0 OpenSSL/3.5.9 …); logged HTTP/3 (experimental) is off — Alt-Svc is not set; no Alt-Svc cache file.
  • Switch on, after a restart: same bind; logged HTTP/3 (experimental) is on — Alt-Svc is set on strict requests; the Alt-Svc cache file was created.
  • Switched back off and verified again.
  • Not observed: HTTP/3 on the wire from this build (no playback was started; see 9aaad044d above for the media
    plane).
  • After the run, the off-state lines were read back verbatim from the debug install's event log on the set.

Earlier head 29f330ad (before the switch existed, so HTTP/3 was always available in the bundle):
webOS 10.3 set, 5 launch/close cycles bound the bundle with legacy-locks=NotNeeded; the reverse proxy's
log showed 43 requests from the set as HTTP/3.0; removing the bundle fell back to the system libcurl
and Home loaded, as did removing one dependency. Carried over, not repeated.

webOS 5.6.2 (OpenSSL 1.0.2 in-process), packages from before the merge and the switch: the
firmware's libcrypto.so.1.0.2/libssl.so.1.0.2 were mapped beside libcrypto-plx.so.3/libssl-plx.so.3;
5 cycles bound libcurl/8.23.0 OpenSSL/3.5.9, reached Home, no crash; a later package logged
legacy-locks=Installed. One boot stayed up more than three minutes and then played video without a
crash. Carried over, not repeated.

Translations

The new row title and help text are in all 12 catalogs. 11 of the 12 are AI drafts pending native review
(docs/localization.md requires it); English is the exception.

Not verified

  • HTTP/3 on the wire from the final head, and playback over HTTP/3.
  • An A9-class CPU (no Crypto Extensions); every device run was on a CPU that has them.
  • webOS 4.x and older (firmware OpenSSL 1.0.x beside the bundle) on the final head.
  • Concurrent firmware use of OpenSSL 1.0.2 while the bundle is active.
  • Whether /etc/ssl/certs holds OpenSSL hash links on every firmware (present on the webOS 10.3 set).
  • The loader and resident-libcurl lookup run only in a glibc http3-curlstack build; host tests cover
    their pure decision functions, the device runs the rest.

build-bench

make build-bench ARGS="--runs 1 --cold", one run each, on main 8e8330ab0 (base) and then 2bea7f310 (head), Apple M1, rustc 1.100.0. The commits after 2bea7f310 touch only CI scripts, tests, docs, .gitignore, one Makefile list entry and one comment, none of which the build compiles. The host was loaded during both runs (the tool warns "these numbers are noisy"), so read the rows against each other, not as absolute times.

Scenario base head
No-op host test build 0.3 s 0.1 s
Edit leaf plx_base, non-incremental 57.1 s 56.9 s
Edit leaf plx_machine 55.5 s 54.2 s
Edit leaf plx_platform 57.2 s 53.0 s
Edit leaf plx_gfx 32.1 s 30.9 s
Edit leaf plx_net 47.4 s 46.7 s
Edit leaf plx_ui 29.3 s 29.1 s
Edit leaf plx_plex 44.7 s 43.6 s
Edit leaf plx_telemetry 40.2 s 39.5 s
Edit leaf plx_data 38.1 s 37.3 s
Edit leaf plx_session 24.4 s 23.9 s
Edit leaf plx_media 29.8 s 28.6 s
Edit leaf plx_appkit 25.1 s 24.2 s
Edit leaf plx_screens 21.7 s 21.2 s
Edit leaf app (coldstart.rs) 12.8 s 12.3 s
Edit hub plx_ui lib.rs, non-incremental 29.4 s 28.7 s
Edit leaf plx_base, incremental 16.0 s 16.3 s
Edit hub plx_ui lib.rs, incremental 6.7 s 7.1 s
Unit suite run (default features) 55.1 s (13563 passed) 55.3 s (13581 passed)
ARM staticlib rebuild (touch lib.rs) skipped 66.8 s

Nothing in the default build got slower beyond noise. The arm row has no base number: the base worktree had no ARM staticlib to rebuild, so the tool skipped it there.

Signed-off-by: fraygox [email protected]

🤖 Generated with Claude Code

fraygox and others added 18 commits November 6, 2026 00:41
Adds GnuTLS, nettle/hogweed, GMP, libtasn1, nghttp2, nghttp3, and ngtcp2
(+ its GnuTLS crypto glue), all cross-compiled for the cortex-a9/armv7/
soft-float/no-NEON baseline via ci/build-curlstack.sh, SONAME-renamed to
this project's existing `-plx` convention, and wired into net.rs/curlio.rs
as the preferred dlopen candidate ahead of the television's system
libcurl 7.53.1 (HTTP/1.1+HTTP/2 only, no QUIC). Falls back to the system
library automatically if the bundle is missing or any dependency fails to
load — net.rs owns the one bundled-vs-system decision via `bundled()`,
and curlio.rs's separate multi table mirrors it rather than deciding on
its own, since an easy handle from one libcurl handed to another's
curl_multi_add_handle would be an ABI violation.

Motivated by a reverse proxy in front of the Plex server advertising
HTTP/3 on its entrypoint, which the television's own libcurl could never
speak.

GnuTLS over OpenSSL: the firmware's own libcurl links its own OpenSSL
1.0.2p unconditionally (`libplayerAPIs.so.1`'s own NEEDED entry pulls it
in at process start regardless of anything this app does), and a second,
newer OpenSSL in the same process corrupts the first's RNG/atfork/
provider state well before any symbol collision theory would predict —
confirmed by a crash that got MORE deterministic after isolating the
bundle's symbols with RTLD_LOCAL, which ruled out ordinary interposition.
GnuTLS has no such global state to collide with.

That system libcurl dependency has a second consequence this stack
works around directly: it is always resident in the process's global
symbol scope before main() runs, so the bundled curl's own internal
self-calls were getting hijacked by the identically-named system curl via
ordinary PLT resolution — a second, independent crash, reproducing at a
fixed file-relative offset inside the system library regardless of which
libcurl our own code successfully resolved its symbols from. Fixed by
loading the bundled curl and its 9 dependencies with RTLD_DEEPBIND
(dynlib.rs's new `open_in_deepbind`/`dlopen_str_deepbind`), so each
library prefers its own dependency chain over the process-wide scope.

Two more fixes were needed before the bundle actually verified anything:

- net.rs's TLS verify-result predicates (date failure, untrusted issuer,
  the plex.direct roots-mode trigger) were written against OpenSSL's
  X509_V_ERR_* enum. GnuTLS reports an entirely different bitmask
  (confirmed against the vendored gnutls.h), so every one of them
  silently misread a real verification failure as not one at all. Each
  now decodes by backend, gated on `bundled()`.
- curl's GnuTLS backend never calls gnutls_certificate_set_x509_system_trust()
  unless CURLOPT_SSL_OPTIONS / CURLSSLOPT_NATIVE_CA is set at runtime, so
  net.rs and curlio.rs now set it on the ordinary (strict) TLS path.
  GnuTLS's own default trust store also points at /etc/ssl/certs as a
  directory rather than the device's stale concatenated
  ca-certificates.crt, which is missing ISRG Root X1 despite the
  individual cert file sitting right next to it.

With connectivity restored, wired up actual HTTP/3 use: CURLOPT_ALTSVC /
CURLOPT_ALTSVC_CTRL with a cache file shared between the control and
media planes, so curl opportunistically upgrades to QUIC once the far
end's Alt-Svc header is seen, rather than staying on HTTP/2 forever.

Also fixes ci/check-package.py's THIRD-PARTY-NOTICES SONAME regex, which
only ever anticipated letters-only library basenames (nghttp2/nghttp3/
ngtcp2 carry digits, libngtcp2_crypto_gnutls an underscore).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

Signed-off-by: fraygox <[email protected]>
The bundled GnuTLS/HTTP/3 curl stack becomes opt-in. A plain `make`,
`make ipk` and CI's cross-build no longer build, link or package it, and
the binary carries no loader for it.

- Makefile: CURLSTACK=1 (only `1` accepted) stages the ten libraries,
  copies licenses/curlstack/*.txt into the package, passes
  `--features http3-curlstack`, writes `+curlstack` into
  pkg/.build-config and uses its own target-curlstack dir. Without it
  every CURLSTACK_* list is empty.
- Cargo: `http3-curlstack` gates only the loader (net::curlstack,
  glibc only) and dynlib::Handle::open_in_deepbind. `libcurl-plx.so.4`
  leaves both candidate lists; net binds it through the new
  `dynlib!` `load_from`, and curlio binds its multi table from the same
  handle (net::bundled_curl). The GnuTLS verify-bitmask decoding
  (keypin::VerifyScheme, now unit-tested), NATIVE_CA and Alt-Svc stay
  compiled and sit behind net::bundled(), which is constant false
  without the feature, so the system-curl path is upstream's.
- check-package: decodes `+curlstack`; THIRD-PARTY-NOTICES' section
  2.8 is marked "(CURLSTACK=1 builds only)", and a package must ship
  all of its libraries and licence texts with the flag and none without.
- ci/dependencies.json: the eight pins stay in the one manifest, now
  `bundled: false` (no release ships them, and `bundled` entries need a
  release-source recipe). The shared deps-cache skips the group
  (new `fetch-all --exclude-group`).
- ci/build-curlstack.sh: a keyed output cache under
  $PLX_BUILD_CACHE/curlstack, modelled on build-ffmpeg.sh's.
- ci.yml: a cross-build-curlstack job running the same artifact gates
  with the flag. It caches the script's tree, has its own 30 min budget
  and is not waited on by any required check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
ci/test_deps_update.py requires every github-release entry to round-trip
its pinned version through tag_pattern and tag_format; their tags are
v-prefixed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
… gates

The cargo feature now rides RUST_FEATFLAGS (tools/build-bench.py mirrors
the staticlib line), with the stamp's features field taken without it
(RUST_CFG_FEATFLAGS). The Alt-Svc cache path drops its /tmp literal
fallback (check-deps tmppath) and names its file through a constant.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
libcurl-plx.so.4 was opened RTLD_GLOBAL, and glibc's RTLD_GLOBAL adds
the opened object's whole search list to the global scope: GMP, Nettle,
Hogweed, libtasn1 and GnuTLS with it. Every gated firmware ships its own
older libgnutls.so.28, libnettle.so.4, libhogweed.so.2 and libgmp.so.3
(libtasn1.so.6 through 7.4.0), so a firmware library dlopen'd later could
bind its unversioned references to this stack's newer ABIs. The curl and
multi tables dlsym through the returned handle, so nothing needs the
stack to be global: open_in_deepbind now always uses RTLD_NOW |
RTLD_DEEPBIND | RTLD_LOCAL, and the Scope enum is gone.

The loader and open_in_deepbind are gated on target_env = "gnu" as well
as linux, since RTLD_DEEPBIND is glibc's. The doc comments now name the
TV's libcurl by release (libplayerAPIs.so.1 NEEDs libcurl.so.5 through
4.10.0 and libcurl.so.4 from 5.3.1, read from the firmware inventory),
and say the two-worker crash's cause was not determined; the explicit
gnutls_global_init call is kept but is only a refcount bump on GnuTLS
3.3 and later.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
- agent-reference, curlio.rs: curlio binds its multi table from net.rs's
  bundled handle when there is one and from the system candidate list
  otherwise; it never makes the choice itself. The dynlib caller count
  is replaced by the git grep that lists them (it had already missed
  platform/src/playback_trace.rs).
- agent-reference: the TV's libcurl by release, and RTLD_LOCAL's reason.
- THIRD-PARTY-NOTICES 2.8: quote the real curl and GnuTLS configure
  flags and the protocol and feature lists curl-config reports for the
  built library (no --disable-guile; libz is the TV's own); drop the
  "only GET" claim; add nghttp2/nghttp3/ngtcp2 copyright holders, the
  libunistring code GnuTLS compiles in, and where the GPL-3.0 text that
  LGPL-3.0 incorporates is shipped (LICENSE, in every package).
- build-curlstack.sh: the strict path sets no CAINFO (NATIVE_CA plus
  GnuTLS's default trust-store dir); drop a stale libssl-plx reference.
- ci.yml: the curlstack cache restore is ~4 MB (zstd), not ~1 MB.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
The opt-in CURLSTACK=1 bundle now builds curl 8.23 over OpenSSL 3.5.9
(libcrypto-plx.so.3, libssl-plx.so.3) with ngtcp2's crypto_ossl glue,
replacing GnuTLS, Nettle/Hogweed, libtasn1 and GMP. OpenSSL's linux-armv4
assembly carries ARMv8 Crypto Extension paths for AArch32 (AES, PMULL,
SHA-1, SHA-256), chosen at run time from OPENSSL_armcap_P; Nettle has no
such paths on 32-bit ARM.

The -plx names come from OpenSSL's own shlib_variant, so the symbol-version
needs name the bundled files rather than a firmware libcrypto.so.3. Its
config and module directories point at a path no television has, the
default provider is built in (no-module), and curl takes its trust anchors
from the television's hashed /etc/ssl/certs through --with-ca-path.
libcrypto is linked --as-needed, which drops the NEEDED libatomic.so.1
that linux-latomic adds and that four supported firmwares do not ship.

Every library is still opened RTLD_DEEPBIND | RTLD_LOCAL. The verify-result
numbering in keypin now follows the TLS library the bound curl reports
(curl_version_info()->ssl_version, net::tls_backend) instead of whether
the bundled curl was bound.

Notices: OpenSSL is Apache-2.0; the LGPL-3.0 text only GMP and Nettle
needed is gone from licenses/curlstack/.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nuTLS

TlsBackend::from_ssl_version took the first word with its parentheses
stripped, so a MultiSSL curl's "(SecureTransport) LibreSSL/3.3.6" read as
Other; curl marks every backend NOT in use with parentheses, so the one
in use is the word without them. The new tls_backend_tests fail on the
old parse.

CURLSSLOPT_NATIVE_CA followed bundled(), which now means OpenSSL: there
it loads no anchors on Linux and only turns off curl's shared CA-store
cache. It now follows the reported TLS library (net::native_ca_needed),
like the verify-result numbering, in both net.rs and curlio.rs; Alt-Svc
stays behind bundled(). A test maps the same verify results through each
backend's scheme.

Comments, notices and docs describe the OpenSSL stack as it is built:
how it is kept apart from the television's OpenSSL, the firmware's
libcrypto names in the RTLD_LOCAL rationale, OpenSSL's tag, copyright
and the config target the build adds, the CI job's tool list (no m4)
and counts, and a test that the pins, the script and the Makefile name
the same five-library stack.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
One conflict, the app's link line in the Makefile: upstream added
$(EXIT_INTERPOSER_LDFLAG) and this branch $(CURLSTACK_STAGED) as a
prerequisite; both are kept.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
install_sw installs libcrypto.a and libssl.a, which nothing links: ngtcp2
is handed the shared files by name and curl's -lssl -lcrypto resolve
through the .so links. They were 11 MB of the keyed cache tree; without
them it is 4.8 MB as zstd. The CI job's comment now carries this tree's
measurements (168 s cold on an 8-core M1), and the Makefile no longer
names 7.53.1 as the television's libcurl, which is newer on later
firmware.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…op GnuTLS paths

net::global_init decided OpenSSL 1.0's lock callbacks from the BOUND
curl's version string alone. With the bundle bound that string says
OpenSSL/3.5.9, so a CURLSTACK=1 build never installed the callbacks a
default build installs on the firmware's libcrypto 1.0.x, which stays in
the process through libplayerAPIs.so.1's NEEDED on the system libcurl
(webOS 5 and older). legacy_lock_target now also weighs that resident
libcurl, found with RTLD_NOLOAD and read through its own curl_version(),
and setup_legacy_crypto_locks takes the handle whose OpenSSL needs them.
legacy_locks_go_on_the_televisions_openssl_even_with_the_bundle_bound
failed against the old choice (left None, right Some("libcurl.so.4"))
and passes now.

Every curl this branch binds is OpenSSL (firmware 1.0.x to 3.x, the
bundle's 3.5), so the GnuTLS verify-result bitmask in keypin, the
CURLSSLOPT_NATIVE_CA option it needed, and the TlsBackend detection that
chose between them were unreachable. They are removed, and keypin's
predicates are main's again; the net.rs module doc now says how the
bundled curl is chosen.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ci/check-curlstack-elf.sh checks each of the seven -plx libraries the way
check-elf.sh checks the binary: ELF32/ARM/soft-float, Tag_CPU_arch v7 and
no CP15 barrier, with a live-disassembly control. OpenSSL's ARMv8 Crypto
Extension code is emitted as raw words behind armcap and keeps the v7
attributes, so no allowance is needed. It also fails on an `exit` import:
the libraries are opened RTLD_DEEPBIND, which would bind that `exit` to
libc ahead of the app's interposer (noted beside EXIT_INTERPOSER_LDFLAG).
None imports it today. The cross-build-curlstack job runs it, and a
workflow test pins that.

The release guard's comment and a CI test comment no longer give the
LGPL source-bundle reason: CURLSTACK=1 is a developer build no release
ships, and its licences carry no source obligation.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ci/test_ci_timeouts.py flags any line with a bare `curl ` lacking
--max-time, and the new step's name "Bundled curl stack ELF assertions"
was one. It is "Bundled curl-stack ELF assertions" now.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
THIRD-PARTY-NOTICES §2.8, against the shipped package and
ci/build-curlstack.sh:

- OpenSSL's copyright is its README's two lines, 1998-2026 The OpenSSL
  Project Authors and 1995-1998 Eric A. Young, Tim J. Hudson, not a
  merged 1995-2026 line.
- OpenSSL's configure target is linux-armv4-plx, and the flag list now
  includes no-fuzz-afl and no-fuzz-libfuzzer.
- Restore curl's enabled protocols and features as curl-config reports
  them for the built library (FTP/FTPS among them).
- The firmware libcurl is not one pinned 7.53.1: it is 7.53.1 on the
  oldest sets and 7.82.0 on webOS 10, and none has HTTP/3.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fraygox

fraygox commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Additional benefit of this, with updating TVs being out of the question in many cases, vendoring OpenSSL helps close up that hole, at least when connecting to plex and any other network dependencies within the app of course.

@GLinnik21 GLinnik21 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!

I’d use what Plex Media Server officially supports as our baseline for feature parity. Plex doesn’t document native HTTP/3 support, so I’d treat it as an optional enhancement for reverse-proxy setups. I’m open to supporting it if it makes a measurable difference for remote users.

I’m fine with splitting the work by layer. For this PR, a small transport-level benchmark is enough to make the case. For example, use a standalone test on the TV to request the same video byte ranges through the same proxy, with the same curl build forced to HTTP/2 and then HTTP/3. On a realistic remote connection, is there a meaningful difference in time to first byte, sustained throughput, or pauses in data delivery?

That gives us something concrete to evaluate before taking on the extra stack upstream. Player integration can be a separate PR. I’d also evaluate shipping a maintained curl/OpenSSL for older TVs on its own merits.

fraygox and others added 2 commits November 7, 2026 23:39
main moved the HTTPS range transport into plx_net::range_io (the file is
rust-modules/net/src/curlio.rs; media's curlio.rs is now a Plex
authorization adapter) and made the playback backends explicit features
(PLAYBACK_BACKENDS). Resolved so both hold:

- curlio: the curl_multi_* table's bind from net::bundled_curl()
  (load_from) and the strict-path Alt-Svc options move to
  plx_net's curlio.rs; media/src/curlio.rs is main's.
- Makefile: CURLSTACK_FEATFLAG is appended to main's RUST_FEATFLAGS and
  -curlstack to main's RUST_TDIR, so RUST_CFG_FEATFLAGS still strips it
  and the stamp's feature field is the plain configuration's;
  print-curlstack-staged joins print-playback-config in QUERY_GOALS.
- check-package: main's per-backend stamp cases plus the +curlstack
  ones in the new flag format.
- rust_toolchain.featflags pins CURLSTACK= like LAB= and RC=: run from
  inside `make CURLSTACK=1 ipk` it inherited CURLSTACK=1, derived a
  table with --features http3-curlstack that no stamp carries, and
  every CURLSTACK=1 package would have decoded as None. Tests added in
  ci/test_arm_profile.py.
- Comments that said every build links libplayerAPIs.so.1 now say
  every Feed build does (a PLAYBACK_BACKENDS=uri build does not).
- docs/agent-reference.md: main's paths with the branch's wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
RUST_CFG_FEATFLAGS was defined after the parse-time stamp write, so
pkg/.build-config's features field expanded empty in every build
("features:+tel:..."). The old decoder read an empty field as a dev
build, which hid it (a RELEASE=1 stamp decoded as dev too); main's
decoder reads the Makefile's real flag strings and decoded every stamp
as None, which ci/test_arm_profile.py caught. The validation,
CURLSTACK_FEATFLAG and RUST_CFG_FEATFLAGS now sit beside
RUST_FEATFLAGS.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
fraygox and others added 4 commits November 9, 2026 00:01
…stack at run time

Settings > System > HTTP/3 (experimental) is a new install-wide preference,
`http3_experimental`, default off. Boot reads it from the session it already
loads before the window and hands it to `net::global_init_with`
(`CurlStack::from_setting`). Off, `global_init` never looks for the bundled
stack (no stat, no dlopen) and binds the television's own libcurl exactly as a
build without the bundle does, so `bundled()` stays false and no request sets
Alt-Svc; it is not the bundled curl with HTTP/3 disabled, which would move
older firmware from HTTP/1.1 to curl 8.23's HTTP/2 default. On is the previous
behaviour of this branch: the bundle first, the system libcurl as fallback.
The process binds once (the first `global_init_with` call wins), so a change
applies at the next launch and never rebinds curl under a running session.

The Settings row is a switch in the System section, signed in only, and only in
a build that carries the loader (`net::BUNDLED_STACK_BUILT`, a compile-time
fact: the http3-curlstack feature on glibc, which `make CURLSTACK=1` packages
only with all seven libraries). It writes through `PreferenceCmd::Http3` on the
storage worker and shows the pick until the write answers. A sign-out does not
retain it. New strings in every catalog; the translations are drafted and need
native review.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
- The Settings root keeps the switch out of its state and canon wherever the
  row is not offered, so a stored on from a stack build does not change a
  non-stack build's root digest (`offers_http3`, with a test).
- A source-scan test pins `global_init_once` to `bind_curl(stack,
  load_bundled, ...)` with the loader passed uncalled, so the off rule cannot
  be bypassed by the caller.
- `Scope::Install` now says what a sign-out keeps: the key is never cleared as
  account data, but a signed-out read carries only the language and the
  resolution; the HTTP/3 row names itself as such a key.
- A DB8 sign-out test: `ClearTenure` keeps `http3_experimental: true` stored,
  the Cleared read reports it off, a PublicOnly write from Cleared is refused,
  and the next sign-in's write drops the key.
- The detail sentence says "may be slower on networks with packet loss" and
  "Applies after restarting." like the resolution row, in every catalog
  (translations drafted, still need native review).
- Comments and docs that said `global_init` or that a CURLSTACK=1 build always
  prefers the bundle now name `global_init_with`, its first call, and the
  setting (net.rs, curlio.rs, Makefile, agent-reference, THIRD-PARTY-NOTICES).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
…s binds the bundle

The owner's call: switching libraries behind the HTTP/3 toggle would be
confusing. A CURLSTACK=1 build binds the bundled curl stack whenever it is
there (bundle first, system fallback, as the PR first had it), and Settings >
System > HTTP/3 (experimental) decides only HTTP/3.

- `net::set_http3` installs the stored switch once, before `net::global_init`
  (boot reads it from the session it already loads); `net::alt_svc()` is the one
  answer both planes ask (the bundle bound AND the switch on) before setting
  CURLOPT_ALTSVC/_CTRL. Off, no request sets Alt-Svc and the bundled curl
  negotiates its default (HTTP/2 over ALPN). `CurlStack`, `global_init_with` and
  `bind_curl` are gone; the bind is the build's alone again.
- The bind log is followed by `net: HTTP/3 (experimental) is off — Alt-Svc is
  not set` (or `is on — Alt-Svc is set on strict requests`) when the bundle is
  bound.
- Tests: the Alt-Svc rule (failed against the bundled()-only rule first), a
  source scan that both planes' Alt-Svc sites ask `alt_svc()` and that the bind
  does not read the switch, the install-once rule, and boot's order (session
  read, switch, bind).
- Help text: "Uses HTTP/3 with servers that offer it. Experimental: may be
  slower on networks with packet loss. Applies after restarting." in all 12
  catalogs (11 drafted, need native review). Docs, notices and comments say the
  bundle is used in every CURLSTACK=1 build and the switch gates only HTTP/3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
- The scan now tokenises every production `.rs` file under rust-modules
  (comments, literals and `#[cfg(test)]` items removed, newline-insensitive),
  counts every `CURLOPT_ALTSVC` and `CURLOPT_ALTSVC_CTRL` use (constant
  definitions excluded), requires exactly the two known sites (net.rs and
  curlio.rs, two uses each), and requires the innermost enclosing `if` to be
  `alt_svc()` itself or end in `&& …alt_svc()`. `CURLOPT_ALTSVC` alone already
  enables h3 (curl's `Curl_altsvc_init` defaults to H1|H2|H3), so it counts too.
  A scanner test proves it by mutation: an unguarded or rustfmt-wrapped site,
  `!alt_svc()`, `bundled()`, `||` and a guard that closed before the site each
  fail.
- The install-once test is renamed to what it proves
  (`a_later_install_changes_nothing`) and installs the default, off, so the rest
  of the test process reads off.
- Comment fixes: a Linux glibc host with `http3-curlstack` does carry the loader;
  a sign-out turns Alt-Svc off from the NEXT launch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
@fraygox

fraygox commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, agreed on PMS parity as the baseline: HTTP/3 is only an enhancement for reverse-proxy setups. Below is the transport benchmark you suggested, shaped around how the app actually uses curl.

Setup

  • Client: a wired webOS 5.6.2 set (Cortex-A55). A small client binary drives libcurl through dlopen, so the same code exercises each library. It reproduces the media plane:

    • curlio's curl options;
    • the Auto remote pre-check (1 s of source bitrate);
    • one multi, with a fresh easy and an open-ended bytes=N- range per seek;
    • the Matroska first seek (Cues read, seek-back, target);
    • the feed buffer cap (1.6 s plus 10.375 MiB), and a start/resume threshold of 0.7 s buffered.

    Each run is a 60 s session at a constant media bitrate, with seeks at 15, 30 and 45 s.

  • Server: Traefik v3.7.17 (default http3) in Docker on a datacenter VPS about 10 ms from the set, reverse-proxying to an HTTP/1.1 origin. Delay and loss are added with netem on the proxy's egress.

  • Baseline: today's app on that set. The firmware libcurl is 7.61.0, which defaults to HTTP/1.1 because the app never sets CURLOPT_HTTP_VERSION (the default became HTTP/2 in 7.62.0). The shipping app's own requests from that set reach the proxy as HTTP/1.1.

  • Statistics: paired by round, with 5 to 8 interleaved rounds per cell and the arm order rotated. Values are median ratios against the baseline with a 95% bootstrap CI. All 399 runs completed; none were excluded.

What you asked: the same curl, HTTP/2 vs HTTP/3, through the same proxy (the bundled curl 8.23 forced to HTTP/2, against the bundled curl through Alt-Svc, where every playback transfer ran over HTTP/3). Medians of 8 rounds:

Path Bitrate Start, h2 → h3 Seek to resume, h2 → h3 Stall time per 60 s, h2 → h3 Refill rate, h2 → h3
No added latency (~10 ms) 8 Mbit/s 139 → 107 ms 431 → 103 ms 0 → 0 s 163 → 145 Mbit/s
20 Mbit/s 229 → 198 ms 544 → 200 ms 0 → 0 s 208 → 177 Mbit/s
+50 ms, 1% loss 8 Mbit/s 909 → 1230 ms 6.0 → 1.4 s 26.4 → 23.8 s 2.8 → 4.4 Mbit/s
20 Mbit/s 3754 → 1093 ms 6.7 → 3.7 s 33.2 → 36.2 s 3.0 → 4.8 Mbit/s
  • The refill rate is bytes per second while the client reads below its buffer cap. It is not link capacity, but it compares fairly across arms.
  • At low latency, HTTP/3 refills far above any media bitrate.
  • At +50 ms with no loss, HTTP/3 refills at 41 to 56 Mbit/s against 130 to 222 Mbit/s for TCP, which is less headroom but no stalls at up to 40 Mbit/s.
  • With 1% loss at 50 ms, no arm can carry these bitrates.

PR #1270's path vs today (bundled curl, opportunistic HTTP/3 through Alt-Svc, exactly as the PR sets it):

Path Start Seek to resume Stalls Client CPU per MB
No loss, 10 ms 0.74x / 0.85x / 0.92x at 8 / 20 / 40 Mbit/s 0.66x / 0.83x / 0.84x none in any arm 2.2x to 2.9x
No loss, +50 ms 0.66x / 0.69x / 0.88x 0.71x / 0.91x / 0.87x none in any arm 3.0x to 3.9x
0.5% to 1% loss, +50 to +100 ms no significant change 1.2x to 2.7x slower (CI excludes 1 in 4 of 8 cells) no significant change 3.5x to 4.2x

On clean paths, start is 8 to 34% faster and seeks 9 to 34% faster. Under loss there is no gain, and seeks get slower. In absolute terms the CPU cost is about 2 percentage points of one core at 8 Mbit/s and about 10 points at 40 Mbit/s. It has not been measured on a CPU without the ARMv8 crypto extensions.

The most likely cause of the loss result is the proxy's QUIC congestion control, not the client. This is not proven by a controlled test:

  • quic-go (Traefik 3.7.17 bundles v0.64.1) always constructs its sender with Reno (sent_packet_handler.go: true, // use Reno). Reno recovers from loss more slowly than the Linux TCP CUBIC that the HTTP/1.1 and HTTP/2 arms ran on.
  • On a Wi-Fi set, a full-speed transfer from a production QUIC edge reached 46 Mbit/s over HTTP/3 against 51 Mbit/s over HTTP/2.

Two findings that don't depend on HTTP/3

  • HTTP/2 seeks are slower than HTTP/1.1. With the firmware curl asked for HTTP/2 (what sets with curl 7.62 or newer do by default), seek to resume is 2.98x slower at 8 Mbit/s [2.91, 3.52] and 2.24x slower at 20 Mbit/s. The seek's new stream waits behind the megabytes the server has already queued in its TCP send buffer for the cancelled stream. A reproduction with ss and a packet capture shows 2670 to 3378 KB not yet sent at each seek. New data reached the wire 236 to 299 ms later, against 227 to 287 ms predicted from the queued bytes divided by the link rate. The stock Linux tcp_wmem shows it too.

  • The fixes:

    • CURLOPT_FRESH_CONNECT on seek requests made over HTTP/2: 1.00x [0.79, 1.02] at 8 Mbit/s and 1.38x [1.01, 1.89] at 20 Mbit/s, with 12 to 17% less client CPU.
    • On the server side, tcp_notsent_lowat=16384: HTTP/2 seeks reach 0.58x to 0.70x of the HTTP/1.1 baseline, on par with HTTP/3.

    The client-side fix is Net: a seek that cancels an HTTP/2 transfer dials a fresh connection #1289. It helps every firmware whose curl already negotiates HTTP/2, with no new stack.

Proposal for this PR

  • The build gate: the stack stays behind CURLSTACK=1. A build without it is unchanged from main. Whether release packages ship the stack (about 7.6 MB, plus keeping OpenSSL current) stays your call.
  • A CURLSTACK=1 build always uses the bundled curl/OpenSSL, falling back to the system libcurl if the bundle cannot load. That gives the older sets a current TLS stack (OpenSSL 3.5.9 in place of the firmware's 1.0.2), separately from HTTP/3.
  • HTTP/3 is a separate switch: an HTTP/3 (experimental) setting, off by default, that takes effect after a restart and only decides whether Alt-Svc is set.
  • What off means: the bundled curl uses HTTP/2, or HTTP/1.1 where the server only speaks that.
  • Why the two PRs belong together: the bundled curl defaults to HTTP/2, so on sets whose firmware curl uses HTTP/1.1 today this changes the protocol. That is why the HTTP/2 seek fix above should land with or before this PR.
  • Splitting by layer, as you suggested: this PR currently carries both the transport (the stack, its loader and the bind) and the switch with its Alt-Svc wiring. If you'd rather keep it to the transport, I can move the Settings switch and the Alt-Svc wiring into a follow-up PR.

Not covered:

  • a CPU without crypto extensions (an A9-class set);
  • a QUIC server other than quic-go under loss;
  • frame-level playback, since the client models the media plane rather than running the player.

The client, runner, analysis script (with a self-test) and raw JSON are available if you want to reproduce or extend it.

Brings in main through 8e486d1 (Playback engine opt-in, WebSocket codec,
Magic Remote Back fix, Under posters ask, default version, Opus sizing).

Conflicts:
- plex session prefs_tests: main added UriEnginePref as the twenty-first
  Setting row and this branch added Http3Pref; both rows are checked and
  the table now lists twenty-two Setting rows.
- screens settings RootPage::new: keep this branch's pending_http3 and
  offers_http3 fields beside main's new under_ask field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: fraygox <[email protected]>
@fraygox

fraygox commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@GLinnik21 for your review when you get some time, thank you!

fraygox and others added 4 commits November 9, 2026 20:15
Conflict: docs/agent-reference.md, the dynlib callers paragraph. Both
sides dropped the old caller count; kept this branch's wording (it
excludes dynlib.rs from the grep) and main's new `net::connect_only`
sentence.

Semantic fix the merge needs: main's plxnative#1283 added `net::connect_only`,
a third libcurl table bound with `raw::load(None)`, i.e. always the
system candidates. Its easy handle comes from `net::curl_easy_init`,
which in a CURLSTACK=1 build is the bundled libcurl-plx.so.4, so
curl_easy_send/recv/getinfo from the system library would be handed a
handle from another libcurl. The table now binds from
`net::bundled_curl()` when it is Some, as curlio's multi table does;
the agent-reference and curlstack module docs say so.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…busy mark

Review of the main merge (Fable 5.2):

- A source scan pins every libcurl dynlib! table outside net.rs (curlio,
  connect_only) and requires each to bind from net::bundled_curl() with
  load_from, so a revert of the merge's connect_only fix, or a new table
  bound from the system candidates, fails a host test. Nothing else can
  catch it: the host tests never bind the bundle.
- plxnative#1289's busy mark met this branch's Alt-Svc: after a cancelled h2
  transfer, an origin that moves to HTTP/3 kept dialling fresh QUIC
  connections for the whole 120 s window. ConnLedger::saw_version now ends
  the mark on an HTTP/3 answer (Alt-Svc routes the origin to QUIC, which
  never matches the busy TCP connection); an HTTP/1.1 answer still keeps
  it, since it can come from a fresh connection while the busy one is
  cached.
- Docs that named only curlio's multi table as reading bundled_curl now
  name connect_only's too.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
`make CURLSTACK=1 deploy` failed at its last step with
`/bin/sh: -c: ... unexpected EOF`. The command that retires curl-stack
libraries this build no longer carries sat inside
`$(if $(CURLSTACK),...)`, and make counts parentheses in a function's
arguments: the first `case` pattern's `)` ended the `$(if`, and the
shell got half a command. It has been so since f75f1eb put the stack
behind CURLSTACK=1; no gate runs `deploy`, and the device runs installed
a packaged .ipk.

The command is now CURLSTACK_PRUNE, which make does not parse for
parentheses. print-curlstack-prune echoes it, and
ci/test_deploy_manifest.py has `sh -n` parse the command and the remote
script inside it, and checks every staged library is kept. Against the
old inline text the query itself fails the same way the deploy did.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cribed

The module doc and BUSY_FOR's doc still said every request dials fresh
for the whole window; since the last commit an HTTP/3 answer ends the
mark early (ConnLedger::saw_version). Doc only.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fraygox

fraygox commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

Updated to 9aaad044d: main merged in, plus three follow-ups. The description is revised (Since the last revision, Gates, Device verification, build-bench).

  • The merge needed one semantic fix. main's net::connect_only (Net: the WebSocket transport over libcurl CONNECT_ONLY #1283) binds its curl_easy_send/curl_easy_recv table from the system candidates, but its easy handle comes from net::curl_easy_init, which is the bundle in a CURLSTACK=1 build. It now binds from net::bundled_curl() as curlio does. A source scan pins every libcurl dynlib! table outside net.rs to that, so a fourth one can't quietly bind the system library.
  • Net: a seek that cancels an HTTP/2 transfer dials a fresh connection #1289 meets Alt-Svc: an HTTP/3 answer now ends Net: a seek that cancels an HTTP/2 transfer dials a fresh connection #1289's busy mark (ConnLedger::saw_version). Otherwise an origin moved to QUIC would dial a fresh QUIC connection on every request for 120 s after a seek.
  • make CURLSTACK=1 deploy was broken since f75f1eb55. The stale-stack prune sat inside $(if $(CURLSTACK),...), make took the case pattern's ) as the end of the $(if, and the shell got half a command. No gate runs deploy, and the device runs so far installed the .ipk, so nothing caught it. It's now a variable, with a test in ci/test_deploy_manifest.py that sh -n-parses the expanded command.
  • On the device: with that fixed, a CURLSTACK=1 deploy to a webOS 10.3 set shows the media plane on the bundle for the first time (curlio: bound libcurl-plx.so.4 curl_multi_* (7 symbols)), with playback, a seek, and Net: a seek that cancels an HTTP/2 transfer dials a fresh connection #1289's fresh-dial rule firing on the bundle's HTTP/2.
  • build-bench is in the description. Nothing in the default build got slower. The host was loaded, so the times are noisy. The head's 14 s no-op is the benchmark's own arm row touching lib.rs before the next round's no-op, not this branch (details there; happy to send a fix to tools/build-bench.py separately if you'd like).

Copy link
Copy Markdown
Collaborator

Thanks for running the benchmark. The faster seeks on clean connections are promising. I’m still hesitant to take on the extra stack for HTTP/3, since the tests don’t show a consistent reduction in buffering on lossy connections.

Could you rerun the same transport benchmark with the HTTP/2 seek fix from #1289 in place? I’d like to see how much of the seek improvement remains against current main. The same test client is enough for that comparison.

…tion

With the bundled curl, a seek still took 1.7x as long as over HTTP/1.1
under plxnative#1289's rule (254 against 148 ms to resume, 8 Mbit/s, ~10 ms from
Traefik, webOS 5.6.2 set; that set's firmware 7.61 asked for HTTP/2
under the same rule: 152 ms). Every request after a seek already dials
fresh, but up to four abandoned connections stayed open beside the new
one.

A bundled media transfer to an origin last heard over HTTP/2, or not yet
heard from while Alt-Svc cannot route it to QUIC, is now set
CURLOPT_FORBID_REUSE before it enters the multi (setting it on a transfer
in progress is undefined per curl_easy_setopt), so its connection closes
with it: 136 ms in the same runs, 0.92x HTTP/1.1. stop() then records no
busy connection for it. Firmware libcurls, HTTP/1.1, HTTP/3, an
unknown origin with Alt-Svc on, and a source reopened for HLS (its
playlist and segment requests finish cleanly, and plxnative#1289's mark still
covers its cancels) are unchanged. A redirect hop the rule chose closes
its connection too, so its next hop dials its own.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fraygox

fraygox commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

@GLinnik21 I reran the benchmark against current main (#1289 merged), using the same client and server, plus a second proxy to check the lossy results. In short:

  • Clean paths: HTTP/3 still seeks 5–36% faster than main on HTTP/1.1 firmware, and 10–42% faster than main on HTTP/2 firmware with Net: a seek that cancels an HTTP/2 transfer dials a fresh connection #1289. Startup is 14–38% faster. The gain is largest at short RTT and low bitrate.
  • Lossy paths: you were right that HTTP/3 doesn't reduce buffering by itself. Stalls depend on the proxy's congestion control. With TCP and QUIC both on BBR, no protocol stalled at 0.5% or 1% loss, and HTTP/3 still seeked faster (0.67x and 0.79x main).
  • A regression in this PR, now fixed: with the switch off, the bundled curl over HTTP/2 seeked 1.7x slower than main, even with Net: a seek that cancels an HTTP/2 transfer dials a fresh connection #1289. The new commit bfe0f60f closes the connection a seek abandons, which brings it to 0.92x main.

Setup

The setup is the same as in the first benchmark:

  • Client: a wired webOS 5.6.2 set. The test client drives each libcurl through dlopen.
  • Server: Traefik v3.7.17 about 10 ms away, with netem on the proxy's egress.
  • Sessions: 60 s each, with seeks at 15, 30 and 45 s.
  • Statistics: paired rounds with rotated arm order. Ratios are paired medians against the baseline with 95% bootstrap CIs.

The client now models #1289's rule as ConnLedger implements it. A detached, unfinished HTTP/2 transfer marks the origin busy. Requests then dial fresh for 120 s. An HTTP/3 answer ends the mark.

Arm What it stands for
sys main on this set: firmware curl 7.61, HTTP/1.1
sysh2fc main with #1289 on firmware whose curl defaults to HTTP/2 (7.62+). This is the firmware curl asked for HTTP/2, with a fresh connection for each seek request. I couldn't run a real 7.82 firmware curl on this set, because its glibc is too old.
h2fc this PR with the switch off, against an HTTP/2 proxy (bundled curl, #1289 rule)
altfc this PR with HTTP/3 on (Alt-Svc, #1289 rule)

Clean path: Traefik, no loss, 8 rounds per cell

Seek to resume is the median per run in ms. Ratios are paired, with 95% CIs.

Path main, HTTP/1.1 fw main, HTTP/2 fw HTTP/3 HTTP/3 vs HTTP/1.1 fw HTTP/3 vs HTTP/2 fw
~10 ms, 8 Mbit/s 146 159 94 0.64 [0.62–0.67] 0.58 [0.34–0.64]
~10 ms, 20 Mbit/s 238 244 190 0.80 [0.75–0.85] 0.79 [0.73–0.82]
+50 ms, 8 Mbit/s 587 627 485 0.82 [0.79–0.88] 0.75 [0.46–0.82]
+50 ms, 20 Mbit/s 699 734 667 0.95 [0.83–0.99] 0.90 [0.77–0.95]
  • Startup: HTTP/3 is 0.66–0.86x main on HTTP/1.1 firmware and 0.62–0.81x on HTTP/2 firmware. It was lower in every round.
  • CPU: HTTP/3 costs the client 2.4–3.3x the CPU time per session.

Lossy paths: +50 ms, 8 Mbit/s, 8 rounds per cell

Each cell shows stall time per 60 s, then the median seek to resume. The HTTP/2 column is this PR with the switch off, measured before bfe0f60f.

Proxy (QUIC / TCP congestion control) Loss main (HTTP/1.1) PR, switch off (HTTP/2) HTTP/3
Traefik (quic-go Reno / CUBIC) 1% 24.7 s · 1063 ms 28.6 s · 898 ms 19.0 s · 1479 ms
HAProxy 3.2 (CUBIC / CUBIC) 0.5% 8.9 s · 839 ms 10.5 s · 653 ms 18.6 s · 1732 ms
HAProxy 3.2 (CUBIC / CUBIC) 1% 24.0 s · 933 ms 25.7 s · 1128 ms 32.1 s · 2213 ms
HAProxy 3.2 (BBR / CUBIC) 0.5% 9.1 s · 820 ms 9.8 s · 597 ms 0 s · 478 ms
HAProxy 3.2 (BBR / CUBIC) 1% 27.6 s · 925 ms 25.5 s · 737 ms 0 s · 523 ms
HAProxy 3.2 (BBR / BBR) 0.5% 0 s · 699 ms 0 s · 646 ms 0 s · 470 ms
HAProxy 3.2 (BBR / BBR) 1% 0 s · 689 ms 0 s · 653 ms 0 s · 537 ms
  • Reno or CUBIC on QUIC: HTTP/3 stalls about as much as TCP, or more, and seeks slower under loss. This matches what you saw in the first benchmark.

  • BBR on QUIC only: HTTP/3 doesn't stall, but TCP still does. The last two rows are the control for this: with TCP on BBR too, every protocol stops stalling. So the zero stalls come from BBR, not from HTTP/3.

  • BBR on both: HTTP/3 still seeks faster than main:

    • at 0.5% loss: 0.67x [0.59–0.73], lower in all 8 rounds;
    • at 1% loss: 0.79x [0.69–0.94], lower in all 8 rounds.

    It also starts faster: 0.87x and 0.83x.

  • At 20 Mbit/s with 1% loss, every variant stalled for 37–42 s per minute on Traefik, so that link can't carry the stream with any protocol.

Regression found in this PR, fixed in bfe0f60f

With the switch off, this PR moves an HTTP/1.1-firmware set's media onto the bundled curl. That curl negotiates HTTP/2 with an HTTP/2 proxy. Even under #1289's rule, its seeks were 1.36–1.74x main's on the clean cells (253 against 146 ms at ~10 ms and 8 Mbit/s). Firmware 7.61 asked for HTTP/2 under the same rule had no such slowdown (159 ms).

I counted established sockets to the proxy around each detach:

  • Bundled curl: kept up to four abandoned connections open next to the new one.
  • Firmware 7.61: also kept them, without the slowdown. I haven't established why the bundled curl's leftover connections cost more.

The fix: a bundled media transfer is now set CURLOPT_FORBID_REUSE before it enters the multi, so its connection closes when the transfer does. This applies when:

  • the origin was last heard over HTTP/2; or
  • the origin hasn't been heard from yet and Alt-Svc can't route the handle to QUIC.

stop() then records no busy connection for that handle.

These are unchanged:

A redirect hop the rule chose also closes its connection, which costs that chain's next hop a dial.

Clean, ~10 ms, 8 Mbit/s, 5 paired rounds Seek to resume vs main Start
main (sys) 148 ms — 144 ms
switch off, before 255 ms 1.71x [1.69–1.76] 139 ms
switch off, bfe0f60f rule 136 ms 0.92x [0.89–0.94], lower in 5/5 rounds 138 ms

Two alternatives I measured and rejected:

  • Setting FORBID_REUSE at detach instead: this measured the same (137 ms), but curl_easy_setopt on a transfer in progress is documented as undefined behaviour.
  • CURLMOPT_MAXCONNECTS=1 on the multi: this made seeks worse (447 ms).

Not measured: whether main on firmware with curl 7.62+, which uses HTTP/2 by default, has the same problem. If it does, the same rule could cover firmware curls in a separate PR.

Checked on a device, 7040caec: the webOS 5.6.2 set, with make CURLSTACK=1 deploy, the switch off, and a direct play through our HTTPS reverse proxy.

  • Boot: it bound libcurl-plx.so.4 (libcurl/8.23.0 …) and logged HTTP/3 (experimental) is off.
  • Protocol: the proxy logged all 6 media-part requests as HTTP/2.0.
  • Connections: the app held one established connection through playback and two seeks. Each seek reopened in 19–20 ms (ff: seek_cb reopen … ms=19), and no fresh connection line was logged.

Gates on 7040caec:

  • make check: 127 steps, all ok.
  • make check-nodef: exit 0.
  • http3-curlstack feature tests: 237, 1974 and 342 passed.
  • Flag-off and CURLSTACK=1 release IPKs: packaging and ELF assertions passed, including check-curlstack-elf.sh.
  • fwcompat --min-release 4.4.2: exit 0.

The PR description is updated to match.

Signed-off-by: fraygox [email protected]

fraygox and others added 8 commits November 16, 2026 02:03
Three conflicts, all where main's Settings work met this branch's HTTP/3 row:

- session.rs, prefs_tests.rs: both sides added a `Setting` row (`HudEndTimePref`,
  `Http3Pref`). Both are kept; the descriptor count is now 23 Setting rows.
- settings.rs: main moved the root page onto captured `ScreenInputs` with a
  receipt per pending write. The HTTP/3 switch follows the auto sign-in switch's
  shape (`http3_receipt`, cleared once the settled session answers) instead of
  reading `session::peek_settled()`.
- settings_root_navigation_tests.rs: the HTTP/3 tests build the page with the
  captured inputs and refresh them before a rebuild.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
… writes do

main removed `plx_machine::idle`; a storage-worker reply now wakes the frame
through `plx_machine::present::wake_from_worker`. The merge left this branch's
`PreferenceCmd::Http3` on the removed call, which does not compile.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The ported screen tests covered only a refused receipt. main gave the auto
sign-in switch `a_success_receipt_waits_for_the_next_captured_authority`;
`a_saved_http3_write_waits_for_the_next_captured_authority` is its twin, so
dropping the `settled` check or the stored-value comparison now fails. The
page comment says which half follows auto sign-in (the receipt) and which the
resolution picker (the install write).

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
main's machine-shape gate (plxnative#1358, plxnative#1392) certifies shared payload types against
two proof files that pin every workspace manifest's hash. This branch adds the
`http3-curlstack` feature to rust-modules/Cargo.toml, base/Cargo.toml and
net/Cargo.toml, so after the merge both certificates were refused and
`ci/check-machine-shape.py` reported the session machine's payloads as opaque
(28 problems), failing five `make check` steps.

Both are regenerated with their own producers
(`ci/readonly_dependencies.py --produce serde_json-1.0.154.crate`,
`readonly_generated.produce_certificate`) and the pinned certificate hashes
updated, as main's own dependency bump did (6d7b48e). The only changes are
those three manifest hashes, plus play-feed's `lib_sha256` in the serde_json
certificate, which the producer refreshed: main's entry predates a later edit
to play-feed/src/lib.rs that this branch does not touch.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`print-curlstack-prune` was added (f3e2577) without its `QUERY_GOALS` entry, so
it was not `SIDE_EFFECT_FREE`. `ci/test_deploy_manifest.py` asks for it with
`CURLSTACK=1` from `make check`, in the real checkout: with a default build in
`pkg/`, the parse saw a `+curlstack` configuration that no default stamp
matches, rewrote the stamp and deleted the built binary, the storage helper and
the staged `-plx` libraries. CI never saw it because its runners start with no
`pkg/`.

It joins `QUERY_GOALS` beside `print-curlstack-staged`, and both join
`ci/test_arm_profile.py`'s `HOST_ONLY_GOALS`, which seeds a release build and
checks each goal leaves it alone; against the old Makefile that test fails for
`print-curlstack-prune`. Found by pr-reviewer on the merged branch.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`make CURLSTACK=1` unpacks and builds five libraries under vendor/
(`{openssl,nghttp2,nghttp3,ngtcp2,curl}-{src,build,prefix}`, `openssl-stage`,
`curl-link-shim`) and writes the stamp `vendor/curlstack-built`. None was in
.gitignore, so a checkout that had built the stack showed them as untracked:
`git status --short` was no longer empty after a build, and one `git add -A`
would have staged the unpacked source and object trees, the mistake the FFmpeg
entries' comment records. (The lane this branch was built in had a local
`info/exclude` for vendor/, which hid it.)

They are listed slashless beside the FFmpeg entries, and `tools/build-gc.sh`'s
`derived_output` classifies them as build output, which
`ci/test_build_gc.py::test_every_gitignore_pattern_is_either_build_output_or_kept_as_private`
requires of every new pattern (it fails with the .gitignore lines alone).
Found by pr-reviewer.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…mment

Two findings from pr-reviewer's fourth pass, both minor.

- docs/sans-io-guide.md: "When you add a registry reader, add its name to the
  rule in the same change." `net::bundled_curl`, `net::bundled`,
  `net::http3_switch` and `net::alt_svc` read what boot decided once for the
  process and were not spellings of the globals rule. They are now, the way
  `devcaps::caps` was added: qualified, bare as a call after an import from
  `net` (singly or through a glob), and a `use ... as` rename refused. Only the
  net crate's transport code calls them and it is no machine, so no ledger line
  is seeded and the site count is unchanged (19).
  `test_globals_ledger_sees_the_bundled_curl_stack_readers_in_a_machine` plants
  each shape and checks `net::BUNDLED_STACK_BUILT` (a const), a method of the
  same name and a `bundled` parameter are not sites. The guide's list and the
  rule's comment name them.
- curlio.rs: the comment on `ensure_loaded` said the Feed's `ff::boot` binds the
  multi table at start-up. Nothing calls that function on main, so the table is
  bound at the first media open. The ordering it relies on is unchanged and
  still holds (`construct` runs `net::global_init` before any screen exists);
  the comment now says that. No code change.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
ci/build-curlstack.sh keys its output tree on the runner's cmake and patchelf
versions (`INHERITED`), but the workflow's actions/cache key did not. After a
runner image moved either tool the workflow key would still hit, the script
would miss inside the restored tree and build all five libraries cold, and
actions/cache would skip its save on the exact key hit: every later
`cross-build-curlstack` run cold, against a 30-minute budget, until a pin or
script changed. The output was never wrong, only slow.

The `curlstack-pins` id now hashes both versions with the pins (the tools are
installed by the step before it), and `ci/test_ci_workflows.py` pins that the
workflow reads the two versions the script keys on. Found by pr-reviewer.

Signed-off-by: fraygox <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
@fraygox

fraygox commented Nov 16, 2026

Copy link
Copy Markdown
Contributor Author

@GLinnik21 this has current main merged in again and is ready for another look when you have time. Head is 58fd0c06b; the conflicts are gone, and the description's "Since the last revision", "Gates", "Device verification" and "build-bench" sections are rewritten for it.

What changed since 7040caec5. Nothing in curl's options, the TLS/HTTP stack, the loader or the media transfer path; under rust-modules/net our only edit is a comment. The rest is the merge and what a fresh review of the merged diff found:

  • The merge (main at 8e8330ab0). Three conflicts, all where your Settings work met the HTTP/3 row. The switch now follows the captured-ScreenInputs model with a receipt, shaped like the auto sign-in switch, and has the success-path test that one has.
  • Two things the merge broke without a textual conflict. plx_machine::idle is gone, so the HTTP/3 preference write now uses present::wake_from_worker. And the read-only proof certificates pin every manifest hash, so adding the http3-curlstack feature needed both regenerated (as 6d7b48e7a did for a dependency bump).
  • Four defects of mine that predate the merge, each now covered by a test:
    • make check deleted a built package: print-curlstack-prune was missing from QUERY_GOALS and a make check step calls it with CURLSTACK=1.
    • The stack's vendor/ build trees were not in .gitignore (a local exclude in my build lane hid it).
    • The four new net:: readers were not in the globals rule in ci/check-deps.sh.
    • The CI cache key for the stack lacked the cmake/patchelf versions the build script keys on, so a runner image update would have left the job building cold.

Gates, all on 58fd0c06b: make check 136 steps all ok, check-nodef, both ARM packages (flag off: 8 ELF files, flag on: 15) with their ELF and size checks, check-curlstack-elf.sh, the http3-curlstack feature tests, and fwcompat.py --min-release 4.4.2. build-bench is one run each on 8e8330ab0 and the head; nothing slower beyond noise (the host was loaded, noted in the table).

Not repeated: device verification. Given that nothing on the wire changed, I left the earlier runs standing rather than re-run them; the description says exactly which head each run was on. If you would rather see a fresh run on this head before merging, say so and I'll do one.

Two things I'd like your call on:

  1. set_http3_experimental is an unguarded install-scope write, like set_ui_resolution and set_language, rather than account-guarded like auto sign-in. I went with the Install-rows-are-never-account-bound rule in plex/CLAUDE.md; easy to change if you see it the other way.
  2. Eleven of the twelve translations are AI drafts and need the native review docs/localization.md asks for.

Your earlier question (how much of the seek improvement remains against main with #1289) is answered in #1270 (comment); nothing in this revision changes those numbers.

Copy link
Copy Markdown
Collaborator

Thanks for rerunning the benchmark against #1289 and for testing a second proxy. That answered my question. At 20 Mbit/s on a clean connection, HTTP/3 cut roughly 50–70 ms from a seek compared with the corrected HTTP/2 baseline. On lossy connections, the buffering results depended heavily on the proxy configuration.

I’m closing this PR for now. For the reverse-proxy setups that could use it, I don’t think the measured improvement justifies maintaining a second curl stack upstream. I appreciate the investigation, especially the HTTP/2 seek fix that’s already in main. If a concrete remote-playback issue turns up where HTTP/3 makes a noticeable difference, we can revisit it.

@GLinnik21 GLinnik21 closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants