lua-resty-url - URL parser for OpenResty.
- Name
- Status
- Description
- Synopsis
- Methods
- Installation
- TODO
- Community
- Bugs and Patches
- Author
- Copyright and License
- See Also
This library is considered production ready.
This Lua library is very simple Regex based URL parser.
This library can parse URLs and split them to components.
http {
server {
location /test {
content_by_lua_block {
local resty_url = require 'resty.url'
ngx.say("USER: ", resty_url.parse('http://foo:bar@example.com').user)
}
}
}
}
All the methods are expected to be called on the module without self.
syntax: parts = resty_url.split(url)
Returns a table with integer keys and parts of the URL. Components are: scheme, user, password, host, port, path.
syntax: uri = resty_url.parse(url)
Returns a table with components as keys. Components are: scheme, user, password, host, port, path.
syntax: url = resty_url.join(base, part, ...)
Concatenates URI components into resulting URL. Also normalizes URI to remove double slashes.
Can concatenate objects returned by parse
method.
syntax: port = resty_url.default_port(scheme)
Returns default port for given scheme. Only http and https provided by default.
syntax: uri = resty_url.normalize(uri)
Removes unnecessary slashes from the URI.
If you are using the OpenResty bundle (http://openresty.org ), then you can use opm to install this package.
opm get 3scale/lua-resty-url
Please report bugs or submit patches by
- creating a ticket on the GitHub Issue Tracker,
Michal "mikz" Cichra mcichra@redhat.com, Red Hat Inc.
This module is licensed under the Apache License Version 2.0.
Copyright (C) 2016-2017, Red Hat Inc.
All rights reserved.
See LICENSE for the full license.
- the APIcast API Gateway: https://github.com/3scale/apicast/#readme