Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8e9be622
Commit
8e9be622
authored
Jan 18, 2021
by
Quang-Minh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply 3 suggestion(s) to 1 file(s)
parent
e6bf8c8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
lib/gitlab/rack_attack.rb
lib/gitlab/rack_attack.rb
+3
-3
No files found.
lib/gitlab/rack_attack.rb
View file @
8e9be622
...
@@ -49,9 +49,9 @@ module Gitlab
...
@@ -49,9 +49,9 @@ module Gitlab
# reset. This is a standardized HTTP header:
# reset. This is a standardized HTTP header:
# https://tools.ietf.org/html/rfc7231#page-69
# https://tools.ietf.org/html/rfc7231#page-69
#
#
# - RateLimit-Reset: the point of time that the quest quota is reset, in Unix time
# - RateLimit-Reset: the point of time that the
re
quest quota is reset, in Unix time
#
#
# - RateLimit-ResetTime: the point of time that the quest quota is reset, in HTTP date format
# - RateLimit-ResetTime: the point of time that the
re
quest quota is reset, in HTTP date format
def
self
.
throttled_response_headers
(
matched
,
match_data
)
def
self
.
throttled_response_headers
(
matched
,
match_data
)
# Match data example:
# Match data example:
# {:discriminator=>"127.0.0.1", :count=>12, :period=>60 seconds, :limit=>1, :epoch_time=>1609833930}
# {:discriminator=>"127.0.0.1", :count=>12, :period=>60 seconds, :limit=>1, :epoch_time=>1609833930}
...
@@ -62,7 +62,7 @@ module Gitlab
...
@@ -62,7 +62,7 @@ module Gitlab
observed
=
match_data
[
:count
]
observed
=
match_data
[
:count
]
now
=
match_data
[
:epoch_time
]
now
=
match_data
[
:epoch_time
]
retry_after
=
period
-
(
now
%
period
)
retry_after
=
period
-
(
now
%
period
)
reset_time
=
Time
.
at
(
now
+
(
period
-
now
%
period
)
)
# rubocop:disable Rails/TimeZone
reset_time
=
Time
.
at
(
now
+
retry_after
)
# rubocop:disable Rails/TimeZone
{
{
'RateLimit-Name'
=>
matched
.
to_s
,
'RateLimit-Name'
=>
matched
.
to_s
,
'RateLimit-Limit'
=>
rounded_limit
.
to_s
,
'RateLimit-Limit'
=>
rounded_limit
.
to_s
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment