URL¶
Holds the components of a URL. These are always stored as valid, URL-encoded values.
Constructors¶
create¶
Create an empty URL.
Returns¶
- URL val^
build¶
Parse the URL string into its components. If it isn't URL encoded, encode it. If existing URL encoding is invalid, raise an error.
Parameters¶
Returns¶
- URL val^ ?
valid¶
Parse the URL string into its components. If it isn't URL encoded, raise an error.
Parameters¶
- from: String val
Returns¶
- URL val^ ?
Public fields¶
var scheme: String val¶
URL scheme.
If the given URL does not provide a scheme, this will be the empty string.
See also RFC 3986.
var user: String val¶
URL user as part of the URLs authority component:
If the URL does not provide user information, this will be the empty string.
See also RFC 3986.
var password: String val¶
URL password as part of the URLs authority component:
If the URL does not provide a password, this will be the empty string.
See also RFC 3986.
var host: String val¶
URL host as part of the URLs authority component:
If the URL does not provide a host, this will be the empty string.
See also RFC 3986.
var port: U16 val¶
URL port as part of the URLs authority component:
If the URL does not provide a port, this will be the empty string.
See also RFC 3986.
var path: String val¶
URL path component.
If the URL does not provide a path component, this will be the empty string.
See also RFC 3986.
var query: String val¶
URL query component.
If the URL does not provide a query component, this will be the empty string.
See also RFC 3986.
var fragment: String val¶
Url fragment identifier component.
If the URL does not provide a fragment identifier component, this will be the empty string.
See also RFC 3986.
Public Functions¶
is_valid¶
Return true if all elements are correctly URL encoded.
Returns¶
- Bool val
string¶
Combine the components into a string.
Returns¶
- String iso^
join¶
Using this as a base URL, concatenate with another, possibly relative, URL in the same way a browser does for a link.
Parameters¶
- that: URL val
Returns¶
- URL val
default_port¶
Report the default port for our scheme. Returns 0 for unrecognised schemes.
Returns¶
- U16 val