Рейтинг@Mail.ru

Module uri

Замечание

Документация находится в процессе перевода и может отставать от английской версии.

Module uri

A «URI» is a «Uniform Resource Identifier». The IETF standard says a URI string looks like this:
[scheme:]scheme-specific-part[#fragment]
A common type, a hierarchical URI, looks like this:
[scheme:][//authority][path][?query][#fragment]
For example the string „https://tarantool.org/x.html#y“ has three components: https is the scheme, tarantool.org/x.html is the path, and y is the fragment. Tarantool’s URI module provides routines which convert URI strings into their components, or turn components into URI strings.

uri.parse(URI-string)
Параметры:
  • URI-string – a Uniform Resource Identifier
Returns:

URI-components-table. Possible components are fragment, host, login, password, path, query, scheme, service.

Rtype:

Table

Example:

tarantool> uri = require('uri')
---
...

tarantool> uri.parse('http://x.html#y')
---
- host: x.html
  scheme: http
  fragment: y
...
uri.format(URI-components-table)
Параметры:
  • URI-components-table – a series of name:value pairs, one for each component
Returns:

URI-string. Thus uri.format() is the reverse of uri.parse().

Rtype:

string

Example:

tarantool> uri.format({host = 'x.html', scheme = 'http', fragment = 'y'})
---
- http://x.html#y
...