mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-17 13:15:50 +00:00
Merge pull request #579 from kyoshidajp/replace_git.io
Replace git.io URL
This commit is contained in:
commit
95ce9fdd7c
2 changed files with 4 additions and 2 deletions
|
|
@ -62,7 +62,7 @@ module Rack
|
||||||
|
|
||||||
def key_and_expiry(unprefixed_key, period)
|
def key_and_expiry(unprefixed_key, period)
|
||||||
@last_epoch_time = Time.now.to_i
|
@last_epoch_time = Time.now.to_i
|
||||||
# Add 1 to expires_in to avoid timing error: https://git.io/i1PHXA
|
# Add 1 to expires_in to avoid timing error: https://github.com/rack/rack-attack/pull/85
|
||||||
expires_in = (period - (@last_epoch_time % period) + 1).to_i
|
expires_in = (period - (@last_epoch_time % period) + 1).to_i
|
||||||
["#{prefix}:#{(@last_epoch_time / period).to_i}:#{unprefixed_key}", expires_in]
|
["#{prefix}:#{(@last_epoch_time / period).to_i}:#{unprefixed_key}", expires_in]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ module Rack
|
||||||
class Attack
|
class Attack
|
||||||
# When using Rack::Attack with a Rails app, developers expect the request path
|
# When using Rack::Attack with a Rails app, developers expect the request path
|
||||||
# to be normalized. In particular, trailing slashes are stripped.
|
# to be normalized. In particular, trailing slashes are stripped.
|
||||||
# (See https://git.io/v0rrR for implementation.)
|
# (See
|
||||||
|
# https://github.com/rails/rails/blob/f8edd20/actionpack/lib/action_dispatch/journey/router/utils.rb#L5-L22
|
||||||
|
# for implementation.)
|
||||||
#
|
#
|
||||||
# Look for an ActionDispatch utility class that Rails folks would expect
|
# Look for an ActionDispatch utility class that Rails folks would expect
|
||||||
# to normalize request paths. If unavailable, use a fallback class that
|
# to normalize request paths. If unavailable, use a fallback class that
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue