url (macro)
Package: CURL.LANGUAGE.COMPILER

Signature

{url path:String}:Url

Create a Url from a String.

path: a String containing either an absolute or relative URL

Description

Use this form when you have a String that contains a URL you know is valid. The URL can be absolute (a full URL that contains a scheme and path, such as http://www.curl.com/applet.curl) or relative (such as images/textures/stone.jpg). Relative paths are resolved relative to the file containing the call to url.

Notes

The abs-url procedure can be used if the String is known to contain an absolute URL.

The parse-url procedure accepts a wider-range of "URL like" Strings and translates them into Urls. It will accept things such as Windows-native paths, which url will not.

Because certain characters, namely '%', '?', and '#', have special meanings in a URL, which are different from their meanings in a local filename, if you wish to create a Url containing any of these characters, with the meaning they have in local filenames, you must escape them, using "percent escapes". The url-encode-filename procedure will escape exactly these three characters.

Certain other characters, such as '@' and space, may optionally be escaped, and this may even be required if the characters are to be used in a Url.query string, where many characters, such as '&' and '=' have special meaning. The url-encode-string procedure may be used to escape such characters, and also, by default, to escape any non-ascii characters (using utf8 encoding). Note that the full encoding done by url-encode-string by default is rarely necessary.