jiangfucheng commented on code in PR #9448:
URL: https://github.com/apache/apisix/pull/9448#discussion_r1204189752


##########
apisix/plugins/ua-restriction.lua:
##########
@@ -142,7 +142,7 @@ function _M.access(conf, ctx)
         match = lrucache_useragent(user_agent, conf, match_user_agent, 
user_agent, conf)
     end
 
-    if match > MATCH_ALLOW then
+    if match > MATCH_ALLOW or (match == MATCH_NONE and conf.allowlist and not 
conf.denylist) then

Review Comment:
   ```
      if type(user_agent) == "table" then
           for _, v in ipairs(user_agent) do
               if type(v) == "string" then
                   match = lrucache_useragent(v, conf, match_user_agent, v, 
conf)
                   if match > MATCH_ALLOW then
                       break
                   end
               end
           end
       else
           match = lrucache_useragent(user_agent, conf, match_user_agent, 
user_agent, conf)
       end
   ```
   
   When more than one UA, this code will traverse all of the UA talbe util 
`match > MATCH_ALLOW`, so even if `match == MATCH_NONE or match == MATCH_ALLOW` 
, it will still continue to traverse.
   
   I don't know if I understand correctly, if not, can you give me a example to 
explain it?



-- 
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]

Reply via email to