Skip to main content

same_server

Function same_server 

Source
pub fn same_server(a: &str, b: &str) -> bool
Expand description

Whether two Visdom base URLs identify the same instance.

Needed because the two sides reach us differently formatted from the same user-supplied string: ApiClient trims trailing slashes from its base_url, while credentials.json stores server_url exactly as it was passed to tracevault login. So https://tv.example.com/ and https://tv.example.com must compare equal, or a legitimate session would never be adopted.

Comparison is otherwise byte-exact (no host lowercasing, no default-port folding). That is deliberate: both values originate from the same string in every real flow, and the two failure directions are not symmetric. A false negative costs one extra token refresh; a false positive would send an access token to a host it was not minted for. When in doubt, don’t match.