From cbed7dfdf503b8d56de4ae5ed86e32bfc4e8e60e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 10 Jun 2023 12:14:12 +0200 Subject: util.array: Expose new() on module table For consistency with other utils. Consistency is good. --- util/array.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/util/array.lua b/util/array.lua index c33a5ef1..5461882a 100644 --- a/util/array.lua +++ b/util/array.lua @@ -35,6 +35,8 @@ local function new_array(self, t, _s, _var) return setmetatable(t or {}, array_mt); end +array.new = new_array; + function array_mt.__add(a1, a2) local res = new_array(); return res:append(a1):append(a2); -- cgit v1.2.3 From 960f406662c436762033ce13422eb030d3a52f61 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 10 Jun 2023 12:33:58 +0200 Subject: mod_http: Fix error if 'access_control_allow_origins' is set Because it changes the type of the 'opt_origins' variable from util.set to the internal _items table so next time an http app is added an error "attempt to call a nil value (method 'empty')" is triggered. The value is not used anywhere else. Noticed when reviewing uses of the '_items' set property. Not reported by any users, implying this setting is rarely used. --- plugins/mod_http.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index 01bb1f6f..0cee26c4 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -149,7 +149,7 @@ function module.add_host(module) local app_credentials = opt_credentials; local app_origins; if opt_origins and not (opt_origins:empty() or opt_origins:contains("*")) then - opt_origins = opt_origins._items; + app_origins = opt_origins._items; end local function cors_handler(event_data) -- cgit v1.2.3