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.

Files changed (409) hide show
  1. data.tar.gz.asc +7 -7
  2. data/NEWS +31 -0
  3. data/bin/passenger +5 -5
  4. data/bin/passenger-config +6 -126
  5. data/bin/passenger-install-apache2-module +108 -26
  6. data/bin/passenger-install-nginx-module +81 -27
  7. data/bin/passenger-memory-stats +7 -6
  8. data/bin/passenger-status +13 -10
  9. data/build/agents.rb +8 -12
  10. data/build/apache2.rb +12 -7
  11. data/build/basics.rb +28 -20
  12. data/build/common_library.rb +4 -4
  13. data/build/cplusplus_support.rb +4 -4
  14. data/build/cxx_tests.rb +5 -3
  15. data/build/debian.rb +1 -2
  16. data/build/integration_tests.rb +25 -9
  17. data/build/misc.rb +2 -2
  18. data/build/oxt_tests.rb +5 -6
  19. data/build/packaging.rb +72 -40
  20. data/build/ruby_tests.rb +5 -1
  21. data/build/test_basics.rb +1 -2
  22. data/debian.template/locations.ini.template +1 -0
  23. data/debian.template/rules.template +2 -1
  24. data/dev/install_scripts_bootstrap_code.rb +42 -0
  25. data/dev/run_travis.sh +1 -0
  26. data/dev/runner +27 -0
  27. data/doc/Packaging.txt.md +5 -10
  28. data/doc/Users guide Apache.idmap.txt +3 -1
  29. data/doc/Users guide Apache.txt +5 -3
  30. data/doc/Users guide Nginx.idmap.txt +9 -5
  31. data/doc/Users guide Nginx.txt +47 -17
  32. data/doc/users_guide_snippets/environment_variables.txt +2 -2
  33. data/doc/users_guide_snippets/installation.txt +6 -2
  34. data/doc/users_guide_snippets/tips.txt +4 -0
  35. data/ext/apache2/Hooks.cpp +16 -3
  36. data/ext/common/Account.h +6 -5
  37. data/ext/common/AgentsStarter.h +1 -1
  38. data/ext/common/ApplicationPool2/Common.h +72 -0
  39. data/ext/common/ApplicationPool2/Group.h +263 -148
  40. data/ext/common/ApplicationPool2/Implementation.cpp +66 -44
  41. data/ext/common/ApplicationPool2/Options.h +1 -7
  42. data/ext/common/ApplicationPool2/Pool.h +96 -72
  43. data/ext/common/ApplicationPool2/Process.h +12 -17
  44. data/ext/common/ApplicationPool2/Socket.h +4 -4
  45. data/ext/common/ApplicationPool2/SuperGroup.h +20 -17
  46. data/ext/common/Constants.h +15 -1
  47. data/ext/common/MessageServer.h +22 -0
  48. data/ext/common/Utils.cpp +4 -1
  49. data/ext/common/Utils.h +3 -1
  50. data/ext/common/Utils/StrIntUtils.h +1 -0
  51. data/ext/common/Utils/Timer.h +15 -1
  52. data/ext/common/Utils/utf8/checked.h +0 -0
  53. data/ext/common/Utils/utf8/core.h +0 -0
  54. data/ext/common/Utils/utf8/unchecked.h +0 -0
  55. data/ext/common/agents/Base.cpp +59 -35
  56. data/ext/common/agents/HelperAgent/Main.cpp +23 -12
  57. data/ext/common/agents/HelperAgent/RequestHandler.h +10 -1
  58. data/ext/common/agents/LoggingAgent/FilterSupport.h +9 -5
  59. data/ext/common/agents/TempDirToucher.c +12 -3
  60. data/ext/common/agents/Watchdog/Main.cpp +8 -2
  61. data/ext/nginx/ConfigurationCommands.c +10 -0
  62. data/ext/nginx/ConfigurationFields.h +2 -0
  63. data/ext/nginx/ContentHandler.c +32 -19
  64. data/ext/nginx/CreateLocationConfig.c +5 -0
  65. data/ext/nginx/MergeLocationConfig.c +6 -0
  66. data/ext/nginx/config +13 -6
  67. data/ext/ruby/passenger_native_support.c +61 -2
  68. data/helper-scripts/classic-rails-loader.rb +9 -10
  69. data/helper-scripts/classic-rails-preloader.rb +10 -11
  70. data/helper-scripts/node-loader.js +3 -2
  71. data/helper-scripts/rack-loader.rb +8 -9
  72. data/helper-scripts/rack-preloader.rb +9 -10
  73. data/lib/phusion_passenger.rb +36 -7
  74. data/lib/phusion_passenger/abstract_installer.rb +16 -15
  75. data/lib/phusion_passenger/active_support3_extensions/init.rb +1 -1
  76. data/lib/phusion_passenger/admin_tools/memory_stats.rb +2 -2
  77. data/lib/phusion_passenger/admin_tools/server_instance.rb +5 -5
  78. data/lib/phusion_passenger/analytics_logger.rb +3 -3
  79. data/lib/phusion_passenger/classic_rails/thread_handler_extension.rb +1 -1
  80. data/lib/phusion_passenger/config.rb +125 -0
  81. data/lib/phusion_passenger/config/about_command.rb +183 -0
  82. data/lib/phusion_passenger/config/command.rb +57 -0
  83. data/lib/phusion_passenger/config/restart_app_command.rb +146 -0
  84. data/lib/phusion_passenger/config/utils.rb +108 -0
  85. data/lib/phusion_passenger/console_text_template.rb +2 -1
  86. data/lib/phusion_passenger/constants.rb +7 -2
  87. data/lib/phusion_passenger/loader_shared_helpers.rb +12 -21
  88. data/lib/phusion_passenger/message_client.rb +15 -4
  89. data/lib/phusion_passenger/native_support.rb +116 -98
  90. data/lib/phusion_passenger/nginx/config_options.rb +5 -0
  91. data/lib/phusion_passenger/platform_info.rb +1 -1
  92. data/lib/phusion_passenger/platform_info/apache.rb +9 -5
  93. data/lib/phusion_passenger/platform_info/apache_detector.rb +5 -6
  94. data/lib/phusion_passenger/platform_info/binary_compatibility.rb +3 -3
  95. data/lib/phusion_passenger/platform_info/compiler.rb +29 -11
  96. data/lib/phusion_passenger/platform_info/curl.rb +1 -1
  97. data/lib/phusion_passenger/platform_info/cxx_portability.rb +30 -16
  98. data/lib/phusion_passenger/platform_info/depcheck.rb +6 -6
  99. data/lib/phusion_passenger/platform_info/linux.rb +2 -2
  100. data/lib/phusion_passenger/platform_info/operating_system.rb +25 -5
  101. data/lib/phusion_passenger/platform_info/ruby.rb +7 -4
  102. data/lib/phusion_passenger/platform_info/zlib.rb +1 -1
  103. data/lib/phusion_passenger/plugin.rb +0 -1
  104. data/lib/phusion_passenger/preloader_shared_helpers.rb +1 -1
  105. data/lib/phusion_passenger/public_api.rb +1 -1
  106. data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
  107. data/lib/phusion_passenger/request_handler.rb +8 -9
  108. data/lib/phusion_passenger/request_handler/thread_handler.rb +21 -9
  109. data/lib/phusion_passenger/ruby_core_enhancements.rb +1 -1
  110. data/lib/phusion_passenger/standalone/app_finder.rb +2 -2
  111. data/lib/phusion_passenger/standalone/command.rb +10 -8
  112. data/lib/phusion_passenger/standalone/help_command.rb +1 -1
  113. data/lib/phusion_passenger/standalone/main.rb +3 -3
  114. data/lib/phusion_passenger/standalone/package_runtime_command.rb +2 -2
  115. data/lib/phusion_passenger/standalone/runtime_installer.rb +55 -13
  116. data/lib/phusion_passenger/standalone/runtime_locator.rb +3 -3
  117. data/lib/phusion_passenger/standalone/start_command.rb +6 -7
  118. data/lib/phusion_passenger/standalone/status_command.rb +1 -1
  119. data/lib/phusion_passenger/standalone/stop_command.rb +1 -1
  120. data/lib/phusion_passenger/standalone/utils.rb +1 -1
  121. data/lib/phusion_passenger/standalone/version_command.rb +2 -3
  122. data/lib/phusion_passenger/utils.rb +1 -1
  123. data/lib/phusion_passenger/utils/download.rb +1 -2
  124. data/lib/phusion_passenger/utils/file_system_watcher.rb +1 -1
  125. data/lib/phusion_passenger/utils/hosts_file_parser.rb +1 -1
  126. data/lib/phusion_passenger/utils/tee_input.rb +1 -1
  127. data/lib/phusion_passenger/utils/terminal_choice_menu.rb +217 -0
  128. data/lib/phusion_passenger/utils/unseekable_socket.rb +1 -1
  129. data/resources/templates/apache2/config_snippets.txt.erb +2 -3
  130. data/resources/templates/apache2/deployment_example.txt.erb +2 -2
  131. data/resources/templates/apache2/notify_apache_module_installed.txt.erb +3 -0
  132. data/resources/templates/nginx/config_snippets.txt.erb +1 -1
  133. data/resources/templates/nginx/deployment_example.txt.erb +2 -2
  134. data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +11 -5
  135. data/rpm/Vagrantfile +1 -0
  136. data/test/cxx/ApplicationPool2/PoolTest.cpp +224 -35
  137. data/test/cxx/ApplicationPool2/ProcessTest.cpp +6 -6
  138. data/test/cxx/MessagePassingTest.cpp +1 -1
  139. data/test/cxx/RequestHandlerTest.cpp +26 -26
  140. data/test/integration_tests/apache2_tests.rb +162 -243
  141. data/test/integration_tests/native_packaging_spec.rb +10 -10
  142. data/test/integration_tests/nginx_tests.rb +87 -107
  143. data/test/integration_tests/shared/example_webapp_tests.rb +246 -0
  144. data/test/integration_tests/source_packaging_test.rb +2 -1
  145. data/test/integration_tests/standalone_tests.rb +34 -19
  146. data/test/ruby/admin_tools_spec.rb +4 -4
  147. data/test/ruby/analytics_logger_spec.rb +1 -1
  148. data/test/ruby/debug_logging_spec.rb +2 -2
  149. data/test/ruby/message_channel_spec.rb +1 -1
  150. data/test/ruby/request_handler_spec.rb +171 -64
  151. data/test/ruby/shared/loader_sharedspec.rb +5 -5
  152. data/test/ruby/shared/rails/analytics_logging_extensions_sharedspec.rb +2 -2
  153. data/test/ruby/spec_helper.rb +4 -4
  154. data/test/ruby/standalone/runtime_installer_spec.rb +1 -1
  155. data/test/ruby/standalone/runtime_locator_spec.rb +1 -1
  156. data/test/ruby/utils/file_system_watcher_spec.rb +1 -1
  157. data/test/ruby/utils/hosts_file_parser.rb +1 -1
  158. data/test/ruby/utils/unseekable_socket_spec.rb +1 -1
  159. data/test/ruby/utils_spec.rb +4 -4
  160. data/test/stub/apache2/httpd.conf.erb +5 -0
  161. data/test/stub/index.html +1 -0
  162. data/test/stub/rack/config.ru +80 -33
  163. data/test/stub/{rails_apps/1.2/empty/app/models → rack/public}/.gitignore +0 -0
  164. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/Rakefile +0 -0
  165. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/application_controller.rb +0 -0
  166. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/recipes_controller.rb +0 -0
  167. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/uploads_controller.rb +0 -0
  168. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/welcome_controller.rb +0 -0
  169. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/app/helpers/application_helper.rb +0 -0
  170. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/recipes_helper.rb +0 -0
  171. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/test_helper.rb +0 -0
  172. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/uploads_helper.rb +0 -0
  173. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/welcome_helper.rb +0 -0
  174. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/layouts/default.rhtml +0 -0
  175. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/create.rhtml +0 -0
  176. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/index.rhtml +0 -0
  177. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/new.rhtml +0 -0
  178. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/index.rhtml +0 -0
  179. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/new.html.erb +0 -0
  180. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/cached.rhtml +0 -0
  181. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/index.rhtml +0 -0
  182. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/boot.rb +0 -0
  183. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/database.yml +0 -0
  184. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environment.rb +0 -0
  185. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/environments/development.rb +0 -0
  186. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environments/production.rb +0 -0
  187. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/inflections.rb +0 -0
  188. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/mime_types.rb +0 -0
  189. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/routes.rb +0 -0
  190. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/log/useless.txt +0 -0
  191. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/.htaccess +0 -0
  192. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/404.html +0 -0
  193. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/422.html +0 -0
  194. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/500.html +0 -0
  195. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.cgi +0 -0
  196. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.fcgi +0 -0
  197. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.rb +0 -0
  198. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/favicon.ico +0 -0
  199. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/angrywizard.gif +0 -0
  200. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/cookbook.gif +0 -0
  201. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/header.png +0 -0
  202. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/images/rails.png +0 -0
  203. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/robots.txt +0 -0
  204. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/uploads.html +0 -0
  205. data/test/stub/{rails_apps/1.2/empty/db → rails2.3-mycook/public/uploads}/.gitignore +0 -0
  206. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/welcome/cached.html +0 -0
  207. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/about +0 -0
  208. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/console +0 -0
  209. data/test/stub/{rails_apps/2.2/empty → rails2.3-mycook}/script/dbconsole +0 -0
  210. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/destroy +0 -0
  211. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/generate +0 -0
  212. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/benchmarker +0 -0
  213. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/profiler +0 -0
  214. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/performance/request +0 -0
  215. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/plugin +0 -0
  216. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/inspector +0 -0
  217. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/reaper +0 -0
  218. data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/spawner +0 -0
  219. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/runner +0 -0
  220. data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/server +0 -0
  221. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/uploads.html +0 -0
  222. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/welcome/cached.html +0 -0
  223. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/cache/useless.txt +0 -0
  224. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/pids/useless.txt +0 -0
  225. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sessions/useless.txt +0 -0
  226. data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sockets/useless.txt +0 -0
  227. data/test/stub/rails2.3/app/controllers/foo_controller.rb +1 -1
  228. data/test/stub/rails2.3/config/routes.rb +1 -2
  229. data/test/stub/wsgi/passenger_wsgi.py +47 -8
  230. data/test/stub/{rails_apps/1.2/empty/public/stylesheets → wsgi/public}/.gitignore +0 -0
  231. data/test/support/apache2_controller.rb +2 -2
  232. data/test/support/nginx_controller.rb +11 -5
  233. data/test/support/placebo-preloader.rb +2 -2
  234. data/test/support/test_helper.rb +26 -7
  235. metadata +78 -240
  236. metadata.gz.asc +7 -7
  237. data/debian.template/repack.sh +0 -42
  238. data/debian.template/watch +0 -3
  239. data/test/integration_tests/cgi_environment_spec.rb +0 -36
  240. data/test/integration_tests/hello_world_rack_spec.rb +0 -43
  241. data/test/integration_tests/hello_world_wsgi_spec.rb +0 -41
  242. data/test/integration_tests/mycook_spec.rb +0 -166
  243. data/test/stub/rack/public/rack.jpg +0 -0
  244. data/test/stub/rails_apps/1.2/empty/.gitignore +0 -3
  245. data/test/stub/rails_apps/1.2/empty/app/controllers/application.rb +0 -7
  246. data/test/stub/rails_apps/1.2/empty/config/boot.rb +0 -108
  247. data/test/stub/rails_apps/1.2/empty/config/database.yml +0 -31
  248. data/test/stub/rails_apps/1.2/empty/config/environment.rb +0 -66
  249. data/test/stub/rails_apps/1.2/empty/config/environments/development.rb +0 -21
  250. data/test/stub/rails_apps/1.2/empty/config/environments/production.rb +0 -18
  251. data/test/stub/rails_apps/1.2/empty/config/environments/staging.rb +0 -18
  252. data/test/stub/rails_apps/1.2/empty/config/environments/test.rb +0 -19
  253. data/test/stub/rails_apps/1.2/empty/config/routes.rb +0 -23
  254. data/test/stub/rails_apps/1.2/empty/doc/README_FOR_APP +0 -2
  255. data/test/stub/rails_apps/1.2/empty/public/.htaccess +0 -40
  256. data/test/stub/rails_apps/1.2/empty/public/500.html +0 -30
  257. data/test/stub/rails_apps/1.2/empty/public/dispatch.cgi +0 -10
  258. data/test/stub/rails_apps/1.2/empty/public/dispatch.fcgi +0 -24
  259. data/test/stub/rails_apps/1.2/empty/public/dispatch.rb +0 -10
  260. data/test/stub/rails_apps/1.2/empty/public/robots.txt +0 -1
  261. data/test/stub/rails_apps/1.2/empty/script/about +0 -3
  262. data/test/stub/rails_apps/1.2/empty/script/breakpointer +0 -3
  263. data/test/stub/rails_apps/1.2/empty/script/console +0 -3
  264. data/test/stub/rails_apps/1.2/empty/script/destroy +0 -3
  265. data/test/stub/rails_apps/1.2/empty/script/generate +0 -3
  266. data/test/stub/rails_apps/1.2/empty/script/plugin +0 -3
  267. data/test/stub/rails_apps/1.2/empty/script/runner +0 -3
  268. data/test/stub/rails_apps/1.2/empty/script/server +0 -3
  269. data/test/stub/rails_apps/1.2/empty/test/test_helper.rb +0 -28
  270. data/test/stub/rails_apps/2.0/empty/.gitignore +0 -3
  271. data/test/stub/rails_apps/2.0/empty/Rakefile +0 -10
  272. data/test/stub/rails_apps/2.0/empty/app/controllers/application.rb +0 -10
  273. data/test/stub/rails_apps/2.0/empty/app/helpers/application_helper.rb +0 -3
  274. data/test/stub/rails_apps/2.0/empty/app/models/.gitignore +0 -0
  275. data/test/stub/rails_apps/2.0/empty/config/boot.rb +0 -108
  276. data/test/stub/rails_apps/2.0/empty/config/database.yml +0 -31
  277. data/test/stub/rails_apps/2.0/empty/config/environment.rb +0 -59
  278. data/test/stub/rails_apps/2.0/empty/config/environments/production.rb +0 -18
  279. data/test/stub/rails_apps/2.0/empty/config/environments/staging.rb +0 -18
  280. data/test/stub/rails_apps/2.0/empty/config/environments/test.rb +0 -22
  281. data/test/stub/rails_apps/2.0/empty/config/routes.rb +0 -35
  282. data/test/stub/rails_apps/2.0/empty/db/.gitignore +0 -0
  283. data/test/stub/rails_apps/2.0/empty/doc/README_FOR_APP +0 -2
  284. data/test/stub/rails_apps/2.0/empty/public/.htaccess +0 -40
  285. data/test/stub/rails_apps/2.0/empty/public/404.html +0 -30
  286. data/test/stub/rails_apps/2.0/empty/public/dispatch.cgi +0 -10
  287. data/test/stub/rails_apps/2.0/empty/public/dispatch.fcgi +0 -24
  288. data/test/stub/rails_apps/2.0/empty/public/dispatch.rb +0 -10
  289. data/test/stub/rails_apps/2.0/empty/public/favicon.ico +0 -0
  290. data/test/stub/rails_apps/2.0/empty/public/images/rails.png +0 -0
  291. data/test/stub/rails_apps/2.0/empty/public/stylesheets/.gitignore +0 -0
  292. data/test/stub/rails_apps/2.0/empty/script/performance/benchmarker +0 -3
  293. data/test/stub/rails_apps/2.0/empty/script/performance/profiler +0 -3
  294. data/test/stub/rails_apps/2.0/empty/script/process/inspector +0 -3
  295. data/test/stub/rails_apps/2.0/empty/script/process/reaper +0 -3
  296. data/test/stub/rails_apps/2.0/empty/script/process/spawner +0 -3
  297. data/test/stub/rails_apps/2.0/empty/test/test_helper.rb +0 -38
  298. data/test/stub/rails_apps/2.2/empty/.gitignore +0 -3
  299. data/test/stub/rails_apps/2.2/empty/Rakefile +0 -10
  300. data/test/stub/rails_apps/2.2/empty/app/controllers/application.rb +0 -15
  301. data/test/stub/rails_apps/2.2/empty/app/helpers/application_helper.rb +0 -3
  302. data/test/stub/rails_apps/2.2/empty/app/models/.gitignore +0 -0
  303. data/test/stub/rails_apps/2.2/empty/config/boot.rb +0 -109
  304. data/test/stub/rails_apps/2.2/empty/config/database.yml +0 -31
  305. data/test/stub/rails_apps/2.2/empty/config/environment.rb +0 -75
  306. data/test/stub/rails_apps/2.2/empty/config/environments/development.rb +0 -17
  307. data/test/stub/rails_apps/2.2/empty/config/environments/production.rb +0 -24
  308. data/test/stub/rails_apps/2.2/empty/config/environments/staging.rb +0 -24
  309. data/test/stub/rails_apps/2.2/empty/config/environments/test.rb +0 -22
  310. data/test/stub/rails_apps/2.2/empty/config/initializers/inflections.rb +0 -10
  311. data/test/stub/rails_apps/2.2/empty/config/initializers/mime_types.rb +0 -5
  312. data/test/stub/rails_apps/2.2/empty/config/initializers/new_rails_defaults.rb +0 -17
  313. data/test/stub/rails_apps/2.2/empty/config/locales/en.yml +0 -5
  314. data/test/stub/rails_apps/2.2/empty/config/routes.rb +0 -43
  315. data/test/stub/rails_apps/2.2/empty/db/.gitignore +0 -0
  316. data/test/stub/rails_apps/2.2/empty/doc/README_FOR_APP +0 -5
  317. data/test/stub/rails_apps/2.2/empty/public/404.html +0 -30
  318. data/test/stub/rails_apps/2.2/empty/public/422.html +0 -30
  319. data/test/stub/rails_apps/2.2/empty/public/500.html +0 -33
  320. data/test/stub/rails_apps/2.2/empty/public/dispatch.cgi +0 -10
  321. data/test/stub/rails_apps/2.2/empty/public/dispatch.fcgi +0 -24
  322. data/test/stub/rails_apps/2.2/empty/public/dispatch.rb +0 -10
  323. data/test/stub/rails_apps/2.2/empty/public/favicon.ico +0 -0
  324. data/test/stub/rails_apps/2.2/empty/public/images/rails.png +0 -0
  325. data/test/stub/rails_apps/2.2/empty/public/robots.txt +0 -5
  326. data/test/stub/rails_apps/2.2/empty/public/stylesheets/.gitignore +0 -0
  327. data/test/stub/rails_apps/2.2/empty/script/about +0 -4
  328. data/test/stub/rails_apps/2.2/empty/script/console +0 -3
  329. data/test/stub/rails_apps/2.2/empty/script/destroy +0 -3
  330. data/test/stub/rails_apps/2.2/empty/script/generate +0 -3
  331. data/test/stub/rails_apps/2.2/empty/script/performance/benchmarker +0 -3
  332. data/test/stub/rails_apps/2.2/empty/script/performance/profiler +0 -3
  333. data/test/stub/rails_apps/2.2/empty/script/performance/request +0 -3
  334. data/test/stub/rails_apps/2.2/empty/script/plugin +0 -3
  335. data/test/stub/rails_apps/2.2/empty/script/process/inspector +0 -3
  336. data/test/stub/rails_apps/2.2/empty/script/process/reaper +0 -3
  337. data/test/stub/rails_apps/2.2/empty/script/process/spawner +0 -3
  338. data/test/stub/rails_apps/2.2/empty/script/runner +0 -3
  339. data/test/stub/rails_apps/2.2/empty/script/server +0 -3
  340. data/test/stub/rails_apps/2.2/empty/test/performance/browsing_test.rb +0 -9
  341. data/test/stub/rails_apps/2.2/empty/test/test_helper.rb +0 -38
  342. data/test/stub/rails_apps/2.3/empty/.gitignore +0 -3
  343. data/test/stub/rails_apps/2.3/empty/Rakefile +0 -10
  344. data/test/stub/rails_apps/2.3/empty/app/controllers/application_controller.rb +0 -10
  345. data/test/stub/rails_apps/2.3/empty/app/helpers/application_helper.rb +0 -3
  346. data/test/stub/rails_apps/2.3/empty/app/models/.gitignore +0 -0
  347. data/test/stub/rails_apps/2.3/empty/config/boot.rb +0 -110
  348. data/test/stub/rails_apps/2.3/empty/config/database.yml +0 -31
  349. data/test/stub/rails_apps/2.3/empty/config/environment.rb +0 -41
  350. data/test/stub/rails_apps/2.3/empty/config/environments/development.rb +0 -17
  351. data/test/stub/rails_apps/2.3/empty/config/environments/production.rb +0 -28
  352. data/test/stub/rails_apps/2.3/empty/config/environments/staging.rb +0 -28
  353. data/test/stub/rails_apps/2.3/empty/config/environments/test.rb +0 -28
  354. data/test/stub/rails_apps/2.3/empty/config/initializers/backtrace_silencers.rb +0 -7
  355. data/test/stub/rails_apps/2.3/empty/config/initializers/inflections.rb +0 -10
  356. data/test/stub/rails_apps/2.3/empty/config/initializers/mime_types.rb +0 -5
  357. data/test/stub/rails_apps/2.3/empty/config/initializers/new_rails_defaults.rb +0 -21
  358. data/test/stub/rails_apps/2.3/empty/config/initializers/session_store.rb +0 -15
  359. data/test/stub/rails_apps/2.3/empty/config/locales/en.yml +0 -5
  360. data/test/stub/rails_apps/2.3/empty/config/routes.rb +0 -43
  361. data/test/stub/rails_apps/2.3/empty/db/.gitignore +0 -0
  362. data/test/stub/rails_apps/2.3/empty/db/seeds.rb +0 -7
  363. data/test/stub/rails_apps/2.3/empty/doc/README_FOR_APP +0 -2
  364. data/test/stub/rails_apps/2.3/empty/public/404.html +0 -30
  365. data/test/stub/rails_apps/2.3/empty/public/422.html +0 -30
  366. data/test/stub/rails_apps/2.3/empty/public/500.html +0 -30
  367. data/test/stub/rails_apps/2.3/empty/public/favicon.ico +0 -0
  368. data/test/stub/rails_apps/2.3/empty/public/images/rails.png +0 -0
  369. data/test/stub/rails_apps/2.3/empty/public/robots.txt +0 -5
  370. data/test/stub/rails_apps/2.3/empty/public/stylesheets/.gitignore +0 -0
  371. data/test/stub/rails_apps/2.3/empty/script/about +0 -4
  372. data/test/stub/rails_apps/2.3/empty/script/console +0 -3
  373. data/test/stub/rails_apps/2.3/empty/script/dbconsole +0 -3
  374. data/test/stub/rails_apps/2.3/empty/script/destroy +0 -3
  375. data/test/stub/rails_apps/2.3/empty/script/generate +0 -3
  376. data/test/stub/rails_apps/2.3/empty/script/performance/benchmarker +0 -3
  377. data/test/stub/rails_apps/2.3/empty/script/performance/profiler +0 -3
  378. data/test/stub/rails_apps/2.3/empty/script/plugin +0 -3
  379. data/test/stub/rails_apps/2.3/empty/script/runner +0 -3
  380. data/test/stub/rails_apps/2.3/empty/script/server +0 -3
  381. data/test/stub/rails_apps/2.3/empty/test/performance/browsing_test.rb +0 -9
  382. data/test/stub/rails_apps/2.3/empty/test/test_helper.rb +0 -38
  383. data/test/stub/rails_apps/2.3/mycook/Rakefile +0 -10
  384. data/test/stub/rails_apps/2.3/mycook/app/helpers/application_helper.rb +0 -3
  385. data/test/stub/rails_apps/2.3/mycook/config/environments/development.rb +0 -18
  386. data/test/stub/rails_apps/2.3/mycook/config/initializers/inflections.rb +0 -10
  387. data/test/stub/rails_apps/2.3/mycook/config/initializers/mime_types.rb +0 -5
  388. data/test/stub/rails_apps/2.3/mycook/public/404.html +0 -30
  389. data/test/stub/rails_apps/2.3/mycook/public/422.html +0 -30
  390. data/test/stub/rails_apps/2.3/mycook/public/500.html +0 -30
  391. data/test/stub/rails_apps/2.3/mycook/public/favicon.ico +0 -0
  392. data/test/stub/rails_apps/2.3/mycook/public/images/rails.png +0 -0
  393. data/test/stub/rails_apps/2.3/mycook/public/robots.txt +0 -5
  394. data/test/stub/rails_apps/2.3/mycook/public/uploads/.gitignore +0 -0
  395. data/test/stub/rails_apps/2.3/mycook/script/about +0 -3
  396. data/test/stub/rails_apps/2.3/mycook/script/console +0 -3
  397. data/test/stub/rails_apps/2.3/mycook/script/dbconsole +0 -3
  398. data/test/stub/rails_apps/2.3/mycook/script/destroy +0 -3
  399. data/test/stub/rails_apps/2.3/mycook/script/generate +0 -3
  400. data/test/stub/rails_apps/2.3/mycook/script/performance/benchmarker +0 -3
  401. data/test/stub/rails_apps/2.3/mycook/script/performance/profiler +0 -3
  402. data/test/stub/rails_apps/2.3/mycook/script/performance/request +0 -3
  403. data/test/stub/rails_apps/2.3/mycook/script/plugin +0 -3
  404. data/test/stub/rails_apps/2.3/mycook/script/process/inspector +0 -3
  405. data/test/stub/rails_apps/2.3/mycook/script/process/reaper +0 -3
  406. data/test/stub/rails_apps/2.3/mycook/script/process/spawner +0 -3
  407. data/test/stub/rails_apps/2.3/mycook/script/runner +0 -3
  408. data/test/stub/rails_apps/2.3/mycook/script/server +0 -3
  409. data/test/stub/wsgi/public/wsgi-snake.jpg +0 -0
@@ -51,7 +51,7 @@ namespace tut {
51
51
  unsigned long long timeout = 0;
52
52
  Timer timer;
53
53
  ensure_equals(box->recv("hi", &timeout), MessagePtr());
54
- ensure(timer.elapsed() < 2);
54
+ ensure(timer.elapsed() < 10);
55
55
  ensure_equals(timeout, 0ull);
56
56
  }
57
57
 
@@ -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/html\r\n"));
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, "hello <b>world</b>");
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/html\r\n"));
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, "hello <b>world</b>");
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/html\r\n"));
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, "hello <b>world</b>");
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), "hello <b>world</b>"));
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), "hello <b>world</b>"));
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, "Passenger:<wbr>:<wbr>RuntimeException"));
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", "/upload",
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", "/upload",
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", "/upload",
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", "/upload",
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", "/upload",
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", "/upload",
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", "/upload",
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", "/upload",
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", "/upload",
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", "/chunked",
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
- require 'phusion_passenger/platform_info'
6
- require 'phusion_passenger/admin_tools'
7
- require 'phusion_passenger/admin_tools/server_instance'
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/mycook_spec'
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 ": MyCook(tm) beta running on root URI" do
46
+
47
+ describe "a Ruby app running on the root URI" do
51
48
  before :all do
52
49
  create_apache2_controller
53
- @web_server_supports_chunked_transfer_encoding = true
54
- @base_uri = ""
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
- @stub = ClassicRailsStub.new('rails_apps/2.3/mycook')
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 "MyCook(tm) beta"
72
- include_examples "CGI environment variables compliance"
73
-
74
- it "doesn't block Rails while an upload is in progress" do
75
- get('/') # Force spawning so that the timeout below is enough.
76
-
77
- socket = TCPSocket.new('passenger.test', @apache2.port)
78
- begin
79
- socket.write("POST / HTTP/1.1\r\n")
80
- socket.write("Host: passenger.test\r\n")
81
-
82
- upload_data = File.read("stub/upload_data.txt")
83
- size_of_first_half = upload_data.size / 2
84
-
85
- socket.write(upload_data[0..size_of_first_half])
86
- socket.flush
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
- it "doesn't block Rails while a large number of uploads are in progress" do
97
- get('/') # Force spawning so that the timeout below is enough.
98
- sockets = []
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
- it "appends an X-Powered-By header containing the Phusion Passenger version number" do
123
- response = get_response('/')
124
- response["X-Powered-By"].should include("Phusion Passenger")
125
- response["X-Powered-By"].should include(PhusionPassenger::VERSION_STRING)
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 ": MyCook(tm) beta running in a sub-URI" do
103
+
104
+ describe "a Python app running on the root URI" do
130
105
  before :all do
131
106
  create_apache2_controller
132
- @web_server_supports_chunked_transfer_encoding = true
133
- @base_uri = "/mycook"
134
- @stub = ClassicRailsStub.new('rails_apps/2.3/mycook')
135
- FileUtils.rm_rf('tmp.webdir')
136
- FileUtils.mkdir_p('tmp.webdir')
137
- FileUtils.cp_r('stub/zsfa/.', 'tmp.webdir')
138
- FileUtils.ln_sf(@stub.full_app_root + "/public", 'tmp.webdir/mycook')
139
-
140
- @apache2.set_vhost('passenger.test', File.expand_path('tmp.webdir')) do |vhost|
141
- vhost << "RailsBaseURI /mycook"
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 "MyCook(tm) beta"
158
- include_examples "CGI environment variables compliance"
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 =~ /Zed, you rock\!/
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
- @mycook = ClassicRailsStub.new('rails_apps/2.3/mycook')
172
- @mycook_url_root = "http://1.passenger.test:#{@apache2.port}"
173
- @apache2.set_vhost("1.passenger.test", "#{@mycook.full_app_root}/public") do |vhost|
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 ^/rewritten_welcome$ /welcome [PT,QSA,L]"
176
- vhost << "RewriteRule ^/rewritten_cgi_environment$ /welcome/cgi_environment [PT,QSA,L]"
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
- @mycook.destroy
178
+ @stub.destroy
183
179
  @apache2.stop if @apache2
184
180
  end
185
-
181
+
186
182
  before :each do
187
- @mycook.reset
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("#{@mycook.app_root}/public/.htaccess", 'SetEnv FOO "Foo Bar!"')
193
- File.touch("#{@mycook.app_root}/tmp/restart.txt") # Activate ENV changes.
194
- get('/welcome/environment').should =~ /FOO = Foo Bar\!/
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('/rewritten_welcome').should =~ /Welcome to MyCook/
200
- cgi_envs = get('/rewritten_cgi_environment?foo=bar+baz')
201
- cgi_envs.should include("REQUEST_URI = /welcome/cgi_environment?foo=bar+baz\n")
202
- cgi_envs.should include("PATH_INFO = /welcome/cgi_environment\n")
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("#{@mycook.app_root}/public/.htaccess", %Q{
200
+ File.write("#{@stub.app_root}/public/.htaccess", %Q{
207
201
  RewriteEngine on
208
- RewriteRule ^htaccess_welcome$ welcome [PT,QSA,L]
209
- RewriteRule ^htaccess_cgi_environment$ welcome/cgi_environment [PT,QSA,L]
202
+ RewriteRule ^htaccess_frontpage$ / [PT,QSA,L]
203
+ RewriteRule ^htaccess_env$ env [PT,QSA,L]
210
204
  })
211
- get('/htaccess_welcome').should =~ /Welcome to MyCook/
212
- cgi_envs = get('/htaccess_cgi_environment?foo=bar+baz')
213
- cgi_envs.should include("REQUEST_URI = /welcome/cgi_environment?foo=bar+baz\n")
214
- cgi_envs.should include("PATH_INFO = /welcome/cgi_environment\n")
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('rails_apps/2.3/mycook')
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('rails_apps/2.3/mycook')
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('rails_apps/2.3/mycook')
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('rails_apps/2.3/mycook')
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