Skip to main content

origin_of

Function origin_of 

Source
pub fn origin_of(url: &str) -> Result<String>
Expand description

The origin of a URL: scheme + host + non-default port, and nothing else.

Built from the parsed components rather than sliced out of the input, so userinfo cannot survive into it — https://u:p@host/x has origin https://host, and a slice would have kept the credentials. Both sides of the RFC 9728 resource comparison are attacker-influenced, so this needs to be an origin in fact and not just in name.