Skip to main content

Module fetch

Module fetch 

Source
Expand description

HTTP fetch with a hard body cap and a configurable timeout.

Constants:

  • MAX_BODY_BYTES โ€” hard cap on response size (currently 2 MiB).
  • USER_AGENT โ€” sent as User-Agent header; format is agentsec/<cargo-pkg-version>.

The timeout is driven by crate::config::WebConfig::timeout_secs (default: crate::config::DEFAULT_WEB_TIMEOUT_SECS = 10 s).

Non-2xx responses and oversized bodies are rejected via crate::Error::Sanitize. The body is not truncated; the request is failed.

Functionsยง

get
Fetch a URL with a 2 MiB body cap and a timeout driven by timeout_secs.