UnpackURL (open)

Unpack a URL into its parts

Syntax

LOADLIB "wh::internet/urls.whlib";

RECORD FUNCTION UnpackURL(STRING inurl)

Parameters

STRING inurl

URL to decode

Return value

RECORD

A record explaining this URL

STRING host

The host to connect to (url-decoded)

BOOLEAN isdefaultport

True if the port number (explicitly specified or not) is the default for this scheme

BOOLEAN origin

Origin of the url (scheme://hostname(:port) - no slash!)

STRING password

Password (url-decoded)

INTEGER port

The port to connect to (if not specified, and the URL scheme does not specify a default, it will be 0)

STRING scheme

URL Scheme (in lowercase, url-decoded)

STRING schemespecificpart

The data after the colon (NOT decoded!)

BOOLEAN secure

True if this is a secure (SSL, TLS) protocol

BOOLEAN specifiedport

True if this URL specified a port number

STRING urlpath

The path and variables requested (NOT decoded! does not include the slash following the hostname/port number)

STRING urlpathslash

True if the URL path started with a slash

STRING user

Username (url-decoded)

Description

This function splits and parses as much of a URL as possible. The parts it cannot decode, will require a manual DecodeURL when interpreted!