Skip to main content

build_client

Function build_client 

Source
pub fn build_client() -> Result<Client>
Expand description

Build a reqwest::Client configured for polite and safe feed fetching.

Callers should build this once and share it (connection pooling), then hand a reference to poll_feed. Kept here so the fetch policy (UA, timeout, redirect behaviour) lives with the code that depends on it.

Auto-redirect is disabled on purpose: feed URLs are untrusted, so redirects are followed manually by crate::net::guarded_get, which re-validates the scheme + resolved IP of every hop (SSRF defence). A client that silently followed redirects could be bounced onto 169.254.169.254 or 127.0.0.1 between the guard’s check and the connect.