From b0c682a8118c5775da784e9a0f569ee995319f80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A9ter=20Dimitrov?= This module contains functions for parsing and handling URIs (RFC 3986) and
- form-urlencoded query strings (RFC 1866). This module contains functions for parsing and handling URIs
+ ( A URI is an identifier consisting of a sequence of characters matching the syntax
- rule named URI in RFC 3986.
The generic URI syntax consists of a hierarchical sequence of components referred to as the scheme, authority, path, query, and fragment:
@@ -55,16 +58,24 @@
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 cover the following use cases:
There are four different encodings present during the handling of URIs:
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
- for
All of the functions but
Error tuple indicating the type of error. Possible values of the second component:
+List of unicode codepoints, UTF-8 encoded binary, or a mix of the two,
- representing an RFC 3986 compliant URI (percent-encoded form).
+ representing an
Composes a form-urlencoded
See also the opposite operation
Example:
-1> uri_string:compose_query([{"foo bar","1"},{"city","örebro"}]). - +1> uri_string:compose_query([{"foo bar","1"},{"city","örebro"}], +1> [{separator, semicolon}]). +"foo+bar=1;city=%C3%B6rebro" +2> >,<<"1">>}, +2> {<<"city">>,<<"örebro"/utf8>>}]).]]> +>]]>
Same as
See also the opposite operation
Example:
1> uri_string:compose_query([{"foo bar","1"},{"city","örebro"}], -2> [{separator, semicolon}]). -"foo+bar=1;city=%C3%B6rebro" +1> [{separator, amp}]). +@@ -143,13 +181,19 @@
Dissects an urlencoded
See also the opposite operation
Example:
1> uri_string:dissect_query("foo+bar=1;city=%C3%B6rebro"). [{"foo bar","1"},{"city","örebro"}] +2> >).]]> +>,<<"1">>},{<<"city">>,<<"örebro"/utf8>>}] ]]>@@ -159,14 +203,19 @@
Returns a
If parsing fails, an error tuple is returned.
+ of theSee also the opposite operation
Example:
1> uri_string:parse("foo://user@example.com:8042/over/there?name=ferret#nose"). #{fragment => "nose",host => "example.com", path => "/over/there",port => 8042,query => "name=ferret", scheme => foo,userinfo => "user"} +2> >).]]> + <<"example.com">>,path => <<"/over/there">>, + port => 8042,query => <<"name=ferret">>,scheme => <<"foo">>, + userinfo => <<"user">>}]]>
Returns an RFC 3986 compliant
If the
Returns an
See also the opposite operation
Example:
1> URIMap = #{fragment => "nose", host => "example.com", path => "/over/there", -port => 8042, query => "name=ferret", scheme => "foo", userinfo => "user"}. +1> port => 8042, query => "name=ferret", scheme => "foo", userinfo => "user"}. #{fragment => "top",host => "example.com", path => "/over/there",port => 8042,query => "?name=ferret", scheme => foo,userinfo => "user"} @@ -194,14 +246,15 @@ port => 8042, query => "name=ferret", scheme => "foo", userinfo => "user"}.Transcode URI. - -- cgit v1.2.3Transcodes an RFC 3986 compliant
, + URIString Transcodes an
-RFC 3986 + compliant, where URIString is a list of tagged tuples, specifying the inbound - ( Options in_encoding ) and outbound (out_encoding ) encodings.If an argument is invalid, an error tuple is returned.
+ (in_encoding ) and outbound (out_encoding ) encodings. + If an argument is invalid, an error tuple is returned.Example:
1> >,]]> -2> [{in_encoding, utf32},{out_encoding, utf8}]). +1> [{in_encoding, utf32},{out_encoding, utf8}]). >]]>