flail 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/flail/exception.rb +5 -2
- data/lib/flail/version.rb +1 -1
- metadata +2 -2
data/lib/flail/exception.rb
CHANGED
@@ -14,8 +14,10 @@ class Flail
|
|
14
14
|
def request
|
15
15
|
@request ||= if @env['flail.request']
|
16
16
|
@env['flail.request']
|
17
|
-
|
17
|
+
elsif defined?(ActionDispath::Request)
|
18
18
|
ActionDispatch::Request.new(@env)
|
19
|
+
else
|
20
|
+
nil
|
19
21
|
end
|
20
22
|
end
|
21
23
|
|
@@ -108,7 +110,8 @@ class Flail
|
|
108
110
|
def ignore?
|
109
111
|
# Ignore requests with user agent string matching
|
110
112
|
# this regxp as they are surely made by bots
|
111
|
-
|
113
|
+
user_agents = request.respond_to?(:user_agent) ? request.user_agent : @env['HTTP_USER_AGENT']
|
114
|
+
if user_agents =~ /\b(Baidu|Gigabot|Googlebot|libwww-perl|lwp-trivial|msnbot|SiteUptime|Slurp|WordPress|ZIBB|ZyBorg|Yandex|Jyxobot|Huaweisymantecspider|ApptusBot)\b/i
|
112
115
|
return true
|
113
116
|
end
|
114
117
|
|
data/lib/flail/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|