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 1.8 or
8 # the GPLv2+ (GPLv3+ preferred)
9 # Additional work donated by contributors. See CONTRIBUTORS for more info.
10 require 'unicorn/cgi_wrapper'
13 module Unicorn; module App; end; end
15 # Implements a handler that can run Rails.
16 class Unicorn::App::OldRails
18 autoload :Static, "unicorn/app/old_rails/static"
21 cgi = Unicorn::CGIWrapper.new(env)
23 Dispatcher.dispatch(cgi,
24 ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS,
27 err = env['rack.errors']
28 err.write("#{e} #{e.message}\n")
29 e.backtrace.each { |line| err.write("#{line}\n") }
31 cgi.out # finalize the response