passenger 4.0.30 → 4.0.31
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- data.tar.gz.asc +7 -7
- data/NEWS +31 -0
- data/bin/passenger +5 -5
- data/bin/passenger-config +6 -126
- data/bin/passenger-install-apache2-module +108 -26
- data/bin/passenger-install-nginx-module +81 -27
- data/bin/passenger-memory-stats +7 -6
- data/bin/passenger-status +13 -10
- data/build/agents.rb +8 -12
- data/build/apache2.rb +12 -7
- data/build/basics.rb +28 -20
- data/build/common_library.rb +4 -4
- data/build/cplusplus_support.rb +4 -4
- data/build/cxx_tests.rb +5 -3
- data/build/debian.rb +1 -2
- data/build/integration_tests.rb +25 -9
- data/build/misc.rb +2 -2
- data/build/oxt_tests.rb +5 -6
- data/build/packaging.rb +72 -40
- data/build/ruby_tests.rb +5 -1
- data/build/test_basics.rb +1 -2
- data/debian.template/locations.ini.template +1 -0
- data/debian.template/rules.template +2 -1
- data/dev/install_scripts_bootstrap_code.rb +42 -0
- data/dev/run_travis.sh +1 -0
- data/dev/runner +27 -0
- data/doc/Packaging.txt.md +5 -10
- data/doc/Users guide Apache.idmap.txt +3 -1
- data/doc/Users guide Apache.txt +5 -3
- data/doc/Users guide Nginx.idmap.txt +9 -5
- data/doc/Users guide Nginx.txt +47 -17
- data/doc/users_guide_snippets/environment_variables.txt +2 -2
- data/doc/users_guide_snippets/installation.txt +6 -2
- data/doc/users_guide_snippets/tips.txt +4 -0
- data/ext/apache2/Hooks.cpp +16 -3
- data/ext/common/Account.h +6 -5
- data/ext/common/AgentsStarter.h +1 -1
- data/ext/common/ApplicationPool2/Common.h +72 -0
- data/ext/common/ApplicationPool2/Group.h +263 -148
- data/ext/common/ApplicationPool2/Implementation.cpp +66 -44
- data/ext/common/ApplicationPool2/Options.h +1 -7
- data/ext/common/ApplicationPool2/Pool.h +96 -72
- data/ext/common/ApplicationPool2/Process.h +12 -17
- data/ext/common/ApplicationPool2/Socket.h +4 -4
- data/ext/common/ApplicationPool2/SuperGroup.h +20 -17
- data/ext/common/Constants.h +15 -1
- data/ext/common/MessageServer.h +22 -0
- data/ext/common/Utils.cpp +4 -1
- data/ext/common/Utils.h +3 -1
- data/ext/common/Utils/StrIntUtils.h +1 -0
- data/ext/common/Utils/Timer.h +15 -1
- data/ext/common/Utils/utf8/checked.h +0 -0
- data/ext/common/Utils/utf8/core.h +0 -0
- data/ext/common/Utils/utf8/unchecked.h +0 -0
- data/ext/common/agents/Base.cpp +59 -35
- data/ext/common/agents/HelperAgent/Main.cpp +23 -12
- data/ext/common/agents/HelperAgent/RequestHandler.h +10 -1
- data/ext/common/agents/LoggingAgent/FilterSupport.h +9 -5
- data/ext/common/agents/TempDirToucher.c +12 -3
- data/ext/common/agents/Watchdog/Main.cpp +8 -2
- data/ext/nginx/ConfigurationCommands.c +10 -0
- data/ext/nginx/ConfigurationFields.h +2 -0
- data/ext/nginx/ContentHandler.c +32 -19
- data/ext/nginx/CreateLocationConfig.c +5 -0
- data/ext/nginx/MergeLocationConfig.c +6 -0
- data/ext/nginx/config +13 -6
- data/ext/ruby/passenger_native_support.c +61 -2
- data/helper-scripts/classic-rails-loader.rb +9 -10
- data/helper-scripts/classic-rails-preloader.rb +10 -11
- data/helper-scripts/node-loader.js +3 -2
- data/helper-scripts/rack-loader.rb +8 -9
- data/helper-scripts/rack-preloader.rb +9 -10
- data/lib/phusion_passenger.rb +36 -7
- data/lib/phusion_passenger/abstract_installer.rb +16 -15
- data/lib/phusion_passenger/active_support3_extensions/init.rb +1 -1
- data/lib/phusion_passenger/admin_tools/memory_stats.rb +2 -2
- data/lib/phusion_passenger/admin_tools/server_instance.rb +5 -5
- data/lib/phusion_passenger/analytics_logger.rb +3 -3
- data/lib/phusion_passenger/classic_rails/thread_handler_extension.rb +1 -1
- data/lib/phusion_passenger/config.rb +125 -0
- data/lib/phusion_passenger/config/about_command.rb +183 -0
- data/lib/phusion_passenger/config/command.rb +57 -0
- data/lib/phusion_passenger/config/restart_app_command.rb +146 -0
- data/lib/phusion_passenger/config/utils.rb +108 -0
- data/lib/phusion_passenger/console_text_template.rb +2 -1
- data/lib/phusion_passenger/constants.rb +7 -2
- data/lib/phusion_passenger/loader_shared_helpers.rb +12 -21
- data/lib/phusion_passenger/message_client.rb +15 -4
- data/lib/phusion_passenger/native_support.rb +116 -98
- data/lib/phusion_passenger/nginx/config_options.rb +5 -0
- data/lib/phusion_passenger/platform_info.rb +1 -1
- data/lib/phusion_passenger/platform_info/apache.rb +9 -5
- data/lib/phusion_passenger/platform_info/apache_detector.rb +5 -6
- data/lib/phusion_passenger/platform_info/binary_compatibility.rb +3 -3
- data/lib/phusion_passenger/platform_info/compiler.rb +29 -11
- data/lib/phusion_passenger/platform_info/curl.rb +1 -1
- data/lib/phusion_passenger/platform_info/cxx_portability.rb +30 -16
- data/lib/phusion_passenger/platform_info/depcheck.rb +6 -6
- data/lib/phusion_passenger/platform_info/linux.rb +2 -2
- data/lib/phusion_passenger/platform_info/operating_system.rb +25 -5
- data/lib/phusion_passenger/platform_info/ruby.rb +7 -4
- data/lib/phusion_passenger/platform_info/zlib.rb +1 -1
- data/lib/phusion_passenger/plugin.rb +0 -1
- data/lib/phusion_passenger/preloader_shared_helpers.rb +1 -1
- data/lib/phusion_passenger/public_api.rb +1 -1
- data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/lib/phusion_passenger/request_handler.rb +8 -9
- data/lib/phusion_passenger/request_handler/thread_handler.rb +21 -9
- data/lib/phusion_passenger/ruby_core_enhancements.rb +1 -1
- data/lib/phusion_passenger/standalone/app_finder.rb +2 -2
- data/lib/phusion_passenger/standalone/command.rb +10 -8
- data/lib/phusion_passenger/standalone/help_command.rb +1 -1
- data/lib/phusion_passenger/standalone/main.rb +3 -3
- data/lib/phusion_passenger/standalone/package_runtime_command.rb +2 -2
- data/lib/phusion_passenger/standalone/runtime_installer.rb +55 -13
- data/lib/phusion_passenger/standalone/runtime_locator.rb +3 -3
- data/lib/phusion_passenger/standalone/start_command.rb +6 -7
- data/lib/phusion_passenger/standalone/status_command.rb +1 -1
- data/lib/phusion_passenger/standalone/stop_command.rb +1 -1
- data/lib/phusion_passenger/standalone/utils.rb +1 -1
- data/lib/phusion_passenger/standalone/version_command.rb +2 -3
- data/lib/phusion_passenger/utils.rb +1 -1
- data/lib/phusion_passenger/utils/download.rb +1 -2
- data/lib/phusion_passenger/utils/file_system_watcher.rb +1 -1
- data/lib/phusion_passenger/utils/hosts_file_parser.rb +1 -1
- data/lib/phusion_passenger/utils/tee_input.rb +1 -1
- data/lib/phusion_passenger/utils/terminal_choice_menu.rb +217 -0
- data/lib/phusion_passenger/utils/unseekable_socket.rb +1 -1
- data/resources/templates/apache2/config_snippets.txt.erb +2 -3
- data/resources/templates/apache2/deployment_example.txt.erb +2 -2
- data/resources/templates/apache2/notify_apache_module_installed.txt.erb +3 -0
- data/resources/templates/nginx/config_snippets.txt.erb +1 -1
- data/resources/templates/nginx/deployment_example.txt.erb +2 -2
- data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +11 -5
- data/rpm/Vagrantfile +1 -0
- data/test/cxx/ApplicationPool2/PoolTest.cpp +224 -35
- data/test/cxx/ApplicationPool2/ProcessTest.cpp +6 -6
- data/test/cxx/MessagePassingTest.cpp +1 -1
- data/test/cxx/RequestHandlerTest.cpp +26 -26
- data/test/integration_tests/apache2_tests.rb +162 -243
- data/test/integration_tests/native_packaging_spec.rb +10 -10
- data/test/integration_tests/nginx_tests.rb +87 -107
- data/test/integration_tests/shared/example_webapp_tests.rb +246 -0
- data/test/integration_tests/source_packaging_test.rb +2 -1
- data/test/integration_tests/standalone_tests.rb +34 -19
- data/test/ruby/admin_tools_spec.rb +4 -4
- data/test/ruby/analytics_logger_spec.rb +1 -1
- data/test/ruby/debug_logging_spec.rb +2 -2
- data/test/ruby/message_channel_spec.rb +1 -1
- data/test/ruby/request_handler_spec.rb +171 -64
- data/test/ruby/shared/loader_sharedspec.rb +5 -5
- data/test/ruby/shared/rails/analytics_logging_extensions_sharedspec.rb +2 -2
- data/test/ruby/spec_helper.rb +4 -4
- data/test/ruby/standalone/runtime_installer_spec.rb +1 -1
- data/test/ruby/standalone/runtime_locator_spec.rb +1 -1
- data/test/ruby/utils/file_system_watcher_spec.rb +1 -1
- data/test/ruby/utils/hosts_file_parser.rb +1 -1
- data/test/ruby/utils/unseekable_socket_spec.rb +1 -1
- data/test/ruby/utils_spec.rb +4 -4
- data/test/stub/apache2/httpd.conf.erb +5 -0
- data/test/stub/index.html +1 -0
- data/test/stub/rack/config.ru +80 -33
- data/test/stub/{rails_apps/1.2/empty/app/models → rack/public}/.gitignore +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/Rakefile +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/application_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/recipes_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/uploads_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/welcome_controller.rb +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/app/helpers/application_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/recipes_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/test_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/uploads_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/welcome_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/layouts/default.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/create.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/new.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/new.html.erb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/cached.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/boot.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/database.yml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environment.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/environments/development.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environments/production.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/inflections.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/mime_types.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/routes.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/log/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/.htaccess +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/404.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/422.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/500.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.cgi +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.fcgi +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.rb +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/favicon.ico +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/angrywizard.gif +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/cookbook.gif +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/header.png +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/images/rails.png +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/robots.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/uploads.html +0 -0
- data/test/stub/{rails_apps/1.2/empty/db → rails2.3-mycook/public/uploads}/.gitignore +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/welcome/cached.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/about +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/console +0 -0
- data/test/stub/{rails_apps/2.2/empty → rails2.3-mycook}/script/dbconsole +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/destroy +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/generate +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/benchmarker +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/profiler +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/performance/request +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/plugin +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/inspector +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/reaper +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/spawner +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/runner +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/server +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/uploads.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/welcome/cached.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/cache/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/pids/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sessions/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sockets/useless.txt +0 -0
- data/test/stub/rails2.3/app/controllers/foo_controller.rb +1 -1
- data/test/stub/rails2.3/config/routes.rb +1 -2
- data/test/stub/wsgi/passenger_wsgi.py +47 -8
- data/test/stub/{rails_apps/1.2/empty/public/stylesheets → wsgi/public}/.gitignore +0 -0
- data/test/support/apache2_controller.rb +2 -2
- data/test/support/nginx_controller.rb +11 -5
- data/test/support/placebo-preloader.rb +2 -2
- data/test/support/test_helper.rb +26 -7
- metadata +78 -240
- metadata.gz.asc +7 -7
- data/debian.template/repack.sh +0 -42
- data/debian.template/watch +0 -3
- data/test/integration_tests/cgi_environment_spec.rb +0 -36
- data/test/integration_tests/hello_world_rack_spec.rb +0 -43
- data/test/integration_tests/hello_world_wsgi_spec.rb +0 -41
- data/test/integration_tests/mycook_spec.rb +0 -166
- data/test/stub/rack/public/rack.jpg +0 -0
- data/test/stub/rails_apps/1.2/empty/.gitignore +0 -3
- data/test/stub/rails_apps/1.2/empty/app/controllers/application.rb +0 -7
- data/test/stub/rails_apps/1.2/empty/config/boot.rb +0 -108
- data/test/stub/rails_apps/1.2/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/1.2/empty/config/environment.rb +0 -66
- data/test/stub/rails_apps/1.2/empty/config/environments/development.rb +0 -21
- data/test/stub/rails_apps/1.2/empty/config/environments/production.rb +0 -18
- data/test/stub/rails_apps/1.2/empty/config/environments/staging.rb +0 -18
- data/test/stub/rails_apps/1.2/empty/config/environments/test.rb +0 -19
- data/test/stub/rails_apps/1.2/empty/config/routes.rb +0 -23
- data/test/stub/rails_apps/1.2/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/1.2/empty/public/.htaccess +0 -40
- data/test/stub/rails_apps/1.2/empty/public/500.html +0 -30
- data/test/stub/rails_apps/1.2/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/1.2/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/1.2/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/1.2/empty/public/robots.txt +0 -1
- data/test/stub/rails_apps/1.2/empty/script/about +0 -3
- data/test/stub/rails_apps/1.2/empty/script/breakpointer +0 -3
- data/test/stub/rails_apps/1.2/empty/script/console +0 -3
- data/test/stub/rails_apps/1.2/empty/script/destroy +0 -3
- data/test/stub/rails_apps/1.2/empty/script/generate +0 -3
- data/test/stub/rails_apps/1.2/empty/script/plugin +0 -3
- data/test/stub/rails_apps/1.2/empty/script/runner +0 -3
- data/test/stub/rails_apps/1.2/empty/script/server +0 -3
- data/test/stub/rails_apps/1.2/empty/test/test_helper.rb +0 -28
- data/test/stub/rails_apps/2.0/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.0/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.0/empty/app/controllers/application.rb +0 -10
- data/test/stub/rails_apps/2.0/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.0/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/config/boot.rb +0 -108
- data/test/stub/rails_apps/2.0/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.0/empty/config/environment.rb +0 -59
- data/test/stub/rails_apps/2.0/empty/config/environments/production.rb +0 -18
- data/test/stub/rails_apps/2.0/empty/config/environments/staging.rb +0 -18
- data/test/stub/rails_apps/2.0/empty/config/environments/test.rb +0 -22
- data/test/stub/rails_apps/2.0/empty/config/routes.rb +0 -35
- data/test/stub/rails_apps/2.0/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/2.0/empty/public/.htaccess +0 -40
- data/test/stub/rails_apps/2.0/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.0/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/2.0/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/2.0/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/2.0/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.0/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.0/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.0/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.0/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.2/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.2/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.2/empty/app/controllers/application.rb +0 -15
- data/test/stub/rails_apps/2.2/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.2/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/config/boot.rb +0 -109
- data/test/stub/rails_apps/2.2/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.2/empty/config/environment.rb +0 -75
- data/test/stub/rails_apps/2.2/empty/config/environments/development.rb +0 -17
- data/test/stub/rails_apps/2.2/empty/config/environments/production.rb +0 -24
- data/test/stub/rails_apps/2.2/empty/config/environments/staging.rb +0 -24
- data/test/stub/rails_apps/2.2/empty/config/environments/test.rb +0 -22
- data/test/stub/rails_apps/2.2/empty/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.2/empty/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.2/empty/config/initializers/new_rails_defaults.rb +0 -17
- data/test/stub/rails_apps/2.2/empty/config/locales/en.yml +0 -5
- data/test/stub/rails_apps/2.2/empty/config/routes.rb +0 -43
- data/test/stub/rails_apps/2.2/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/doc/README_FOR_APP +0 -5
- data/test/stub/rails_apps/2.2/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.2/empty/public/422.html +0 -30
- data/test/stub/rails_apps/2.2/empty/public/500.html +0 -33
- data/test/stub/rails_apps/2.2/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/2.2/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/2.2/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/2.2/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.2/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.2/empty/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.2/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/script/about +0 -4
- data/test/stub/rails_apps/2.2/empty/script/console +0 -3
- data/test/stub/rails_apps/2.2/empty/script/destroy +0 -3
- data/test/stub/rails_apps/2.2/empty/script/generate +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/request +0 -3
- data/test/stub/rails_apps/2.2/empty/script/plugin +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.2/empty/script/runner +0 -3
- data/test/stub/rails_apps/2.2/empty/script/server +0 -3
- data/test/stub/rails_apps/2.2/empty/test/performance/browsing_test.rb +0 -9
- data/test/stub/rails_apps/2.2/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.3/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.3/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.3/empty/app/controllers/application_controller.rb +0 -10
- data/test/stub/rails_apps/2.3/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.3/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/config/boot.rb +0 -110
- data/test/stub/rails_apps/2.3/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.3/empty/config/environment.rb +0 -41
- data/test/stub/rails_apps/2.3/empty/config/environments/development.rb +0 -17
- data/test/stub/rails_apps/2.3/empty/config/environments/production.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/environments/staging.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/environments/test.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/initializers/backtrace_silencers.rb +0 -7
- data/test/stub/rails_apps/2.3/empty/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.3/empty/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.3/empty/config/initializers/new_rails_defaults.rb +0 -21
- data/test/stub/rails_apps/2.3/empty/config/initializers/session_store.rb +0 -15
- data/test/stub/rails_apps/2.3/empty/config/locales/en.yml +0 -5
- data/test/stub/rails_apps/2.3/empty/config/routes.rb +0 -43
- data/test/stub/rails_apps/2.3/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/db/seeds.rb +0 -7
- data/test/stub/rails_apps/2.3/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/2.3/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/422.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/500.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.3/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.3/empty/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.3/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/script/about +0 -4
- data/test/stub/rails_apps/2.3/empty/script/console +0 -3
- data/test/stub/rails_apps/2.3/empty/script/dbconsole +0 -3
- data/test/stub/rails_apps/2.3/empty/script/destroy +0 -3
- data/test/stub/rails_apps/2.3/empty/script/generate +0 -3
- data/test/stub/rails_apps/2.3/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.3/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.3/empty/script/plugin +0 -3
- data/test/stub/rails_apps/2.3/empty/script/runner +0 -3
- data/test/stub/rails_apps/2.3/empty/script/server +0 -3
- data/test/stub/rails_apps/2.3/empty/test/performance/browsing_test.rb +0 -9
- data/test/stub/rails_apps/2.3/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.3/mycook/Rakefile +0 -10
- data/test/stub/rails_apps/2.3/mycook/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.3/mycook/config/environments/development.rb +0 -18
- data/test/stub/rails_apps/2.3/mycook/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.3/mycook/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.3/mycook/public/404.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/422.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/500.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.3/mycook/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.3/mycook/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.3/mycook/public/uploads/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/mycook/script/about +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/console +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/dbconsole +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/destroy +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/generate +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/request +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/plugin +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/runner +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/server +0 -3
- data/test/stub/wsgi/public/wsgi-snake.jpg +0 -0
@@ -122,17 +122,8 @@ private:
|
|
122
122
|
return false;
|
123
123
|
}
|
124
124
|
|
125
|
-
VariantMap
|
126
|
-
|
127
|
-
it++;
|
128
|
-
while (it != end) {
|
129
|
-
const string &key = *it;
|
130
|
-
it++;
|
131
|
-
const string &value = *it;
|
132
|
-
map.set(key, value);
|
133
|
-
it++;
|
134
|
-
}
|
135
|
-
writeScalarMessage(commonContext.fd, pool->inspect(Pool::InspectOptions(map)));
|
125
|
+
VariantMap options = argsToOptions(args);
|
126
|
+
writeScalarMessage(commonContext.fd, pool->inspect(Pool::InspectOptions(options)));
|
136
127
|
return true;
|
137
128
|
}
|
138
129
|
|
@@ -155,6 +146,22 @@ private:
|
|
155
146
|
writeScalarMessage(commonContext.fd, oxt::thread::all_backtraces());
|
156
147
|
}
|
157
148
|
|
149
|
+
void processRestartAppGroup(CommonClientContext &commonContext, SpecificContext *specificContext,
|
150
|
+
const vector<string> &args)
|
151
|
+
{
|
152
|
+
TRACE_POINT();
|
153
|
+
commonContext.requireRights(Account::RESTART);
|
154
|
+
VariantMap options = argsToOptions(args, 2);
|
155
|
+
RestartMethod method = RM_DEFAULT;
|
156
|
+
if (options.get("method", false) == "blocking") {
|
157
|
+
method = RM_BLOCKING;
|
158
|
+
} else if (options.get("method", false) == "rolling") {
|
159
|
+
method = RM_ROLLING;
|
160
|
+
}
|
161
|
+
bool result = pool->restartGroupByName(args[1], method);
|
162
|
+
writeArrayMessage(commonContext.fd, result ? "true" : "false", NULL);
|
163
|
+
}
|
164
|
+
|
158
165
|
void processRequests(CommonClientContext &commonContext, SpecificContext *specificContext,
|
159
166
|
const vector<string> &args)
|
160
167
|
{
|
@@ -191,6 +198,8 @@ public:
|
|
191
198
|
processToXml(commonContext, specificContext, args);
|
192
199
|
} else if (isCommand(args, "backtraces", 0)) {
|
193
200
|
processBacktraces(commonContext, specificContext, args);
|
201
|
+
} else if (isCommand(args, "restart_app_group", 1, 99)) {
|
202
|
+
processRestartAppGroup(commonContext, specificContext, args);
|
194
203
|
} else if (isCommand(args, "requests", 0)) {
|
195
204
|
processRequests(commonContext, specificContext, args);
|
196
205
|
} else {
|
@@ -424,7 +433,8 @@ public:
|
|
424
433
|
accountsDatabase = boost::make_shared<AccountsDatabase>();
|
425
434
|
accountsDatabase->add("_passenger-status", options.adminToolStatusPassword, false,
|
426
435
|
Account::INSPECT_BASIC_INFO | Account::INSPECT_SENSITIVE_INFO |
|
427
|
-
Account::INSPECT_BACKTRACES | Account::INSPECT_REQUESTS
|
436
|
+
Account::INSPECT_BACKTRACES | Account::INSPECT_REQUESTS |
|
437
|
+
Account::RESTART);
|
428
438
|
accountsDatabase->add("_web_server", options.exitPassword, false, Account::EXIT);
|
429
439
|
messageServer = boost::make_shared<MessageServer>(
|
430
440
|
parseUnixSocketAddress(options.adminSocketAddress), accountsDatabase);
|
@@ -579,6 +589,7 @@ public:
|
|
579
589
|
*/
|
580
590
|
P_DEBUG("Received command to exit gracefully. "
|
581
591
|
"Waiting until 5 seconds after all clients have disconnected...");
|
592
|
+
requestHandler->resetInactivityTime();
|
582
593
|
while (requestHandler->inactivityTime() < 5000) {
|
583
594
|
syscalls::usleep(250000);
|
584
595
|
}
|
@@ -639,6 +639,10 @@ private:
|
|
639
639
|
// GDB helper function, implemented in .cpp file to prevent inlining.
|
640
640
|
Client *getClientPointer(const ClientPtr &client);
|
641
641
|
|
642
|
+
void doResetInactivityTime() {
|
643
|
+
inactivityTimer.reset();
|
644
|
+
}
|
645
|
+
|
642
646
|
void getInactivityTime(unsigned long long *result) const {
|
643
647
|
*result = inactivityTimer.elapsed();
|
644
648
|
}
|
@@ -1297,7 +1301,8 @@ private:
|
|
1297
1301
|
if (accept4Available) {
|
1298
1302
|
FileDescriptor fd(callAccept4(requestSocket,
|
1299
1303
|
(struct sockaddr *) &u, &addrlen, O_NONBLOCK));
|
1300
|
-
if (
|
1304
|
+
// FreeBSD returns EINVAL if accept4() is called with invalid flags.
|
1305
|
+
if (fd == -1 && (errno == ENOSYS || errno == EINVAL)) {
|
1301
1306
|
accept4Available = false;
|
1302
1307
|
return acceptNonBlockingSocket(sock);
|
1303
1308
|
} else {
|
@@ -2467,6 +2472,10 @@ public:
|
|
2467
2472
|
}
|
2468
2473
|
}
|
2469
2474
|
|
2475
|
+
void resetInactivityTime() {
|
2476
|
+
libev->run(boost::bind(&RequestHandler::doResetInactivityTime, this));
|
2477
|
+
}
|
2478
|
+
|
2470
2479
|
unsigned long long inactivityTime() const {
|
2471
2480
|
unsigned long long result;
|
2472
2481
|
libev->run(boost::bind(&RequestHandler::getInactivityTime, this, &result));
|
@@ -920,6 +920,7 @@ private:
|
|
920
920
|
union {
|
921
921
|
struct {
|
922
922
|
char stringStorage[sizeof(string)];
|
923
|
+
string *stringPointer;
|
923
924
|
struct {
|
924
925
|
regex_t regexp;
|
925
926
|
int options;
|
@@ -945,7 +946,8 @@ private:
|
|
945
946
|
} else {
|
946
947
|
source = STRING_LITERAL;
|
947
948
|
}
|
948
|
-
new (u.stringOrRegexpValue.stringStorage)
|
949
|
+
u.stringOrRegexpValue.stringPointer = new (u.stringOrRegexpValue.stringStorage)
|
950
|
+
string(value.data(), value.size());
|
949
951
|
if (regexp) {
|
950
952
|
int options = REG_EXTENDED;
|
951
953
|
u.stringOrRegexpValue.regexp.options = 0;
|
@@ -955,7 +957,7 @@ private:
|
|
955
957
|
Tokenizer::REGEXP_OPTION_CASE_INSENSITIVE;
|
956
958
|
}
|
957
959
|
regcomp(&u.stringOrRegexpValue.regexp.regexp,
|
958
|
-
|
960
|
+
u.stringOrRegexpValue.stringPointer->c_str(),
|
959
961
|
options);
|
960
962
|
}
|
961
963
|
}
|
@@ -1066,7 +1068,7 @@ private:
|
|
1066
1068
|
|
1067
1069
|
private:
|
1068
1070
|
const string &storedString() const {
|
1069
|
-
return *
|
1071
|
+
return *u.stringOrRegexpValue.stringPointer;
|
1070
1072
|
}
|
1071
1073
|
|
1072
1074
|
regex_t &storedRegexp() const {
|
@@ -1087,7 +1089,8 @@ private:
|
|
1087
1089
|
source = other.source;
|
1088
1090
|
switch (source) {
|
1089
1091
|
case REGEXP_LITERAL:
|
1090
|
-
new (u.stringOrRegexpValue.stringStorage)
|
1092
|
+
u.stringOrRegexpValue.stringPointer = new (u.stringOrRegexpValue.stringStorage)
|
1093
|
+
string(other.storedString());
|
1091
1094
|
options = REG_EXTENDED;
|
1092
1095
|
if (other.u.stringOrRegexpValue.regexp.options & Tokenizer::REGEXP_OPTION_CASE_INSENSITIVE) {
|
1093
1096
|
options |= REG_ICASE;
|
@@ -1098,7 +1101,8 @@ private:
|
|
1098
1101
|
u.stringOrRegexpValue.regexp.options = other.u.stringOrRegexpValue.regexp.options;
|
1099
1102
|
break;
|
1100
1103
|
case STRING_LITERAL:
|
1101
|
-
new (u.stringOrRegexpValue.stringStorage)
|
1104
|
+
u.stringOrRegexpValue.stringPointer = new (u.stringOrRegexpValue.stringStorage)
|
1105
|
+
string(other.storedString());
|
1102
1106
|
break;
|
1103
1107
|
case INTEGER_LITERAL:
|
1104
1108
|
u.intValue = other.u.intValue;
|
@@ -113,7 +113,7 @@ initialize(int argc, char *argv[]) {
|
|
113
113
|
parseArguments(argc, argv);
|
114
114
|
|
115
115
|
if (logFile != NULL) {
|
116
|
-
fd = open(logFile, O_WRONLY | O_APPEND | O_CREAT);
|
116
|
+
fd = open(logFile, O_WRONLY | O_APPEND | O_CREAT, 0644);
|
117
117
|
if (fd == -1) {
|
118
118
|
e = errno;
|
119
119
|
fprintf(stderr, ERROR_PREFIX
|
@@ -148,7 +148,10 @@ initialize(int argc, char *argv[]) {
|
|
148
148
|
|
149
149
|
static void
|
150
150
|
exitHandler(int signo) {
|
151
|
-
write(terminationPipe[1], "x", 1);
|
151
|
+
int ret = write(terminationPipe[1], "x", 1);
|
152
|
+
// We can't do anything about failures, so ignore
|
153
|
+
// compiler warnings about not using the result.
|
154
|
+
(void) ret;
|
152
155
|
}
|
153
156
|
|
154
157
|
static void
|
@@ -180,7 +183,13 @@ maybeDaemonize() {
|
|
180
183
|
pid = fork();
|
181
184
|
if (pid == 0) {
|
182
185
|
setsid();
|
183
|
-
chdir("/")
|
186
|
+
if (chdir("/") == -1) {
|
187
|
+
e = errno;
|
188
|
+
fprintf(stderr, ERROR_PREFIX
|
189
|
+
": cannot change working directory to /: %s (errno %d)\n",
|
190
|
+
strerror(e), e);
|
191
|
+
_exit(1);
|
192
|
+
}
|
184
193
|
redirectStdinToNull();
|
185
194
|
} else if (pid == -1) {
|
186
195
|
e = errno;
|
@@ -172,7 +172,10 @@ setOomScore(const StaticString &score) {
|
|
172
172
|
|
173
173
|
f = openOomAdjFile("w", type);
|
174
174
|
if (f != NULL) {
|
175
|
-
fwrite(score.data(), 1, score.size(), f);
|
175
|
+
size_t ret = fwrite(score.data(), 1, score.size(), f);
|
176
|
+
// We can't do anything about failures, so ignore compiler
|
177
|
+
// warnings about not doing anything with the result.
|
178
|
+
(void) ret;
|
176
179
|
fclose(f);
|
177
180
|
}
|
178
181
|
}
|
@@ -467,7 +470,10 @@ initializeBareEssentials(int argc, char *argv[]) {
|
|
467
470
|
agentsOptions = initializeAgent(argc, argv, "PassengerWatchdog");
|
468
471
|
|
469
472
|
if (agentsOptions.get("test_binary", false) == "1") {
|
470
|
-
|
473
|
+
int ret;
|
474
|
+
do {
|
475
|
+
ret = write(oldStdout, "PASS\n", 5);
|
476
|
+
} while (ret == -1 && errno == EAGAIN);
|
471
477
|
exit(0);
|
472
478
|
}
|
473
479
|
close(oldStdout);
|
@@ -149,6 +149,16 @@
|
|
149
149
|
NULL
|
150
150
|
},
|
151
151
|
|
152
|
+
{
|
153
|
+
|
154
|
+
ngx_string("passenger_document_root"),
|
155
|
+
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
|
156
|
+
ngx_conf_set_str_slot,
|
157
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
158
|
+
offsetof(passenger_loc_conf_t, document_root),
|
159
|
+
NULL
|
160
|
+
},
|
161
|
+
|
152
162
|
{
|
153
163
|
|
154
164
|
ngx_string("passenger_user"),
|
data/ext/nginx/ContentHandler.c
CHANGED
@@ -87,6 +87,16 @@ file_exists(const u_char *filename, unsigned int throttle_rate) {
|
|
87
87
|
return get_file_type(filename, throttle_rate) == FT_FILE;
|
88
88
|
}
|
89
89
|
|
90
|
+
static int
|
91
|
+
mapped_filename_equals(const u_char *filename, size_t filename_len, ngx_str_t *str)
|
92
|
+
{
|
93
|
+
return (str->len == filename_len &&
|
94
|
+
memcmp(str->data, filename, filename_len) == 0) ||
|
95
|
+
(str->len == filename_len - 1 &&
|
96
|
+
filename[filename_len - 1] == '/' &&
|
97
|
+
memcmp(str->data, filename, filename_len - 1) == 0);
|
98
|
+
}
|
99
|
+
|
90
100
|
/**
|
91
101
|
* Maps the URI for the given request to a page cache file, if possible.
|
92
102
|
*
|
@@ -115,16 +125,12 @@ map_uri_to_page_cache_file(ngx_http_request_t *r, ngx_str_t *public_dir,
|
|
115
125
|
|
116
126
|
/* From this point on we know that filename is not an empty string. */
|
117
127
|
|
118
|
-
|
119
|
-
|
128
|
+
|
129
|
+
/* Check whether `filename` is equal to public_dir.
|
130
|
+
* `filename` may also be equal to public_dir + "/" so check for that as well.
|
120
131
|
*/
|
121
|
-
if ((
|
122
|
-
|
123
|
-
(public_dir->len == filename_len - 1 &&
|
124
|
-
filename[filename_len - 1] == '/' &&
|
125
|
-
memcmp(public_dir->data, filename, filename_len - 1) == 0)
|
126
|
-
) {
|
127
|
-
/* If the URI maps to the 'public' directory (i.e. the request is the
|
132
|
+
if (mapped_filename_equals(filename, filename_len, public_dir)) {
|
133
|
+
/* If the URI maps to the 'public' or the alias directory (i.e. the request is the
|
128
134
|
* base URI) then index.html is the page cache file.
|
129
135
|
*/
|
130
136
|
|
@@ -1216,7 +1222,7 @@ passenger_content_handler(ngx_http_request_t *r)
|
|
1216
1222
|
u_char *path_last, *end;
|
1217
1223
|
u_char root_path_str[NGX_MAX_PATH + 1];
|
1218
1224
|
ngx_str_t root_path;
|
1219
|
-
size_t
|
1225
|
+
size_t root_len, len;
|
1220
1226
|
u_char page_cache_file_str[NGX_MAX_PATH + 1];
|
1221
1227
|
ngx_str_t page_cache_file;
|
1222
1228
|
passenger_context_t *context;
|
@@ -1243,7 +1249,7 @@ passenger_content_handler(ngx_http_request_t *r)
|
|
1243
1249
|
/* Let the next content handler take care of this request if this URL
|
1244
1250
|
* maps to an existing file.
|
1245
1251
|
*/
|
1246
|
-
path_last = ngx_http_map_uri_to_path(r, &path, &
|
1252
|
+
path_last = ngx_http_map_uri_to_path(r, &path, &root_len, 0);
|
1247
1253
|
if (path_last != NULL && file_exists(path.data, 0)) {
|
1248
1254
|
return NGX_DECLINED;
|
1249
1255
|
}
|
@@ -1251,10 +1257,10 @@ passenger_content_handler(ngx_http_request_t *r)
|
|
1251
1257
|
/* Create a string containing the root path. This path already
|
1252
1258
|
* contains a trailing slash.
|
1253
1259
|
*/
|
1254
|
-
end = ngx_copy(root_path_str, path.data,
|
1260
|
+
end = ngx_copy(root_path_str, path.data, root_len);
|
1255
1261
|
*end = '\0';
|
1256
1262
|
root_path.data = root_path_str;
|
1257
|
-
root_path.len =
|
1263
|
+
root_path.len = root_len;
|
1258
1264
|
|
1259
1265
|
|
1260
1266
|
context = ngx_pcalloc(r->pool, sizeof(passenger_context_t));
|
@@ -1266,13 +1272,20 @@ passenger_content_handler(ngx_http_request_t *r)
|
|
1266
1272
|
|
1267
1273
|
/* Find the base URI for this web application, if any. */
|
1268
1274
|
if (find_base_uri(r, slcf, &base_uri)) {
|
1269
|
-
/* Store the found base URI into context->public_dir. We infer that
|
1270
|
-
* directory of the web
|
1275
|
+
/* Store the found base URI into context->public_dir. We infer that
|
1276
|
+
* the 'public' directory of the web app equals document root + base URI.
|
1271
1277
|
*/
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1278
|
+
if (slcf->document_root.data != NULL) {
|
1279
|
+
len = slcf->document_root.len + 1;
|
1280
|
+
context->public_dir.data = ngx_palloc(r->pool, sizeof(u_char) * len);
|
1281
|
+
end = ngx_copy(context->public_dir.data, slcf->document_root.data,
|
1282
|
+
slcf->document_root.len);
|
1283
|
+
} else {
|
1284
|
+
len = root_path.len + base_uri.len + 1;
|
1285
|
+
context->public_dir.data = ngx_palloc(r->pool, sizeof(u_char) * len);
|
1286
|
+
end = ngx_copy(context->public_dir.data, root_path.data, root_path.len);
|
1287
|
+
end = ngx_copy(end, base_uri.data, base_uri.len);
|
1288
|
+
}
|
1276
1289
|
*end = '\0';
|
1277
1290
|
context->public_dir.len = len - 1;
|
1278
1291
|
context->base_uri = base_uri;
|
data/ext/nginx/config
CHANGED
@@ -1,13 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# passenger-config is run with the 'ruby' command in $PATH, even when natively packaged,
|
2
|
+
# so we check whether 'ruby' is correctly in $PATH.
|
4
3
|
if ! ruby -v >/dev/null 2>/dev/null; then
|
5
4
|
echo '*** ERROR: Cannot find the "ruby" command in $PATH. Please fix your $PATH. You can learn more about $PATH at: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_the_path_environment_variable'
|
6
5
|
echo '*** Do you think that you set $PATH correctly, and you happen to be using sudo or rvmsudo? Read this: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#env_vars_and_sudo'
|
7
6
|
exit 1
|
8
7
|
fi
|
9
8
|
|
10
|
-
|
9
|
+
## Magic comment: begin bootstrap ##
|
10
|
+
# Ensure that this script finds the passenger-config that belongs to this Phusion Passenger installation.
|
11
|
+
PATH="$ngx_addon_dir/../../bin:$PATH"
|
12
|
+
export PATH
|
13
|
+
|
14
|
+
PASSENGER_CONFIG=${PASSENGER_CONFIG:-passenger-config}
|
15
|
+
|
16
|
+
if test "x$PASSENGER_LIBS" = "x" && ! $PASSENGER_CONFIG --compiled; then
|
11
17
|
echo "*** The Phusion Passenger support files are not yet compiled. Compiling them for you... ***"
|
12
18
|
echo "*** Running 'rake nginx CACHING=false' in $ngx_addon_dir... ***"
|
13
19
|
old_dir=`pwd`
|
@@ -26,12 +32,13 @@ if test "x$PASSENGER_LIBS" = "x" && ! passenger-config --compiled; then
|
|
26
32
|
cd "$old_dir"
|
27
33
|
echo "*** Phusion Passenger support files have been successfully compiled. ***"
|
28
34
|
fi
|
35
|
+
## Magic comment: end bootstrap ##
|
29
36
|
|
30
37
|
if test "x$PASSENGER_INCLUDEDIR" = "x"; then
|
31
|
-
PASSENGER_INCLUDEDIR
|
38
|
+
PASSENGER_INCLUDEDIR=`$PASSENGER_CONFIG --includedir`
|
32
39
|
fi
|
33
40
|
if test "x$PASSENGER_LIBS" = "x"; then
|
34
|
-
PASSENGER_LIBS
|
41
|
+
PASSENGER_LIBS=`$PASSENGER_CONFIG --nginx-libs`
|
35
42
|
fi
|
36
43
|
|
37
44
|
ngx_addon_name=ngx_http_passenger_module
|
@@ -27,9 +27,11 @@
|
|
27
27
|
/* Ruby 1.9 */
|
28
28
|
#include "ruby/intern.h"
|
29
29
|
#include "ruby/io.h"
|
30
|
+
#include "ruby/version.h"
|
30
31
|
#else
|
31
32
|
#include "rubysig.h"
|
32
33
|
#include "rubyio.h"
|
34
|
+
#include "version.h"
|
33
35
|
#endif
|
34
36
|
#include <sys/types.h>
|
35
37
|
#include <sys/stat.h>
|
@@ -861,8 +863,65 @@ void
|
|
861
863
|
Init_passenger_native_support() {
|
862
864
|
struct sockaddr_un addr;
|
863
865
|
|
864
|
-
/* */
|
865
|
-
|
866
|
+
/* Only defined on Ruby >= 1.9 */
|
867
|
+
#ifdef RUBY_API_VERSION_CODE
|
868
|
+
if (ruby_api_version[0] != RUBY_API_VERSION_MAJOR
|
869
|
+
|| ruby_api_version[1] != RUBY_API_VERSION_MINOR
|
870
|
+
|| ruby_api_version[2] != RUBY_API_VERSION_TEENY)
|
871
|
+
{
|
872
|
+
fprintf(stderr, " --> passenger_native_support was compiled for Ruby API version %d.%d.%d, "
|
873
|
+
"but you're currently running a Ruby interpreter with API version %d.%d.%d.\n",
|
874
|
+
RUBY_API_VERSION_MAJOR,
|
875
|
+
RUBY_API_VERSION_MINOR,
|
876
|
+
RUBY_API_VERSION_TEENY,
|
877
|
+
ruby_api_version[0],
|
878
|
+
ruby_api_version[1],
|
879
|
+
ruby_api_version[2]);
|
880
|
+
fprintf(stderr, " Refusing to load existing passenger_native_support.\n");
|
881
|
+
return;
|
882
|
+
}
|
883
|
+
/* Because native extensions may be linked to libruby, loading
|
884
|
+
* a Ruby 1.9 native extension may not fail on Ruby 1.8 (even though
|
885
|
+
* the extension will crash later on). We detect such a case here and
|
886
|
+
* abort early.
|
887
|
+
*/
|
888
|
+
if (strlen(ruby_version) >= sizeof("1.8.7") - 1
|
889
|
+
&& ruby_version[0] == '1'
|
890
|
+
&& ruby_version[1] == '.'
|
891
|
+
&& ruby_version[2] == '8')
|
892
|
+
{
|
893
|
+
fprintf(stderr, " --> passenger_native_support was compiled for Ruby %d.%d, "
|
894
|
+
"but you're currently running Ruby %s\n",
|
895
|
+
RUBY_API_VERSION_MAJOR,
|
896
|
+
RUBY_API_VERSION_MINOR,
|
897
|
+
ruby_version);
|
898
|
+
fprintf(stderr, " Refusing to load existing passenger_native_support.\n");
|
899
|
+
return;
|
900
|
+
}
|
901
|
+
#else
|
902
|
+
if (strlen(ruby_version) < sizeof("1.8.7") - 1
|
903
|
+
|| ruby_version[0] != '1'
|
904
|
+
|| ruby_version[1] != '.'
|
905
|
+
|| ruby_version[2] != '8')
|
906
|
+
{
|
907
|
+
/* We may not have included Ruby 1.8's version.h because of compiler
|
908
|
+
* header file search paths, so we can't rely on RUBY_VERSION being
|
909
|
+
* defined.
|
910
|
+
*/
|
911
|
+
#ifdef RUBY_VERSION
|
912
|
+
#define ESTIMATED_RUBY_VERSION RUBY_VERSION
|
913
|
+
#else
|
914
|
+
#define ESTIMATED_RUBY_VERSION "1.8"
|
915
|
+
#endif
|
916
|
+
fprintf(stderr, " --> passenger_native_support was compiled for Ruby %s, "
|
917
|
+
"but you're currently running Ruby %s\n",
|
918
|
+
ESTIMATED_RUBY_VERSION, ruby_version);
|
919
|
+
fprintf(stderr, " Refusing to load existing passenger_native_support.\n");
|
920
|
+
return;
|
921
|
+
}
|
922
|
+
#endif
|
923
|
+
|
924
|
+
mPassenger = rb_define_module("PhusionPassenger");
|
866
925
|
|
867
926
|
/*
|
868
927
|
* Utility functions for accessing system functionality.
|