Skip to main content

Module http

Module http 

Source
Expand description

HTTP client, metadata probing and range requests (PRD §6).

Two rules drive this module:

  1. Never trust the server. Headers are parsed defensively, sizes are sanity-checked, Content-Range is verified against what we asked for, and a server that ignores Range is detected rather than believed.
  2. Never leak credentials. URLs are redacted before they can reach a log line, and Authorization is dropped across a cross-host redirect.

Structs§

HttpConfig
Primed
What a priming probe learned, plus the response body it opened.
RemoteInfo
Everything we learn about the remote resource before transferring it.

Constants§

DEFAULT_USER_AGENT

Functions§

build_client
get_range
A ranged GET, with the response validated against what we asked for.
header
parse_content_range
bytes 0-1023/4096(0, 1023, Some(4096)). * total → None.
parse_retry_after
Retry-After in delta-seconds form. The HTTP-date form is rare in practice and parsing dates without a date library invites bugs, so we fall back to our own backoff for it rather than guess.
probe
Ask the server what it has, without downloading it.
probe_priming
Probe and start the download in a single request.
redact
Strip userinfo and query before a URL can reach a log line (PRD §36).