Skip to content

fix(platform): keep net/http out of minimal apps - #1797

Closed
houko wants to merge 2 commits into
mainfrom
fix/minimal-app-links
Closed

houko wants to merge 2 commits into
mainfrom
fix/minimal-app-links

Conversation

@houko

@houko houko commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

TestMinimalAppLinks fails on main: an app showing one text links Go's HTTP and TLS stack again.

  • darwin_arm64: f0fccfb (feat(apple): send headers with finite video requests) added internal/platform/apple/videoresource.go, which serves header-carrying video byte ranges through net/http. The Apple backend's video handling links into every app, so every darwin app linked net/http, crypto/tls and crypto/x509 (failing in main's test job for 7b12b97).
  • linux_amd64: 00fd256 (feat(linux): send headers with video requests) calls http.CanonicalHeaderKey in internal/platform/linux/videohttp.go, which links net/http into every Linux app.

Fix

  • Apple: each byte range is now a data task in a per-resource URLSession, the system's HTTP client, as image downloads already are (imageload.HTTP, docs/architecture/layers.md "What an app links"). The session delegate keeps the existing behaviour: the app's headers go only to the source's origin across redirects, Referer is dropped cross-origin, at most 10 redirects, no stored cookies (only the app's Cookie header), Range and Accept-Encoding: identity are always the transfer's own, and each chunk waits on the delegate queue until the loader takes it, so a slow player still throttles the download.
  • Linux: canonicalize header names with net/textproto.CanonicalMIMEHeaderKey, which http.CanonicalHeaderKey wraps.
  • layers.md notes the Apple video path next to the image one.

The test and its unlinked list are unchanged.

Verification

  • ubuild: go test ./internal/moduletest -run 'TestMinimalAppLinks|TestDevBuildsLink|TestTextViewAppLinks|TestLayering' passes for all five targets; with only the Linux change reverted, TestMinimalAppLinks/linux_amd64 fails with "links net/http".
  • ubuild: GOOS=darwin go vet ./internal/platform/apple ./internal/platform/macos, go vet ./internal/platform/linux, gofmt clean.
  • Studio: go test -race ./internal/platform/apple -skip '^TestWeb' (includes TestVideoResourceRedirectKeepsOnlyThePlayerRangeAcrossOrigins, now against URLSession), go test ./internal/platform/macos -run Video (includes TestVideoHTTPHeadersAndReactiveSource: same-origin redirect, Referer, Cookie, User-Agent, byte ranges, source change), and GOOS=ios go vet ./internal/platform/apple ./internal/platform/ios.

Screenshots

None.

f0fccfb (feat(apple): send headers with finite video requests) served header-carrying video byte ranges through Go's net/http from internal/platform/apple/videoresource.go, and 00fd256 (feat(linux): send headers with video requests) called http.CanonicalHeaderKey from internal/platform/linux/videohttp.go. A backend's handling of every mount item links into every app, so every darwin app linked net/http, crypto/tls and crypto/x509, every Linux app linked net/http, and TestMinimalAppLinks failed on main for darwin_arm64 and linux_amd64.

On Apple platforms the resource loader now runs each byte range as a data task in a per-resource URLSession, the system's HTTP client, as image downloads already do. Its delegate keeps the same redirect rules (the app's headers only to the source's origin, no Referer elsewhere, at most 10 redirects), sends no stored cookies, and holds each chunk until the player takes it so a slow player still throttles the download. On Linux the header names are canonicalized with net/textproto's CanonicalMIMEHeaderKey, which http.CanonicalHeaderKey wraps.
@houko
houko force-pushed the fix/minimal-app-links branch from 267269e to 483d230 Compare November 22, 2026 01:29
@houko

houko commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #1874, which stacks this fix with the other two main fixes (#1797, #1815, #1847) so that one PR can pass every required check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation iOS Linux macOS size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant