Url
A canonical http or https URL. parse accepts text and rewrites it exactly as OkHttp 5.5.0's HttpUrl does when the host is ASCII: it percent-encodes with HttpUrl's sets (non-ASCII path and query text as UTF-8 in upper-case hex), resolves . and .. (the %2e forms included), drops the default port, gives an empty path /, trims TAB, LF, FF, CR and SP at the ends, drops a #fragment, keeps an existing %XX and a malformed % as typed, keeps a bare ? as an empty query, prints IPv6 in RFC 5952 form and an IPv4-mapped address as dotted IPv4, and keeps digits-and-dots hosts and a trailing dot as written. It is only ever stricter than HttpUrl: it refuses a backslash, whitespace or a control character anywhere in the text, an unpaired surrogate, any scheme but http and https and any separator but ://, user-info, a host that is non-ASCII, percent-encoded, outside a-z 0-9 - _ ., outside the length rules or holding an xn-- label, a malformed IPv6 literal (a zone included), and a port that is signed, non-numeric, 0 or above 65535. Building a URL from parts is done as text, then parsed; there is no builder.
Stable Core. Equality and hash are on the canonical text, so %2f and %2F, 127.1 and 127.0.0.1, h and h. are different URLs. toString is the full canonical URL, query included; use redacted for logs and messages.