pub fn fetch_bytes(url: &str, max_size: u64) -> Result<Vec<u8>, ForgeError>Expand description
Fetch url, capped by max_size, streaming the body to a temp file.
Content-Length is checked before reading when present; the cap is then
enforced per chunk while streaming, so an oversized body is aborted
mid-download (temp deleted) instead of being buffered in full. At most
max_size bytes are ever held in memory (the final read-back). Redirects
are limited to 5; the connect timeout is 30 s and the whole download must
finish within a 120 s wall-clock budget (enforced here, because the
client’s timeout applies per read). Bodyless success responses
(204/304/3xx without a location) are refused.