Skip to main content

url_within

Function url_within 

Source
pub fn url_within(url: &str, allowed: &str) -> bool
Expand description

Whether url is within allowed (decision 425): the same scheme, host and port, no user or password, and a path under allowed’s, at a / (https://a.example.com/hooks allows /hooks and /hooks/x, not /hooksy). Both are parsed, as the client parses them, so a host suffix (a.example.com.evil) or userinfo (a.example.com@127.0.0.1) can’t pass.