]> source.dussan.org Git - redmine.git/commitdiff
Updates dispatch.fcgi.example to work with Rails3 and removes CGI handlers.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 1 May 2012 15:48:46 +0000 (15:48 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 1 May 2012 15:48:46 +0000 (15:48 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9604 e93f8b46-1217-0410-a6f0-8f06a7374b81

public/dispatch.cgi.example [deleted file]
public/dispatch.fcgi.example
public/dispatch.rb.example [deleted file]
public/htaccess.fcgi.example

diff --git a/public/dispatch.cgi.example b/public/dispatch.cgi.example
deleted file mode 100755 (executable)
index 32fa3b2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env ruby
-
-require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
-
-# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
-# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
-require "dispatcher"
-
-ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
-Dispatcher.dispatch
index 664dbbbee8291ba62f81496f4bf2076d44d75534..85184c446132c9cd336dd249e3692278ea042b91 100755 (executable)
@@ -1,24 +1,20 @@
 #!/usr/bin/env ruby
-#
-# You may specify the path to the FastCGI crash log (a log of unhandled
-# exceptions which forced the FastCGI instance to exit, great for debugging)
-# and the number of requests to process before running garbage collection.
-#
-# By default, the FastCGI crash log is RAILS_ROOT/log/fastcgi.crash.log
-# and the GC period is nil (turned off).  A reasonable number of requests
-# could range from 10-100 depending on the memory footprint of your app.
-#
-# Example:
-#   # Default log path, normal GC behavior.
-#   RailsFCGIHandler.process!
-#
-#   # Default log path, 50 requests between GC.
-#   RailsFCGIHandler.process! nil, 50
-#
-#   # Custom log path, normal GC behavior.
-#   RailsFCGIHandler.process! '/var/log/myapp_fcgi_crash.log'
-#
-require File.dirname(__FILE__) + "/../config/environment"
-require 'fcgi_handler'
 
-RailsFCGIHandler.process!
+require File.dirname(__FILE__) + '/../config/boot'
+require File.dirname(__FILE__) + '/../config/environment'
+
+class Rack::PathInfoRewriter
+  def initialize(app)
+    @app = app
+  end
+
+  def call(env)
+    env.delete('SCRIPT_NAME')
+    parts = env['REQUEST_URI'].split('?')
+    env['PATH_INFO'] = parts[0]
+    env['QUERY_STRING'] = parts[1].to_s
+    @app.call(env)
+  end
+end
+
+Rack::Handler::FastCGI.run Rack::PathInfoRewriter.new(RedmineApp::Application)
diff --git a/public/dispatch.rb.example b/public/dispatch.rb.example
deleted file mode 100755 (executable)
index 32fa3b2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env ruby
-
-require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
-
-# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
-# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is severely impaired
-require "dispatcher"
-
-ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
-Dispatcher.dispatch
index 7183bb0eefb31debb430e89b1721f4e694e5351a..f06975d43507694f8508a3e448a85cfbdb3b9c0a 100644 (file)
@@ -5,9 +5,6 @@
 <IfModule mod_fcgid.c>
        AddHandler fcgid-script .fcgi
 </IfModule>
-<IfModule mod_cgi.c>
-       AddHandler cgi-script .cgi
-</IfModule>
 Options +FollowSymLinks +ExecCGI
 
 # If you don't want Rails to look in certain directories,
@@ -42,9 +39,6 @@ RewriteCond %{REQUEST_FILENAME} !-f
 <IfModule mod_fcgid.c>
        RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
 </IfModule>
-<IfModule mod_cgi.c>
-       RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
-</IfModule>
 
 # In case Rails experiences terminal errors
 # Instead of displaying this message you can supply a file here which will be rendered instead