Skip to content
This repository has been archived by the owner on Jan 23, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Accept upload-pack/receive-pack in has_access?
  • Loading branch information
technomancy committed Nov 8, 2012
1 parent 1bef4d2 commit 28d2974
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions lib/sokoban/receiver.rb
Expand Up @@ -11,8 +11,6 @@ class Receiver
[["POST", 'service_rpc', /(.*?)\/git-upload-pack$/, 'upload-pack'], [["POST", 'service_rpc', /(.*?)\/git-upload-pack$/, 'upload-pack'],
["POST", 'service_rpc', /(.*?)\/git-receive-pack$/, 'receive-pack'], ["POST", 'service_rpc', /(.*?)\/git-receive-pack$/, 'receive-pack'],


# TODO: need a sensible route for this?
["GET", 'get_text_file', /(.*?)\.git$/],
["GET", 'get_info_refs', /(.*?)\/info\/refs$/], ["GET", 'get_info_refs', /(.*?)\/info\/refs$/],
["GET", 'get_text_file', /(.*?)\/HEAD$/], ["GET", 'get_text_file', /(.*?)\/HEAD$/],
["GET", 'get_text_file', /(.*?)\/objects\/info\/alternates$/], ["GET", 'get_text_file', /(.*?)\/objects\/info\/alternates$/],
Expand Down Expand Up @@ -182,19 +180,9 @@ def route(req_method, req_path)


def has_access?(rpc, check_content_type = false) def has_access?(rpc, check_content_type = false)
if check_content_type if check_content_type
return false if @req.content_type != "application/x-git-%s-request" % rpc @req.content_type == "application/x-git-%s-request" % rpc
end
return false if !['upload-pack', 'receive-pack'].include? rpc
return get_config_setting(rpc)
end

def get_config_setting(service_name)
service_name = service_name.gsub('-', '')
setting = get_git_config("http.#{service_name}")
if service_name == 'uploadpack'
return setting != 'false'
else else
return setting == 'true' ['upload-pack', 'receive-pack'].include?(rpc)
end end
end end


Expand Down

0 comments on commit 28d2974

Please sign in to comment.