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
@@ -32,9 +32,13 @@ ENV['PATH'] = "/usr/bin:#{ENV['PATH']}"
|
|
32
32
|
LOCATIONS_INI = ENV['LOCATIONS_INI']
|
33
33
|
abort "Please set the LOCATIONS_INI environment variable to the right locations.ini" if !LOCATIONS_INI
|
34
34
|
|
35
|
+
NATIVE_PACKAGING_METHOD = ENV['NATIVE_PACKAGING_METHOD']
|
36
|
+
abort "Please set NATIVE_PACKAGING_METHOD to either 'deb' or 'rpm'" if !["deb", "rpm"].include?(NATIVE_PACKAGING_METHOD)
|
37
|
+
|
35
38
|
source_root = File.expand_path("../..", File.dirname(__FILE__))
|
36
39
|
$LOAD_PATH.unshift("#{source_root}/lib")
|
37
40
|
require 'phusion_passenger'
|
41
|
+
PhusionPassenger.locate_directories
|
38
42
|
require 'tmpdir'
|
39
43
|
require 'fileutils'
|
40
44
|
require 'open-uri'
|
@@ -80,6 +84,10 @@ describe "A natively packaged Phusion Passenger" do
|
|
80
84
|
end
|
81
85
|
end
|
82
86
|
|
87
|
+
specify "locations.ini sets native_packaging_method to #{NATIVE_PACKAGING_METHOD}" do
|
88
|
+
File.read(LOCATIONS_INI).should =~ /^native_packaging_method=#{NATIVE_PACKAGING_METHOD}$/
|
89
|
+
end
|
90
|
+
|
83
91
|
specify "passenger-status is in #{SBINDIR}" do
|
84
92
|
which("passenger-status").should == "#{SBINDIR}/passenger-status"
|
85
93
|
end
|
@@ -191,17 +199,9 @@ describe "A natively packaged Phusion Passenger" do
|
|
191
199
|
which("passenger-install-apache2-module").should == "#{BINDIR}/passenger-install-apache2-module"
|
192
200
|
end
|
193
201
|
|
194
|
-
it "
|
195
|
-
output = capture_output("passenger-install-apache2-module --auto")
|
196
|
-
output.should =~ /Please edit your Apache configuration file/
|
197
|
-
output.should_not include("Compiling and installing Apache 2 module")
|
198
|
-
output.should_not include("rake apache2")
|
199
|
-
end
|
200
|
-
|
201
|
-
it "produces a correct configuration snippet" do
|
202
|
+
it "checks whether the Apache module is installed" do
|
202
203
|
output = capture_output("passenger-install-apache2-module --auto")
|
203
|
-
output.should
|
204
|
-
output.should include("PassengerRoot #{LOCATIONS_INI}")
|
204
|
+
output.should =~ /Apache module is correctly installed/
|
205
205
|
end
|
206
206
|
end
|
207
207
|
|
@@ -1,9 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
2
2
|
require 'support/nginx_controller'
|
3
|
-
require 'integration_tests/
|
4
|
-
require 'integration_tests/cgi_environment_spec'
|
5
|
-
require 'integration_tests/hello_world_rack_spec'
|
6
|
-
require 'integration_tests/hello_world_wsgi_spec'
|
3
|
+
require 'integration_tests/shared/example_webapp_tests'
|
7
4
|
|
8
5
|
describe "Phusion Passenger for Nginx" do
|
9
6
|
before :all do
|
@@ -11,11 +8,11 @@ describe "Phusion Passenger for Nginx" do
|
|
11
8
|
STDERR.puts "*** ERROR: You must set the 'nginx' config option in test/config.json."
|
12
9
|
exit!(1)
|
13
10
|
end
|
14
|
-
|
11
|
+
|
15
12
|
check_hosts_configuration
|
16
13
|
FileUtils.mkdir_p("tmp.nginx")
|
17
14
|
end
|
18
|
-
|
15
|
+
|
19
16
|
after :all do
|
20
17
|
begin
|
21
18
|
@nginx.stop if @nginx
|
@@ -23,7 +20,7 @@ describe "Phusion Passenger for Nginx" do
|
|
23
20
|
FileUtils.rm_rf("tmp.nginx")
|
24
21
|
end
|
25
22
|
end
|
26
|
-
|
23
|
+
|
27
24
|
before :each do
|
28
25
|
File.open("test.log", "a") do |f|
|
29
26
|
# Make sure that all Nginx log output is prepended by the test description
|
@@ -42,189 +39,172 @@ describe "Phusion Passenger for Nginx" do
|
|
42
39
|
end
|
43
40
|
end
|
44
41
|
|
45
|
-
describe "
|
42
|
+
describe "a Ruby app running on the root URI" do
|
46
43
|
before :all do
|
47
44
|
create_nginx_controller
|
48
45
|
@server = "http://1.passenger.test:#{@nginx.port}"
|
49
|
-
@
|
50
|
-
@stub = ClassicRailsStub.new('rails_apps/2.3/mycook')
|
46
|
+
@stub = RackStub.new('rack')
|
51
47
|
@nginx.add_server do |server|
|
52
48
|
server[:server_name] = "1.passenger.test"
|
53
49
|
server[:root] = "#{@stub.full_app_root}/public"
|
54
50
|
end
|
55
51
|
@nginx.start
|
56
52
|
end
|
57
|
-
|
53
|
+
|
58
54
|
after :all do
|
59
55
|
@stub.destroy
|
60
56
|
@nginx.stop if @nginx
|
61
57
|
end
|
62
|
-
|
58
|
+
|
63
59
|
before :each do
|
64
60
|
@stub.reset
|
65
61
|
end
|
66
|
-
|
67
|
-
it_should_behave_like "
|
68
|
-
include_examples "CGI environment variables compliance"
|
62
|
+
|
63
|
+
it_should_behave_like "an example web app"
|
69
64
|
end
|
70
|
-
|
71
|
-
describe "
|
65
|
+
|
66
|
+
describe "a Ruby app running in a sub-URI" do
|
72
67
|
before :all do
|
73
|
-
@base_uri = "/mycook"
|
74
|
-
@stub = ClassicRailsStub.new('rails_apps/2.3/mycook')
|
75
|
-
FileUtils.rm_rf('tmp.webdir')
|
76
|
-
FileUtils.mkdir_p('tmp.webdir')
|
77
|
-
FileUtils.cp_r('stub/zsfa/.', 'tmp.webdir')
|
78
|
-
FileUtils.ln_sf(@stub.full_app_root + "/public", 'tmp.webdir/mycook')
|
79
|
-
|
80
68
|
create_nginx_controller
|
69
|
+
@server = "http://1.passenger.test:#{@nginx.port}/subapp"
|
70
|
+
@stub = RackStub.new('rack')
|
81
71
|
@nginx.add_server do |server|
|
82
72
|
server[:server_name] = "1.passenger.test"
|
83
|
-
server[:root] =
|
84
|
-
server
|
73
|
+
server[:root] = "#{PhusionPassenger.source_root}/test/stub"
|
74
|
+
server << %Q{
|
75
|
+
location ~ ^/subapp(/.*|$) {
|
76
|
+
alias #{@stub.full_app_root}/public$1;
|
77
|
+
passenger_base_uri /subapp;
|
78
|
+
passenger_document_root #{@stub.full_app_root}/public;
|
79
|
+
passenger_app_root #{@stub.full_app_root};
|
80
|
+
passenger_enabled on;
|
81
|
+
}
|
82
|
+
}
|
85
83
|
end
|
86
84
|
@nginx.start
|
87
85
|
end
|
88
|
-
|
86
|
+
|
89
87
|
after :all do
|
90
|
-
FileUtils.rm_rf('tmp.webdir')
|
91
88
|
@stub.destroy
|
92
89
|
@nginx.stop if @nginx
|
93
90
|
end
|
94
|
-
|
91
|
+
|
95
92
|
before :each do
|
96
|
-
@server = "http://1.passenger.test:#{@nginx.port}/mycook"
|
97
93
|
@stub.reset
|
98
94
|
end
|
99
95
|
|
100
|
-
it_should_behave_like "
|
101
|
-
|
102
|
-
|
96
|
+
it_should_behave_like "an example web app"
|
97
|
+
|
103
98
|
it "does not interfere with the root website" do
|
104
99
|
@server = "http://1.passenger.test:#{@nginx.port}"
|
105
|
-
get('/').should
|
100
|
+
get('/').should == "This is the stub directory."
|
106
101
|
end
|
107
102
|
end
|
108
|
-
|
109
|
-
describe "
|
103
|
+
|
104
|
+
describe "a Python app running on the root URI" do
|
110
105
|
before :all do
|
111
106
|
create_nginx_controller
|
112
|
-
@server = "http://passenger.test:#{@nginx.port}"
|
113
|
-
@stub =
|
107
|
+
@server = "http://1.passenger.test:#{@nginx.port}"
|
108
|
+
@stub = PythonStub.new('wsgi')
|
114
109
|
@nginx.add_server do |server|
|
115
|
-
server[:server_name] = "passenger.test"
|
110
|
+
server[:server_name] = "1.passenger.test"
|
116
111
|
server[:root] = "#{@stub.full_app_root}/public"
|
117
|
-
server[:passenger_max_requests] = 3
|
118
112
|
end
|
119
113
|
@nginx.start
|
120
114
|
end
|
121
|
-
|
115
|
+
|
122
116
|
after :all do
|
123
117
|
@stub.destroy
|
124
118
|
@nginx.stop if @nginx
|
125
119
|
end
|
126
|
-
|
120
|
+
|
127
121
|
before :each do
|
128
122
|
@stub.reset
|
129
123
|
end
|
130
|
-
|
131
|
-
it_should_behave_like "
|
124
|
+
|
125
|
+
it_should_behave_like "an example web app"
|
132
126
|
end
|
133
|
-
|
134
|
-
describe "
|
127
|
+
|
128
|
+
describe "a Python app running in a sub-URI" do
|
135
129
|
before :all do
|
136
|
-
FileUtils.rm_rf('tmp.webdir')
|
137
|
-
FileUtils.mkdir_p('tmp.webdir')
|
138
|
-
@stub = RackStub.new('rack')
|
139
130
|
create_nginx_controller
|
131
|
+
@server = "http://1.passenger.test:#{@nginx.port}/subapp"
|
132
|
+
@stub = PythonStub.new('wsgi')
|
140
133
|
@nginx.add_server do |server|
|
141
|
-
|
142
|
-
server[:
|
143
|
-
server
|
144
|
-
|
134
|
+
server[:server_name] = "1.passenger.test"
|
135
|
+
server[:root] = "#{PhusionPassenger.source_root}/test/stub"
|
136
|
+
server << %Q{
|
137
|
+
location ~ ^/subapp(/.*|$) {
|
138
|
+
alias #{@stub.full_app_root}/public$1;
|
139
|
+
passenger_base_uri /subapp;
|
140
|
+
passenger_app_root #{@stub.full_app_root};
|
141
|
+
passenger_document_root #{@stub.full_app_root}/public;
|
142
|
+
passenger_enabled on;
|
143
|
+
}
|
144
|
+
}
|
145
145
|
end
|
146
146
|
@nginx.start
|
147
|
-
@server = "http://passenger.test:#{@nginx.port}/rack"
|
148
147
|
end
|
149
|
-
|
148
|
+
|
150
149
|
after :all do
|
151
150
|
@stub.destroy
|
152
|
-
FileUtils.rm_rf('tmp.webdir')
|
153
151
|
@nginx.stop if @nginx
|
154
152
|
end
|
155
|
-
|
153
|
+
|
156
154
|
before :each do
|
157
155
|
@stub.reset
|
158
156
|
end
|
159
|
-
|
160
|
-
it_should_behave_like "
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
create_nginx_controller
|
166
|
-
@server = "http://passenger.test:#{@nginx.port}"
|
167
|
-
@stub = ClassicRailsStub.new('rails_apps/2.3/mycook')
|
168
|
-
FileUtils.cp_r("stub/rack/.", @stub.app_root)
|
169
|
-
@nginx.add_server do |server|
|
170
|
-
server[:server_name] = "passenger.test"
|
171
|
-
server[:root] = "#{@stub.full_app_root}/public"
|
172
|
-
end
|
173
|
-
@nginx.start
|
174
|
-
end
|
175
|
-
|
176
|
-
after :all do
|
177
|
-
@stub.destroy
|
178
|
-
@nginx.stop if @nginx
|
179
|
-
end
|
180
|
-
|
181
|
-
before :each do
|
182
|
-
@stub.reset
|
183
|
-
FileUtils.cp_r("stub/rack/.", @stub.app_root)
|
157
|
+
|
158
|
+
it_should_behave_like "an example web app"
|
159
|
+
|
160
|
+
it "does not interfere with the root website" do
|
161
|
+
@server = "http://1.passenger.test:#{@nginx.port}"
|
162
|
+
get('/').should == "This is the stub directory."
|
184
163
|
end
|
185
|
-
|
186
|
-
it_should_behave_like "HelloWorld Rack application"
|
187
164
|
end
|
188
|
-
|
165
|
+
|
189
166
|
describe "various features" do
|
190
167
|
before :all do
|
191
168
|
create_nginx_controller
|
192
|
-
@server = "http://passenger.test:#{@nginx.port}"
|
169
|
+
@server = "http://1.passenger.test:#{@nginx.port}"
|
193
170
|
@stub = RackStub.new('rack')
|
171
|
+
@nginx.set(:passenger_load_shell_envvars => 'off')
|
194
172
|
@nginx.add_server do |server|
|
195
|
-
server[:server_name] = "passenger.test"
|
173
|
+
server[:server_name] = "1.passenger.test"
|
196
174
|
server[:root] = "#{@stub.full_app_root}/public"
|
197
175
|
server << %q{
|
198
176
|
location /crash_without_friendly_error_page {
|
177
|
+
passenger_enabled on;
|
199
178
|
passenger_friendly_error_pages off;
|
200
179
|
}
|
201
180
|
}
|
202
181
|
end
|
203
182
|
@nginx.add_server do |server|
|
204
|
-
server[:server_name] = "
|
183
|
+
server[:server_name] = "2.passenger.test"
|
205
184
|
server[:root] = "#{@stub.full_app_root}/public"
|
206
185
|
server[:passenger_app_group_name] = "secondary"
|
207
186
|
server[:passenger_show_version_in_header] = "off"
|
208
187
|
end
|
209
188
|
@nginx.add_server do |server|
|
210
|
-
server[:server_name] = "
|
189
|
+
server[:server_name] = "3.passenger.test"
|
190
|
+
server[:passenger_app_group_name] = "tertiary"
|
211
191
|
server[:root] = "#{@stub.full_app_root}/public"
|
212
192
|
server[:passenger_max_requests] = 3
|
213
193
|
end
|
214
194
|
@nginx.start
|
215
195
|
end
|
216
|
-
|
196
|
+
|
217
197
|
after :all do
|
218
198
|
@stub.destroy
|
219
199
|
@nginx.stop if @nginx
|
220
200
|
end
|
221
|
-
|
201
|
+
|
222
202
|
before :each do
|
223
203
|
@stub.reset
|
224
204
|
@error_page_signature = /<meta name="generator" content="Phusion Passenger">/
|
225
205
|
File.touch("#{@stub.app_root}/tmp/restart.txt", 1 + rand(100000))
|
226
206
|
end
|
227
|
-
|
207
|
+
|
228
208
|
it "sets ENV['SERVER_SOFTWARE']" do
|
229
209
|
File.write("#{@stub.app_root}/config.ru", %q{
|
230
210
|
server_software = ENV['SERVER_SOFTWARE']
|
@@ -235,7 +215,7 @@ describe "Phusion Passenger for Nginx" do
|
|
235
215
|
})
|
236
216
|
get('/').should =~ /nginx/i
|
237
217
|
end
|
238
|
-
|
218
|
+
|
239
219
|
it "displays a friendly error page if the application fails to spawn" do
|
240
220
|
File.write("#{@stub.app_root}/config.ru", %q{
|
241
221
|
raise "my error"
|
@@ -244,7 +224,7 @@ describe "Phusion Passenger for Nginx" do
|
|
244
224
|
data.should =~ /#{@error_page_signature}/
|
245
225
|
data.should =~ /my error/
|
246
226
|
end
|
247
|
-
|
227
|
+
|
248
228
|
it "doesn't display a friendly error page if the application fails to spawn but passenger_friendly_error_pages is off" do
|
249
229
|
File.write("#{@stub.app_root}/config.ru", %q{
|
250
230
|
raise "my error"
|
@@ -253,29 +233,29 @@ describe "Phusion Passenger for Nginx" do
|
|
253
233
|
data.should_not =~ /#{@error_page_signature}/
|
254
234
|
data.should_not =~ /my error/
|
255
235
|
end
|
256
|
-
|
236
|
+
|
257
237
|
it "appends an X-Powered-By header containing the Phusion Passenger version number" do
|
258
238
|
response = get_response('/')
|
259
239
|
response["X-Powered-By"].should include("Phusion Passenger")
|
260
240
|
response["X-Powered-By"].should include(PhusionPassenger::VERSION_STRING)
|
261
241
|
end
|
262
|
-
|
242
|
+
|
263
243
|
it "omits the version number in X-Powered-By when passenger_show_version_in_header is off" do
|
264
|
-
@server = "http://
|
244
|
+
@server = "http://2.passenger.test:#{@nginx.port}/"
|
265
245
|
response = get_response('/')
|
266
246
|
response["X-Powered-By"].should include("Phusion Passenger")
|
267
247
|
response["X-Powered-By"].should_not include(PhusionPassenger::VERSION_STRING)
|
268
248
|
end
|
269
|
-
|
249
|
+
|
270
250
|
it "respawns the app after handling max_requests requests" do
|
271
|
-
@server = "http://
|
251
|
+
@server = "http://3.passenger.test:#{@nginx.port}/"
|
272
252
|
pid = get("/pid")
|
273
253
|
get("/pid").should == pid
|
274
254
|
get("/pid").should == pid
|
275
255
|
get("/pid").should_not == pid
|
276
256
|
end
|
277
257
|
end
|
278
|
-
|
258
|
+
|
279
259
|
describe "oob work" do
|
280
260
|
before :all do
|
281
261
|
create_nginx_controller
|
@@ -292,10 +272,10 @@ describe "Phusion Passenger for Nginx" do
|
|
292
272
|
@stub.destroy
|
293
273
|
@nginx.stop if @nginx
|
294
274
|
end
|
295
|
-
|
275
|
+
|
296
276
|
before :each do
|
297
277
|
@stub.reset
|
298
|
-
|
278
|
+
|
299
279
|
File.write("#{@stub.app_root}/config.ru", <<-RUBY)
|
300
280
|
PhusionPassenger.on_event(:oob_work) do
|
301
281
|
f = File.open("#{@stub.full_app_root}/oob_work.\#{$$}", 'w')
|
@@ -311,16 +291,16 @@ describe "Phusion Passenger for Nginx" do
|
|
311
291
|
end
|
312
292
|
run app
|
313
293
|
RUBY
|
314
|
-
|
294
|
+
|
315
295
|
@nginx.start
|
316
296
|
end
|
317
|
-
|
297
|
+
|
318
298
|
it "invokes oobw when requested by the app process" do
|
319
299
|
pid = get("/oobw")
|
320
300
|
sleep 0.5 # wait for oobw callback to be invoked
|
321
301
|
File.exists?("#{@stub.app_root}/oob_work.#{pid}").should == true
|
322
302
|
end
|
323
|
-
|
303
|
+
|
324
304
|
it "does not block client while invoking oob work" do
|
325
305
|
get("/") # ensure there are spawned app processes
|
326
306
|
t0 = Time.now
|
@@ -329,9 +309,9 @@ describe "Phusion Passenger for Nginx" do
|
|
329
309
|
secs.should <= 0.1
|
330
310
|
end
|
331
311
|
end
|
332
|
-
|
312
|
+
|
333
313
|
##### Helper methods #####
|
334
|
-
|
314
|
+
|
335
315
|
def start_web_server_if_necessary
|
336
316
|
if !@nginx.running?
|
337
317
|
@nginx.start
|
@@ -0,0 +1,246 @@
|
|
1
|
+
require 'socket'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
shared_examples_for "an example web app" do
|
5
|
+
it "responds to GET requests for static asset" do
|
6
|
+
FileUtils.cp('stub/garbage1.dat', @stub.full_app_root + "/public/garbage1.dat")
|
7
|
+
get('/garbage1.dat').should == @stub.public_file('garbage1.dat')
|
8
|
+
end
|
9
|
+
|
10
|
+
it "supports page caching on file URIs" do
|
11
|
+
File.write(@stub.full_app_root + "/public/cached.html", "This is the cached version of /cached")
|
12
|
+
get('/cached').should == "This is the cached version of /cached"
|
13
|
+
end
|
14
|
+
|
15
|
+
it "supports page caching on directory URIs" do
|
16
|
+
File.write(@stub.full_app_root + "/public/cached.html", "This is the cached version of /cached")
|
17
|
+
Dir.mkdir(@stub.full_app_root + "/public/cached")
|
18
|
+
get('/cached').should == "This is the cached version of /cached"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "supports page caching on root/base URIs" do
|
22
|
+
File.write(@stub.full_app_root + "/public/index.html", "This is index.html")
|
23
|
+
get('/').should == "This is index.html"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "doesn't use page caching if the HTTP request is not GET" do
|
27
|
+
File.write(@stub.full_app_root + "/public/cached.html", "This is the cached version of /cached")
|
28
|
+
post('/cached').should == "This is the uncached version of /cached"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "responds to GET requests on dynamic pages" do
|
32
|
+
get('/').should == "front page"
|
33
|
+
end
|
34
|
+
|
35
|
+
it "properly receives GET parameters" do
|
36
|
+
result = get('/parameters?first=one&second=two')
|
37
|
+
result.should == "Method: GET\n" +
|
38
|
+
"First: one\n" +
|
39
|
+
"Second: two\n"
|
40
|
+
end
|
41
|
+
|
42
|
+
it "responds to POST requests on dynamic pages" do
|
43
|
+
result = post('/parameters',
|
44
|
+
"first" => "one",
|
45
|
+
"second" => "two"
|
46
|
+
)
|
47
|
+
result.should == "Method: POST\n" +
|
48
|
+
"First: one\n" +
|
49
|
+
"Second: two\n"
|
50
|
+
end
|
51
|
+
|
52
|
+
it "properly handles file uploads" do
|
53
|
+
static_file = File.open('stub/garbage1.dat', 'rb')
|
54
|
+
params = {
|
55
|
+
'name1' => 'Kotonoha',
|
56
|
+
'name2' => 'Sekai',
|
57
|
+
'data' => static_file
|
58
|
+
}
|
59
|
+
begin
|
60
|
+
# For some reason the WSGI stub app does not accept the multipart data generated by
|
61
|
+
# post(), so we use curl instead.
|
62
|
+
command = "curl --silent -F name1=Kotonoha -F name2=Sekai -F data=@stub/garbage1.dat #{@server}/upload_with_params"
|
63
|
+
response = IO.popen(command, "rb") do |io|
|
64
|
+
io.read
|
65
|
+
end
|
66
|
+
response.should ==
|
67
|
+
binary_string("name 1 = Kotonoha\n") <<
|
68
|
+
binary_string("name 2 = Sekai\n") <<
|
69
|
+
binary_string("data = ") << static_file.read
|
70
|
+
ensure
|
71
|
+
static_file.close
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
it "properly handles POST requests with 'chunked' transfer encoding" do
|
76
|
+
uri = URI.parse(@server)
|
77
|
+
socket = TCPSocket.new(uri.host, uri.port)
|
78
|
+
begin
|
79
|
+
socket.write("POST #{base_uri}/raw_upload_to_file HTTP/1.1\r\n")
|
80
|
+
socket.write("Host: #{uri.host}:#{uri.port}\r\n")
|
81
|
+
socket.write("Transfer-Encoding: chunked\r\n")
|
82
|
+
socket.write("Content-Type: text/plain\r\n")
|
83
|
+
socket.write("Connection: close\r\n")
|
84
|
+
socket.write("X-Output: output.txt\r\n")
|
85
|
+
socket.write("\r\n")
|
86
|
+
|
87
|
+
chunk = "foo=bar!"
|
88
|
+
socket.write("%X\r\n%s\r\n" % [chunk.size, chunk])
|
89
|
+
socket.write("0\r\n\r\n")
|
90
|
+
socket.flush
|
91
|
+
|
92
|
+
socket.read.should =~ /\r\nok\Z/
|
93
|
+
ensure
|
94
|
+
socket.close
|
95
|
+
end
|
96
|
+
|
97
|
+
File.read(@stub.full_app_root + "/output.txt").should == "foo=bar!"
|
98
|
+
end
|
99
|
+
|
100
|
+
it "supports responses with the 'chunked' transfer encoding" do
|
101
|
+
get('/chunked').should ==
|
102
|
+
"chunk1\n" +
|
103
|
+
"chunk2\n" +
|
104
|
+
"chunk3\n"
|
105
|
+
end
|
106
|
+
|
107
|
+
it "supports custom headers in responses" do
|
108
|
+
response = get_response('/extra_header')
|
109
|
+
response["X-Foo"].should == "Bar"
|
110
|
+
end
|
111
|
+
|
112
|
+
it "sets the 'Status' header in responses" do
|
113
|
+
response = get_response('/nonexistant')
|
114
|
+
response["Status"].should == "404 Not Found"
|
115
|
+
end
|
116
|
+
|
117
|
+
specify "REQUEST_URI contains the request URI including query string" do
|
118
|
+
cgi_envs = get('/env?foo=escaped%20string')
|
119
|
+
cgi_envs.should include("REQUEST_URI = #{base_uri}/env?foo=escaped%20string\n")
|
120
|
+
end
|
121
|
+
|
122
|
+
specify "REQUEST_URI contains the original escaped URI" do
|
123
|
+
cgi_envs = get('/env/%C3%BC?foo=escaped%20string')
|
124
|
+
cgi_envs.downcase.should include("request_uri = #{base_uri}/env/%c3%bc?foo=escaped%20string\n")
|
125
|
+
end
|
126
|
+
|
127
|
+
specify "PATH_INFO contains the request URI without the base URI and without the query string" do
|
128
|
+
cgi_envs = get('/env?foo=escaped%20string')
|
129
|
+
cgi_envs.should include("PATH_INFO = /env\n")
|
130
|
+
end
|
131
|
+
|
132
|
+
specify "PATH_INFO contains the original escaped URI" do
|
133
|
+
cgi_envs = get('/env/%C3%BC')
|
134
|
+
cgi_envs.downcase.should include("path_info = /env/%c3%bc\n")
|
135
|
+
end
|
136
|
+
|
137
|
+
specify "QUERY_STRING contains the query string" do
|
138
|
+
cgi_envs = get('/env?foo=escaped%20string')
|
139
|
+
cgi_envs.should include("QUERY_STRING = foo=escaped%20string\n")
|
140
|
+
end
|
141
|
+
|
142
|
+
specify "QUERY_STRING must be present even when there's no query string" do
|
143
|
+
cgi_envs = get('/env')
|
144
|
+
cgi_envs.should include("QUERY_STRING = \n")
|
145
|
+
end
|
146
|
+
|
147
|
+
specify "SCRIPT_NAME contains the base URI, or the empty string if the app is deployed on the root URI" do
|
148
|
+
cgi_envs = get('/env')
|
149
|
+
cgi_envs.should include("SCRIPT_NAME = #{base_uri}\n")
|
150
|
+
end
|
151
|
+
|
152
|
+
it "appends an X-Powered-By header containing the Phusion Passenger version number" do
|
153
|
+
response = get_response('/')
|
154
|
+
response["X-Powered-By"].should include("Phusion Passenger")
|
155
|
+
response["X-Powered-By"].should include(PhusionPassenger::VERSION_STRING)
|
156
|
+
end
|
157
|
+
|
158
|
+
it "buffers uploads" do
|
159
|
+
get('/') # Force spawning so that the timeout below is enough.
|
160
|
+
|
161
|
+
uri = URI.parse(@server)
|
162
|
+
socket = TCPSocket.new(uri.host, uri.port)
|
163
|
+
begin
|
164
|
+
upload_data = File.read("stub/upload_data.txt")
|
165
|
+
size_of_first_half = upload_data.size / 2
|
166
|
+
|
167
|
+
socket.write("POST #{base_uri}/ HTTP/1.1\r\n")
|
168
|
+
socket.write("Host: #{uri.host}:#{uri.port}\r\n")
|
169
|
+
socket.write("Content-Type: multipart/form-data\r\n")
|
170
|
+
socket.write("Content-Length: #{upload_data.size}\r\n")
|
171
|
+
socket.write("Connection: close\r\n")
|
172
|
+
socket.write("\r\n")
|
173
|
+
|
174
|
+
socket.write(upload_data[0 .. size_of_first_half - 1])
|
175
|
+
socket.flush
|
176
|
+
|
177
|
+
Timeout.timeout(10) do
|
178
|
+
get('/').should == "front page"
|
179
|
+
end
|
180
|
+
|
181
|
+
socket.write(upload_data[0 .. size_of_first_half])
|
182
|
+
socket.flush
|
183
|
+
socket.read.should =~ /front page/
|
184
|
+
ensure
|
185
|
+
socket.close rescue nil
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
it "buffers any number of concurrent uploads" do
|
190
|
+
get('/') # Force spawning so that the timeout below is enough.
|
191
|
+
sockets = []
|
192
|
+
|
193
|
+
uri = URI.parse(@server)
|
194
|
+
upload_data = File.read("stub/upload_data.txt")
|
195
|
+
size_of_first_half = upload_data.size / 2
|
196
|
+
|
197
|
+
begin
|
198
|
+
5.times do |i|
|
199
|
+
socket = TCPSocket.new(uri.host, uri.port)
|
200
|
+
sockets << socket
|
201
|
+
socket.write("POST #{base_uri}/ HTTP/1.1\r\n")
|
202
|
+
socket.write("Host: #{uri.host}:#{uri.port}\r\n")
|
203
|
+
socket.write("Content-Type: multipart/form-data\r\n")
|
204
|
+
socket.write("Content-Length: #{upload_data.size}\r\n")
|
205
|
+
socket.write("Connection: close\r\n")
|
206
|
+
socket.write("\r\n")
|
207
|
+
socket.write(upload_data[0 .. size_of_first_half - 1])
|
208
|
+
socket.flush
|
209
|
+
end
|
210
|
+
Timeout.timeout(10) do
|
211
|
+
get('/').should == "front page"
|
212
|
+
end
|
213
|
+
sockets.each do |socket|
|
214
|
+
socket.write(upload_data[size_of_first_half .. -1])
|
215
|
+
socket.flush
|
216
|
+
socket.read.should =~ /front page/
|
217
|
+
end
|
218
|
+
ensure
|
219
|
+
sockets.each do |socket|
|
220
|
+
socket.close rescue nil
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
it "supports restarting via restart.txt" do
|
226
|
+
get('/').should == "front page"
|
227
|
+
File.write(@stub.full_app_root + "/front_page.txt", "new front page")
|
228
|
+
File.touch(@stub.full_app_root + "/tmp/restart.txt", 2)
|
229
|
+
get('/').should == "new front page"
|
230
|
+
end
|
231
|
+
|
232
|
+
it "runs as an unprivileged user" do
|
233
|
+
get('/touch_file?file=file.txt').should == "ok"
|
234
|
+
stat = File.stat(@stub.full_app_root + "/file.txt")
|
235
|
+
stat.uid.should_not == 0
|
236
|
+
stat.gid.should_not == 0
|
237
|
+
end
|
238
|
+
|
239
|
+
############
|
240
|
+
|
241
|
+
private
|
242
|
+
def base_uri
|
243
|
+
uri = URI.parse(@server)
|
244
|
+
return uri.path.sub(%r(/$), '')
|
245
|
+
end
|
246
|
+
end
|