Skip to main content

Crate oxideav_http

Crate oxideav_http 

Source
Expand description

HTTP/HTTPS source driver for oxideav.

Implements Read + Seek over HTTP Range requests so any container demuxer that takes a Box<dyn BytesSource> can read directly from a URL. Servers must support Range: bytes=… (most static-file hosts do; we verify with a HEAD at construction).

Wire it into a oxideav_core::RuntimeContext with register: both http and https register as bytes-shape sources, so ctx.sources.open(uri) yields SourceOutput::Bytes(_). For callers that hold a bare oxideav_source::SourceRegistry use register_source directly.

let mut ctx = oxideav_core::RuntimeContext::new();
oxideav_http::register(&mut ctx);
let _r = ctx.sources.open("https://example.com/clip.mp4").unwrap();

§Configuring the underlying agent

By default the driver uses a process-wide ureq agent with library defaults. To tighten policy (redirect cap, downgrade-safe Authorization handling, custom User-Agent, timeouts, https-only mode) build an HttpConfig and either:

  1. Install it once at startup with install_default_config, so every ctx.sources.open("http://…") call honours it; or
  2. Open a one-off source with HttpSource::open_with_config, leaving the registry-default agent untouched.
let cfg = oxideav_http::HttpConfig::builder()
    .max_redirects(5)
    .user_agent("my-app/1.0")
    .https_only(true)
    .build();
oxideav_http::install_default_config(cfg).ok();

§Mid-stream mutation detection (RFC 9110 §13.1.5)

When the origin’s HEAD reply carries a STRONG validator (an ETag without the W/ weakness prefix, or a Last-Modified whose companion Date header is at least one second later — the §8.8.2.2 promotion rule), every subsequent Range: bytes=N- GET is sent with If-Range: <validator>. Per §13.1.5 the server then EITHER satisfies the range (206 Partial Content — happy path) OR ignores Range and returns the full new representation (200 OK). The driver treats the latter as a fatal mid-stream-mutation error rather than silently re-anchoring the byte offset against a different resource.

Structs§

CacheControl
A parsed Cache-Control field value per RFC 9111 §5.2.
Challenge
One parsed challenge from a WWW-Authenticate (or Proxy-Authenticate) field value, per RFC 9110 §11.3:
ConfigAlreadyInstalled
Returned by install_default_config when the global agent has already been materialised (either by a prior install_default_config call or by a register/open call that consumed the default).
HttpConfig
Tunable policy for the HTTP/HTTPS source driver.
HttpConfigBuilder
Builder for HttpConfig.
HttpSource
ReadSeek over an HTTP/HTTPS resource, using Range requests.

Enums§

RedirectAuthPolicy
Policy for re-sending an Authorization header across an HTTP redirect.
RetryAfter
A parsed Retry-After header value per RFC 9110 §10.2.3.

Constants§

DELTA_SECONDS_MAX
The delta-seconds saturation value mandated by RFC 9111 §1.2.2.

Functions§

install_default_config
Install a process-wide HttpConfig that the default scheme openers (register, register_source, open_http) will use.
open_http
Open a URL as a seekable byte source.
parse_cache_control
Parse a Cache-Control field value per RFC 9111 §5.2.
parse_retry_after
Parse a Retry-After field value per RFC 9110 §10.2.3.
parse_www_authenticate
Parse a WWW-Authenticate / Proxy-Authenticate field value into a list of Challenges, per RFC 9110 §11.6.1:
register
Install the http + https schemes into a full runtime context.
register_source
Register the http and https schemes on a bare SourceRegistry as bytes sources. Both schemes share the same opener (open_http).