Skip to content

Cache resolved redirect URL for subsequent HTTP range requests #12

Closed

Description

@Delarkz

Summary

It would be useful if AetherEngine remembered the final URL after an HTTP redirect during a media load and reused that resolved URL for later range requests, seeks, reconnects, or pipeline rebuilds.

For debrid/proxy playback URLs, the app often starts with a stable-looking playback endpoint that redirects to a CDN/object-storage URL. If every new HTTP request starts again from the original playback URL, playback can pay an extra proxy request and redirect hop repeatedly.

Proposed Behavior

When opening an HTTP(S) media URL:

  1. Start with the caller-provided source URL.
  2. If the request redirects, keep the final resolved URL in memory for that media load.
  3. Use the resolved URL for subsequent range requests, reconnects, and seeks.
  4. If the resolved URL fails with an expiry-like status such as 401, 403, 404, 410, or a CDN-specific auth error, fall back to the original source URL and allow it to redirect again.

Safety / Correctness Notes

  • Keep the original URL as the canonical fallback because signed CDN URLs can expire.
  • Preserve Range and Accept-Encoding: identity behavior across redirects.
  • Consider exposing this as internal transport behavior rather than a public API requirement.

Expected Benefit

This should reduce startup/seek/reconnect latency for redirected playback URLs and avoid repeated debrid/proxy hops while keeping the original source URL available when the resolved target expires.

Activity

  1. superuser404notfound commented on May 23, 2026

    @superuser404notfound
    Owner

    Implemented in 601205e. After the first probe / chunk fetch completes with a 2xx/206, AVIOReader captures dataTask.currentRequest?.url (the post-redirect URL) and reuses it for every subsequent Range request. Cache is per playback session (one AVIOReader per Demuxer).

    Safety rails:

    • Cache only populates on success, so 4xx redirect targets can't poison it.
    • 401 / 403 / 404 / 410 against the cached URL drop the cache and trigger a one-shot retry against the original source URL so the proxy can re-issue a fresh signed redirect. fetchChunk wraps the request in a two-pass helper that handles the fallback.
    • Range and the caller-supplied extra headers are re-applied on cross-host redirects in ChunkFetchDelegate (the probe path already did this).

    Scope: seekable mode only. Streaming mode is a single GET, so caching doesn't help there.

    Engine pin bumped on Sodalite main. Once a release goes out, debrid playback should see fewer proxy hops on seek and reconnect. Please ping if you notice the fallback firing more than expected (each invalidation prints [AVIOReader] Dropped resolved URL cache (expiry status) in DEBUG builds).

  2. added a commit that references this issue on May 24, 2026
    601205e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions