Module network_utils

Module network_utils 

Source

Functions§

base_domain_from_host
Get the base “site” domain from a host.
base_domain_from_url
host_and_rest
Returns (host_without_port, rest_starting_at_/ ? # or empty) Robust: handles protocol-relative, userinfo, IPv6 literals, ports.
host_is_subdomain_of
Host matches base if host == base OR host ends with “.{base}” (case-insensitive), with a required dot boundary to prevent “evil-logrocket.com” matching “logrocket.com”.
rel_for_ignore_script
Given a base domain (already computed) and a URL, returns the “relative” path for same-site/subdomain URLs, otherwise returns the original URL.