flail 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/flail/exception.rb +13 -1
- data/lib/flail/version.rb +1 -1
- data/spec/exception_spec.rb +4 -0
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/lib/flail/exception.rb
CHANGED
@@ -3,6 +3,14 @@ require 'json'
|
|
3
3
|
|
4
4
|
class Flail
|
5
5
|
class Exception
|
6
|
+
def self.notify(exception, request_data = {})
|
7
|
+
env = {'flail.request' => {'user_agent' => 'internal'}}
|
8
|
+
|
9
|
+
fe = Flail::Exception.new(env, exception)
|
10
|
+
fe.request_data = fe.request_data.merge(request_data)
|
11
|
+
fe.handle!
|
12
|
+
end
|
13
|
+
|
6
14
|
def initialize(env, exception, local = false)
|
7
15
|
@exception = exception
|
8
16
|
@env = env
|
@@ -32,6 +40,10 @@ class Flail
|
|
32
40
|
end
|
33
41
|
end
|
34
42
|
|
43
|
+
def request_data=(value)
|
44
|
+
@request_data = value
|
45
|
+
end
|
46
|
+
|
35
47
|
def clean_unserializable_data(data, stack = [])
|
36
48
|
return "[possible infinite recursion halted]" if stack.any? {|item| item == data.object_id}
|
37
49
|
|
@@ -110,7 +122,7 @@ class Flail
|
|
110
122
|
def ignore?
|
111
123
|
# Ignore requests with user agent string matching
|
112
124
|
# this regxp as they are surely made by bots
|
113
|
-
user_agents = request.respond_to?(:user_agent) ? request.user_agent : @env['HTTP_USER_AGENT']
|
125
|
+
user_agents = request.respond_to?(:user_agent) ? request.user_agent : @env['HTTP_USER_AGENT'].to_s
|
114
126
|
if user_agents =~ /\b(Baidu|Gigabot|Googlebot|libwww-perl|lwp-trivial|msnbot|SiteUptime|Slurp|WordPress|ZIBB|ZyBorg|Yandex|Jyxobot|Huaweisymantecspider|ApptusBot)\b/i
|
115
127
|
return true
|
116
128
|
end
|
data/lib/flail/version.rb
CHANGED
data/spec/exception_spec.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.2
|
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-09-
|
12
|
+
date: 2012-09-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: actionpack
|