Krikri::PluginHelpers::HTTPDownload
HTTPDownload - shared binary-safe HTTP download with redirect following, used by get_url.cr and deb822_repository.cr. Both plugins previously hand-rolled their own near-identical download logic (each with its own redirect loop and body streaming); this centralizes the common behavior so it can't drift apart (e.g. one plugin learning redirect handling while the other doesn't).
The download is binary-safe: response.body_io is streamed straight to disk, matching how get_url.cr's own download always worked. A plain HTTP::Client#get with a String-returning body would UTF-8-decode and corrupt arbitrary binary data (GPG key bytes, archives, etc.), so never "fix" this by reading into a String.
Constants
Class methods
Downloads url to dest, following up to max_redirects
redirects and streaming the raw body byte-for-byte. Returns nil on
success; raises on non-2xx response, too many redirects, or an
unsupported scheme.
auth_attempted tracks the 401-challenge retry: with
force_basic_auth: false (the real-Ansible default) the first
request goes out WITHOUT Authorization and exactly one retry is
made WITH it when the server answers 401 - a second 401 then
surfaces as the failure it is instead of looping.