summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaito <saitowu@gmail.com>2013-05-02 22:13:43 -0700
committerSaito <saitowu@gmail.com>2013-05-02 22:13:43 -0700
commit36efe0f5807e92c2a0b6ec71b828387e6684a9ab (patch)
tree8c60e7f6cedef86c3dc16ab708c64021539afbd9
parentae006dd90ba635c1c7ee7c5c56b5570bb50a3f83 (diff)
parentf1c9b05868cb6ecc72c1dc6f7de0583ca7f95faa (diff)
downloadgitlab-ce-36efe0f5807e92c2a0b6ec71b828387e6684a9ab.tar.gz
Merge pull request #3634 from tsl0922/patch-grack-auth
fix http push 401 and 500 with some git clients
-rw-r--r--lib/gitlab/backend/grack_auth.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb
index f46455f4735..6a411aabcc6 100644
--- a/lib/gitlab/backend/grack_auth.rb
+++ b/lib/gitlab/backend/grack_auth.rb
@@ -76,13 +76,17 @@ module Grack
end
def validate_get_request
- project.public || can?(user, :download_code, project)
+ validate_request(@request.params['service'])
end
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)
- elsif @request.path_info.end_with?('git-receive-pack')
+ elsif service == 'git-receive-pack'
action = if project.protected_branch?(current_ref)
:push_code_to_protected_branches
else
@@ -107,7 +111,7 @@ module Grack
end
# Need to reset seek point
@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
def project