The interpretation of a URI depends only on the characters used and not on how those
characters are represented in a network protocol.
-
The functions implemented by this module covers the following use cases:
+
The functions implemented by this module covers the following use cases:
Parsing URIs parse/1Recomposing URIs recompose/2
- Resolving URI references
- resolve_uri_reference/3
- Creating URI references
- create_uri_reference/3
- Normalizing URIs
- normalize/1Transcoding URIs transcode/2
- Working with urlencoded query strings
- compose_query/1, dissect_query/1
+ Working with form-urlencoded query strings
+ compose_query/[1,2], dissect_query/1
-
-
There are four different encodings present during the handling of URIs:
+
There are four different encodings present during the handling of URIs:
Inbound binary encoding in binariesInbound percent-encoding in lists and binariesOutbound binary encoding in binariesOutbound percent-encoding in lists and binaries
-
Unless otherwise specified the return value type and encoding are the same as the input
type and encoding. That is, binary input returns binary output, list input returns a list
output but mixed input returns list output. Input and output encodings are the same except
@@ -113,31 +105,34 @@
Compose urlencoded query string.
-
Composes an urlencoded QueryString based on a
+
Composes a form-urlencoded QueryString based on a
QueryList, a list of unescaped key-value pairs.
Media type application/x-www-form-urlencoded is defined in section
- 8.2.1 of RFC 1866 (HTML 2.0).
+ 8.2.1 of RFC 1866 (HTML 2.0). Reserved and unsafe characters, as
+ defined by RFC 1738 (Uniform Resource Locators), are procent-encoded.
-
If an argument is invalid, a badarg exception is raised.
Creates an RFC 3986 compliant RelativeDestURI,
- based AbsoluteSourceURI and AbsoluteSourceURI
-
-
If an argument is invalid, a badarg exception is raised.
+
Same as compose_query/1 but with an additional
+ Options parameter, that controls the type of separator used
+ between key-value pairs. There are two supported separator types: amp ()
+ and semicolon (;).
Dissects an urlencoded QueryString and returns a
QueryList, a list of unescaped key-value pairs.
Media type application/x-www-form-urlencoded is defined in section
- 8.2.1 of RFC 1866 (HTML 2.0).
+ 8.2.1 of RFC 1866 (HTML 2.0). Percent-encoded segments are decoded
+ as defined by RFC 1738 (Uniform Resource Locators).
-
If an argument is invalid, a badarg exception is raised.
Example:
-1> uri_string:dissect_query(...).
-
-
-
-
-
-
- Normalize URI.
-
-
Normalizes an RFC 3986 compliant URIString and returns
- a NormalizedURI. The algorithm used to shorten the input
- URI is called Syntax-Based Normalization and described at
- Section 6.2.2 of RFC 3986.
-
-
If an argument is invalid, a badarg exception is raised.
Transcodes an RFC 3986 compliant URIString,
where Options is a list of tagged tuples, specifying the inbound
(in_encoding) and outbound (out_encoding) encodings.
-
If an argument is invalid, a badarg exception is raised.
+
If an argument is invalid, an error tuple is returned.