From 231a2a45e050fa122c28a368ab9f88a5da477933 Mon Sep 17 00:00:00 2001 From: Scott Chacon Date: Mon, 2 Nov 2009 15:28:36 -0800 Subject: [PATCH] using path_info instead of path because its broke on jruby-rack --- config.ru | 1 - lib/git_http.rb | 9 ++++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/config.ru b/config.ru index 2c41258..2398214 100644 --- a/config.ru +++ b/config.ru @@ -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, } diff --git a/lib/git_http.rb b/lib/git_http.rb index 6bd97a8..90f2e30 100644 --- a/lib/git_http.rb +++ b/lib/git_http.rb @@ -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' @@ -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 @@ -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