Description
Related dev. issue(s): tarantool/tarantool#3682
Product: Tarantool
Since: 2.11
Root document:
- https://www.tarantool.io/en/doc/latest/reference/reference_lua/uri/
- https://www.tarantool.io/en/doc/latest/reference/configuration/#uri
- https://www.tarantool.io/en/doc/latest/reference/reference_lua/http/#making-requests
- https://www.tarantool.io/en/doc/latest/reference/reference_lua/socket/#socket-tcp-connect
- https://www.tarantool.io/en/doc/latest/reference/reference_lua/net_box/#lua-function.net_box.connect
- https://www.tarantool.io/en/doc/latest/reference/reference_lua/console/#console-listen
SME: @ ligurio
Details
New functions uri.escape()
and uri.unescape()
have been introduced.
First one allows to escape symbols to a string and second one to
unescape symbols to a string according to RFC 3986 [1].
Examples:
tarantool> uri.escape("тарантул")
---
- '%D1%82%D0%B0%D1%80%D0%B0%D0%BD%D1%82%D1%83%D0%BB'
...
tarantool> uri.unescape("%D1%82%D0%B0%D1%80%D0%B0%D0%BD%D1%82%D1%83%D0%BB")
---
- тарантул
...
uri.escape()
accepts a string that will be encoded and optionally a
table with encoding options: string with unreserved symbols that will
not be encoded and boolean option that enables/disables encoding of a
space characters as '+'. By default uri.escape()
uses a set of
unreserved symbols defined in RFC 3986 ("2.3. Unreserved Characters")
and encoding of space characters as '+' is disabled. Table with default
encoding options is defined as uri.RFC3986
.
uri.unescape()
accepts a string that will be decoded and optionally a
table with decoding options: string with unreserved symbols (these
symbols are actually unused by decoding function) and boolean option
that enables/disables decoding of '+' as a space character. Table with
default decoding options is defined as uri.RFC3986
.
See detailed description in RFC "http: add percent-encoding/decoding of
query string in request" [2].
NO_WRAP
- Uniform Resource Identifier (URI): Generic Syntax
https://datatracker.ietf.org/doc/html/rfc3986 - https://www.notion.so/tarantool/http-add-percent-encoding-decoding-of-query-string-in-request-76a2425a4c4744a1a72643527a4fe7f7
NO_WRAP
Requested by @ ligurio in tarantool/tarantool@5ebe186.