Commit graph

871 commits

Author SHA1 Message Date
Genadi Samokovarov
d9a5587676 Allow throttle period option to be a proc
I need to filter requests on a period I need to get dynamically out of
information I have in the requests. Currently, I can work out the limit,
as it can be a `Proc`, however I can't do that with the period.

This PR adds support for that. Tried to do it in a way that doesn't
brake backwards compatibility, as periods are coerced to numbers during
`Rack::Throttle` initialization.
2014-09-19 19:32:39 +02:00
Aaron Suggs
60d4834969 update changelog for release 2014-09-11 16:23:35 -04:00
Aaron Suggs
1db5a00431 version 4.1.1 2014-09-08 21:34:28 -04:00
Aaron Suggs
8d3e824068 Merge pull request #85 from kickstarter/69-spec-failures
Add 1 second buffer to expiry to correct throttles
2014-09-08 21:28:31 -04:00
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
Aaron Suggs
ba52e2ce15 Merge pull request #82 from brchristian/patch-1
Fix typo in README.md
2014-08-15 12:21:16 -04:00
brchristian
4a724d8c8b Fix typo in README.md 2014-08-15 09:03:38 -07:00
Aaron Suggs
7820986d9c Merge pull request #74 from zmillman/readme-request
Improve documentation of Rack::Attack::Request
2014-08-01 14:43:53 -04:00
Aaron Suggs
502e5ae108 Merge pull request #76 from greysteil/clean-up-travis
Clean up travis.yml
2014-06-20 10:09:13 -04:00
Grey Baker
78663d4a93 Clean up travis.yml 2014-06-20 14:36:48 +01:00
Zach Millman
882221212a Fix formatting of note on Rack::Attack::Request 2014-06-17 11:38:50 -07:00
Zach Millman
5c78f84be2 Improve documentation of Rack::Attack::Request
https://github.com/kickstarter/rack-attack/issues/73
2014-06-17 11:37:25 -07:00
Aaron Suggs
1a3cddb468 Prep for v4.1.0 2014-05-22 13:59:26 -04:00
Aaron Suggs
105c3ba575 Merge pull request #67 from chiliburger/track_only
Limit and period options for track
2014-05-22 13:55:54 -04:00
Paul Coates
e8d98a7ad3 Changed track checker to track filter. Made track filter tests more clear. 2014-05-22 10:11:23 -07:00
Aaron Suggs
6f7bd66dfa Default responses: add Content-Type header
Fixes #68
2014-05-21 18:35:28 -04:00
Paul Coates
1857f8dd57 Added track with limit/period options example to the README.md for clarity. 2014-05-19 12:30:18 -07:00
Paul Coates
c51676d295 Updated README.md to reflect optional limit and period parmas for tracks. 2014-05-19 11:14:50 -07:00
Paul Coates
1ebe1c3517 Added limit and period options to track. Delegates [] to Throttle if they are present otherwise Check. 2014-05-19 11:11:01 -07:00
Aaron Suggs
1fbcb479f1 Merge pull request #66 from rickygu/patch-1
Update README.md
2014-05-18 20:48:35 -04:00
Aaron Suggs
b0a31b999c update changelog 2014-05-18 20:47:34 -04:00
Aaron Suggs
f9eabed6d4 Rack::Attack.clear! resets tracks
Fixes flaky tests like
https://travis-ci.org/kickstarter/rack-attack/builds/25438931
2014-05-18 20:46:11 -04:00
Ricky Gu
3fe74441d7 Update README.md
Update init file from module to class
2014-05-18 00:00:28 -07:00
Aaron Suggs
0e599a4dd6 version 4.0.1 2014-05-14 13:37:30 -04:00
Aaron Suggs
9e26160eae [travis] Test ruby 2.1.2 2014-05-10 14:27:13 -04:00
Aaron Suggs
7b5ebb8180 Update CHANGELOG.md 2014-05-06 15:14:43 -04:00
Aaron Suggs
3aa7e541a3 Merge pull request #63 from blahed/tag-env-with-discriminator
add throttle discriminator to rack env
2014-05-06 15:13:12 -04:00
blahed
6548f3debf Merge remote-tracking branch 'upstream/master' into tag-env-with-discriminator 2014-05-06 13:07:39 -04:00
Aaron Suggs
c17374eada [travisci] Remove tests for ruby 2.1.0; it's no longer installed 2014-05-06 10:52:35 -04:00
blahed
97dce48bfc add throttle discriminator to rack env 2014-05-01 22:20:13 -04:00
Aaron Suggs
430672d8f4 Update changelog for v4.0.0 2014-04-28 15:45:13 -04:00
Aaron Suggs
e1d736f0f0 Changelog + better README description 2014-04-25 13:39:21 -05:00
Aaron Suggs
f911138f7d Merge branch 'pr57'
Closes #57
2014-04-25 13:35:54 -05:00
Aaron Suggs
833e1e937d Integration tests: use 127.0.0.1 instead of localhost 2014-04-25 13:19:22 -05:00
Aaron Suggs
eb81baf612 Readme: installation => getting started 2014-04-24 07:45:48 -05:00
Aaron Suggs
1903edd1cf Merge pull request #61 from zmillman/readme-wiki-link
Add link to example configuration in README
2014-04-24 07:44:17 -05:00
Zach Millman
7af1239655 Add link to example configuration in README 2014-04-23 15:47:24 -05:00
hakanensari
5ff5bf44ba Don't memoize in test
I don’t think this has any side effect, but still…
2014-04-17 18:21:13 +01:00
hakanensari
5d72c6e5f9 Move individual proxy classes to separate files 2014-04-15 16:19:43 +01:00
hakanensari
bf40123c04 Move offline case to separate file 2014-04-15 16:17:27 +01:00
hakanensari
f0a53f474e Stub #with on delegator 2014-04-09 13:15:00 +01:00
hakanensari
0640a53cdf Use Appraisal to test against multiple versions 2014-04-09 13:11:43 +01:00
hakanensari
ca2c0e5515 Ignore binstubs 2014-04-09 13:11:10 +01:00
hakanensari
b4fc97405d Merge remote-tracking branch 'upstream/dalli_versions' into patch-3 2014-04-09 12:17:29 +01:00
hakanensari
937cd3ca20 Merge branch 'master' into patch-3 2014-04-09 12:17:10 +01:00
hakanensari
1c0bc3da4d Merge branch 'patch-2' into patch-3
Conflicts:
	lib/rack/attack/store_proxy.rb
2014-04-09 12:16:16 +01:00
Aaron Suggs
66231dc5b2 v3.1.0 2014-04-04 16:16:31 -04:00
Aaron Suggs
d7f5a31e31 update changelog 2014-04-04 15:52:26 -04:00
Aaron Suggs
f872f5140c Merge pull request #59 from tristandunn/custom-request
Add a custom request class to allow for helper methods.
2014-04-04 15:52:02 -04:00
Tristan Dunn
16f1cfc578 Add a custom request class to allow for helper methods.
Fixes #58.
2014-04-04 14:41:59 -05:00