8.16.0.1
URIs and URLs
1 URI
The original intent of the URI library was for full support of URI genericity, however, the current incarnation is biased for URLs but probably usable for many other flavors of URIs in common use.
1.1 URI Data Structures
struct
(struct Uri (scheme authority path query fragment) #:transparent) scheme : String authority : (U False Authority) path : String query : (Option String) fragment : (Option String)
The major compositional structures of a URI.
struct
(struct Authority (user host port) #:transparent) user : (Option String) host : String port : Integer
The authority structure of a URI. The host and port are required values.
procedure
(make-uri scheme user host port path query fragment) → Uri scheme : String user : (Option String) host : String port : Natural path : String query : String fragment : String
Construct a uri.
Parse the given string into a Uri. If the string fails to parse #f is returned.
2 Url
2.1 Query Params
(require uri/url/param) | package: uri |
A Param is a name value pair intended for use in constructing the URL query string.
A Param is typed defined as a pairof strings, the name and value.
Construct a new Param from the given Param percent encoding URL query reserved characters. If space-as-plus is true spaces are encoded as + chars in lieu of %20. Both the name and value of the Param are encoded.
A collection of Param. Params may contain any number of Param with the same name, even the same name and value.
Parse out as many name value pairs as are legal from the given string. Given a partially malformed URL query string several Params may be parsed out with the remainder (unfortunately) silently failing.
Generates a URL query string suitable for constructing a URL via make-uri. All Param’s name and values are encoded.
Names are concatenated with values separated by a = character. These string snips are then subsequently concatenated together with an interstitial &.
Example:
2.2 Path Utilties
Split a URL path into its constituent segments. For reasons of arcania the first element of a split absolute path is the empty string.