Sha256: 284ec76b9780211fa39eee077604349a59867a003fa4d38c061e26ae1208e0b4

Contents?: true

Size: 847 Bytes

Versions: 11

Compression:

Stored size: 847 Bytes

Contents

# This code is based on the original Rails handler in Mongrel
# Copyright (c) 2005 Zed A. Shaw
# Copyright (c) 2009 Eric Wong
# You can redistribute it and/or modify it under the same terms as Ruby.
# Additional work donated by contributors.  See CONTRIBUTORS for more info.
require 'unicorn/cgi_wrapper'
require 'dispatcher'

module Unicorn; module App; end; end

# Implements a handler that can run Rails.
class Unicorn::App::OldRails

  def call(env)
    cgi = Unicorn::CGIWrapper.new(env)
    begin
      Dispatcher.dispatch(cgi,
          ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS,
          cgi.body)
    rescue Object => e
      err = env['rack.errors']
      err.write("#{e} #{e.message}\n")
      e.backtrace.each { |line| err.write("#{line}\n") }
    end
    cgi.out  # finalize the response
    cgi.rack_response
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unicorn-0.91.0 lib/unicorn/app/old_rails.rb
unicorn-0.90.0 lib/unicorn/app/old_rails.rb
unicorn-0.8.4 lib/unicorn/app/old_rails.rb
unicorn-0.8.2 lib/unicorn/app/old_rails.rb
unicorn-0.8.3 lib/unicorn/app/old_rails.rb
unicorn-0.9.0 lib/unicorn/app/old_rails.rb
unicorn-0.9.1 lib/unicorn/app/old_rails.rb
unicorn-0.9.2 lib/unicorn/app/old_rails.rb
unicorn-0.8.1 lib/unicorn/app/old_rails.rb
unicorn-0.8.0 lib/unicorn/app/old_rails.rb
unicorn-0.7.1 lib/unicorn/app/old_rails.rb