Skip to main content

normalize_origin

Function normalize_origin 

Source
fn normalize_origin(origin: &str) -> Result<String, String>
Expand description

An origin as browsers send it, via the WHATWG URL parser browsers use: http or https, a host, an optional port — no path, user, query or fragment. Serialized the way Origin is: lowercase, IDNA hosts in punycode, canonical IPv4/IPv6, and no default port, so every spelling of one origin compares equal (Codex P2s on #3900). A trailing / is fine.