rack-attack/lib/rack/attack
Aaron Suggs 074e8e5aa4 Add 1 second buffer to expiry to correct throttles
Fixes #69.

There was a race condition when `Time.now.to_i` changes between when
`epoch_time` is computed in line 18, and the cache request is made (and
the `key` is expired).

I.e., a throttle check starts at t0, but doesn’t reach the cache until
t1, the cache will have expired the throttle count. The request will
likely be allowed, even if the request exceeded the limit.

This has the effect of keeping keys in cache about 1 second longer than
strictly necessary. But the extra cache space seems like a good
trade-off for correct throttling.
2014-09-02 14:30:57 -04:00
..
store_proxy Move individual proxy classes to separate files 2014-04-15 16:19:43 +01:00
allow2ban.rb Make Rack::Attack a class and Rack::Attack.new return an instance of that class, rather than Rack::Attack. 2014-03-28 14:53:51 +11:00
blacklist.rb Make Rack::Attack a class and Rack::Attack.new return an instance of that class, rather than Rack::Attack. 2014-03-28 14:53:51 +11:00
cache.rb Add 1 second buffer to expiry to correct throttles 2014-09-02 14:30:57 -04:00
check.rb Added limit and period options to track. Delegates [] to Throttle if they are present otherwise Check. 2014-05-19 11:11:01 -07:00
fail2ban.rb Make Rack::Attack a class and Rack::Attack.new return an instance of that class, rather than Rack::Attack. 2014-03-28 14:53:51 +11:00
request.rb Improve documentation of Rack::Attack::Request 2014-06-17 11:37:25 -07:00
store_proxy.rb Move individual proxy classes to separate files 2014-04-15 16:19:43 +01:00
throttle.rb Added limit and period options to track. Delegates [] to Throttle if they are present otherwise Check. 2014-05-19 11:11:01 -07:00
track.rb Changed track checker to track filter. Made track filter tests more clear. 2014-05-22 10:11:23 -07:00
version.rb Prep for v4.1.0 2014-05-22 13:59:26 -04:00
whitelist.rb Make Rack::Attack a class and Rack::Attack.new return an instance of that class, rather than Rack::Attack. 2014-03-28 14:53:51 +11:00