Permalink
Browse files

clarify purpose of code

  • Loading branch information...
sudara committed Sep 12, 2011
1 parent 404165c commit 20ef49b545f52c73966ee834057c93ffbe2a061c
Showing with 2 additions and 1 deletion.
  1. +2 −1 app/controllers/assets_controller.rb
@@ -15,6 +15,7 @@ class AssetsController < ApplicationController
@@bots = ['bot','spider','baidu']
@@bad_ip_ranges = ['195.239', '220.181', '61.135', '60.28.232', '121.14', '221.194']
+
# GET /assets
# GET /assets.xml
def index
@@ -296,7 +297,7 @@ def bot?
ip = request.remote_ip
return true unless present? request.user_agent
return true if @@bad_ip_ranges.any?{|cloaked_ip| ip.match /^#{cloaked_ip}/ } # check bad ips that fake user agent
- not browser? or @@bots.any?{|bot_agent| @agent.include? bot_agent} # check user agent
+ not browser? or @@bots.any?{|bot_agent| @agent.include? bot_agent} # check user agent againts white and black list
end
def browser?

0 comments on commit 20ef49b

Please sign in to comment.