Skip to main content

https_host

Function https_host 

Source
pub fn https_host(url: &str) -> Option<String>
Expand description

Extract the host[:port] from an HTTPS git URL (https://[user[:pass]@]host[:port]/…), verbatim — original case and port preserved — to scope a credential helper to the host an operation targets. git carries the same host[:port] in its credential request and compares it byte-for-byte, so normalizing here would withhold a legitimate credential. Returns None for a non-HTTPS URL (an SSH remote never invokes the HTTPS credential helper, so gating it is moot), an IPv6-literal authority, or an unparseable one — in which case the helper stays ungated, no worse than before host scoping existed.