Documentation
¶
Overview ¶
Package nodeurl ports the Node URL host/path handling and fileURLToPath semantics used by PiG.
Index ¶
- func DomainToUnicode(host string) string
- func FileHost(server string) (string, error)
- func FileURLToPath(raw string, windows bool) (string, error)
- func PrepareInput(raw string) string
- func RequestURL(serialized string) (*url.URL, error)
- func ResolveDirectoryPath(raw, relativePath string) (string, error)
- func SpecialHost(server string) (string, error)
- func SpecialPath(pathname string, file bool) string
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DomainToUnicode ¶
DomainToUnicode is Node's url.domainToUnicode for a host FileHost returned: an IP address is unchanged, and a domain's IDNA labels become Unicode.
func FileHost ¶
FileHost is the WHATWG host parser's result for a file URL's host: an IPv6 address in brackets, a dotted IPv4 address, or a lowercase ASCII domain, where localhost is empty. The input is percent-decoded first, as the parser does.
func FileURLToPath ¶
FileURLToPath converts raw as Node's url.fileURLToPath(raw, {windows}) does: raw is parsed as a WHATWG URL, and a Windows host names a UNC server in Unicode. It returns the Error Node throws for a URL that does not parse, is not a file URL, encodes a path separator, has a host on POSIX, or on Windows has neither a host nor a drive letter.
func PrepareInput ¶
PrepareInput applies the URL parser's C0/space trimming and tab/newline removal.
func RequestURL ¶
RequestURL represents an already-resolved WHATWG URL without net/url rewriting its serialized spelling. Opaque retains path characters and malformed percent escapes that Go's RawPath cannot represent; Host and Path still identify the request destination.
func ResolveDirectoryPath ¶
ResolveDirectoryPath resolves a relative URL path beneath a normalized directory base. It applies the WHATWG special-URL authority, host and path rules before resolution; the base query and fragment do not participate in the resulting path.
func SpecialHost ¶
SpecialHost parses the host of a WHATWG special URL. Unlike FileHost, localhost remains a hostname.
func SpecialPath ¶
SpecialPath resolves dot segments in a special URL pathname. File URLs additionally preserve and normalize a leading Windows drive letter.