Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
All notable changes to `lua-resty-ada` will be documented in this file.

## [1.2.0] - Unreleased
### Fixed
- Ada library will now be also loaded from <lib>.so|.dylib.<version>, in addition to
wrong <lib>.<version>.so|.dylib.
### Changed
- Bumped Ada to `3.2.1`
- Bumped Ada to `3.3.0`

## [1.1.0] - 2024-09-03
### Added
Expand Down
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ project(
ada
DESCRIPTION "Fast spec-compliant URL parser"
LANGUAGES C CXX
VERSION 3.2.1
VERSION 3.3.3
)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Avoid warning about DOWNLOAD_EXTRACT_TIMESTAMP in CMake 3.24:
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
Expand All @@ -18,8 +20,8 @@ include(FetchContent)

FetchContent_Declare(
ada
URL https://github.com/ada-url/ada/releases/download/v3.2.1/singleheader.zip
URL_HASH SHA256=2954ff2208aa016de4213af7371273e1c41c71571e373eadf550ada808c79f42
URL https://github.com/ada-url/ada/releases/download/v3.3.0/singleheader.zip
URL_HASH SHA256=127994be3ce79a0416fd5bcdbb4b10cee84839c4ec8251e9c52aa8e6c6e16762
)

FetchContent_MakeAvailable(ada)
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ copy-library: build
@cp build/$(LIBRARY) .

luarocks-install:
@luarocks make
@luarocks --lua-version 5.1 make

lint:
@luacheck ./lib
Expand All @@ -33,7 +33,7 @@ docs:
@ldoc .

install-rock:
@luarocks make
@luarocks --lua-version 5.1 make

install-lib: build
@cmake --install build
Expand Down
10 changes: 5 additions & 5 deletions dev/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM openresty/openresty:1.27.1.1-0-noble
FROM openresty/openresty:1.27.1.2-0-noble

ENV DEBIAN_FRONTEND noninteractive
ENV TEST_NGINX_BINARY openresty

USER root

RUN apt update
RUN apt install -y gcc git cmake
RUN luarocks install luacheck
RUN luarocks install busted
RUN luarocks install LuaCov
RUN apt install -y gcc git cmake lua5.1 liblua5.1-dev luarocks
RUN luarocks --lua-version 5.1 install luacheck
RUN luarocks --lua-version 5.1 install busted
RUN luarocks --lua-version 5.1 install LuaCov
2 changes: 1 addition & 1 deletion lib/resty/ada.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ end
---
-- Iterate over each parameter in search parameters in URL.
--
-- @function search_pairs
-- @function search_ipairs
-- @treturn function iterator function
-- @treturn cdata state
--
Expand Down
13 changes: 9 additions & 4 deletions lib/resty/ada/lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,25 @@ do
"ada",
}

local library_extensions = ffi.os == "OSX" and { ".dylib", ".so", }
or { ".so", ".dylib", }


local library_versions = {
"",
".3",
".2",
}

local library_extensions = ffi.os == "OSX" and { ".dylib", ".so", }
or { ".so", ".dylib", }

-- try to load ada library from package.cpath
for _, library_name in ipairs(library_names) do
for _, library_version in ipairs(library_versions) do
for _, library_extension in ipairs(library_extensions) do
local lib = load_lib_from_cpath(library_name .. library_version .. library_extension)
local lib = load_lib_from_cpath(library_name .. library_extension .. library_version)
if lib then
return lib
end
lib = load_lib_from_cpath(library_name .. library_version .. library_extension)
if lib then
return lib
end
Expand Down
2 changes: 1 addition & 1 deletion lib/resty/ada/search.lua
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ mt.__pairs = mt.pairs
---
-- Iterate over each parameter in search parameters.
--
-- @function __pairs
-- @function __ipairs
-- @treturn function iterator function
-- @treturn cdata state
--
Expand Down