pub struct HttpAllowList { /* private fields */ }Expand description
Allow only requests to hosts matching the given patterns.
Matching is performed against the host portion of the URL only. The URL is parsed to extract the host (stripping scheme, userinfo, port, path, query, and fragment) before matching.
Patterns are matched as exact or suffix of the host — e.g.
"example.com" matches https://example.com/path and
https://api.example.com/path but does not match
https://notexample.com/path or https://evil.com/?ref=example.com.
§Security
Previous versions matched against the full URL string, which allowed bypass via query parameters or path segments. This implementation extracts the host and matches only against it.
use mlua_batteries::policy::HttpAllowList;
let policy = HttpAllowList::new(["api.example.com", "httpbin.org"]);Implementations§
Source§impl HttpAllowList
impl HttpAllowList
Trait Implementations§
Source§impl Debug for HttpAllowList
impl Debug for HttpAllowList
Source§impl HttpPolicy for HttpAllowList
impl HttpPolicy for HttpAllowList
Auto Trait Implementations§
impl Freeze for HttpAllowList
impl RefUnwindSafe for HttpAllowList
impl Send for HttpAllowList
impl Sync for HttpAllowList
impl Unpin for HttpAllowList
impl UnsafeUnpin for HttpAllowList
impl UnwindSafe for HttpAllowList
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more