1http_uri(3)                Erlang Module Definition                http_uri(3)
2
3
4

NAME

6       http_uri - URI utility module
7

DESCRIPTION

9       This module provides utility functions for working with URIs, according
10       to RFC 3986.
11

DATA TYPES

13       Type definitions that are used more than once in this module:
14
15       boolean() = true | false
16
17       string() = list of ASCII characters
18

URI DATA TYPES

20       Type definitions that are related to URI:
21
22         uri() = string() | binary():
23           Syntax according to the URI definition in RFC  3986,  for  example,
24           "http://www.erlang.org/"
25
26         user_info() = string() | binary():
27
28
29         scheme() = atom():
30           Example: http, https
31
32         host() = string() | binary():
33
34
35         port() = inet:port_number():
36
37
38         path() = string() | binary():
39           Represents a file path or directory path
40
41         query() = string() | binary():
42
43
44         fragment() = string() | binary():
45
46
47       For more information about URI, see RFC 3986.
48

EXPORTS

50       decode(HexEncodedURI) -> URI
51
52              Types:
53
54                 HexEncodedURI  = string() | binary() - A possibly hexadecimal
55                 encoded URI
56                 URI = uri()
57
58              Decodes a possibly hexadecimal encoded URI.
59
60       encode(URI) -> HexEncodedURI
61
62              Types:
63
64                 URI = uri()
65                 HexEncodedURI = string() | binary() - Hexadecimal encoded URI
66
67              Encodes a hexadecimal encoded URI.
68
69       parse(URI) -> {ok, Result} | {error, Reason}
70       parse(URI, Options) -> {ok, Result} | {error, Reason}
71
72              Types:
73
74                 URI = uri()
75                 Options = [Option]
76                 Option    =    {ipv6_host_with_brackets,     boolean()}     |
77                 {scheme_defaults,  scheme_defaults()} | {fragment, boolean()}
78                 | {scheme_validation_fun, fun()}
79                 Result =  {Scheme,  UserInfo,  Host,  Port,  Path,  Query}  |
80                 {Scheme, UserInfo, Host, Port, Path, Query, Fragment}
81                 Scheme = scheme()
82                 UserInfo = user_info()
83                 Host = host()
84                 Port = inet:port_number()
85                 Path = path()
86                 Query = query()
87                 Fragment = fragment()
88                 Reason = term()
89
90              Parses  a  URI. If no scheme defaults are provided, the value of
91              the scheme_defaults function is used.
92
93              When parsing a URI with an unknown scheme (that is, a scheme not
94              found  in  the scheme defaults), a port number must be provided,
95              otherwise the parsing fails.
96
97              If the fragment option is true, the URI fragment is returned  as
98              part of the parsing result, otherwise it is ignored.
99
100              Scheme validation fun is to be defined as follows:
101
102              fun(SchemeStr :: string() | binary()) ->
103                   valid |   {error, Reason :: term()}.
104
105
106              It  is  called  before  scheme string gets converted into scheme
107              atom and thus possible atom leak could be prevented
108
109          Warning:
110              The scheme portion of the URI gets converted into atom,  meaning
111              that  atom leak may occur. Specifying a scheme validation fun is
112              recommended unless the URI is already sanitized.
113
114
115       scheme_defaults() -> SchemeDefaults
116
117              Types:
118
119                 SchemeDefaults = [{scheme(), default_scheme_port_number()}]
120                 default_scheme_port_number() = inet:port_number()
121
122              Provides a list of the scheme and  their  default  port  numbers
123              supported (by default) by this utility.
124
125
126
127Ericsson AB                       inets 7.0.7                      http_uri(3)
Impressum