1 # -*- encoding: binary -*-
3 # This code is based on the original Rails handler in Mongrel
4 # Copyright (c) 2005 Zed A. Shaw
5 # Copyright (c) 2009 Eric Wong
6 # You can redistribute it and/or modify it under the same terms as Ruby.
7 # Additional work donated by contributors. See CONTRIBUTORS for more info.
8 require 'unicorn/cgi_wrapper'
11 module Unicorn; module App; end; end
13 # Implements a handler that can run Rails.
14 class Unicorn::App::OldRails
16 autoload :Static, "unicorn/app/old_rails/static"
19 cgi = Unicorn::CGIWrapper.new(env)
21 Dispatcher.dispatch(cgi,
22 ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS,
25 err = env['rack.errors']
26 err.write("#{e} #{e.message}\n")
27 e.backtrace.each { |line| err.write("#{line}\n") }
29 cgi.out # finalize the response