Skip to main content

Module advice

Module advice 

Source
Expand description

Server advice and a session’s relative expiry, read leniently.

The server tunes clients it cannot redeploy through one X-Capsule-Advice header on session create and HEAD: an RFC 9651 structured-field dictionary of integers whose members are chunk (suggested chunk bytes), sessions (in-flight sessions per lane), ranges (in-flight ranges per session) and ttl (seconds the advice holds) — networking design doc, Server Advice. Advice is never an instruction, so reading it never fails:

  • Clamped. Every member is clamped into bounds compiled into this client. A window member can only lower the client’s own cap: the effective window is the smaller of the two.
  • Lenient. A member this client does not know is ignored, a member whose value is not an integer is treated as absent, and an absent member — or an absent or malformed header — is the client’s own default.
  • Bounded in time. Advice older than its ttl is dropped, except ranges, which is fixed for the session’s life.

The session’s own expiry travels beside the advice as seconds remaining (X-Capsule-Session-Expires-In, X-Capsule-Session-Idle-Expires-In), never as an instant, so a skewed device clock still schedules correctly (SessionExpiry).

Structs§

ServerAdvice
What one X-Capsule-Advice header said, already clamped into this client’s bounds.
SessionExpiry
A session’s remaining lifetime as the server stated it, relative to the response.

Constants§

ADVICE_HEADER
The advice header.
DEFAULT_ADVICE_TTL
How long advice that names no usable ttl holds.
EXPIRES_IN_HEADER
Seconds until the session’s lifetime cap.
IDLE_EXPIRES_IN_HEADER
Seconds until the session’s survival floor.
MAX_ADVICE_LEN
A header longer than this is not read at all: advice is a handful of integers, and a header past this length is a server bug or a hostile one, either way the client’s defaults.
MAX_ADVICE_TTL
The longest any advice holds, whatever its ttl says.
MAX_ADVISED_RANGES
The most in-flight ranges per session any advice can grant: the protocol’s ceiling on a session’s in-flight cap (transfer upload design doc, Bounded fan-in).
MAX_ADVISED_SESSIONS
The most in-flight sessions per lane any advice can grant.