Repository navigation
Closed
Description
What happened
An Xtream panel behind a portal's 302 answered every GET for a VOD .mkv with 403 for about twenty seconds (its one-connection slot was still held), while a HEAD came back 200 with Content-Length: 0. The reader's log, in order:
[AVIOReader] pump tail prefetch issued bytes=-65536
[AVIOReader] pump conn start gen=1 offset=0 len=32MB
[AVIOReader] pump tail prefetch rejected after 762ms: status=403 (no suffix range support); not asking this origin again this session
[AVIOReader] pump gen=1 rejected response status=403 at offset 0
[AVIOReader] Data connection resolved no size, falling back to probe
[AVIOReader] Range probe (bytes=0-) didn't yield a size
[AVIOReader] Cached resolved URL host=…
[AVIOReader] File size: 0 bytes (HEAD fallback)
[AVIOReader] Range probe (bytes=0-1) didn't yield a size
[AVIOReader] no probe resolved a size, streaming mode (forward-only)
[AVIOReader] Streaming started: 1325105.mkv
[AVIOReader] Streaming ended
[AetherEngine] probe failed (Demuxer: open failed (Invalid data found when processing input (-1094995529))); proceeding without criteria
…
state = .error("Failed to load: HLSVideoEngine: open failed (Demuxer: open failed (Invalid data found when processing input (-1094995529))))
errorInfo = sourceOpenFailed, underlyingDomain = "AetherEngine.HLSVideoEngine.HLSVideoEngineError", underlyingCode = 0
Same sequence on all four opens (probe + session, twice through the host's retry), then the host showed its "unsupported format / invalid video data" copy for what was a refused connection.
Why
- The forward-only streaming GET never looks at the status.
StreamingDelegate.didReceivecallscompletionHandler(.allow)unconditionally (AVIOReader.swift:3313 on 6.26.0), so the 403 error page is appended tostreamBufferandreadStreaminghands it to FFmpeg, which reportsAVERROR_INVALIDDATAfor what was a refusal. The 403 the data connection had already been refused with (persistentReceivedResponse) is kept only as the IntconnStatusand then read byopen()as "resolved no size" (:691), so the status is lost before the probe ladder even starts. - Machine-readable companion to
.error(String)so a host can classify a failure #376's classification cannot carry it.PlaybackErrorKindhas no HTTP-status kind, and the underlying error is a Swift enum, sounderlyingCodeis 0. A host cannot tell "the origin refused" (retry later, another device holds the slot, subscription) from "the file is corrupt". - One 403 disables the tail prefetch for the origin for the process lifetime.
TailPrefetchDelegatetakes ANY non-206 asstatus=… (no suffix range support)andSuffixRangeSupportlatches it (VOD cold-start pays a mandatory sequential head→tail→re-anchor round trip on non-fast-start MP4 sources — request for parallel fetch or moov-offset hint #281 / 6.5.5). A 403 during a connection-cap window, a 429 or a 5xx says nothing about suffix ranges, but the origin is never asked again — on an MKV that is the tail read every later open pays for. - After the 403 at byte 0 the reader still issues the HEAD and
bytes=0-1probes, which the same origin answers the same way; on a one-slot panel those are three more connections against a slot that is already full.
Proposal (PR to follow)
StreamingDelegatehangs up at the header on anything but 200/206 and records the status;open()fails typed with a newAVIOReaderError.httpStatus(Int)(the AE#140/AE#154 shape), whichHLSVideoEngine.openFailure(from:)passes through like the HLS classifications, andload()publishes as a newPlaybackErrorKind.sourceRefusedwithunderlyingCode= the status (additive; the struct is string-backed for exactly this).- After a 401/403/404/410 on the data connection at byte 0, skip the HEAD /
bytes=0-1probes; still try the one unranged GET (an origin that refusesRangebut serves a plain GET plays forward-only, one that refuses both fails with its status). 5xx and 429/503/509 keep the ladder. - The suffix-range denial latches only on the origin's answer to the range FORM (a 200 that ignored it, a 416); 401/403/404/429/5xx neither latch nor count as a transport strike.
Tested against a scripted loopback origin (HEAD 200/0, GET 403 with an error page); on-device: Apple TV 4K (tvOS 26), Xtream VOD MKV behind a 302, max_connections=1 panel.
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(io): a refused source fails with its HTTP status, not as invalid …
Merge pull request #379 from tschuegy/fix/378-refused-source-status
fix(io): a metered open publishes sourceRateLimited, and the pump cha…
Merge fix/378-followup-rate-limit-classification: the metered open ke…
superuser404notfound commentedon Aug 17, 2026
Reopening for the retest, not because anything is missing: the "Fixes #378" in #379 closed this on merge, and the on-device confirmation against the reported panel is still outstanding.
State on main:
sourceRateLimitedrather thansourceRefused, and the streaming pump now charges a rate limit against the One request per 32 MB gets me rate limited, and a 429 then kills the session for good #377 origin request budget, which on a sequential origin is the only place its 429 is ever read).Once it ships, the trace to look for on the reported origin is
source refused: HTTP 403; failing the open typedinstead of the fourInvalid data found when processing inputopens, and$errorInfocarrying kindsourceRefusedwithunderlyingCode403 during the slot-held window.chore(release): prep 6.29.0 - a foreign codec_tag, a refused source, …
superuser404notfound commentedon Aug 17, 2026
Released in 6.29.0, together with the #380 and #388 work. Thank you for the report and the PR.
PlaybackErrorKind.sourceRefusedis public from this version, with the HTTP status inunderlyingCode, and a 429/503/509 on the same request publishessourceRateLimitedinstead.tschuegy commentedon Aug 17, 2026
Closing the loop on the retest you reopened this for: the reported origin cannot produce the shape any more, and the reason is on my side, not the engine's.
The 403 was my own aggregator, which sits in front of the panels, routing this episode to the wrong upstream portal — the series lives on one portal and the request went to another, which answered exactly as it should. I deployed an episode-to-portal redirect and since then every series and film plays, so there is no longer an origin in my setup that refuses a GET. The disappearance is the confirmation of that fix, and it also means the original report was never a rights or auth problem: it was a misroute wearing a 403.
So I verified the typed path against a synthetic origin instead: an Xtream stub whose portal answers normally and whose media route answers every GET with a chosen status and an HTML error page as the body — the part that used to reach FFmpeg. On 6.30.0, iOS 26.5 simulator:
403
and at the host:
509, same route, one file change on the stub:
No
Invalid data found when processing inputanywhere in either run — the error page never enters the buffer. Both the refusal and the metered variant carry their status throughunderlyingCode, which is what the host needs: my failure copy is chosen from the status, so a 403 now reads "the provider refused this stream (HTTP 403), check your subscription" and a 509 reads "your provider's connection limit has been reached", where before both were the same generic load failure. On a portal that declares one connection the 403 keeps the connection-limit wording, which is the reading you and I settled on in #377.Happy for you to close this. If a refusing origin ever turns up in my setup again I will bring you a real trace, but I would rather not manufacture one by breaking my own routing on purpose.
superuser404notfound commentedon Aug 17, 2026
Retest accepted, and the synthetic origin is the better witness here anyway. Once the panel stopped refusing, a run against it could only have shown that the misroute is gone, not that the typed path works. A stub whose media route answers with a chosen status and an HTML body reproduces precisely the part that used to reach FFmpeg, which is the thing under test.
Both traces match main line for line:
AVIOReader.swift:2870is the hang-up at the header,:881the skipped size probes after a refusal at byte 0,:967the typed open failure, andPlaybackErrorInfo.swift:148is the split that sends 429/503/509 tosourceRateLimitedand everything else tosourceRefused, both carrying the status inunderlyingCode.Worth recording the diagnosis for anyone who lands here later: the 403 was truthful for the request that was actually made, and said nothing about rights or subscription. That is one more argument for handing the host the status instead of a sentence. "The provider refused this stream (HTTP 403)" is a statement about the answer, and the host can pick its wording from the panel's declared connection limit, while a message baked into the engine would have had to guess at a cause it cannot see.
Closing. Thank you for the report, for the PR, and for bringing a measurement rather than an assumption once the original origin could no longer produce the shape.
fix(demux): one refusal at byte 0 no longer settles a range-capable V…
GiVo R2790: a clear refusal at first data costs one request, no nativ…
test: loopback origins never reuse a port within the process