Permalink
Browse files

Accept upload-pack/receive-pack in has_access?

  • Loading branch information...
1 parent 1bef4d2 commit 28d29744359b5436b4914e181f6b45ee6c7f6d98 @technomancy committed Nov 8, 2012
Showing with 2 additions and 14 deletions.
  1. +2 −14 lib/sokoban/receiver.rb
View
@@ -11,8 +11,6 @@ class Receiver
[["POST", 'service_rpc', /(.*?)\/git-upload-pack$/, 'upload-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_text_file', /(.*?)\/HEAD$/],
["GET", 'get_text_file', /(.*?)\/objects\/info\/alternates$/],
@@ -182,19 +180,9 @@ def route(req_method, req_path)
def has_access?(rpc, check_content_type = false)
if check_content_type
- return false if @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'
+ @req.content_type == "application/x-git-%s-request" % rpc
else
- return setting == 'true'
+ ['upload-pack', 'receive-pack'].include?(rpc)
end
end

0 comments on commit 28d2974

Please sign in to comment.