Authored by chunhua.zhang

add

@@ -153,10 +153,10 @@ end @@ -153,10 +153,10 @@ end
153 153
154 --forbid user agent 154 --forbid user agent
155 function forbid_ua() 155 function forbid_ua()
156 - local forbid_uas = {'python-requests'} 156 + local forbid_ua_table = {'python-requests'}
157 local ua = http_request.get_ua() 157 local ua = http_request.get_ua()
158 - for forbid_ua in forbid_uas do  
159 - if ua and string.find(ua, forbid_ua) then 158 + for i = 1, #forbid_ua_table do
  159 + if ua and string.find(ua, forbid_ua_table[i]) then
160 ngx.log(ngx.ERR, "[User-Agent Not Allowed]", ua) 160 ngx.log(ngx.ERR, "[User-Agent Not Allowed]", ua)
161 ngx.exist(HTTP_OK) 161 ngx.exist(HTTP_OK)
162 end 162 end