Sha256: fc931d89a7a0594a4607f18f1ab6b4ed6e6361ecc10bcf988369f3840645c325
Contents?: true
Size: 1.95 KB
Versions: 2
Compression:
Stored size: 1.95 KB
Contents
# Phusion Passenger - http://www.modrails.com/ # Copyright (C) 2008 Phusion # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. require 'phusion_passenger/abstract_request_handler' require 'phusion_passenger/railz/cgi_fixed' module PhusionPassenger module Railz # A request handler for Ruby on Rails applications. class RequestHandler < AbstractRequestHandler NINJA_PATCHING_LOCK = Mutex.new @@ninja_patched_action_controller = false def initialize(owner_pipe, options = {}) super(owner_pipe, options) NINJA_PATCHING_LOCK.synchronize do ninja_patch_action_controller end end protected # Overrided method. def process_request(headers, input, output) cgi = CGIFixed.new(headers, input, output) ::Dispatcher.dispatch(cgi, ::ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, cgi.stdoutput) end private 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 end end end end end # module Railz end # module PhusionPassenger
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
passenger-2.1.2 | lib/phusion_passenger/railz/request_handler.rb |
passenger-2.1.3 | lib/phusion_passenger/railz/request_handler.rb |