lua-resty-ada
LuaJIT FFI 绑定到 Ada — 符合 WHATWG 标准且快速的 URL 解析器
$ opm get bungle/lua-resty-ada
lua-resty-ada
lua-resty-ada 实现了一个 LuaJIT FFI 绑定到 Ada — 符合 WHATWG 标准且快速的 URL 解析器。
状态
此库被认为已准备好投入生产。
概要
local ada = require("resty.ada")
local url = assert(ada.parse("https://www.7‑Eleven.com:1234/Home/../Privacy/Montréal"))
print(tostring(url))
-- prints: https://www.xn--7eleven-506c.com:1234/Privacy/Montr%C3%A9al
print(tostring(url:clear_port())) -- there are many more methods
-- prints: https://www.xn--7eleven-506c.com/Privacy/Montr%C3%A9al
url:free()
-- explicitly frees the memory without waiting for the garbage collector
-- There is also a static API
print(ada.get_href("https://www.7‑Eleven.com:1234/Home/../Privacy/Montréal"))
-- prints: https://www.xn--7eleven-506c.com:1234/Privacy/Montr%C3%A9al
print(ada.clear_port("https://www.7‑Eleven.com:1234/Home/../Privacy/Montréal"))
-- prints: https://www.xn--7eleven-506c.com/Privacy/Montr%C3%A9al
API
由 LDoc 生成的 API 文档可以在 bungle.github.io/lua-resty-ada 查看。
安装
使用 OpenResty 包管理器
❯ opm get bungle/lua-resty-ada
lua-resty-ada
的 OPM 仓库位于 opm.openresty.org/package/bungle/lua-resty-ada。
使用 LuaRocks
❯ luarocks install lua-resty-ada
lua-resty-ada
的 LuaRocks 仓库位于 luarocks.org/modules/bungle/lua-resty-ada。
构建 Ada
请查阅 Ada 以了解如何构建或安装 ada 库。Ada 库需要安装在系统库路径或 Lua 的 package.cpath
中的其中一个路径。
此项目还可以通过执行以下命令进行构建(需要 cmake)
❯ make build
或使用 act 运行测试套件
❯ act
许可证
lua-resty-ada
使用双条款 BSD 许可证。
Copyright (c) 2024 Aapo Talvensaari, 2024 Guilherme Salazar
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
作者
Aapo Talvensaari (@bungle)
许可证
2bsd
依赖项
luajit
版本
-
bungle/lua-resty-ada 1.1.0LuaJIT FFI 绑定到 Ada — 符合 WHATWG 标准且快速的 URL 解析器 2024-09-03 13:01:12
-
bungle/lua-resty-ada 1.0.1LuaJIT FFI 绑定到 Ada — 符合 WHATWG 标准且快速的 URL 解析器 2024-08-20 18:29:51
-
bungle/lua-resty-ada 1.0.0LuaJIT FFI 绑定到 Ada — 符合 WHATWG 标准且快速的 URL 解析器 2024-08-08 19:57:27