6
6
Overview
7
7
===============================================================================
8
8
9
- A "URI" is a "Uniform Resource Identifier".
9
+ *URI * stands for *Uniform Resource Identifier * - a sequence of characters that
10
+ identifies a logical or physical resource.
10
11
The `IETF standard <https://www.ietf.org/rfc/rfc2396.txt >`_
11
12
says a URI string looks like this:
12
13
@@ -23,11 +24,11 @@ A common type, a hierarchical URI, looks like this:
23
24
For example the string ``'https://tarantool.org/x.html#y' ``
24
25
has three components:
25
26
26
- * ``https `` is the scheme,
27
- * ``tarantool.org/x.html `` is the path,
27
+ * ``https `` is the scheme.
28
+ * ``tarantool.org/x.html `` is the path.
28
29
* ``y `` is the fragment.
29
30
30
- Tarantool's URI module provides routines which convert URI strings into their
31
+ Tarantool's URI module provides functions that convert URI strings into their
31
32
components, or turn components into URI strings.
32
33
33
34
===============================================================================
@@ -57,9 +58,25 @@ Below is a list of all ``uri`` functions.
57
58
58
59
.. function :: parse(URI-string)
59
60
61
+ Parse a URI string into components. Possible components are:
62
+
63
+ * ``fragment ``
64
+ * ``host ``
65
+ * ``ipv4 ``
66
+ * ``ipv6 ``
67
+ * ``login ``
68
+ * ``password ``
69
+ * ``path ``
70
+ * ``query ``
71
+ * ``scheme ``
72
+ * ``service ``
73
+ * ``unix ``
74
+
75
+ ``uri.parse() `` is the reverse of :ref: `uri.format() <uri-format >`.
76
+
60
77
:param URI-string: a Uniform Resource Identifier
61
- :return: URI-components-table. Possible components are fragment, host,
62
- login, password, path, query, scheme, service.
78
+ :return: URI components table.
79
+
63
80
:rtype: Table
64
81
65
82
**Example: **
@@ -70,31 +87,61 @@ Below is a list of all ``uri`` functions.
70
87
---
71
88
...
72
89
73
- tarantool> uri.parse('http://x.html#y')
90
+ tarantool> uri.parse('scheme://login:password@host:service'..
91
+ '/path1/path2/path3?q1=v1&q2=v2&q3=v3:1|v3:2#fragment')
74
92
---
75
- - host: x.html
76
- scheme: http
77
- fragment: y
93
+ - login: login
94
+ params:
95
+ q1:
96
+ - v1
97
+ q2:
98
+ - v2
99
+ q3:
100
+ - v3:1|v3:2
101
+ service: service
102
+ fragment: fragment
103
+ password: password
104
+ scheme: scheme
105
+ query: q1=v1&q2=v2&q3=v3:1|v3:2
106
+ host: host
107
+ path: /path1/path2/path3
78
108
...
79
109
80
110
.. _uri-format :
81
111
82
112
.. function :: format(URI-components-table[, include-password])
83
113
84
- :param URI-components-table: a series of name:value pairs, one for each
114
+ Form a URI string from its components. Possible components are:
115
+
116
+ * ``fragment ``
117
+ * ``host ``
118
+ * ``ipv4 ``
119
+ * ``ipv6 ``
120
+ * ``login ``
121
+ * ``password ``
122
+ * ``path ``
123
+ * ``query ``
124
+ * ``scheme ``
125
+ * ``service ``
126
+ * ``unix ``
127
+
128
+ ``uri.format() `` is the reverse of :ref: `uri.parse() <uri-parse >`.
129
+
130
+ :param URI-components-table: a series of ``name=value `` pairs, one for each
85
131
component
86
132
:param include-password: boolean. If this is supplied and is ``true ``, then
87
133
the password component is rendered in clear text,
88
134
otherwise it is omitted.
89
- :return: URI-string. Thus uri.format() is the reverse of uri.parse().
135
+ :return: URI string
90
136
:rtype: string
91
137
92
138
**Example: **
93
139
94
140
.. code-block :: tarantoolsession
95
141
96
- tarantool> uri.format({host = 'x.html', scheme = 'http', fragment = 'y'})
142
+ tarantool> uri.format({scheme='scheme', login='login', password='password', host='host',
143
+ service='service', path='/path1/path2/path3', query='q1=v1&q2=v2&q3=v3'})
97
144
---
98
- - http ://x.html#y
145
+ - scheme ://login@host:service/path1/path2/path3
99
146
...
100
147
0 commit comments