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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
66dc7159
Commit
66dc7159
authored
Feb 16, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup formatting
parent
e5cf3f51
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
6 deletions
+4
-6
lib/gitlab/auth/unique_ips_limiter.rb
lib/gitlab/auth/unique_ips_limiter.rb
+1
-1
lib/gitlab/request_context.rb
lib/gitlab/request_context.rb
+1
-1
spec/lib/gitlab/auth/unique_ips_limiter_spec.rb
spec/lib/gitlab/auth/unique_ips_limiter_spec.rb
+0
-2
spec/lib/gitlab/request_context_spec.rb
spec/lib/gitlab/request_context_spec.rb
+2
-2
No files found.
lib/gitlab/auth/unique_ips_limiter.rb
View file @
66dc7159
...
@@ -62,7 +62,7 @@ module Gitlab
...
@@ -62,7 +62,7 @@ module Gitlab
rescue
TooManyIps
=>
ex
rescue
TooManyIps
=>
ex
Rails
.
logger
.
info
ex
.
message
Rails
.
logger
.
info
ex
.
message
[
429
,
{
'Content-Type'
=>
'text/plain'
,
'Retry-After'
=>
UniqueIpsLimiter
.
config
.
unique_ips_limit_time_window
},
[
"Retry later
\n
"
]]
[
429
,
{
'Content-Type'
=>
'text/plain'
,
'Retry-After'
=>
UniqueIpsLimiter
.
config
.
unique_ips_limit_time_window
},
[
"Retry later
\n
"
]]
end
end
end
end
end
end
...
...
lib/gitlab/request_context.rb
View file @
66dc7159
...
@@ -22,4 +22,4 @@ module Gitlab
...
@@ -22,4 +22,4 @@ module Gitlab
@app
.
call
(
env
)
@app
.
call
(
env
)
end
end
end
end
end
end
\ No newline at end of file
spec/lib/gitlab/auth/unique_ips_limiter_spec.rb
View file @
66dc7159
...
@@ -10,7 +10,6 @@ describe Gitlab::Auth::UniqueIpsLimiter, lib: true do
...
@@ -10,7 +10,6 @@ describe Gitlab::Auth::UniqueIpsLimiter, lib: true do
end
end
describe
'#count_unique_ips'
do
describe
'#count_unique_ips'
do
context
'non unique IPs'
do
context
'non unique IPs'
do
it
'properly counts them'
do
it
'properly counts them'
do
expect
(
Gitlab
::
Auth
::
UniqueIpsLimiter
.
count_unique_ips
(
user
.
id
,
'192.168.1.1'
)).
to
eq
(
1
)
expect
(
Gitlab
::
Auth
::
UniqueIpsLimiter
.
count_unique_ips
(
user
.
id
,
'192.168.1.1'
)).
to
eq
(
1
)
...
@@ -39,7 +38,6 @@ describe Gitlab::Auth::UniqueIpsLimiter, lib: true do
...
@@ -39,7 +38,6 @@ describe Gitlab::Auth::UniqueIpsLimiter, lib: true do
end
end
end
end
describe
'#limit_user!'
do
describe
'#limit_user!'
do
context
'when unique ips limit is enabled'
do
context
'when unique ips limit is enabled'
do
before
do
before
do
...
...
spec/lib/gitlab/request_context_spec.rb
View file @
66dc7159
...
@@ -3,12 +3,12 @@ require 'spec_helper'
...
@@ -3,12 +3,12 @@ require 'spec_helper'
describe
Gitlab
::
RequestContext
,
lib:
true
do
describe
Gitlab
::
RequestContext
,
lib:
true
do
describe
'#client_ip'
do
describe
'#client_ip'
do
subject
{
Gitlab
::
RequestContext
.
client_ip
}
subject
{
Gitlab
::
RequestContext
.
client_ip
}
let
(
:app
)
{
->
env
{}
}
let
(
:app
)
{
->
(
env
)
{}
}
let
(
:env
)
{
Hash
.
new
}
let
(
:env
)
{
Hash
.
new
}
context
'when RequestStore::Middleware is used'
do
context
'when RequestStore::Middleware is used'
do
around
(
:each
)
do
|
example
|
around
(
:each
)
do
|
example
|
RequestStore
::
Middleware
.
new
(
->
env
{
example
.
run
}).
call
({})
RequestStore
::
Middleware
.
new
(
->
(
env
)
{
example
.
run
}).
call
({})
end
end
context
'request'
do
context
'request'
do
...
...
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