Skip to main content

Module url

Module url 

Source

Modules§

url_class
url_search_params

Structs§

UrlModule

Functions§

convert_trailing_space
Encode trailing space as %20 in opaque paths before a setter runs.
domain_to_ascii
domain_to_unicode
erase_empty_host_path
Per WHATWG URL spec, a non-special URL with an empty host can have its path erased (WPT url-setters.any.js). The url crate keeps a trailing / after the authority; reparse the serialization with it stripped when the caller has explicitly set an empty pathname on such a URL.
file_url_to_path
init
is_special_scheme
Returns whether the given scheme is a special scheme.
normalize_windows_drive_letter
path_to_file_url
preserve_file_url_host
Per WHATWG URL spec §4.5.3 (“URL serializer”), the /. path sentinel is only inserted when a URL has no host AND its path starts with //. The url crate inserts the sentinel during parsing and can leave it in the serialization even after a host is set, breaking WPT url-setters subtests like <non-spec:/.//p>.hostname = 'h'.
restore_file_url_host
When resolving a relative URL against a file:// base whose first path segment is a Windows drive letter (e.g. file://h/C:/a/b), the url crate loses the host during join. Per WHATWG URL spec the host must be preserved (WPT url-constructor.any.jsfile://h/C:/a/b” base). Patch the joined URL by restoring the base’s host.
strip_path_sentinel
url_format