(chibi uri)

Library for parsing and constructing URI objects.Accessors for the URI type.

(make-uri scheme [user host port path query fragment])

(uri-with-scheme u scheme)

(uri-with-user u user)

(uri-with-host u host)

(uri-with-path u path)

(uri-with-query u query)

(uri-with-fragment u fragment)

Functional updaters - returns a new uri identical to u with only the specified field changed.

(string->path-uri scheme str . o)

Parses a string with a default scheme and returns a new URI object. If the string does not begin with a scheme it is take to be a simple path URI with the default scheme. This is a lightweight permissive parser.

(string->uri str . o)

Parses a string and returns a new URI object. If the string does not have a scheme, returns false.

(uri->string uri . o)

Convert a URI object to a string. Returns #f if the uri has no scheme.

(uri-has-scheme? url)

Returns true iff the given URI string has a scheme.

(uri-safe-char? ch)

(uri-encode str [plus?])

Return the URI encoded version of the string str, using hex escapes as needed and replacing spaces with "+" iff the optional argument plus? is true.

(uri-decode str [plus?])

Decodes any URI hex escapes in the given string, and translates any pluses ("+") to space iff the optional argument plus? is true.

(uri-query->alist str [plus?])

Parses the query part of a URI as a delimited list of URI encoded VAR=VALUE pairs, decodes them and returns the result as an alist.

(uri-alist->query ls [plus?])

The reverse of the above, formats the alist as a URI query string.

(uri-resolve path orig-uri)

Returns a new URI from path, a string or URI object, as would be interpreted from as a reference from uri. Thus if any components of path are missing, or if path is a raw path, it is taken relative to uri.