rack-attack 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rack-attack might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/rack/attack/throttle.rb +4 -3
- data/lib/rack/attack/version.rb +1 -1
- data/spec/rack_attack_throttle_spec.rb +1 -0
- 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: b2ad64c34913ec247b9f1952ec77a38762742151
|
4
|
+
data.tar.gz: f953e23413add27445c65ef5d058afc0c5dc2cb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2c8ebf7e34dae93d31c300ca035723794f1f185fecaa008fdf1f305697c6d1f36614ae6e5c1135be3722cbfd68b7ea1ef809d6f045f7858e6674dca837cbcc0
|
7
|
+
data.tar.gz: 6b8d3632cae6db709922e400e681b7e0742067baaf3596957af962ab13be55a5a445fee534b40279ae19ab3f50ae2cd8776d473359e06d8889c4b8b5e0b3dab0
|
data/lib/rack/attack/throttle.rb
CHANGED
@@ -32,9 +32,10 @@ module Rack
|
|
32
32
|
|
33
33
|
(count > current_limit).tap do |throttled|
|
34
34
|
if throttled
|
35
|
-
req.env['rack.attack.matched']
|
36
|
-
req.env['rack.attack.
|
37
|
-
req.env['rack.attack.
|
35
|
+
req.env['rack.attack.matched'] = name
|
36
|
+
req.env['rack.attack.match_discriminator'] = discriminator
|
37
|
+
req.env['rack.attack.match_type'] = :throttle
|
38
|
+
req.env['rack.attack.match_data'] = data
|
38
39
|
Rack::Attack.instrument(req)
|
39
40
|
end
|
40
41
|
end
|
data/lib/rack/attack/version.rb
CHANGED
@@ -32,6 +32,7 @@ describe 'Rack::Attack.throttle' do
|
|
32
32
|
last_request.env['rack.attack.matched'].must_equal 'ip/sec'
|
33
33
|
last_request.env['rack.attack.match_type'].must_equal :throttle
|
34
34
|
last_request.env['rack.attack.match_data'].must_equal({:count => 2, :limit => 1, :period => @period})
|
35
|
+
last_request.env['rack.attack.match_discriminator'].must_equal('1.2.3.4')
|
35
36
|
end
|
36
37
|
it 'should set a Retry-After header' do
|
37
38
|
last_response.headers['Retry-After'].must_equal @period.to_s
|
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.0.
|
4
|
+
version: 4.0.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: 2014-
|
11
|
+
date: 2014-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|