Next: Retrieving URLs, Previous: Introduction, Up: Top [Contents][Index]

## 2 URI Parsing

A URI consists of several components, each having a different meaning. For example, the URI

    http://www.gnu.org/software/emacs/

specifies the scheme component ‘`http`’, the hostname component ‘`www.gnu.org`’, and the path component ‘`/software/emacs/`’.

The format of URIs is specified by RFC 3986. The `url` library provides the Lisp function `url-generic-parse-url`, a (mostly) standard-compliant URI parser, as well as function `url-recreate-url`, which converts a parsed URI back into a URI string.

Function: url-generic-parse-url uri-string

  This function returns a parsed version of the string uri-string.

Function: url-recreate-url uri-obj

  Given a parsed URI, this function returns the corresponding URI string.

The return value of `url-generic-parse-url`, and the argument expected by `url-recreate-url`, is a parsed URI: a CL structure whose slots hold the various components of the URI. See the CL Manual in GNU Emacs Common Lisp Emulation, for details about CL structures. Most of the other functions in the `url` library act on parsed URIs.