Skip to content

Commit

Permalink
Lower case headers. (#573)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix authored Feb 19, 2022
1 parent d41abd7 commit 933c057
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/rack/attack/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
module Rack
class Attack
class Configuration
DEFAULT_BLOCKLISTED_RESPONDER = lambda { |_req| [403, { 'Content-Type' => 'text/plain' }, ["Forbidden\n"]] }
DEFAULT_BLOCKLISTED_RESPONDER = lambda { |_req| [403, { 'content-type' => 'text/plain' }, ["Forbidden\n"]] }

DEFAULT_THROTTLED_RESPONDER = lambda do |req|
if Rack::Attack.configuration.throttled_response_retry_after_header
match_data = req.env['rack.attack.match_data']
now = match_data[:epoch_time]
retry_after = match_data[:period] - (now % match_data[:period])

[429, { 'Content-Type' => 'text/plain', 'Retry-After' => retry_after.to_s }, ["Retry later\n"]]
[429, { 'content-type' => 'text/plain', 'retry-after' => retry_after.to_s }, ["Retry later\n"]]
else
[429, { 'Content-Type' => 'text/plain' }, ["Retry later\n"]]
[429, { 'content-type' => 'text/plain' }, ["Retry later\n"]]
end
end

Expand Down

0 comments on commit 933c057

Please sign in to comment.