URL

A Unique Resource Locator.

The syntax for URLs is scheme:[//[user:password@]host[:port]][/]path[?query]fragment.

Members

Functions

toString
string toString()

Convert this URL to a string. The string is properly formatted and usable for, eg, a web request.

Properties

port
ushort port [@property getter]

The port. This is inferred from the scheme if it isn't present in the URL itself. If the scheme is not known and the port is not present, the port will be given as 0. For some schemes, port will not be sensible -- for instance, file or chrome-extension.

port
ushort port [@property setter]

Set the port. This is a shortcut for convenience because you probably don't care about the difference between port and providedPort.

Variables

fragment
string fragment;

The fragment. In web documents, this typically refers to an anchor element. For instance, in the URL https://cnn.com/news/story/17774#header2, the fragment is "header2".

host
string host;

The hostname.

pass
string pass;

The password in this URL. Usually absent.

path
string path;

The path. This excludes the query string. For instance, in the URL https://cnn.com/news/story/17774?visited=false, the path is "/news/story/17774".

providedPort
ushort providedPort;

The port that was explicitly provided in the URL.

query
string[string] query;

The query string elements. For instance, in the URL https://cnn.com/news/story/17774?visited=false, the query string elements will be ["visited": "false"]. Similarly, in the URL https://bbc.co.uk/news?item, the query string elements will be ["item": ""].

scheme
string scheme;

The URL scheme. For instance, ssh, ftp, or https.

user
string user;

The username in this URL. Usually absent. If present, there will also be a password.

Meta