forked from tarantool/tarantool
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uri: add escape and unescape functions
Closes tarantool#3682 @TarantoolBot document Title: Document a new functions to encode and decode parts of URI 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 1. Uniform Resource Identifier (URI): Generic Syntax https://datatracker.ietf.org/doc/html/rfc3986 2. https://www.notion.so/tarantool/http-add-percent-encoding-decoding-of-query-string-in-request-76a2425a4c4744a1a72643527a4fe7f7 NO_WRAP
- Loading branch information
Showing
4 changed files
with
506 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## feature/lua/uri | ||
|
||
* Added functions for percent-encoding and decoding of URI's parts (gh-3682). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.