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:
- Install it once at startup with
install_default_config, so everyctx.sources.open("http://…")call honours it; or - 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§
- Cache
Control - A parsed
Cache-Controlfield value per RFC 9111 §5.2. - Challenge
- One parsed
challengefrom aWWW-Authenticate(orProxy-Authenticate) field value, per RFC 9110 §11.3: - Config
Already Installed - Returned by
install_default_configwhen the global agent has already been materialised (either by a priorinstall_default_configcall or by aregister/opencall that consumed the default). - Http
Config - Tunable policy for the HTTP/HTTPS source driver.
- Http
Config Builder - Builder for
HttpConfig. - Http
Source ReadSeekover an HTTP/HTTPS resource, usingRangerequests.
Enums§
- Redirect
Auth Policy - Policy for re-sending an
Authorizationheader across an HTTP redirect. - Retry
After - A parsed
Retry-Afterheader value per RFC 9110 §10.2.3.
Constants§
- DELTA_
SECONDS_ MAX - The
delta-secondssaturation value mandated by RFC 9111 §1.2.2.
Functions§
- install_
default_ config - Install a process-wide
HttpConfigthat 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-Controlfield value per RFC 9111 §5.2. - parse_
retry_ after - Parse a
Retry-Afterfield value per RFC 9110 §10.2.3. - parse_
www_ authenticate - Parse a
WWW-Authenticate/Proxy-Authenticatefield value into a list ofChallenges, per RFC 9110 §11.6.1: - register
- Install the
http+httpsschemes into a full runtime context. - register_
source - Register the
httpandhttpsschemes on a bareSourceRegistryas bytes sources. Both schemes share the same opener (open_http).