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
Léo-Paul Géneau
gitlab-ce
Commits
36efe0f5
Commit
36efe0f5
authored
May 02, 2013
by
Saito
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3634 from tsl0922/patch-grack-auth
fix http push 401 and 500 with some git clients
parents
ae006dd9
f1c9b058
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
lib/gitlab/backend/grack_auth.rb
lib/gitlab/backend/grack_auth.rb
+8
-4
No files found.
lib/gitlab/backend/grack_auth.rb
View file @
36efe0f5
...
@@ -76,13 +76,17 @@ module Grack
...
@@ -76,13 +76,17 @@ module Grack
end
end
def
validate_get_request
def
validate_get_request
project
.
public
||
can?
(
user
,
:download_code
,
project
)
validate_request
(
@request
.
params
[
'service'
]
)
end
end
def
validate_post_request
def
validate_post_request
if
@request
.
path_info
.
end_with?
(
'git-upload-pack'
)
validate_request
(
File
.
basename
(
@request
.
path
))
end
def
validate_request
(
service
)
if
service
==
'git-upload-pack'
project
.
public
||
can?
(
user
,
:download_code
,
project
)
project
.
public
||
can?
(
user
,
:download_code
,
project
)
elsif
@request
.
path_info
.
end_with?
(
'git-receive-pack'
)
elsif
service
==
'git-receive-pack'
action
=
if
project
.
protected_branch?
(
current_ref
)
action
=
if
project
.
protected_branch?
(
current_ref
)
:push_code_to_protected_branches
:push_code_to_protected_branches
else
else
...
@@ -107,7 +111,7 @@ module Grack
...
@@ -107,7 +111,7 @@ module Grack
end
end
# Need to reset seek point
# Need to reset seek point
@request
.
body
.
rewind
@request
.
body
.
rewind
/refs\/heads\/([\w\.-]+)/
.
match
(
input
).
to_a
.
last
/refs\/heads\/([\w\.-]+)/
n
.
match
(
input
.
force_encoding
(
'ascii-8bit'
)
).
to_a
.
last
end
end
def
project
def
project
...
...
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