Skip to content

Commit

Permalink
using path_info instead of path because its broke on jruby-rack
Browse files Browse the repository at this point in the history
  • Loading branch information
schacon committed Nov 2, 2009
1 parent ddd94fa commit 231a2a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion config.ru
Expand Up @@ -7,7 +7,6 @@ require 'lib/git_http'
config = {
:project_root => "/opt",
:git_path => '/usr/local/libexec/git-core/git',
:server_prefix => 'git/',
:upload_pack => true,
:receive_pack => true,
}
Expand Down
9 changes: 4 additions & 5 deletions lib/git_http.rb
Expand Up @@ -28,7 +28,7 @@ def initialize(config)
def call(env)
@env = env
@req = Rack::Request.new(env)

cmd, path, @reqfile, @rpc = match_routing

return render_method_not_allowed if cmd == 'not_allowed'
Expand Down Expand Up @@ -67,7 +67,7 @@ def service_rpc

def git_command(command)
git_bin = @config[:git_path] || 'git'
puts command = "#{git_bin} #{command}"
command = "#{git_bin} #{command}"
command
end

Expand Down Expand Up @@ -185,12 +185,11 @@ def match_routing
cmd = nil
path = nil
SERVICES.each do |method, handler, match, rpc|
if m = Regexp.new(match).match(@req.path)
if m = Regexp.new(match).match(@req.path_info)
return ['not_allowed'] if method != @req.request_method
cmd = handler
path = m[1]
file = @req.path.gsub(path + '/', '')
path = path.sub(@config[:server_prefix], '') if @config[:server_prefix]
file = @req.path_info.sub(path + '/', '')
return [cmd, path, file, rpc]
end
end
Expand Down

0 comments on commit 231a2a4

Please sign in to comment.