Http module

parse_url

procedureextensionexperimentalSource

Reads an absolute http:// or https:// URL (the port defaults to 80 and 443).

Example
url, problem := parse_url("https://example.com:8443/a/b?x=1");
assert(problem == .NONE);
assert(url.secure && url.host == "example.com" && url.port == 8443);
assert(url.target == "/a/b?x=1");

_, problem = parse_url("ftp://example.com/");
assert(problem == .UNSUPPORTED_SCHEME);

_, problem = parse_url("/relative/path");
assert(problem == .NOT_A_URL);

Doesn't run in the browser (skipped on wasm).

parse_url :: (text: string) -> (Url, Url_Problem)

Parameters

text: string

Returns

See also