pub struct Fetch { /* private fields */ }Expand description
HTTP GET a URL with an SSRF guard.
Rejects non-http(s) schemes, rejects URLs whose DNS resolution returns
any IP in the loopback / private / link-local / unspecified / multicast
ranges, and explicitly blocklists the cloud metadata endpoints. Redirects
are disabled on the underlying ureq agent so attackers cannot bypass the
resolved-IP check via 302 Location: http://169.254.169.254/….
Implementations§
Source§impl Fetch
impl Fetch
pub fn new() -> Self
Sourcepub fn with_allow_hosts(self, hosts: Vec<String>) -> Self
pub fn with_allow_hosts(self, hosts: Vec<String>) -> Self
Restrict fetches to an explicit host allowlist. When set, any URL whose host (case-insensitive) is not in the list is rejected before DNS resolution.
Sourcepub fn with_max_bytes(self, n: usize) -> Self
pub fn with_max_bytes(self, n: usize) -> Self
Set the maximum number of response bytes to read. Defaults to 64KB.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Fetch
impl RefUnwindSafe for Fetch
impl Send for Fetch
impl Sync for Fetch
impl Unpin for Fetch
impl UnsafeUnpin for Fetch
impl UnwindSafe for Fetch
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more