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
@@ -139,6 +139,11 @@ LOCATION_CONFIGURATION_OPTIONS = [
139
139
  :header => nil,
140
140
  :auto_generate_nginx_merge_code => false
141
141
  },
142
+ {
143
+ :name => 'passenger_document_root',
144
+ :type => :string,
145
+ :header => nil
146
+ },
142
147
  {
143
148
  :name => 'passenger_user',
144
149
  :type => :string
@@ -21,7 +21,7 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
- require 'phusion_passenger/utils/tmpio'
24
+ PhusionPassenger.require_passenger_lib 'utils/tmpio'
25
25
 
26
26
  module PhusionPassenger
27
27
 
@@ -22,10 +22,10 @@
22
22
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  # THE SOFTWARE.
24
24
 
25
- require 'phusion_passenger/platform_info'
26
- require 'phusion_passenger/platform_info/compiler'
27
- require 'phusion_passenger/platform_info/operating_system'
28
- require 'phusion_passenger/platform_info/linux'
25
+ PhusionPassenger.require_passenger_lib 'platform_info'
26
+ PhusionPassenger.require_passenger_lib 'platform_info/compiler'
27
+ PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
28
+ PhusionPassenger.require_passenger_lib 'platform_info/linux'
29
29
 
30
30
  module PhusionPassenger
31
31
 
@@ -185,7 +185,11 @@ module PlatformInfo
185
185
 
186
186
  def self.httpd_actual_error_log(options = nil)
187
187
  if config_file = httpd_default_config_file(options)
188
- contents = File.open(config_file, "rb") { |f| f.read }
188
+ begin
189
+ contents = File.open(config_file, "rb") { |f| f.read }
190
+ rescue Errno::EACCES
191
+ return nil
192
+ end
189
193
  # We don't want to match comments
190
194
  contents.gsub!(/^[ \t]*#.*/, '')
191
195
  if contents =~ /^ErrorLog (.+)$/
@@ -21,12 +21,11 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
- require 'phusion_passenger'
25
- require 'phusion_passenger/constants'
26
- require 'phusion_passenger/platform_info'
27
- require 'phusion_passenger/platform_info/ruby'
28
- require 'phusion_passenger/platform_info/apache'
29
- require 'phusion_passenger/utils/ansi_colors'
24
+ PhusionPassenger.require_passenger_lib 'constants'
25
+ PhusionPassenger.require_passenger_lib 'platform_info'
26
+ PhusionPassenger.require_passenger_lib 'platform_info/ruby'
27
+ PhusionPassenger.require_passenger_lib 'platform_info/apache'
28
+ PhusionPassenger.require_passenger_lib 'utils/ansi_colors'
30
29
  require 'pathname'
31
30
 
32
31
  module PhusionPassenger
@@ -22,9 +22,9 @@
22
22
  # THE SOFTWARE.
23
23
 
24
24
  require 'rbconfig'
25
- require 'phusion_passenger/platform_info'
26
- require 'phusion_passenger/platform_info/ruby'
27
- require 'phusion_passenger/platform_info/operating_system'
25
+ PhusionPassenger.require_passenger_lib 'platform_info'
26
+ PhusionPassenger.require_passenger_lib 'platform_info/ruby'
27
+ PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
28
28
 
29
29
  module PhusionPassenger
30
30
 
@@ -21,8 +21,8 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
- require 'phusion_passenger/platform_info'
25
- require 'phusion_passenger/platform_info/operating_system'
24
+ PhusionPassenger.require_passenger_lib 'platform_info'
25
+ PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
26
26
 
27
27
  module PhusionPassenger
28
28
 
@@ -144,18 +144,25 @@ public
144
144
  def self.cc
145
145
  return string_env('CC', default_cc)
146
146
  end
147
+ memoize :cc
147
148
 
148
149
  def self.cxx
149
150
  return string_env('CXX', default_cxx)
150
151
  end
152
+ memoize :cxx
151
153
 
152
154
  def self.default_cc
153
- # OS X Mavericks (10.9) switched from GCC to Clang as the default compiler,
154
- # i.e. as an alias for 'cc'. Since the Nginx by default uses 'cc' as the compiler,
155
- # we'll have to do that too. Otherwise we'll get C++ linker errors because Nginx
156
- # is compiled with Clang while Phusion Passenger is compiled with GCC.
155
+ # On most platforms, we'll want to use the same compiler as what the rest
156
+ # of the system uses, so that we generate compatible binaries. That's
157
+ # most likely the 'cc' command. We used to use 'gcc' by default.
158
+ #
159
+ # See for example this issue with OS X Mavericks (10.9). They switched from
160
+ # GCC to Clang as the default compiler. Since the Nginx by default uses 'cc'
161
+ # as the compiler, we'll have to do that too. Otherwise we'll get C++ linker
162
+ # errors because Nginx is compiled with Clang while Phusion Passenger is
163
+ # compiled with GCC.
157
164
  # https://code.google.com/p/phusion-passenger/issues/detail?id=950
158
- if PlatformInfo.os_name == "macosx"
165
+ if PlatformInfo.find_command('cc')
159
166
  return 'cc'
160
167
  else
161
168
  return 'gcc'
@@ -163,7 +170,7 @@ public
163
170
  end
164
171
 
165
172
  def self.default_cxx
166
- if PlatformInfo.os_name == "macosx"
173
+ if PlatformInfo.find_command('c++')
167
174
  return 'c++'
168
175
  else
169
176
  return 'g++'
@@ -175,6 +182,11 @@ public
175
182
  end
176
183
  memoize :cc_is_gcc?
177
184
 
185
+ def self.cxx_is_gcc?
186
+ `#{cxx} -v 2>&1` =~ /gcc version/
187
+ end
188
+ memoize :cxx_is_gcc?
189
+
178
190
  def self.cc_is_clang?
179
191
  `#{cc} --version 2>&1` =~ /clang version/
180
192
  end
@@ -428,12 +440,18 @@ public
428
440
  memoize :adress_sanitizer_flag
429
441
 
430
442
  def self.cxx_11_flag
431
- source = %Q{
432
- #include <unordered_map>
443
+ # C++11 support on FreeBSD 10.0 + Clang seems to be bugged.
444
+ # http://llvm.org/bugs/show_bug.cgi?id=18310
445
+ return nil if os_name =~ /freebsd/
446
+
447
+ source = %{
448
+ struct Foo {
449
+ Foo(Foo &&f) { }
450
+ };
433
451
  }
434
452
  if try_compile("Checking for C++ -std=gnu++11 compiler flag", :cxx, source, '-std=gnu++11')
435
453
  return "-std=gnu++11"
436
- elsif try_compile("Checking for C++ -std=c++11 compiler flag", :cxx, source, '-std=c++')
454
+ elsif try_compile("Checking for C++ -std=c++11 compiler flag", :cxx, source, '-std=c++11')
437
455
  return "-std=c++11"
438
456
  else
439
457
  return nil
@@ -21,7 +21,7 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
- require 'phusion_passenger/platform_info'
24
+ PhusionPassenger.require_passenger_lib 'platform_info'
25
25
 
26
26
  module PhusionPassenger
27
27
 
@@ -21,27 +21,26 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
- require 'phusion_passenger/platform_info'
25
- require 'phusion_passenger/platform_info/compiler'
26
- require 'phusion_passenger/platform_info/operating_system'
24
+ PhusionPassenger.require_passenger_lib 'platform_info'
25
+ PhusionPassenger.require_passenger_lib 'platform_info/compiler'
26
+ PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
27
27
 
28
28
  module PhusionPassenger
29
29
 
30
30
  module PlatformInfo
31
- # Linker flags that should be used for linking every C/C++ program,
32
- # for portability reasons. These flags should be specified as last
33
- # when invoking the linker.
34
- def self.portability_ldflags
35
- if os_name =~ /solaris/
36
- result = '-lxnet -lsocket -lnsl -lpthread'
37
- else
38
- result = '-lpthread'
39
- end
40
- result << ' -lrt' if has_rt_library?
41
- result << ' -lmath' if has_math_library?
42
- return result
31
+ # Extra flags that should always be passed to the C compiler
32
+ # when linking, to be included last in the command string.
33
+ def self.portability_c_ldflags
34
+ return portability_c_or_cxx_ldflags(:c)
35
+ end
36
+ memoize :portability_c_ldflags
37
+
38
+ # Extra flags that should always be passed to the C++ compiler
39
+ # when linking, to be included last in the command string.
40
+ def self.portability_cxx_ldflags
41
+ return portability_c_or_cxx_ldflags(:cxx)
43
42
  end
44
- memoize :portability_ldflags
43
+ memoize :portability_cxx_ldflags
45
44
 
46
45
  # Extra compiler flags that should always be passed to the C compiler,
47
46
  # last in the command string.
@@ -196,6 +195,21 @@ private
196
195
  return flags.compact.map{ |str| str.strip }.join(" ").strip
197
196
  end
198
197
  private_class_method :default_extra_c_or_cxxflags
198
+
199
+ def self.portability_c_or_cxx_ldflags(cc_or_cxx)
200
+ result = ''
201
+ result << cxx_11_flag if cc_or_cxx == :cxx && cxx_11_flag
202
+ if os_name =~ /solaris/
203
+ result << ' -lxnet -lsocket -lnsl -lpthread'
204
+ else
205
+ result << ' -lpthread'
206
+ end
207
+ result << ' -lrt' if has_rt_library?
208
+ result << ' -lmath' if has_math_library?
209
+ result.strip!
210
+ return result
211
+ end
212
+ private_class_method :portability_c_or_cxx_ldflags
199
213
  end
200
214
 
201
215
  end # module PhusionPassenger
@@ -1,9 +1,9 @@
1
1
  # encoding: utf-8
2
- require 'phusion_passenger/platform_info/ruby'
3
- require 'phusion_passenger/platform_info/linux'
4
- require 'phusion_passenger/platform_info/compiler'
5
- require 'phusion_passenger/platform_info/operating_system'
6
- require 'phusion_passenger/utils/ansi_colors'
2
+ PhusionPassenger.require_passenger_lib 'platform_info/ruby'
3
+ PhusionPassenger.require_passenger_lib 'platform_info/linux'
4
+ PhusionPassenger.require_passenger_lib 'platform_info/compiler'
5
+ PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
6
+ PhusionPassenger.require_passenger_lib 'utils/ansi_colors'
7
7
 
8
8
  module PhusionPassenger
9
9
  module PlatformInfo
@@ -261,7 +261,7 @@ module Depcheck
261
261
  end
262
262
 
263
263
  def install_osx_command_line_tools
264
- require 'phusion_passenger/platform_info/compiler'
264
+ PhusionPassenger.require_passenger_lib 'platform_info/compiler'
265
265
  if PlatformInfo.xcode_select_version.to_s >= "2333"
266
266
  install_instructions "Please install the Xcode command line tools: " +
267
267
  "<b>sudo xcode-select --install</b>"
@@ -21,8 +21,8 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
- require 'phusion_passenger/platform_info'
25
- require 'phusion_passenger/platform_info/operating_system'
24
+ PhusionPassenger.require_passenger_lib 'platform_info'
25
+ PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
26
26
 
27
27
  module PhusionPassenger
28
28
 
@@ -22,13 +22,15 @@
22
22
  # THE SOFTWARE.
23
23
 
24
24
  require 'rbconfig'
25
- require 'phusion_passenger/platform_info'
25
+ PhusionPassenger.require_passenger_lib 'platform_info'
26
26
 
27
27
  module PhusionPassenger
28
28
 
29
29
  module PlatformInfo
30
30
  # Returns the operating system's name. This name is in lowercase and contains no spaces,
31
- # and thus is suitable to be used in some kind of ID. E.g. "linux", "macosx".
31
+ # and thus is suitable to be used in some kind of ID. It may contain a version number.
32
+ # Linux is always identified as "linux". OS X is always identified as "macosx".
33
+ # Identifiers for other operating systems may contain a version number, e.g. "freebsd10".
32
34
  def self.os_name
33
35
  if rb_config['target_os'] =~ /darwin/ && (sw_vers = find_command('sw_vers'))
34
36
  return "macosx"
@@ -49,6 +51,22 @@ module PlatformInfo
49
51
  end
50
52
  end
51
53
 
54
+ # Returns the `uname` command, or nil if `uname` cannot be found.
55
+ # In addition to looking for `uname` in `PATH`, this method also looks
56
+ # for `uname` in /bin and /usr/bin, just in case the user didn't
57
+ # configure its PATH properly.
58
+ def self.uname_command
59
+ if result = find_command("uname")
60
+ result
61
+ elsif File.exist?("/bin/uname")
62
+ return "/bin/uname"
63
+ elsif File.exist?("/usr/bin/uname")
64
+ return "/usr/bin/uname"
65
+ else
66
+ return nil
67
+ end
68
+ end
69
+
52
70
  # Returns a list of all CPU architecture names that the current machine CPU
53
71
  # supports. If there are multiple such architectures then the first item in
54
72
  # the result denotes that OS runtime's main/preferred architecture.
@@ -77,8 +95,10 @@ module PlatformInfo
77
95
  # everything is 64-bit by default. The latter result indicates an OS X
78
96
  # version older than 10.6.
79
97
  def self.cpu_architectures
98
+ uname = uname_command
99
+ raise "The 'uname' command cannot be found" if !uname
80
100
  if os_name == "macosx"
81
- arch = `uname -p`.strip
101
+ arch = `#{uname} -p`.strip
82
102
  if arch == "i386"
83
103
  # Macs have been x86 since around 2007. I think all of them come with
84
104
  # a recent enough Intel CPU that supports both x86 and x86_64, and I
@@ -97,12 +117,12 @@ module PlatformInfo
97
117
  arch
98
118
  end
99
119
  else
100
- arch = `uname -p`.strip
120
+ arch = `#{uname} -p`.strip
101
121
  # On some systems 'uname -p' returns something like
102
122
  # 'Intel(R) Pentium(R) M processor 1400MHz' or
103
123
  # 'Intel(R)_Xeon(R)_CPU___________X7460__@_2.66GHz'.
104
124
  if arch == "unknown" || arch =~ / / || arch =~ /Hz$/
105
- arch = `uname -m`.strip
125
+ arch = `#{uname} -m`.strip
106
126
  end
107
127
  if arch =~ /^i.86$/
108
128
  arch = "x86"
@@ -23,8 +23,8 @@
23
23
 
24
24
  require 'rbconfig'
25
25
  require 'etc'
26
- require 'phusion_passenger/platform_info'
27
- require 'phusion_passenger/platform_info/operating_system'
26
+ PhusionPassenger.require_passenger_lib 'platform_info'
27
+ PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
28
28
 
29
29
  module PhusionPassenger
30
30
 
@@ -155,8 +155,11 @@ module PlatformInfo
155
155
  # Returns whether running 'gem install' as the current user requires sudo.
156
156
  def self.gem_install_requires_sudo?
157
157
  `#{gem_command} env` =~ /INSTALLATION DIRECTORY: (.+)/
158
- install_dir = $1
159
- return !File.writable?(install_dir)
158
+ if install_dir = $1
159
+ return !File.writable?(install_dir)
160
+ else
161
+ return nil
162
+ end
160
163
  end
161
164
  memoize :gem_install_requires_sudo?
162
165
 
@@ -21,7 +21,7 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
- require 'phusion_passenger/platform_info'
24
+ PhusionPassenger.require_passenger_lib 'platform_info'
25
25
 
26
26
  module PhusionPassenger
27
27
 
@@ -21,7 +21,6 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
- require 'phusion_passenger'
25
24
  require 'etc'
26
25
 
27
26
  module PhusionPassenger
@@ -23,7 +23,7 @@
23
23
  # THE SOFTWARE.
24
24
 
25
25
  require 'socket'
26
- require 'phusion_passenger/native_support'
26
+ PhusionPassenger.require_passenger_lib 'native_support'
27
27
 
28
28
  module PhusionPassenger
29
29
 
@@ -44,7 +44,7 @@ class << self
44
44
  def install_framework_extensions!(*args)
45
45
  require 'active_support/version' if defined?(::ActiveSupport) && !defined?(::ActiveSupport::VERSION)
46
46
  if defined?(::ActiveSupport) && ::ActiveSupport::VERSION::MAJOR >= 3
47
- require 'phusion_passenger/active_support3_extensions/init'
47
+ PhusionPassenger.require_passenger_lib 'active_support3_extensions/init'
48
48
  ActiveSupport3Extensions.init!(PhusionPassenger::App.options, *args)
49
49
  end
50
50
  end
@@ -22,7 +22,7 @@
22
22
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
23
  # THE SOFTWARE.
24
24
 
25
- require 'phusion_passenger/utils/tee_input'
25
+ PhusionPassenger.require_passenger_lib 'utils/tee_input'
26
26
 
27
27
  module PhusionPassenger
28
28
  module Rack
@@ -24,15 +24,14 @@
24
24
 
25
25
  require 'socket'
26
26
  require 'fcntl'
27
- require 'phusion_passenger'
28
- require 'phusion_passenger/constants'
29
- require 'phusion_passenger/public_api'
30
- require 'phusion_passenger/message_client'
31
- require 'phusion_passenger/debug_logging'
32
- require 'phusion_passenger/utils'
33
- require 'phusion_passenger/utils/tmpdir'
34
- require 'phusion_passenger/ruby_core_enhancements'
35
- require 'phusion_passenger/request_handler/thread_handler'
27
+ PhusionPassenger.require_passenger_lib 'constants'
28
+ PhusionPassenger.require_passenger_lib 'public_api'
29
+ PhusionPassenger.require_passenger_lib 'message_client'
30
+ PhusionPassenger.require_passenger_lib 'debug_logging'
31
+ PhusionPassenger.require_passenger_lib 'utils'
32
+ PhusionPassenger.require_passenger_lib 'utils/tmpdir'
33
+ PhusionPassenger.require_passenger_lib 'ruby_core_enhancements'
34
+ PhusionPassenger.require_passenger_lib 'request_handler/thread_handler'
36
35
 
37
36
  module PhusionPassenger
38
37
 
@@ -21,11 +21,11 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
- require 'phusion_passenger/constants'
25
- require 'phusion_passenger/debug_logging'
26
- require 'phusion_passenger/message_channel'
27
- require 'phusion_passenger/utils'
28
- require 'phusion_passenger/utils/unseekable_socket'
24
+ PhusionPassenger.require_passenger_lib 'constants'
25
+ PhusionPassenger.require_passenger_lib 'debug_logging'
26
+ PhusionPassenger.require_passenger_lib 'message_channel'
27
+ PhusionPassenger.require_passenger_lib 'utils'
28
+ PhusionPassenger.require_passenger_lib 'utils/unseekable_socket'
29
29
 
30
30
  module PhusionPassenger
31
31
  class RequestHandler
@@ -40,11 +40,12 @@ class ThreadHandler
40
40
  end
41
41
 
42
42
  REQUEST_METHOD = 'REQUEST_METHOD'.freeze
43
+ GET = 'GET'.freeze
43
44
  PING = 'PING'.freeze
44
45
  OOBW = 'OOBW'.freeze
45
46
  PASSENGER_CONNECT_PASSWORD = 'PASSENGER_CONNECT_PASSWORD'.freeze
46
47
  CONTENT_LENGTH = 'CONTENT_LENGTH'.freeze
47
- TRANSFER_ENCODING = 'TRANSFER_ENCODING'.freeze
48
+ HTTP_TRANSFER_ENCODING = 'HTTP_TRANSFER_ENCODING'.freeze
48
49
 
49
50
  MAX_HEADER_SIZE = 128 * 1024
50
51
 
@@ -177,7 +178,7 @@ private
177
178
  if connection && !connection.closed?
178
179
  begin
179
180
  connection.close_write
180
- rescue SystemCallError
181
+ rescue SystemCallError, IOError
181
182
  end
182
183
  begin
183
184
  connection.close
@@ -275,8 +276,7 @@ private
275
276
  # end
276
277
 
277
278
  def prepare_request(connection, headers)
278
- if (!headers.has_key?(CONTENT_LENGTH) && !headers.has_key?(TRANSFER_ENCODING)) ||
279
- headers[CONTENT_LENGTH] == 0
279
+ if !may_have_request_body?(headers)
280
280
  connection.simulate_eof!
281
281
  end
282
282
 
@@ -384,6 +384,18 @@ private
384
384
  end
385
385
  end
386
386
 
387
+ def may_have_request_body?(headers)
388
+ if headers[REQUEST_METHOD] == GET
389
+ if content_length = headers[CONTENT_LENGTH]
390
+ return content_length != 0
391
+ else
392
+ return headers.has_key?(HTTP_TRANSFER_ENCODING)
393
+ end
394
+ else
395
+ return true
396
+ end
397
+ end
398
+
387
399
  def should_reraise_error?(e)
388
400
  # Stubable by unit tests.
389
401
  return true