jiangfucheng commented on code in PR #9841:
URL: https://github.com/apache/apisix/pull/9841#discussion_r1267097856
##########
t/plugin/ua-restriction.t:
##########
@@ -340,136 +340,7 @@ User-Agent:foo/bar
hello world
-
-=== TEST 18: bypass_missing test, using default, reset conf(part1)
Review Comment:
Updated.
##########
apisix/plugins/ua-restriction.lua:
##########
@@ -81,27 +70,53 @@ local _M = {
schema = schema,
}
-local function match_user_agent(user_agent, conf)
- user_agent = str_strip(user_agent)
- if conf.allowlist then
- for _, rule in ipairs(conf.allowlist) do
+local function check_with_allow_list(user_agents, allowlist)
+ local check = function (user_agent)
+ user_agent = str_strip(user_agent)
+
+ for _, rule in ipairs(allowlist) do
if re_find(user_agent, rule, "jo") then
return true
end
end
return false
end
- if conf.denylist then
- for _, rule in ipairs(conf.denylist) do
+ if type(user_agents) == "table" then
+ for _, v in ipairs(allowlist) do
Review Comment:
Stupid mistake.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]