urllib — Construction and processing of URLs

This module enables construction and processing of URLs and URIs.

Note

This module performs processing of Uniform Resource Identifiers as described in RFC 3986 - URI Generic Syntax.

type URI
URI(scheme :: Array(Num), hier :: Array(Num), query :: Array(Num), fragment :: Array(Num))

Stores all components as percent-encoded strings.

uriString(uri :: URI) :: Array(Num)

Returns the string representation of uri.

parseURI(uri :: Array(Num)) :: URI

Given uri, a full URI string, returns a URI object. It is an error if uri is not a valid URI.

encodeURIComponent(string :: Array(Num)) :: Array(Num)

Takes an arbitrary string and encodes all necessary bytes so it may be used as a URI component. Returns the resulting string. Encodes all characters except ASCII-alphanumeric, ‘-‘, ‘.’, ‘_’ and ‘~’. It is an error if any element of string is outside the range [0, 255].

encodeURIComponentPlus(string :: Array(Num)) :: Array(Num)

Takes an arbitrary string and encodes all necessary bytes so it may be used as a URI component. Spaces are encoded as a ‘+’ rather than “%20”, as per HTML forms. Otherwise, same as encodeURIComponent. It is an error if any element of string is outside the range [0, 255].

decodeURIComponent(uristring :: Array(Num)) :: Array(Num)

Takes a URI-encoded string, uristring, and decodes all percent-encoded sequences into their source bytes. The resulting string may contain non-ASCII bytes, with an unspecified encoding (dependent on the encoding used in the percent-encoded characters). It is usually safe to assume UTF-8 encoding.

decodeURIComponentPlus(uristring :: Array(Num)) :: Array(Num)

Takes a URI-encoded string, uristring, and decodes all percent-encoded sequences into their source bytes. Also decodes ‘+’ into spaces. The resulting string may contain non-ASCII bytes, with an unspecified encoding (dependent on the encoding used in the percent-encoded characters). It is usually safe to assume UTF-8 encoding.

Previous topic

unittest — Testing user code

Next topic

Frequently Asked Questions

This Page