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