diff --git a/CHANGELOG b/CHANGELOG index eba3b32264..7cc1c559c9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ Release 5.0.25 -------------- * Fixes a crash that occurs when using Nginx + HTTPS + Sub-requests. Closes GH-1724. + * Integrates into the `rails server` command. Please learn more at [the Passenger + Rails integration documentation](https://www.phusionpassenger.com/library/dev/ruby/rails_integration.html). * [Standalone] Makes the `--address` option work more reliably if the passed hostname may resolve to multiple addresses. For example, if you pass `--address localhost` then previous versions could fail because Passenger thinks it's an IPv6 address (::1) while Nginx thinks it's an IPv6 address (127.0.0.1). Hostname resolution is now done in a consistent manner. * [Standalone] Adds IPv6 support to the builtin engine. diff --git a/packaging/debian b/packaging/debian index 809feed70d..6bcd24de6b 160000 --- a/packaging/debian +++ b/packaging/debian @@ -1 +1 @@ -Subproject commit 809feed70d5cf4d8dffa03176ac5873a7e3f656e +Subproject commit 6bcd24de6b1e29316eaa70925f38b886e0ade7b8 diff --git a/packaging/rpm b/packaging/rpm index af5e5bb9d1..5aa0aff287 160000 --- a/packaging/rpm +++ b/packaging/rpm @@ -1 +1 @@ -Subproject commit af5e5bb9d16abbca566416b1cc094f44487a0b4c +Subproject commit 5aa0aff28767e9af9ca12fe8d7dae779fd82c716 diff --git a/src/ruby_supportlib/phusion_passenger/rack_handler.rb b/src/ruby_supportlib/phusion_passenger/rack_handler.rb new file mode 100644 index 0000000000..27aa1504fd --- /dev/null +++ b/src/ruby_supportlib/phusion_passenger/rack_handler.rb @@ -0,0 +1,102 @@ +# Phusion Passenger - https://www.phusionpassenger.com/ +# Copyright (c) 2016 Phusion Holding B.V. +# +# "Passenger", "Phusion Passenger" and "Union Station" are registered +# trademarks of Phusion Holding B.V. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +## Magic comment: begin bootstrap ## +libdir = File.expand_path('..', File.dirname(__FILE__)) +$LOAD_PATH.unshift(libdir) +begin + require 'rubygems' +rescue LoadError +end +require 'phusion_passenger' +## Magic comment: end bootstrap ## + +PhusionPassenger.locate_directories + +require 'rbconfig' + +module Rack + module Handler + class PhusionPassenger + class << self + def run(app, options = {}) + result = system(ruby_executable, '-S', find_passenger_standalone, + 'start', *build_args(options)) + if !result + raise "Error starting Passenger" + end + end + + def environment + ENV['RAILS_ENV'] || 'development' + end + + def to_s + 'Passenger application server' + end + + private + def build_args(options) + args = ['-e', environment] + if options[:Port] + args << '-p' + args << options[:Port].to_s + end + if options[:Host] + args << '-a' + args << options[:Host].to_s + end + if options[:config] + args << '-R' + args << options[:config].to_s + end + args + end + + def rb_config + if defined?(::RbConfig) + ::RbConfig::CONFIG + else + ::Config::CONFIG + end + end + + def ruby_executable + @ruby_executable ||= rb_config['bindir'] + '/' + + rb_config['RUBY_INSTALL_NAME'] + rb_config['EXEEXT'] + end + + def find_passenger_standalone + ::File.join(::PhusionPassenger.bin_dir, 'passenger') + end + end + end + + register 'passenger', 'Rack::Handler::PhusionPassenger' + + def self.default(options = {}) + Rack::Handler::PhusionPassenger + end + end +end