From 62b10d5432ca40491cba700e4c2d70bcb3408ee5 Mon Sep 17 00:00:00 2001 From: Vladimír Čunát Date: Thu, 21 Sep 2023 14:51:42 +0200 Subject: /views/*/options: fix when used with e.g. tags The issue is not now; it has always been broken in 6.x. The model is that at most one view applies on any request. If we need to do more things, they must happen as one meta-action. test_view_insert_action(): dropped; can't see a suitable replacement --- modules/policy/policy.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'modules') diff --git a/modules/policy/policy.lua b/modules/policy/policy.lua index 443fc0b0..60b03478 100644 --- a/modules/policy/policy.lua +++ b/modules/policy/policy.lua @@ -856,6 +856,16 @@ function policy.TAGS_ASSIGN(names) return 'policy.tags_assign_bitmap(' .. tostring(bitmap) .. ')' end +-- Perform a list of actions sequentially; meant for kr_view_insert_action(). +function policy.COMBINE(list) + if #list == 1 then return list[1] end + local r = 'function(state,req) ' + for _, item in ipairs(list) do + r = r .. item .. '(state,req); ' + end + return r .. 'end' +end + --[[ Insert a forwarding rule, i.e. override upstream for one DNS subtree. Throws lua exceptions when detecting something fishy. -- cgit v1.2.3