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
@@ -175,9 +175,9 @@ namespace tut {
|
|
175
175
|
string response = readAll(connection);
|
176
176
|
string body = stripHeaders(response);
|
177
177
|
ensure("Status line is correct", containsSubstring(response, "HTTP/1.1 200 OK\r\n"));
|
178
|
-
ensure("Headers are correct", containsSubstring(response, "Content-Type: text/
|
178
|
+
ensure("Headers are correct", containsSubstring(response, "Content-Type: text/plain\r\n"));
|
179
179
|
ensure("Contains a Status header", containsSubstring(response, "Status: 200 OK\r\n"));
|
180
|
-
ensure_equals(body, "
|
180
|
+
ensure_equals(body, "front page");
|
181
181
|
}
|
182
182
|
|
183
183
|
TEST_METHOD(2) {
|
@@ -192,9 +192,9 @@ namespace tut {
|
|
192
192
|
string response = readAll(connection);
|
193
193
|
string body = stripHeaders(response);
|
194
194
|
ensure("Status line is correct", containsSubstring(response, "HTTP/1.1 200 OK\r\n"));
|
195
|
-
ensure("Headers are correct", containsSubstring(response, "Content-Type: text/
|
195
|
+
ensure("Headers are correct", containsSubstring(response, "Content-Type: text/plain\r\n"));
|
196
196
|
ensure("Contains a Status header", containsSubstring(response, "Status: 200 OK\r\n"));
|
197
|
-
ensure_equals(body, "
|
197
|
+
ensure_equals(body, "front page");
|
198
198
|
}
|
199
199
|
}
|
200
200
|
|
@@ -227,9 +227,9 @@ namespace tut {
|
|
227
227
|
string response = readAll(connection);
|
228
228
|
string body = stripHeaders(response);
|
229
229
|
ensure("Status line is correct", containsSubstring(response, "HTTP/1.1 200 OK\r\n"));
|
230
|
-
ensure("Headers are correct", containsSubstring(response, "Content-Type: text/
|
230
|
+
ensure("Headers are correct", containsSubstring(response, "Content-Type: text/plain\r\n"));
|
231
231
|
ensure("Contains a Status header", containsSubstring(response, "Status: 200 OK\r\n"));
|
232
|
-
ensure_equals(body, "
|
232
|
+
ensure_equals(body, "front page");
|
233
233
|
}
|
234
234
|
|
235
235
|
TEST_METHOD(4) {
|
@@ -245,7 +245,7 @@ namespace tut {
|
|
245
245
|
"PATH_INFO", "/",
|
246
246
|
NULL
|
247
247
|
);
|
248
|
-
ensure(containsSubstring(readAll(connection), "
|
248
|
+
ensure(containsSubstring(readAll(connection), "front page"));
|
249
249
|
|
250
250
|
connect();
|
251
251
|
try {
|
@@ -297,7 +297,7 @@ namespace tut {
|
|
297
297
|
"PATH_INFO", "/",
|
298
298
|
NULL
|
299
299
|
);
|
300
|
-
ensure(containsSubstring(readAll(connection), "
|
300
|
+
ensure(containsSubstring(readAll(connection), "front page"));
|
301
301
|
}
|
302
302
|
|
303
303
|
TEST_METHOD(7) {
|
@@ -390,14 +390,14 @@ namespace tut {
|
|
390
390
|
"PATH_INFO", "/",
|
391
391
|
NULL);
|
392
392
|
string response = readAll(connection);
|
393
|
-
ensure(containsSubstring(response, "HTTP/1.1 500 Internal Server Error\r\n"));
|
394
|
-
ensure(containsSubstring(response, "Status: 500 Internal Server Error\r\n"));
|
395
|
-
ensure(containsSubstring(response, "Content-Type: text/html; charset=UTF-8\r\n"));
|
396
|
-
ensure(containsSubstring(response, "<html>"));
|
397
|
-
ensure(containsSubstring(response, "An internal error occurred while trying to spawn the application."));
|
398
|
-
ensure(containsSubstring(response, "
|
399
|
-
ensure(containsSubstring(response, "An internal error!"));
|
400
|
-
ensure(containsSubstring(response, "Spawner.h"));
|
393
|
+
ensure("(1)", containsSubstring(response, "HTTP/1.1 500 Internal Server Error\r\n"));
|
394
|
+
ensure("(2)", containsSubstring(response, "Status: 500 Internal Server Error\r\n"));
|
395
|
+
ensure("(3)", containsSubstring(response, "Content-Type: text/html; charset=UTF-8\r\n"));
|
396
|
+
ensure("(4)", containsSubstring(response, "<html>"));
|
397
|
+
ensure("(5)", containsSubstring(response, "An internal error occurred while trying to spawn the application."));
|
398
|
+
ensure("(6)", containsSubstring(response, "RuntimeException"));
|
399
|
+
ensure("(7)", containsSubstring(response, "An internal error!"));
|
400
|
+
ensure("(8)", containsSubstring(response, "Spawner.h"));
|
401
401
|
}
|
402
402
|
|
403
403
|
TEST_METHOD(13) {
|
@@ -458,7 +458,7 @@ namespace tut {
|
|
458
458
|
connect();
|
459
459
|
sendHeaders(defaultHeaders,
|
460
460
|
"PASSENGER_APP_ROOT", wsgiAppPath.c_str(),
|
461
|
-
"PATH_INFO", "/
|
461
|
+
"PATH_INFO", "/raw_upload_to_file",
|
462
462
|
"HTTP_X_OUTPUT", (root + "/test/tmp.output").c_str(),
|
463
463
|
NULL);
|
464
464
|
writeExact(connection, "hello\n");
|
@@ -482,7 +482,7 @@ namespace tut {
|
|
482
482
|
sendHeaders(defaultHeaders,
|
483
483
|
"PASSENGER_APP_ROOT", wsgiAppPath.c_str(),
|
484
484
|
"PASSENGER_BUFFERING", "true",
|
485
|
-
"PATH_INFO", "/
|
485
|
+
"PATH_INFO", "/raw_upload_to_file",
|
486
486
|
"HTTP_X_OUTPUT", (root + "/test/tmp.output").c_str(),
|
487
487
|
NULL);
|
488
488
|
writeExact(connection, "hello\n");
|
@@ -515,7 +515,7 @@ namespace tut {
|
|
515
515
|
connect();
|
516
516
|
sendHeaders(defaultHeaders,
|
517
517
|
"PASSENGER_APP_ROOT", wsgiAppPath.c_str(),
|
518
|
-
"PATH_INFO", "/
|
518
|
+
"PATH_INFO", "/raw_upload_to_file",
|
519
519
|
"PASSENGER_BUFFERING", "true",
|
520
520
|
"HTTP_X_WAIT_FOR_FILE", "/tmp/wait.txt",
|
521
521
|
"HTTP_X_OUTPUT", "/tmp/output.txt",
|
@@ -653,7 +653,7 @@ namespace tut {
|
|
653
653
|
connect();
|
654
654
|
sendHeaders(defaultHeaders,
|
655
655
|
"PASSENGER_APP_ROOT", wsgiAppPath.c_str(),
|
656
|
-
"PATH_INFO", "/
|
656
|
+
"PATH_INFO", "/raw_upload_to_file",
|
657
657
|
"CONTENT_LENGTH", toString(requestBody.size()).c_str(),
|
658
658
|
"PASSENGER_BUFFERING", "true",
|
659
659
|
"HTTP_X_OUTPUT", "/tmp/output.txt",
|
@@ -678,7 +678,7 @@ namespace tut {
|
|
678
678
|
connect();
|
679
679
|
sendHeaders(defaultHeaders,
|
680
680
|
"PASSENGER_APP_ROOT", wsgiAppPath.c_str(),
|
681
|
-
"PATH_INFO", "/
|
681
|
+
"PATH_INFO", "/raw_upload_to_file",
|
682
682
|
"CONTENT_LENGTH", toString(requestBody.size()).c_str(),
|
683
683
|
"PASSENGER_BUFFERING", "true",
|
684
684
|
"HTTP_X_OUTPUT", "/tmp/output.txt",
|
@@ -710,7 +710,7 @@ namespace tut {
|
|
710
710
|
connect();
|
711
711
|
sendHeaders(defaultHeaders,
|
712
712
|
"PASSENGER_APP_ROOT", wsgiAppPath.c_str(),
|
713
|
-
"PATH_INFO", "/
|
713
|
+
"PATH_INFO", "/raw_upload_to_file",
|
714
714
|
"CONTENT_LENGTH", toString(requestBody.size()).c_str(),
|
715
715
|
"HTTP_X_OUTPUT", "/tmp/output.txt",
|
716
716
|
NULL);
|
@@ -735,7 +735,7 @@ namespace tut {
|
|
735
735
|
connect();
|
736
736
|
sendHeaders(defaultHeaders,
|
737
737
|
"PASSENGER_APP_ROOT", wsgiAppPath.c_str(),
|
738
|
-
"PATH_INFO", "/
|
738
|
+
"PATH_INFO", "/raw_upload_to_file",
|
739
739
|
"CONTENT_LENGTH", toString(requestBody.size()).c_str(),
|
740
740
|
"HTTP_X_OUTPUT", "/tmp/output.txt",
|
741
741
|
NULL);
|
@@ -758,7 +758,7 @@ namespace tut {
|
|
758
758
|
connect();
|
759
759
|
sendHeaders(defaultHeaders,
|
760
760
|
"PASSENGER_APP_ROOT", wsgiAppPath.c_str(),
|
761
|
-
"PATH_INFO", "/
|
761
|
+
"PATH_INFO", "/raw_upload_to_file",
|
762
762
|
"CONTENT_LENGTH", "0",
|
763
763
|
"PASSENGER_BUFFERING", "true",
|
764
764
|
"HTTP_X_OUTPUT", "/tmp/output.txt",
|
@@ -781,7 +781,7 @@ namespace tut {
|
|
781
781
|
connect();
|
782
782
|
sendHeaders(defaultHeaders,
|
783
783
|
"PASSENGER_APP_ROOT", wsgiAppPath.c_str(),
|
784
|
-
"PATH_INFO", "/
|
784
|
+
"PATH_INFO", "/raw_upload_to_file",
|
785
785
|
"CONTENT_LENGTH", "0",
|
786
786
|
"HTTP_X_OUTPUT", "/tmp/output.txt",
|
787
787
|
NULL);
|
@@ -952,7 +952,7 @@ namespace tut {
|
|
952
952
|
connect();
|
953
953
|
sendHeaders(defaultHeaders,
|
954
954
|
"PASSENGER_APP_ROOT", wsgiAppPath.c_str(),
|
955
|
-
"PATH_INFO", "/
|
955
|
+
"PATH_INFO", "/chunked_stream",
|
956
956
|
NULL
|
957
957
|
);
|
958
958
|
|
@@ -2,14 +2,11 @@ require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
|
|
2
2
|
require 'socket'
|
3
3
|
require 'fileutils'
|
4
4
|
require 'support/apache2_controller'
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
PhusionPassenger.require_passenger_lib 'platform_info'
|
6
|
+
PhusionPassenger.require_passenger_lib 'admin_tools'
|
7
|
+
PhusionPassenger.require_passenger_lib 'admin_tools/server_instance'
|
8
8
|
|
9
|
-
require 'integration_tests/
|
10
|
-
require 'integration_tests/cgi_environment_spec'
|
11
|
-
require 'integration_tests/hello_world_rack_spec'
|
12
|
-
require 'integration_tests/hello_world_wsgi_spec'
|
9
|
+
require 'integration_tests/shared/example_webapp_tests'
|
13
10
|
|
14
11
|
# TODO: test the 'PassengerUserSwitching' and 'PassengerDefaultUser' option.
|
15
12
|
# TODO: test custom page caching directory
|
@@ -21,13 +18,13 @@ describe "Apache 2 module" do
|
|
21
18
|
Dir.mkdir(@passenger_temp_dir)
|
22
19
|
ENV['PASSENGER_TEMP_DIR'] = @passenger_temp_dir
|
23
20
|
end
|
24
|
-
|
21
|
+
|
25
22
|
after :all do
|
26
23
|
@apache2.stop if @apache2
|
27
24
|
FileUtils.chmod_R(0777, @passenger_temp_dir)
|
28
25
|
FileUtils.rm_rf(@passenger_temp_dir)
|
29
26
|
end
|
30
|
-
|
27
|
+
|
31
28
|
before :each do
|
32
29
|
File.open("test.log", "a") do |f|
|
33
30
|
# Make sure that all Apache log output is prepended by the test description
|
@@ -46,186 +43,183 @@ describe "Apache 2 module" do
|
|
46
43
|
)
|
47
44
|
end
|
48
45
|
end
|
49
|
-
|
50
|
-
describe "
|
46
|
+
|
47
|
+
describe "a Ruby app running on the root URI" do
|
51
48
|
before :all do
|
52
49
|
create_apache2_controller
|
53
|
-
@
|
54
|
-
@
|
55
|
-
@server = "http://passenger.test:#{@apache2.port}"
|
50
|
+
@server = "http://1.passenger.test:#{@apache2.port}"
|
51
|
+
@stub = RackStub.new('rack')
|
56
52
|
@apache2 << "RailsMaxPoolSize 1"
|
57
|
-
@
|
58
|
-
@apache2.set_vhost("passenger.test", "#{@stub.full_app_root}/public")
|
53
|
+
@apache2.set_vhost("1.passenger.test", "#{@stub.full_app_root}/public")
|
59
54
|
@apache2.start
|
60
55
|
end
|
61
|
-
|
56
|
+
|
62
57
|
after :all do
|
63
58
|
@stub.destroy
|
64
59
|
@apache2.stop if @apache2
|
65
60
|
end
|
66
|
-
|
61
|
+
|
67
62
|
before :each do
|
68
63
|
@stub.reset
|
69
64
|
end
|
70
|
-
|
71
|
-
it_should_behave_like "
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
Timeout.timeout(10) do
|
89
|
-
get('/').should =~ /Welcome to MyCook/
|
90
|
-
end
|
91
|
-
ensure
|
92
|
-
socket.close rescue nil
|
65
|
+
|
66
|
+
it_should_behave_like "an example web app"
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "a Ruby app running in a sub-URI" do
|
70
|
+
before :all do
|
71
|
+
create_apache2_controller
|
72
|
+
@server = "http://1.passenger.test:#{@apache2.port}/subapp"
|
73
|
+
@stub = RackStub.new('rack')
|
74
|
+
@apache2 << "RailsMaxPoolSize 1"
|
75
|
+
@apache2.set_vhost("1.passenger.test", File.expand_path("stub")) do |vhost|
|
76
|
+
vhost << %Q{
|
77
|
+
Alias /subapp #{@stub.full_app_root}/public
|
78
|
+
<Location /subapp>
|
79
|
+
PassengerBaseURI /subapp
|
80
|
+
PassengerAppRoot #{@stub.full_app_root}
|
81
|
+
</Location>
|
82
|
+
}
|
93
83
|
end
|
84
|
+
@apache2.start
|
94
85
|
end
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
upload_data = File.read("stub/upload_data.txt")
|
101
|
-
size_of_first_half = upload_data.size / 2
|
102
|
-
|
103
|
-
begin
|
104
|
-
9.times do |i|
|
105
|
-
socket = TCPSocket.new('passenger.test', @apache2.port)
|
106
|
-
sockets << socket
|
107
|
-
socket.write("POST / HTTP/1.1\r\n")
|
108
|
-
socket.write("Host: passenger.test\r\n")
|
109
|
-
socket.write(upload_data[0..size_of_first_half])
|
110
|
-
socket.flush
|
111
|
-
end
|
112
|
-
Timeout.timeout(10) do
|
113
|
-
get('/').should =~ /Welcome to MyCook/
|
114
|
-
end
|
115
|
-
ensure
|
116
|
-
sockets.each do |socket|
|
117
|
-
socket.close rescue nil
|
118
|
-
end
|
119
|
-
end
|
86
|
+
|
87
|
+
after :all do
|
88
|
+
@stub.destroy
|
89
|
+
@apache2.stop if @apache2
|
120
90
|
end
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
91
|
+
|
92
|
+
before :each do
|
93
|
+
@stub.reset
|
94
|
+
end
|
95
|
+
|
96
|
+
it_should_behave_like "an example web app"
|
97
|
+
|
98
|
+
it "does not interfere with the root website" do
|
99
|
+
@server = "http://1.passenger.test:#{@apache2.port}"
|
100
|
+
get('/').should == "This is the stub directory."
|
126
101
|
end
|
127
102
|
end
|
128
|
-
|
129
|
-
describe "
|
103
|
+
|
104
|
+
describe "a Python app running on the root URI" do
|
130
105
|
before :all do
|
131
106
|
create_apache2_controller
|
132
|
-
@
|
133
|
-
@
|
134
|
-
@
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
@
|
141
|
-
|
107
|
+
@server = "http://1.passenger.test:#{@apache2.port}"
|
108
|
+
@stub = PythonStub.new('wsgi')
|
109
|
+
@apache2 << "RailsMaxPoolSize 1"
|
110
|
+
@apache2.set_vhost("1.passenger.test", "#{@stub.full_app_root}/public")
|
111
|
+
@apache2.start
|
112
|
+
end
|
113
|
+
|
114
|
+
after :all do
|
115
|
+
@stub.destroy
|
116
|
+
@apache2.stop if @apache2
|
117
|
+
end
|
118
|
+
|
119
|
+
before :each do
|
120
|
+
@stub.reset
|
121
|
+
end
|
122
|
+
|
123
|
+
it_should_behave_like "an example web app"
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "a Python app running in a sub-URI" do
|
127
|
+
before :all do
|
128
|
+
create_apache2_controller
|
129
|
+
@server = "http://1.passenger.test:#{@apache2.port}/subapp"
|
130
|
+
@stub = PythonStub.new('wsgi')
|
131
|
+
@apache2 << "RailsMaxPoolSize 1"
|
132
|
+
@apache2.set_vhost("1.passenger.test", File.expand_path("stub")) do |vhost|
|
133
|
+
vhost << %Q{
|
134
|
+
Alias /subapp #{@stub.full_app_root}/public
|
135
|
+
<Location /subapp>
|
136
|
+
PassengerBaseURI /subapp
|
137
|
+
PassengerAppRoot #{@stub.full_app_root}
|
138
|
+
</Location>
|
139
|
+
}
|
142
140
|
end
|
143
141
|
@apache2.start
|
144
142
|
end
|
145
|
-
|
143
|
+
|
146
144
|
after :all do
|
147
|
-
FileUtils.rm_rf('tmp.webdir')
|
148
145
|
@stub.destroy
|
149
146
|
@apache2.stop if @apache2
|
150
147
|
end
|
151
|
-
|
148
|
+
|
152
149
|
before :each do
|
153
|
-
@server = "http://passenger.test:#{@apache2.port}/mycook"
|
154
150
|
@stub.reset
|
155
151
|
end
|
156
|
-
|
157
|
-
it_should_behave_like "
|
158
|
-
|
159
|
-
|
152
|
+
|
153
|
+
it_should_behave_like "an example web app"
|
154
|
+
|
160
155
|
it "does not interfere with the root website" do
|
161
|
-
@server = "http://passenger.test:#{@apache2.port}"
|
162
|
-
get('/').should
|
156
|
+
@server = "http://1.passenger.test:#{@apache2.port}"
|
157
|
+
get('/').should == "This is the stub directory."
|
163
158
|
end
|
164
159
|
end
|
165
|
-
|
160
|
+
|
166
161
|
describe "compatibility with other modules" do
|
167
162
|
before :all do
|
168
163
|
create_apache2_controller
|
169
164
|
@apache2 << "RailsMaxPoolSize 1"
|
170
|
-
|
171
|
-
@
|
172
|
-
@
|
173
|
-
@apache2
|
165
|
+
|
166
|
+
@stub = RackStub.new('rack')
|
167
|
+
@server = "http://1.passenger.test:#{@apache2.port}"
|
168
|
+
@apache2 << "RailsMaxPoolSize 1"
|
169
|
+
@apache2.set_vhost("1.passenger.test", "#{@stub.full_app_root}/public") do |vhost|
|
174
170
|
vhost << "RewriteEngine on"
|
175
|
-
vhost << "RewriteRule ^/
|
176
|
-
vhost << "RewriteRule ^/
|
171
|
+
vhost << "RewriteRule ^/rewritten_frontpage$ / [PT,QSA,L]"
|
172
|
+
vhost << "RewriteRule ^/rewritten_env$ /env [PT,QSA,L]"
|
177
173
|
end
|
178
174
|
@apache2.start
|
179
175
|
end
|
180
|
-
|
176
|
+
|
181
177
|
after :all do
|
182
|
-
@
|
178
|
+
@stub.destroy
|
183
179
|
@apache2.stop if @apache2
|
184
180
|
end
|
185
|
-
|
181
|
+
|
186
182
|
before :each do
|
187
|
-
@
|
188
|
-
@server = @mycook_url_root
|
183
|
+
@stub.reset
|
189
184
|
end
|
190
|
-
|
185
|
+
|
191
186
|
it "supports environment variable passing through mod_env" do
|
192
|
-
File.write("#{@
|
193
|
-
File.touch("#{@
|
194
|
-
get('/
|
195
|
-
get('/welcome/cgi_environment').should =~ /FOO = Foo Bar\!/
|
187
|
+
File.write("#{@stub.app_root}/public/.htaccess", 'SetEnv FOO "Foo Bar!"')
|
188
|
+
File.touch("#{@stub.app_root}/tmp/restart.txt", 2) # Activate ENV changes.
|
189
|
+
get('/env').should =~ /^FOO = Foo Bar\!$/
|
196
190
|
end
|
197
|
-
|
191
|
+
|
198
192
|
it "supports mod_rewrite in the virtual host block" do
|
199
|
-
get('/
|
200
|
-
cgi_envs = get('/
|
201
|
-
cgi_envs.should include("REQUEST_URI = /
|
202
|
-
cgi_envs.should include("PATH_INFO = /
|
193
|
+
get('/rewritten_frontpage').should == "front page"
|
194
|
+
cgi_envs = get('/rewritten_env?foo=bar+baz')
|
195
|
+
cgi_envs.should include("REQUEST_URI = /env?foo=bar+baz\n")
|
196
|
+
cgi_envs.should include("PATH_INFO = /env\n")
|
203
197
|
end
|
204
|
-
|
198
|
+
|
205
199
|
it "supports mod_rewrite in .htaccess" do
|
206
|
-
File.write("#{@
|
200
|
+
File.write("#{@stub.app_root}/public/.htaccess", %Q{
|
207
201
|
RewriteEngine on
|
208
|
-
RewriteRule ^
|
209
|
-
RewriteRule ^
|
202
|
+
RewriteRule ^htaccess_frontpage$ / [PT,QSA,L]
|
203
|
+
RewriteRule ^htaccess_env$ env [PT,QSA,L]
|
210
204
|
})
|
211
|
-
get('/
|
212
|
-
cgi_envs = get('/
|
213
|
-
cgi_envs.should include("REQUEST_URI = /
|
214
|
-
cgi_envs.should include("PATH_INFO = /
|
205
|
+
get('/htaccess_frontpage').should == "front page"
|
206
|
+
cgi_envs = get('/htaccess_env?foo=bar+baz')
|
207
|
+
cgi_envs.should include("REQUEST_URI = /env?foo=bar+baz\n")
|
208
|
+
cgi_envs.should include("PATH_INFO = /env\n")
|
215
209
|
end
|
216
210
|
end
|
217
|
-
|
211
|
+
|
218
212
|
describe "configuration options" do
|
219
213
|
before :all do
|
220
214
|
create_apache2_controller
|
221
215
|
@apache2 << "PassengerMaxPoolSize 3"
|
222
|
-
|
223
|
-
@mycook = ClassicRailsStub.new('
|
216
|
+
|
217
|
+
@mycook = ClassicRailsStub.new('rails2.3-mycook')
|
224
218
|
@mycook_url_root = "http://1.passenger.test:#{@apache2.port}"
|
225
219
|
@apache2.set_vhost('1.passenger.test', "#{@mycook.full_app_root}/public") do |vhost|
|
226
220
|
vhost << "AllowEncodedSlashes on"
|
227
221
|
end
|
228
|
-
|
222
|
+
|
229
223
|
@foobar = ClassicRailsStub.new('rails2.3')
|
230
224
|
@foobar_url_root = "http://3.passenger.test:#{@apache2.port}"
|
231
225
|
@apache2.set_vhost('3.passenger.test', "#{@foobar.full_app_root}/public") do |vhost|
|
@@ -233,42 +227,42 @@ describe "Apache 2 module" do
|
|
233
227
|
vhost << "PassengerSpawnMethod conservative"
|
234
228
|
vhost << "PassengerRestartDir #{@foobar.full_app_root}/public"
|
235
229
|
end
|
236
|
-
|
237
|
-
@mycook2 = ClassicRailsStub.new('
|
230
|
+
|
231
|
+
@mycook2 = ClassicRailsStub.new('rails2.3-mycook')
|
238
232
|
@mycook2_url_root = "http://4.passenger.test:#{@apache2.port}"
|
239
233
|
@apache2.set_vhost('4.passenger.test', "#{@mycook2.full_app_root}/sites/some.site/public") do |vhost|
|
240
234
|
vhost << "PassengerAppRoot #{@mycook2.full_app_root}"
|
241
235
|
end
|
242
|
-
|
236
|
+
|
243
237
|
@apache2.start
|
244
238
|
end
|
245
|
-
|
239
|
+
|
246
240
|
after :all do
|
247
241
|
@mycook.destroy
|
248
242
|
@foobar.destroy
|
249
243
|
@mycook2.destroy
|
250
244
|
@apache2.stop if @apache2
|
251
245
|
end
|
252
|
-
|
246
|
+
|
253
247
|
before :each do
|
254
248
|
@mycook.reset
|
255
249
|
@foobar.reset
|
256
250
|
@mycook2.reset
|
257
251
|
end
|
258
|
-
|
252
|
+
|
259
253
|
specify "RailsEnv is per-virtual host" do
|
260
254
|
@server = @mycook_url_root
|
261
255
|
get('/welcome/rails_env').should == "production"
|
262
|
-
|
256
|
+
|
263
257
|
@server = @foobar_url_root
|
264
258
|
get('/foo/rails_env').should == "development"
|
265
259
|
end
|
266
|
-
|
260
|
+
|
267
261
|
it "looks for restart.txt in the directory specified by PassengerRestartDir" do
|
268
262
|
@server = @foobar_url_root
|
269
263
|
controller = "#{@foobar.app_root}/app/controllers/bar_controller.rb"
|
270
264
|
restart_file = "#{@foobar.app_root}/public/restart.txt"
|
271
|
-
|
265
|
+
|
272
266
|
File.write(controller, %Q{
|
273
267
|
class BarController < ApplicationController
|
274
268
|
def index
|
@@ -276,11 +270,11 @@ describe "Apache 2 module" do
|
|
276
270
|
end
|
277
271
|
end
|
278
272
|
})
|
279
|
-
|
273
|
+
|
280
274
|
now = Time.now
|
281
275
|
File.touch(restart_file, now - 5)
|
282
276
|
get('/bar').should == "hello world"
|
283
|
-
|
277
|
+
|
284
278
|
File.write(controller, %Q{
|
285
279
|
class BarController < ApplicationController
|
286
280
|
def index
|
@@ -288,24 +282,24 @@ describe "Apache 2 module" do
|
|
288
282
|
end
|
289
283
|
end
|
290
284
|
})
|
291
|
-
|
285
|
+
|
292
286
|
File.touch(restart_file, now - 10)
|
293
287
|
get('/bar').should == "oh hai"
|
294
288
|
end
|
295
|
-
|
289
|
+
|
296
290
|
describe "PassengerAppRoot" do
|
297
291
|
before :each do
|
298
292
|
@server = @mycook2_url_root
|
299
293
|
end
|
300
|
-
|
294
|
+
|
301
295
|
it "supports page caching on non-index URIs" do
|
302
296
|
get('/welcome/cached.html').should =~ %r{This is the cached version of some.site/public/welcome/cached}
|
303
297
|
end
|
304
|
-
|
298
|
+
|
305
299
|
it "supports page caching on index URIs" do
|
306
300
|
get('/uploads.html').should =~ %r{This is the cached version of some.site/public/uploads}
|
307
301
|
end
|
308
|
-
|
302
|
+
|
309
303
|
it "works as a rails application" do
|
310
304
|
result = get('/welcome/parameters_test?hello=world&recipe[name]=Green+Bananas')
|
311
305
|
result.should =~ %r{<hello>world</hello>}
|
@@ -313,7 +307,7 @@ describe "Apache 2 module" do
|
|
313
307
|
result.should =~ %r{<name>Green Bananas</name>}
|
314
308
|
end
|
315
309
|
end
|
316
|
-
|
310
|
+
|
317
311
|
specify "it resolves symlinks in the document root if PassengerResolveSymlinksInDocumentRoot is set" do
|
318
312
|
orig_mycook_app_root = @mycook.app_root
|
319
313
|
@mycook.move(File.expand_path('tmp.mycook.symlinktest'))
|
@@ -328,16 +322,16 @@ describe "Apache 2 module" do
|
|
328
322
|
@mycook.move(orig_mycook_app_root)
|
329
323
|
end
|
330
324
|
end
|
331
|
-
|
325
|
+
|
332
326
|
it "supports encoded slashes in the URL if AllowEncodedSlashes is turned on" do
|
333
327
|
@server = @mycook_url_root
|
334
328
|
File.write("#{@mycook.app_root}/public/.htaccess", "PassengerAllowEncodedSlashes on")
|
335
329
|
get('/welcome/show_id/foo%2fbar').should == 'foo/bar'
|
336
330
|
end
|
337
|
-
|
331
|
+
|
338
332
|
####################################
|
339
333
|
end
|
340
|
-
|
334
|
+
|
341
335
|
describe "error handling" do
|
342
336
|
before :all do
|
343
337
|
create_apache2_controller
|
@@ -348,26 +342,26 @@ describe "Apache 2 module" do
|
|
348
342
|
vhost << "RailsBaseURI /app-with-nonexistant-rails-version/public"
|
349
343
|
vhost << "RailsBaseURI /app-that-crashes-during-startup/public"
|
350
344
|
end
|
351
|
-
|
352
|
-
@mycook = ClassicRailsStub.new('
|
345
|
+
|
346
|
+
@mycook = ClassicRailsStub.new('rails2.3-mycook')
|
353
347
|
@mycook_url_root = "http://2.passenger.test:#{@apache2.port}"
|
354
348
|
@apache2.set_vhost('2.passenger.test', "#{@mycook.full_app_root}/public")
|
355
|
-
|
349
|
+
|
356
350
|
@apache2.start
|
357
351
|
end
|
358
|
-
|
352
|
+
|
359
353
|
after :all do
|
360
354
|
FileUtils.rm_rf('tmp.webdir')
|
361
355
|
@mycook.destroy
|
362
356
|
@apache2.stop if @apache2
|
363
357
|
end
|
364
|
-
|
358
|
+
|
365
359
|
before :each do
|
366
360
|
@server = "http://1.passenger.test:#{@apache2.port}"
|
367
361
|
@error_page_signature = /<meta name="generator" content="Phusion Passenger">/
|
368
362
|
@mycook.reset
|
369
363
|
end
|
370
|
-
|
364
|
+
|
371
365
|
it "displays an error page if the Rails application requires a nonexistant Rails version" do
|
372
366
|
ClassicRailsStub.use('rails2.3', "#{@webdir}/app-with-nonexistant-rails-version") do |stub|
|
373
367
|
File.write(stub.environment_rb) do |content|
|
@@ -376,7 +370,7 @@ describe "Apache 2 module" do
|
|
376
370
|
get("/app-with-nonexistant-rails-version/public").should =~ @error_page_signature
|
377
371
|
end
|
378
372
|
end
|
379
|
-
|
373
|
+
|
380
374
|
it "displays an error page if the Rails application crashes during startup" do
|
381
375
|
ClassicRailsStub.use('rails2.3', "#{@webdir}/app-that-crashes-during-startup") do |stub|
|
382
376
|
File.prepend(stub.environment_rb, "raise 'app crash'")
|
@@ -385,7 +379,7 @@ describe "Apache 2 module" do
|
|
385
379
|
result.should =~ /app crash/
|
386
380
|
end
|
387
381
|
end
|
388
|
-
|
382
|
+
|
389
383
|
it "displays an error if a filesystem permission error was encountered while autodetecting the application type" do
|
390
384
|
@server = @mycook_url_root
|
391
385
|
# This test used to fail because we were improperly blocking mod_autoindex,
|
@@ -396,7 +390,7 @@ describe "Apache 2 module" do
|
|
396
390
|
File.unlink("#{@mycook.app_root}/public/.htaccess")
|
397
391
|
get('/').should =~ /Please fix the relevant file permissions/
|
398
392
|
end
|
399
|
-
|
393
|
+
|
400
394
|
it "doesn't display a Ruby spawn error page if PassengerFriendlyErrorPages is off" do
|
401
395
|
ClassicRailsStub.use('rails2.3', "#{@webdir}/app-that-crashes-during-startup") do |stub|
|
402
396
|
File.write("#{stub.app_root}/public/.htaccess", "PassengerFriendlyErrorPages off")
|
@@ -407,28 +401,28 @@ describe "Apache 2 module" do
|
|
407
401
|
end
|
408
402
|
end
|
409
403
|
end
|
410
|
-
|
404
|
+
|
411
405
|
describe "HelperAgent" do
|
412
406
|
AdminTools = PhusionPassenger::AdminTools
|
413
|
-
|
407
|
+
|
414
408
|
before :all do
|
415
409
|
create_apache2_controller
|
416
|
-
@mycook = ClassicRailsStub.new('
|
410
|
+
@mycook = ClassicRailsStub.new('rails2.3-mycook')
|
417
411
|
@mycook_url_root = "http://1.passenger.test:#{@apache2.port}"
|
418
412
|
@apache2.set_vhost('1.passenger.test', "#{@mycook.full_app_root}/public")
|
419
413
|
@apache2.start
|
420
414
|
@server = "http://1.passenger.test:#{@apache2.port}"
|
421
415
|
end
|
422
|
-
|
416
|
+
|
423
417
|
after :all do
|
424
418
|
@mycook.destroy
|
425
419
|
@apache2.stop if @apache2
|
426
420
|
end
|
427
|
-
|
421
|
+
|
428
422
|
before :each do
|
429
423
|
@mycook.reset
|
430
424
|
end
|
431
|
-
|
425
|
+
|
432
426
|
it "is restarted if it crashes" do
|
433
427
|
# Make sure that all Apache worker processes have connected to
|
434
428
|
# the helper server.
|
@@ -436,12 +430,12 @@ describe "Apache 2 module" do
|
|
436
430
|
get('/welcome').should =~ /Welcome to MyCook/
|
437
431
|
sleep 0.1
|
438
432
|
end
|
439
|
-
|
433
|
+
|
440
434
|
# Now kill the helper server.
|
441
435
|
instance = AdminTools::ServerInstance.list.first
|
442
436
|
Process.kill('SIGKILL', instance.helper_agent_pid)
|
443
437
|
sleep 0.02 # Give the signal a small amount of time to take effect.
|
444
|
-
|
438
|
+
|
445
439
|
# Each worker process should detect that the old
|
446
440
|
# helper server has died, and should reconnect.
|
447
441
|
10.times do
|
@@ -449,15 +443,15 @@ describe "Apache 2 module" do
|
|
449
443
|
sleep 0.1
|
450
444
|
end
|
451
445
|
end
|
452
|
-
|
446
|
+
|
453
447
|
it "exposes the application pool for passenger-status" do
|
454
448
|
File.touch("#{@mycook.app_root}/tmp/restart.txt", 1) # Get rid of all previous app processes.
|
455
449
|
get('/welcome').should =~ /Welcome to MyCook/
|
456
450
|
instance = AdminTools::ServerInstance.list.first
|
457
|
-
|
451
|
+
|
458
452
|
# Wait until the server has processed the session close event.
|
459
453
|
sleep 0.1
|
460
|
-
|
454
|
+
|
461
455
|
processes = instance.connect(:role => :passenger_status) do |client|
|
462
456
|
instance.processes(client)
|
463
457
|
end
|
@@ -466,84 +460,9 @@ describe "Apache 2 module" do
|
|
466
460
|
processes[0].processed.should == 1
|
467
461
|
end
|
468
462
|
end
|
469
|
-
|
470
|
-
describe "Rack application running in root URI" do
|
471
|
-
before :all do
|
472
|
-
create_apache2_controller
|
473
|
-
@stub = RackStub.new('rack')
|
474
|
-
@apache2.set_vhost('passenger.test', @stub.full_app_root + "/public")
|
475
|
-
@apache2.start
|
476
|
-
@server = "http://passenger.test:#{@apache2.port}"
|
477
|
-
end
|
478
|
-
|
479
|
-
after :all do
|
480
|
-
@stub.destroy
|
481
|
-
@apache2.stop if @apache2
|
482
|
-
end
|
483
|
-
|
484
|
-
it_should_behave_like "HelloWorld Rack application"
|
485
|
-
end
|
486
|
-
|
487
|
-
describe "Rack application running in sub-URI" do
|
488
|
-
before :all do
|
489
|
-
create_apache2_controller
|
490
|
-
FileUtils.rm_rf('tmp.webdir')
|
491
|
-
FileUtils.mkdir_p('tmp.webdir')
|
492
|
-
@stub = RackStub.new('rack')
|
493
|
-
@apache2.set_vhost('passenger.test', File.expand_path('tmp.webdir')) do |vhost|
|
494
|
-
FileUtils.ln_s(@stub.full_app_root + "/public", 'tmp.webdir/rack')
|
495
|
-
vhost << "RackBaseURI /rack"
|
496
|
-
end
|
497
|
-
@apache2.start
|
498
|
-
@server = "http://passenger.test:#{@apache2.port}/rack"
|
499
|
-
end
|
500
|
-
|
501
|
-
after :all do
|
502
|
-
@stub.destroy
|
503
|
-
FileUtils.rm_rf('tmp.webdir')
|
504
|
-
@apache2.stop if @apache2
|
505
|
-
end
|
506
|
-
|
507
|
-
it_should_behave_like "HelloWorld Rack application"
|
508
|
-
end
|
509
|
-
|
510
|
-
describe "Rack application running within Rails directory structure" do
|
511
|
-
before :all do
|
512
|
-
create_apache2_controller
|
513
|
-
@stub = ClassicRailsStub.new('rails_apps/2.3/mycook')
|
514
|
-
FileUtils.cp_r("stub/rack/.", @stub.app_root)
|
515
|
-
@apache2.set_vhost('passenger.test', @stub.full_app_root + "/public")
|
516
|
-
@apache2.start
|
517
|
-
@server = "http://passenger.test:#{@apache2.port}"
|
518
|
-
end
|
519
|
-
|
520
|
-
after :all do
|
521
|
-
@stub.destroy
|
522
|
-
@apache2.stop if @apache2
|
523
|
-
end
|
524
|
-
|
525
|
-
it_should_behave_like "HelloWorld Rack application"
|
526
|
-
end
|
527
463
|
|
528
|
-
describe "WSGI application running in root URI" do
|
529
|
-
before :all do
|
530
|
-
create_apache2_controller
|
531
|
-
@stub = Stub.new('wsgi')
|
532
|
-
@apache2.set_vhost('passenger.test', @stub.full_app_root + "/public")
|
533
|
-
@apache2.start
|
534
|
-
@server = "http://passenger.test:#{@apache2.port}"
|
535
|
-
end
|
536
|
-
|
537
|
-
after :all do
|
538
|
-
@stub.destroy
|
539
|
-
@apache2.stop if @apache2
|
540
|
-
end
|
541
|
-
|
542
|
-
it_should_behave_like "HelloWorld WSGI application"
|
543
|
-
end
|
544
|
-
|
545
464
|
##### Helper methods #####
|
546
|
-
|
465
|
+
|
547
466
|
def start_web_server_if_necessary
|
548
467
|
if !@apache2.running?
|
549
468
|
@apache2.start
|