Module network_utils

Module network_utils 

Source

Functions§

base_domain_from_any
base_domain_from_host
Get the base “site” domain from a host.
base_domain_from_url
ends_with_ignore_ascii_case
first_label
host_and_rest
Returns (host_without_port, rest_starting_at_/ ? # or empty) Robust: handles protocol-relative, userinfo, IPv6 literals, ports.
host_contains_label_icase
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-mainr.com” matching “mainr.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.