package orsetto
Install
Dune Dependency
Authors
Maintainers
Sources
sha512=9b654edb663ae697563f150824047052f3b1bf760398f24bce6350553f031f73c46b6337239a1acd871e61238597ea92046809e3358290ff14d6ba671b449085
doc/orsetto.cf/Cf_uri/index.html
Module Cf_uri
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).
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).
Host name (RFC 3986).
IPv4 address literal (RFC 3986)
IPv6 address literal with optional zone identifier (RFC 3986,6874)
Future IP address literal (RFC 3986)
class type virtual basis = object ... end
The virtual class type inherited by all URI subtypes.
class type relative = object ... end
The class type of relative URI references.
class type absolute = object ... end
The class type of absolute URI bases.
class type generic = object ... end
The class type of generic URI.
The private higher-order type of URI object containers.
The private type of URI references.
Scanners
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.
val scan_registry_name : string Cf_scan.ASCII.t
Use scan_registry_name
to scan the "registry name" part of a host.
val scan_ipv4_address : string Cf_scan.ASCII.t
Use scan_ipv4_address
to scan an IPv4 address literal.
val scan_ipv6_address : string Cf_scan.ASCII.t
Use scan_ipv6_address
to scan an IPv6 address literal.
val scan_host : host Cf_scan.ASCII.t
Use scan_host
to scan the "host" part of a URI authority.
val scan_authority : authority Cf_scan.ASCII.t
Use scan_authority
to scan the "authority" part of a URI hierarchy.
val scan_generic : t Cf_scan.ASCII.t
Use scan_generic
to scan a generic URI.
val scan_reference : reference Cf_scan.ASCII.t
Use scan_reference
to scan a URI reference.
val of_string : string -> t
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.
val emit_host : host Cf_emit.To_buffer.t
Use emit_host b name
to emit the "host" part of a URI authority.
val emit_authority : authority Cf_emit.To_buffer.t
Use emit_authority b authority
to emit the "authority" part of a URI hierarchy.
val emit_generic : t Cf_emit.To_buffer.t
Use emit_generic b uri
to emit a generic URI.
val emit_reference : reference Cf_emit.To_buffer.t
Use emit_reference b reference
to emit a URI reference.
val to_string : t -> string
Use to_string uri
to compose uri
into its textual form.
Miscellaneous Functions
Use resolve_aux b r
to resolve r
according to the base b
.
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.
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.