Legend:
Library
Module
Module type
Parameter
Class
Class type
General syntax of the Uniform Resource Identifier (URI)
Overview
This module implements operations on the general syntax of Uniform Resource Identifiers (URI) according to RFC 3986, as well as convenience functions for manipulating their components. Some functions are also provided for conversion to and from strings for presentation.
Types
The private types below comprise the structure of generic URI values in syntax-normalized form (see RFC 3986, section 6.2.2).
type host = ..
The extensible sum type of "host" components of hierarchical URI's. Values of the cases of this type defined in this module are syntax-normalized. In particular, the ASCII letter characters present in "scheme" and "host" components are always lower case (except for the 'zoneid' field in IPv6 addresses).
These functions comprise a parser for the generic URI syntax defined in RFC 3986 (updated by errata and by RFC 6874).
Fields containing percent-encoded text are decoded first, then other syntax normalization functions are applied, e.g. case normalization, path segment list normalization, et cetera.
Use of_string s to decompose s into its URI structural value. Raises Invalid_argument if s is not valid generic URI syntax.
Emitters
These functions comprise a formatter that conforms to the generic URI syntax defined in RFC 3986 (updated by errata and by RFC 6874).
Unreserved characters are not percent-encoded. Reserved characters are only percent-encoded when the fields in which they appear are delimited by them.
Use percent_decode s to transform the sequence s by decoding all the "percent-encoded" characters. Evaluation raises Failure if a '%' character appears without two hexadecimal digits immediately following.
val percent_encode : ?allow:(char -> bool)->char Seq.t->char Seq.t
Use percent_encode ?allow s to transform the sequence s into the equivalent "percent-encoded" sequence. Use ~allow to provide a function that returns true for those reserved characters to be left decoded in the resulting sequence. Unreserved characters are never percent encoded.