diff -wbBur passenger-3.0.12/bin/passenger-install-nginx-module passenger.git/bin/passenger-install-nginx-module --- passenger-3.0.12/bin/passenger-install-nginx-module 2012-04-13 12:09:57.000000000 +0400 +++ passenger.git/bin/passenger-install-nginx-module 2012-05-17 19:35:01.000000000 +0400 @@ -162,7 +162,7 @@ new_screen color_puts "PCRE (required by Nginx) not installed, downloading it..." - url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-#{PREFERRED_PCRE_VERSION}.tar.gz" + url = "http://downloads.sourceforge.net/project/pcre/pcre/#{PREFERRED_PCRE_VERSION}/pcre-#{PREFERRED_PCRE_VERSION}.tar.gz" dirname = "pcre-#{PREFERRED_PCRE_VERSION}" tarball = "#{@working_dir}/pcre.tar.gz" diff -wbBur passenger-3.0.12/build/basics.rb passenger.git/build/basics.rb --- passenger-3.0.12/build/basics.rb 2012-04-13 12:09:57.000000000 +0400 +++ passenger.git/build/basics.rb 2012-05-17 19:35:01.000000000 +0400 @@ -33,7 +33,6 @@ require 'phusion_passenger/platform_info/curl' require 'phusion_passenger/platform_info/zlib' require 'phusion_passenger/platform_info/compiler' -require 'phusion_passenger/platform_info/documentation_tools' include PhusionPassenger include PhusionPassenger::PlatformInfo diff -wbBur passenger-3.0.12/build/documentation.rb passenger.git/build/documentation.rb --- passenger-3.0.12/build/documentation.rb 2012-02-04 02:25:41.000000000 +0400 +++ passenger.git/build/documentation.rb 2012-05-17 19:35:01.000000000 +0400 @@ -1,5 +1,5 @@ # Phusion Passenger - http://www.modrails.com/ -# Copyright (c) 2010 Phusion +# Copyright (c) 2010, 2011, 2012 Phusion # # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui. # @@ -21,25 +21,34 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -ASCIIDOC_FLAGS = "-b html5 -a toc -a theme=flask -a numbered -a toclevels=3 -a icons" - desc "Generate all documentation" task :doc => Packaging::ASCII_DOCS Packaging::ASCII_DOCS.each do |target| source = target.sub(/\.html$/, '.txt') file target => [source] + Dir["doc/users_guide_snippets/**/*"] do - if PlatformInfo.asciidoc + if PlatformInfo.find_command('mizuho') if target =~ /apache/i - type = "-a apache" + type = "apache" + juvia_site_key = "5jpmkyjqlml8rktsfldfpbwth8ig7w9" elsif target =~ /nginx/i - type = "-a nginx" + type = "nginx" + juvia_site_key = "q0ptarhn8o9xanwomq8zkgewbtwffyz" + elsif target =~ /standalone/i + type = nil + juvia_site_key = "amggdy0k65hb4hbjg3dh7pnb9zd8dwy" else type = nil + juvia_site_key = nil + end + command = "mizuho '#{source}'" + command << " -a #{type}" if type + if juvia_site_key + command << " -c juvia --juvia-url http://juvia.phusion.nl --juvia-site-key #{juvia_site_key}" end - sh "#{PlatformInfo.asciidoc} #{ASCIIDOC_FLAGS} #{type} '#{source}'" + sh(command) else - sh "echo 'asciidoc required to build docs' > '#{target}'" + sh "echo 'Mizuho required to build docs' > '#{target}'" end end diff -wbBur passenger-3.0.12/build/packaging.rb passenger.git/build/packaging.rb --- passenger-3.0.12/build/packaging.rb 2012-02-04 02:25:41.000000000 +0400 +++ passenger.git/build/packaging.rb 2012-05-17 19:35:01.000000000 +0400 @@ -1,5 +1,5 @@ # Phusion Passenger - http://www.modrails.com/ -# Copyright (c) 2010 Phusion +# Copyright (c) 2010, 2011, 2012 Phusion # # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui. # @@ -42,7 +42,7 @@ s.require_paths = ["lib"] s.add_dependency 'rake', '>= 0.8.1' s.add_dependency 'fastthread', '>= 1.0.1' - s.add_dependency 'daemon_controller', '>= 0.2.5' + s.add_dependency 'daemon_controller', '>= 1.0.0' s.add_dependency 'rack' s.files = FileList[*Packaging::GLOB] - FileList[*Packaging::EXCLUDE_GLOB] s.executables = Packaging::USER_EXECUTABLES + Packaging::SUPER_USER_EXECUTABLES diff -wbBur passenger-3.0.12/DEVELOPERS.TXT passenger.git/DEVELOPERS.TXT --- passenger-3.0.12/DEVELOPERS.TXT 2012-04-13 12:09:57.000000000 +0400 +++ passenger.git/DEVELOPERS.TXT 2012-05-17 19:35:01.000000000 +0400 @@ -13,6 +13,7 @@ * rspec >= 1.1.2 * mime-types >= 1.15 * sqlite3-ruby +* daemon_controller >= 1.0.0 The following software is optional: diff -wbBur passenger-3.0.12/doc/Users guide Apache.txt passenger.git/doc/Users guide Apache.txt --- passenger-3.0.12/doc/Users guide Apache.txt 2012-02-04 02:25:41.000000000 +0400 +++ passenger.git/doc/Users guide Apache.txt 2012-05-17 19:35:01.000000000 +0400 @@ -203,15 +203,7 @@ ==== Installing via a native Linux package ==== -John Leach from Brightbox has kindly provided an Ubuntu Hardy package for Phusion Passenger. The package is available from the link:http://apt.brightbox.net[Brightbox repository]. - -Please install the native Linux package, e.g.: ------------------------------------------------------- -sudo sh -c 'echo "deb http://apt.brightbox.net hardy main" > /etc/apt/sources.list.d/brightbox.list' -sudo sh -c 'wget -q -O - http://apt.brightbox.net/release.asc | apt-key add -' -sudo apt-get update -sudo apt-get install libapache2-mod-passenger ------------------------------------------------------- +John Leach from Brightbox has kindly provided a Ubuntu packages for Phusion Passenger. The package is available from the link:http://wiki.brightbox.co.uk/docs:phusion-passenger[Brightbox repository]. ==== What does the installer do? ==== @@ -635,7 +627,7 @@ Allow from all - RackBaseURI /rails # <-- These lines have + RackBaseURI /rack # <-- These lines have # <-- been added. Options -MultiViews # <-- # <-- diff -wbBur passenger-3.0.12/ext/boost/config/stdlib/libstdcpp3.hpp passenger.git/ext/boost/config/stdlib/libstdcpp3.hpp --- passenger-3.0.12/ext/boost/config/stdlib/libstdcpp3.hpp 2012-02-04 02:25:42.000000000 +0400 +++ passenger.git/ext/boost/config/stdlib/libstdcpp3.hpp 2012-05-17 19:35:01.000000000 +0400 @@ -31,7 +31,8 @@ #ifdef __GLIBCXX__ // gcc 3.4 and greater: # if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \ - || defined(_GLIBCXX__PTHREADS) + || defined(_GLIBCXX__PTHREADS) \ + || defined(_GLIBCXX_HAS_GTHREADS) // // If the std lib has thread support turned on, then turn it on in Boost // as well. We do this because some gcc-3.4 std lib headers define _REENTANT diff -wbBur passenger-3.0.12/ext/boost/exception/detail/error_info_impl.hpp passenger.git/ext/boost/exception/detail/error_info_impl.hpp --- passenger-3.0.12/ext/boost/exception/detail/error_info_impl.hpp 2012-02-04 02:25:42.000000000 +0400 +++ passenger.git/ext/boost/exception/detail/error_info_impl.hpp 2012-05-17 19:35:01.000000000 +0400 @@ -30,7 +30,7 @@ protected: - ~error_info_base() throw() + virtual ~error_info_base() throw() { } }; diff -wbBur passenger-3.0.12/ext/common/StaticString.h passenger.git/ext/common/StaticString.h --- passenger-3.0.12/ext/common/StaticString.h 2012-04-13 12:09:57.000000000 +0400 +++ passenger.git/ext/common/StaticString.h 2012-05-17 19:35:01.000000000 +0400 @@ -25,6 +25,7 @@ #ifndef _PASSENGER_STATIC_STRING_H_ #define _PASSENGER_STATIC_STRING_H_ +#include #include #include #include diff -wbBur passenger-3.0.12/ext/common/Watchdog.cpp passenger.git/ext/common/Watchdog.cpp --- passenger-3.0.12/ext/common/Watchdog.cpp 2012-04-13 12:09:57.000000000 +0400 +++ passenger.git/ext/common/Watchdog.cpp 2012-05-17 19:35:01.000000000 +0400 @@ -975,7 +975,7 @@ } else if (pid == -1) { // Error e = errno; - throw SystemException("fork() failed", errno); + throw SystemException("fork() failed", e); } else { // Parent diff -wbBur passenger-3.0.12/ext/nginx/Configuration.c passenger.git/ext/nginx/Configuration.c --- passenger-3.0.12/ext/nginx/Configuration.c 2012-04-13 12:09:58.000000000 +0400 +++ passenger.git/ext/nginx/Configuration.c 2012-05-17 19:35:01.000000000 +0400 @@ -1,7 +1,7 @@ /* * Copyright (C) Igor Sysoev * Copyright (C) 2007 Manlio Perillo (manlio.perillo@gmail.com) - * Copyright (C) 2010 Phusion + * Copyright (C) 2010, 2011, 2012 Phusion * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -335,6 +335,14 @@ conf->upstream_config.pass_request_headers = NGX_CONF_UNSET; conf->upstream_config.pass_request_body = NGX_CONF_UNSET; +#if (NGX_HTTP_CACHE) + conf->upstream_config.cache = NGX_CONF_UNSET_PTR; + conf->upstream_config.cache_min_uses = NGX_CONF_UNSET_UINT; + conf->upstream_config.cache_bypass = NGX_CONF_UNSET_PTR; + conf->upstream_config.no_cache = NGX_CONF_UNSET_PTR; + conf->upstream_config.cache_valid = NGX_CONF_UNSET_PTR; +#endif + conf->upstream_config.intercept_errors = NGX_CONF_UNSET; conf->upstream_config.cyclic_temp_file = 0; @@ -511,8 +519,8 @@ if (conf->upstream_config.busy_buffers_size < size) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "\"passenger_busy_buffers_size\" must be equal or bigger than " - "maximum of the value of \"passenger_buffer_size\" and " + "\"passenger_busy_buffers_size\" must be equal to or greater " + "than the maximum of the value of \"passenger_buffer_size\" and " "one of the \"passenger_buffers\""); return NGX_CONF_ERROR; @@ -542,8 +550,8 @@ if (conf->upstream_config.temp_file_write_size < size) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "\"passenger_temp_file_write_size\" must be equal or bigger than " - "maximum of the value of \"passenger_buffer_size\" and " + "\"passenger_temp_file_write_size\" must be equal to or greater than " + "the maximum of the value of \"passenger_buffer_size\" and " "one of the \"passenger_buffers\""); return NGX_CONF_ERROR; @@ -566,8 +574,8 @@ { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "\"passenger_max_temp_file_size\" must be equal to zero to disable " - "the temporary files usage or must be equal or bigger than " - "maximum of the value of \"passenger_buffer_size\" and " + "temporary files usage or must be equal to or greater than " + "the maximum of the value of \"passenger_buffer_size\" and " "one of the \"passenger_buffers\""); return NGX_CONF_ERROR; @@ -639,6 +647,14 @@ conf->cache_key = prev->cache_key; } + #if NGINX_VERSION_NUM >= 1002000 + ngx_conf_merge_value(conf->upstream_config.cache_lock, + prev->upstream_config.cache_lock, 0); + + ngx_conf_merge_msec_value(conf->upstream_config.cache_lock_timeout, + prev->upstream_config.cache_lock_timeout, 5000); + #endif + #endif ngx_conf_merge_value(conf->upstream_config.pass_request_headers, @@ -1273,7 +1289,7 @@ NULL }, { ngx_string("passenger_pass_header"), - NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG, + NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1, ngx_conf_set_str_array_slot, NGX_HTTP_LOC_CONF_OFFSET, offsetof(passenger_loc_conf_t, upstream_config.pass_headers), diff -wbBur passenger-3.0.12/ext/nginx/ContentHandler.c passenger.git/ext/nginx/ContentHandler.c --- passenger-3.0.12/ext/nginx/ContentHandler.c 2012-04-13 12:09:58.000000000 +0400 +++ passenger.git/ext/nginx/ContentHandler.c 2012-05-17 19:35:01.000000000 +0400 @@ -1,7 +1,7 @@ /* * Copyright (C) Igor Sysoev * Copyright (C) 2007 Manlio Perillo (manlio.perillo@gmail.com) - * Copyright (C) 2010 Phusion + * Copyright (C) 2010, 2011, 2012 Phusion * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -387,8 +387,8 @@ app_type_string_len = sizeof("wsgi"); break; default: - app_type_string = (const u_char *) "rails"; - app_type_string_len = sizeof("rails"); + app_type_string = (const u_char *) "rack"; + app_type_string_len = sizeof("rack"); break; } @@ -931,7 +931,7 @@ context = ngx_http_get_module_ctx(r, ngx_http_passenger_module); if (context == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + return NGX_ERROR; } rc = parse_status_line(r, context); @@ -952,7 +952,6 @@ } #endif - r->http_version = NGX_HTTP_VERSION_9; u->headers_in.status_n = NGX_HTTP_OK; u->state->status = NGX_HTTP_OK; @@ -966,7 +965,7 @@ u->headers_in.status_line.data = ngx_palloc(r->pool, u->headers_in.status_line.len); if (u->headers_in.status_line.data == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; + return NGX_ERROR; } ngx_memcpy(u->headers_in.status_line.data, context->status_start, diff -wbBur passenger-3.0.12/lib/phusion_passenger/dependencies.rb passenger.git/lib/phusion_passenger/dependencies.rb --- passenger-3.0.12/lib/phusion_passenger/dependencies.rb 2012-04-13 12:09:58.000000000 +0400 +++ passenger.git/lib/phusion_passenger/dependencies.rb 2012-05-17 19:35:01.000000000 +0400 @@ -1,5 +1,5 @@ # Phusion Passenger - http://www.modrails.com/ -# Copyright (c) 2010 Phusion +# Copyright (c) 2010, 2011, 2012 Phusion # # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui. # @@ -29,7 +29,6 @@ require 'phusion_passenger/platform_info/ruby' require 'phusion_passenger/platform_info/linux' require 'phusion_passenger/platform_info/curl' -require 'phusion_passenger/platform_info/documentation_tools' module PhusionPassenger @@ -110,9 +109,9 @@ return (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby") && RUBY_VERSION < "1.8.7" end - # Returns whether asciidoc is required in order to be able to package all files + # Returns whether Mizuho is required in order to be able to package all files # in the packaging list. - def self.asciidoc_required? + def self.mizuho_required? return Packaging::ASCII_DOCS.any? do |fn| !File.exist?("#{SOURCE_ROOT}/#{fn}") end @@ -579,7 +578,7 @@ end Daemon_Controller = Dependency.new do |dep| - dep.name = "daemon_controller >= 0.2.5" + dep.name = "daemon_controller >= 1.0.0" dep.install_instructions = "Please install RubyGems first, then run " << "#{PlatformInfo.gem_command || "gem"} install daemon_controller" dep.define_checker do |result| @@ -591,7 +590,7 @@ require 'daemon_controller' begin require 'daemon_controller/version' - too_old = DaemonController::VERSION_STRING < '0.2.5' + too_old = DaemonController::VERSION_STRING < '1.0.0' rescue LoadError too_old = true end @@ -610,23 +609,18 @@ end end - AsciiDoc = Dependency.new do |dep| - dep.name = "Asciidoc" + Mizuho = Dependency.new do |dep| + dep.name = "Mizuho" dep.define_checker do |result| - if PlatformInfo.asciidoc.nil? + mizuho = PlatformInfo.find_command('mizuho') + if mizuho.nil? result.not_found else - result.found(PlatformInfo.asciidoc) + result.found(mizuho) end end - if RUBY_PLATFORM =~ /darwin/ - # Installing asciidoc with source-highlight is too much of a pain on OS X, - # so recommend Mizuho instead. dep.website = "http://github.com/FooBarWidget/mizuho" dep.install_instructions = "Please install RubyGems first, then run #{PlatformInfo.gem_command || "gem"} install mizuho" - else - dep.website = "http://www.methods.co.nz/asciidoc/" - end end end diff -wbBur passenger-3.0.12/lib/phusion_passenger/standalone/command.rb passenger.git/lib/phusion_passenger/standalone/command.rb --- passenger-3.0.12/lib/phusion_passenger/standalone/command.rb 2012-04-13 12:09:58.000000000 +0400 +++ passenger.git/lib/phusion_passenger/standalone/command.rb 2012-05-17 19:35:01.000000000 +0400 @@ -1,5 +1,5 @@ # Phusion Passenger - http://www.modrails.com/ -# Copyright (c) 2010 Phusion +# Copyright (c) 2010, 2011, 2012 Phusion # # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui. # @@ -61,13 +61,13 @@ require 'daemon_controller' begin require 'daemon_controller/version' - too_old = DaemonController::VERSION_STRING < '0.2.5' + too_old = DaemonController::VERSION_STRING < '1.0.0' rescue LoadError too_old = true end if too_old error "Your version of daemon_controller is too old. " << - "You must install 0.2.5 or later. Please upgrade:\n\n" << + "You must install 1.0.0 or later. Please upgrade:\n\n" << " sudo gem uninstall FooBarWidget-daemon_controller\n" << " sudo gem install daemon_controller" @@ -210,24 +210,21 @@ end end - def ping_nginx - require 'socket' unless defined?(UNIXSocket) - if @options[:socket_file] - UNIXSocket.new(@options[:socket_file]) - else - TCPSocket.new(@options[:address], nginx_ping_port) - end - end - def create_nginx_controller(extra_options = {}) require_daemon_controller + require 'socket' unless defined?(UNIXSocket) @temp_dir = "/tmp/passenger-standalone.#{$$}" @config_filename = "#{@temp_dir}/config" + if @options[:socket_file] + ping_spec = [:unix, @options[:socket_file]] + else + ping_spec = [:tcp, @options[:address], nginx_ping_port] + end opts = { :identifier => 'Nginx', :before_start => method(:write_nginx_config_file), :start_command => method(:determine_nginx_start_command), - :ping_command => method(:ping_nginx), + :ping_command => ping_spec, :pid_file => @options[:pid_file], :log_file => @options[:log_file], :timeout => 25 diff -wbBur passenger-3.0.12/lib/phusion_passenger/standalone/runtime_installer.rb passenger.git/lib/phusion_passenger/standalone/runtime_installer.rb --- passenger-3.0.12/lib/phusion_passenger/standalone/runtime_installer.rb 2012-04-13 12:09:58.000000000 +0400 +++ passenger.git/lib/phusion_passenger/standalone/runtime_installer.rb 2012-05-17 19:35:01.000000000 +0400 @@ -91,8 +91,8 @@ if Dependencies.fastthread_required? result << Dependencies::FastThread end - if Dependencies.asciidoc_required? - result << Dependencies::AsciiDoc + if Dependencies.mizuho_required? + result << Dependencies::Mizuho end return result end diff -wbBur passenger-3.0.12/lib/phusion_passenger/standalone/start_command.rb passenger.git/lib/phusion_passenger/standalone/start_command.rb --- passenger-3.0.12/lib/phusion_passenger/standalone/start_command.rb 2012-04-13 12:09:58.000000000 +0400 +++ passenger.git/lib/phusion_passenger/standalone/start_command.rb 2012-05-17 19:35:01.000000000 +0400 @@ -243,15 +243,32 @@ end end - def check_port_availability - if !@options[:socket_file] + def check_port(address, port) + begin + socket = Socket.new(Socket::Constants::AF_INET, Socket::Constants::SOCK_STREAM, 0) + sockaddr = Socket.pack_sockaddr_in(port, address) + begin + socket.connect_nonblock(sockaddr) + rescue Errno::ENOENT, Errno::EINPROGRESS, Errno::EAGAIN, Errno::EWOULDBLOCK + if select(nil, [socket], nil, 0.1) begin - TCPSocket.new(@options[:address], @options[:port]).close - port_taken = true - rescue SystemCallError - port_taken = false + socket.connect_nonblock(sockaddr) + rescue Errno::EISCONN + end + else + raise Errno::ECONNREFUSED + end end - if port_taken + return true + rescue Errno::ECONNREFUSED + return false + ensure + socket.close if socket + end + end + + def check_port_availability + if !@options[:socket_file] && check_port(@options[:address], @options[:port]) error "The address #{@options[:address]}:#{@options[:port]} is already " << "in use by another process, perhaps another Phusion Passenger " << "Standalone instance.\n\n" << @@ -261,7 +278,6 @@ exit 1 end end - end def should_watch_logs? return !@options[:daemonize] && @options[:log_file] != "/dev/null" diff -wbBur passenger-3.0.12/lib/phusion_passenger/templates/apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb passenger.git/lib/phusion_passenger/templates/apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb --- passenger-3.0.12/lib/phusion_passenger/templates/apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb 2012-04-13 12:09:58.000000000 +0400 +++ passenger.git/lib/phusion_passenger/templates/apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb 2012-05-17 19:35:01.000000000 +0400 @@ -1,7 +1,7 @@ WARNING: Apache doesn't seem to be compiled with the 'prefork', 'worker' or 'event' MPM Phusion Passenger has only been tested on Apache with the 'prefork', the -'worker' and the 'worker' MPM. Your Apache installation is compiled with +'worker' and the 'event' MPM. Your Apache installation is compiled with the '<%= @current_mpm %>' MPM. We recommend you to abort this installer and to recompile Apache with either the 'prefork', the 'worker' or the 'event' MPM. diff -wbBur passenger-3.0.12/lib/phusion_passenger/templates/standalone/config.erb passenger.git/lib/phusion_passenger/templates/standalone/config.erb --- passenger-3.0.12/lib/phusion_passenger/templates/standalone/config.erb 2012-04-13 12:09:58.000000000 +0400 +++ passenger.git/lib/phusion_passenger/templates/standalone/config.erb 2012-05-17 19:35:01.000000000 +0400 @@ -27,7 +27,7 @@ master_process on; worker_processes 1; daemon on; -error_log '<%= @options[:log_file] %>'; +error_log '<%= @options[:log_file] %>' info; pid '<%= @options[:pid_file] %>'; <% if @options[:user] %>user <%= @options[:user] %> <%= default_group_for(@options[:user]) %>;<% end %> @@ -36,6 +36,7 @@ } http { + log_format debug '[$time_local] $msec "$request" $status conn=$connection sent=$bytes_sent body_sent=$body_bytes_sent'; include '<%= PhusionPassenger::RESOURCES_DIR %>/mime.types'; passenger_ruby <%= PlatformInfo.ruby_command %>; passenger_root '<%= passenger_root %>';