summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaito <saitowu@gmail.com>2012-09-17 18:36:23 +0800
committerSaito <saitowu@gmail.com>2012-09-17 18:36:23 +0800
commitaaa916f15c9bde139058888be660705390cc02db (patch)
tree21c7897e6cb6fc35b9a0d33a30b837c4630b7e63
parentb5442eb5643b10a0e6539b1081ccf048d555d38a (diff)
downloadgitlab-ce-aaa916f15c9bde139058888be660705390cc02db.tar.gz
use high level api and compatibility with Passenger
-rw-r--r--lib/gitlab/backend/grack_auth.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb
index 4f77c327373..43a75cc377b 100644
--- a/lib/gitlab/backend/grack_auth.rb
+++ b/lib/gitlab/backend/grack_auth.rb
@@ -12,21 +12,22 @@ module Grack
# Pass Gitolite update hook
ENV['GL_BYPASS_UPDATE_HOOK'] = "true"
- # Need this patch because the rails mount
- @env['PATH_INFO'] = @env['REQUEST_PATH']
+ # Need this patch due to the rails mount
+ @env['PATH_INFO'] = @request.path
+ @env['SCRIPT_NAME'] = ""
# Find project by PATH_INFO from env
- if m = /^\/([\w-]+).git/.match(@env['PATH_INFO']).to_a
+ if m = /^\/([\w-]+).git/.match(@request.path_info).to_a
return false unless project = Project.find_by_path(m.last)
end
# Git upload and receive
- if @env['REQUEST_METHOD'] == 'GET'
+ if @request.get?
true
- elsif @env['REQUEST_METHOD'] == 'POST'
- if @env['REQUEST_URI'].end_with?('git-upload-pack')
+ elsif @request.post?
+ if @request.path_info.end_with?('git-upload-pack')
return project.dev_access_for?(user)
- elsif @env['REQUEST_URI'].end_with?('git-receive-pack')
+ elsif @request.path_info.end_with?('git-receive-pack')
if project.protected_branches.map(&:name).include?(current_ref)
project.master_access_for?(user)
else