class PhusionPassenger::ClassicRails::RequestHandler

A request handler for Ruby on Rails applications.

Public Class Methods

new(owner_pipe, options = {}) click to toggle source
# File lib/phusion_passenger/classic_rails/request_handler.rb, line 37
def initialize(owner_pipe, options = {})
        super(owner_pipe, options)
        NINJA_PATCHING_LOCK.synchronize do
                ninja_patch_action_controller
        end
end

Protected Instance Methods

process_request(headers, input, output, status_line_desired) click to toggle source

Overrided method.

# File lib/phusion_passenger/classic_rails/request_handler.rb, line 46
def process_request(headers, input, output, status_line_desired)
        # FIXME: how to print status line?
        headers[CONTENT_LENGTH] = headers[HTTP_CONTENT_LENGTH]
        cgi = CGIFixed.new(headers, input, output)
        ::Dispatcher.dispatch(cgi,
                ::ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS,
                cgi.stdoutput)
end

Private Instance Methods

ninja_patch_action_controller() click to toggle source
# File lib/phusion_passenger/classic_rails/request_handler.rb, line 56
def ninja_patch_action_controller
        if !@@ninja_patched_action_controller && defined?(::ActionController::Base)                  && ::ActionController::Base.private_method_defined?(:perform_action)
                @@ninja_patched_action_controller = true
                ::ActionController::Base.class_eval do
                        alias passenger_orig_perform_action perform_action
                        
                        def perform_action(*whatever)
                                headers[X_POWERED_BY] = @passenger_header
                                passenger_orig_perform_action(*whatever)
                        end
                        private :perform_action
                end
        end
end
perform_action(*whatever) click to toggle source
# File lib/phusion_passenger/classic_rails/request_handler.rb, line 63
def perform_action(*whatever)
        headers[X_POWERED_BY] = @passenger_header
        passenger_orig_perform_action(*whatever)
end