1 URL Parsing
class | ||||||||||
| ||||||||||
| ||||||||||
class | ||||||||||
| ||||||||||
| ||||||||||
class | ||||||||||
|
http://sky@www:801/cgi-bin/finger;xyz?name=shriram;host=nw#top |
{1-} {2} {3} {4}{---5---------} {6} {----7-------------} {8} |
|
1 = scheme, 2 = user, 3 = host, 4 = port, |
5 = path (two elements), 6 = param (of second path element), |
7 = query, 8 = fragment |
The strings inside the user, path, query, and fragment fields are represented without URL-syntax-specific quoting. The URL.from_string function and URL.to_string method translate encodings, such as converting a %20 into a space and back again.
By default, query associations are parsed with either ; or & as a separator, and they are generated with & as a separator. The form.current_separator_mode parameter adjusts the behavior.
An empty string at the end of the path list corresponds to a URL that ends in a slash. For example, the result of URL.from_string("http://rhombus-lang.org/a/") has a path field with strings "a" and "", while the result of URL.from_string("http://rhombus-lang.org/a") (string->url "http://racket-lang.org/a") has a path field with only the string "a".
When a "file" URL is represented by a URL instance, the path field is mostly a list of path elements. For Unix paths, the root directory is not included in path; its presence or absence is implicit in the is_path_absolute flag. For Windows paths, the first element typically represents a drive, but a UNC path is represented by a first element that is "" and then successive elements complete the drive components that are separated by / or \.
function | |||
| |||
function | |||
| |||
function | |||
|
The relative_path_to_relative_url_string converts a relative path into a string that represents a relative URL reference (e.g., using forward slashes, even on Windows).
method | |||
| |||
method | |||
|
The URL.to_string conversion is used to print a URL object in #'text mode, while #'expr mode uses the default printing format for a class instance.
context parameter | |||
| |||
enumeration | |||
The current_encode_mode parameter determines how queries are encoded.