View Source jhn_uri (jhn_stdlib v5.3.3)

A URI library based on: Uniform Resource Identifier (URI): Generic Syntax (rfc3986)

Summary

Functions

Decodes the binary into a structured Erlang term. Equivalent of decode(Binary, []) -> URI.

Decodes the binary into a structured Erlang. Decode will give an exception if the binary is not well formed URI. Options are

Encodes the structured Erlang term as an iolist. Equivalent of encode(Term, []) -> URI.

Encodes the structured Erlang term as an iolist or binary. Encode will give an exception if the erlang term is not well formed. Options are: binary -> a binary is returned list -> a flat list is returned iolist -> a iolist is returned ipv4 -> an ipv4 address is encoded when the Host is an integer ipv6 -> an ipv6 address is encoded when the Host is an integer ipv6ipv4 -> encoded IPv6 host address has the two least sigificant segments repesented in IPv4 address format compact -> the most compact encoding of IPv6 used (collapsed zeros)

Types

-type opt() :: ipv4 | ipv6 | ipv6ipv4 | compact | iolist | list | binary.
-type opts() :: [opt()].
-type scheme() :: http | https | file | sip | sips | mailto | ws | wss | atom().
-type uri() ::
          #uri{scheme :: undefined | scheme(),
               userinfo :: [binary()],
               host :: undefined | binary() | inet:ip_address(),
               port :: undefined | inet:port_number(),
               path :: [binary()],
               query :: binary(),
               fragment :: binary()}.

Functions

-spec decode(binary()) -> uri().

Decodes the binary into a structured Erlang term. Equivalent of decode(Binary, []) -> URI.

-spec decode(binary(), opts()) -> uri().

Decodes the binary into a structured Erlang. Decode will give an exception if the binary is not well formed URI. Options are:

-spec encode(uri()) -> iolist().

Encodes the structured Erlang term as an iolist. Equivalent of encode(Term, []) -> URI.

-spec encode(uri(), opts()) -> iolist() | binary().

Encodes the structured Erlang term as an iolist or binary. Encode will give an exception if the erlang term is not well formed. Options are: binary -> a binary is returned list -> a flat list is returned iolist -> a iolist is returned ipv4 -> an ipv4 address is encoded when the Host is an integer ipv6 -> an ipv6 address is encoded when the Host is an integer ipv6ipv4 -> encoded IPv6 host address has the two least sigificant segments repesented in IPv4 address format compact -> the most compact encoding of IPv6 used (collapsed zeros)