rack-attack 4.4.0 → 4.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/attack/store_proxy.rb +20 -16
- data/lib/rack/attack/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b35131dd58c3ab63a32c6ebeba00cd203c207973
|
4
|
+
data.tar.gz: 86113382083a32cec8f0c3a5ed67d45b8a797bba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9b12687222d55512bc1958b56e50b04f2bd87099a3806539df170d321db1e32b992bcff13f18b95875259448a0193f6caf5f5ba63caca0a6a018847a43dfbd3
|
7
|
+
data.tar.gz: 227b3c795cf86843e607ec36cb0c5a5ef3bdfe31ffdc7f30788bf935f716129d51574c326f2b29a542955e028b45a28ff282b13d4277e2233cb93842c1cb2d63
|
@@ -3,26 +3,30 @@ module Rack
|
|
3
3
|
module StoreProxy
|
4
4
|
PROXIES = [DalliProxy, MemCacheProxy, RedisStoreProxy]
|
5
5
|
|
6
|
+
ACTIVE_SUPPORT_WRAPPER_CLASSES = Set.new(['ActiveSupport::Cache::MemCacheStore', 'ActiveSupport::Cache::RedisStore']).freeze
|
7
|
+
ACTIVE_SUPPORT_CLIENTS = Set.new(['Redis::Store', 'Dalli::Client', 'MemCache']).freeze
|
8
|
+
|
6
9
|
def self.build(store)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
client = unwrap_active_support_stores(store)
|
11
|
+
klass = PROXIES.find { |proxy| proxy.handle?(client) }
|
12
|
+
klass ? klass.new(client) : client
|
13
|
+
end
|
14
|
+
|
11
15
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
private
|
17
|
+
def self.unwrap_active_support_stores(store)
|
18
|
+
# ActiveSupport::Cache::RedisStore doesn't expose any way to set an expiry,
|
19
|
+
# so use the raw Redis::Store instead.
|
20
|
+
# We also want to use the underlying Dalli client instead of ::ActiveSupport::Cache::MemCacheStore,
|
21
|
+
# and the MemCache client if using Rails 3.x
|
22
|
+
|
23
|
+
client = store.instance_variable_get(:@data)
|
24
|
+
if ACTIVE_SUPPORT_WRAPPER_CLASSES.include?(store.class.to_s) && ACTIVE_SUPPORT_CLIENTS.include?(client.class.to_s)
|
25
|
+
client
|
26
|
+
else
|
27
|
+
store
|
21
28
|
end
|
22
|
-
klass = PROXIES.find { |proxy| proxy.handle?(store) }
|
23
|
-
klass ? klass.new(store) : store
|
24
29
|
end
|
25
|
-
|
26
30
|
end
|
27
31
|
end
|
28
32
|
end
|
data/lib/rack/attack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-attack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.4.
|
4
|
+
version: 4.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Suggs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|