passenger 2.1.3 → 2.2.0

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 (398) hide show
  1. data/DEVELOPERS.TXT +2 -0
  2. data/INSTALL +3 -1
  3. data/LICENSE +19 -355
  4. data/NEWS +3 -0
  5. data/README +11 -4
  6. data/Rakefile +435 -236
  7. data/bin/passenger-config +20 -14
  8. data/bin/passenger-install-apache2-module +67 -201
  9. data/bin/passenger-install-nginx-module +477 -0
  10. data/bin/passenger-make-enterprisey +17 -12
  11. data/bin/passenger-memory-stats +33 -23
  12. data/bin/passenger-spawn-server +17 -12
  13. data/bin/passenger-status +18 -13
  14. data/bin/passenger-stress-test +17 -12
  15. data/doc/{Users guide.html → Users guide Apache.html } +79 -61
  16. data/doc/{Users guide.txt → Users guide Apache.txt } +43 -939
  17. data/doc/Users guide Nginx.html +2276 -0
  18. data/doc/Users guide Nginx.txt +776 -0
  19. data/doc/cxxapi/ApplicationPoolServer_8h-source.html +9 -4
  20. data/doc/cxxapi/ApplicationPool_8h-source.html +9 -4
  21. data/doc/cxxapi/Application_8h-source.html +26 -21
  22. data/doc/cxxapi/Bucket_8h-source.html +54 -44
  23. data/doc/cxxapi/CachedFileStat_8h-source.html +9 -4
  24. data/doc/cxxapi/Configuration_8h-source.html +357 -339
  25. data/doc/cxxapi/DirectoryMapper_8h-source.html +294 -280
  26. data/doc/cxxapi/DummySpawnManager_8h-source.html +9 -4
  27. data/doc/cxxapi/Exceptions_8h-source.html +9 -4
  28. data/doc/cxxapi/FileChecker_8h-source.html +9 -4
  29. data/doc/cxxapi/Hooks_8h-source.html +50 -40
  30. data/doc/cxxapi/Logging_8h-source.html +9 -4
  31. data/doc/cxxapi/MessageChannel_8h-source.html +20 -15
  32. data/doc/cxxapi/PoolOptions_8h-source.html +10 -5
  33. data/doc/cxxapi/SpawnManager_8h-source.html +9 -4
  34. data/doc/cxxapi/StandardApplicationPool_8h-source.html +10 -5
  35. data/doc/cxxapi/SystemTime_8h-source.html +9 -4
  36. data/doc/cxxapi/Utils_8h-source.html +242 -214
  37. data/doc/cxxapi/annotated.html +4 -28
  38. data/doc/cxxapi/classClient-members.html +4 -4
  39. data/doc/cxxapi/classClient.html +14 -11
  40. data/doc/cxxapi/classHooks-members.html +4 -5
  41. data/doc/cxxapi/classHooks.html +26 -24
  42. data/doc/cxxapi/classPassenger_1_1Application-members.html +4 -4
  43. data/doc/cxxapi/classPassenger_1_1Application.html +40 -37
  44. data/doc/cxxapi/classPassenger_1_1ApplicationPool-members.html +4 -4
  45. data/doc/cxxapi/classPassenger_1_1ApplicationPool.html +95 -92
  46. data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer-members.html +4 -4
  47. data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer.html +26 -23
  48. data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.map +1 -1
  49. data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.md5 +1 -1
  50. data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.png +0 -0
  51. data/doc/cxxapi/classPassenger_1_1Application_1_1Session-members.html +17 -17
  52. data/doc/cxxapi/classPassenger_1_1Application_1_1Session.html +139 -136
  53. data/doc/cxxapi/classPassenger_1_1BufferedUpload-members.html +4 -4
  54. data/doc/cxxapi/classPassenger_1_1BufferedUpload.html +13 -10
  55. data/doc/cxxapi/classPassenger_1_1BusyException-members.html +4 -4
  56. data/doc/cxxapi/classPassenger_1_1BusyException.html +11 -8
  57. data/doc/cxxapi/classPassenger_1_1ConfigurationException-members.html +4 -4
  58. data/doc/cxxapi/classPassenger_1_1ConfigurationException.html +11 -8
  59. data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +4 -5
  60. data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +45 -43
  61. data/doc/cxxapi/classPassenger_1_1DummySpawnManager-members.html +4 -4
  62. data/doc/cxxapi/classPassenger_1_1DummySpawnManager.html +13 -10
  63. data/doc/cxxapi/classPassenger_1_1FileChecker-members.html +4 -4
  64. data/doc/cxxapi/classPassenger_1_1FileChecker.html +22 -19
  65. data/doc/cxxapi/classPassenger_1_1FileNotFoundException-members.html +4 -4
  66. data/doc/cxxapi/classPassenger_1_1FileNotFoundException.html +12 -9
  67. data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.map +1 -1
  68. data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.md5 +1 -1
  69. data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.png +0 -0
  70. data/doc/cxxapi/classPassenger_1_1FileSystemException-members.html +4 -4
  71. data/doc/cxxapi/classPassenger_1_1FileSystemException.html +14 -11
  72. data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.map +1 -1
  73. data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.md5 +1 -1
  74. data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.png +0 -0
  75. data/doc/cxxapi/classPassenger_1_1IOException-members.html +4 -4
  76. data/doc/cxxapi/classPassenger_1_1IOException.html +12 -9
  77. data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.map +1 -1
  78. data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.md5 +1 -1
  79. data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.png +0 -0
  80. data/doc/cxxapi/classPassenger_1_1MessageChannel-members.html +4 -4
  81. data/doc/cxxapi/classPassenger_1_1MessageChannel.html +228 -225
  82. data/doc/cxxapi/classPassenger_1_1RuntimeException-members.html +4 -4
  83. data/doc/cxxapi/classPassenger_1_1RuntimeException.html +11 -8
  84. data/doc/cxxapi/classPassenger_1_1SpawnException-members.html +4 -4
  85. data/doc/cxxapi/classPassenger_1_1SpawnException.html +14 -11
  86. data/doc/cxxapi/classPassenger_1_1SpawnManager-members.html +4 -4
  87. data/doc/cxxapi/classPassenger_1_1SpawnManager.html +50 -47
  88. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool-members.html +4 -4
  89. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool.html +73 -70
  90. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.map +1 -1
  91. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.md5 +1 -1
  92. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.png +0 -0
  93. data/doc/cxxapi/classPassenger_1_1SystemException-members.html +4 -4
  94. data/doc/cxxapi/classPassenger_1_1SystemException.html +17 -14
  95. data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.map +1 -1
  96. data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.md5 +1 -1
  97. data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.png +0 -0
  98. data/doc/cxxapi/classPassenger_1_1SystemTime-members.html +4 -4
  99. data/doc/cxxapi/classPassenger_1_1SystemTime.html +14 -11
  100. data/doc/cxxapi/classes.html +35 -0
  101. data/doc/cxxapi/definitions_8h-source.html +9 -4
  102. data/doc/cxxapi/doxygen.css +311 -303
  103. data/doc/cxxapi/files.html +9 -18
  104. data/doc/cxxapi/functions.html +5 -224
  105. data/doc/cxxapi/functions_func.html +5 -185
  106. data/doc/cxxapi/functions_type.html +4 -4
  107. data/doc/cxxapi/functions_vars.html +4 -4
  108. data/doc/cxxapi/graph_legend.dot +19 -19
  109. data/doc/cxxapi/graph_legend.html +5 -5
  110. data/doc/cxxapi/graph_legend.png +0 -0
  111. data/doc/cxxapi/group__Configuration.html +11 -13
  112. data/doc/cxxapi/group__Configuration.png +0 -0
  113. data/doc/cxxapi/group__Core.html +10 -12
  114. data/doc/cxxapi/group__Core.png +0 -0
  115. data/doc/cxxapi/group__Exceptions.html +5 -7
  116. data/doc/cxxapi/group__Hooks.html +5 -7
  117. data/doc/cxxapi/group__Hooks.png +0 -0
  118. data/doc/cxxapi/group__Support.html +5 -624
  119. data/doc/cxxapi/hierarchy.html +6 -6
  120. data/doc/cxxapi/inherit__graph__0.map +1 -1
  121. data/doc/cxxapi/inherit__graph__0.md5 +1 -1
  122. data/doc/cxxapi/inherit__graph__0.png +0 -0
  123. data/doc/cxxapi/inherit__graph__1.map +1 -1
  124. data/doc/cxxapi/inherit__graph__1.md5 +1 -1
  125. data/doc/cxxapi/inherit__graph__1.png +0 -0
  126. data/doc/cxxapi/inherit__graph__10.map +1 -1
  127. data/doc/cxxapi/inherit__graph__10.md5 +1 -1
  128. data/doc/cxxapi/inherit__graph__10.png +0 -0
  129. data/doc/cxxapi/inherit__graph__11.map +1 -1
  130. data/doc/cxxapi/inherit__graph__11.md5 +1 -1
  131. data/doc/cxxapi/inherit__graph__11.png +0 -0
  132. data/doc/cxxapi/inherit__graph__12.map +1 -1
  133. data/doc/cxxapi/inherit__graph__12.md5 +1 -1
  134. data/doc/cxxapi/inherit__graph__12.png +0 -0
  135. data/doc/cxxapi/inherit__graph__13.map +1 -2
  136. data/doc/cxxapi/inherit__graph__13.md5 +1 -1
  137. data/doc/cxxapi/inherit__graph__13.png +0 -0
  138. data/doc/cxxapi/inherit__graph__14.map +2 -1
  139. data/doc/cxxapi/inherit__graph__14.md5 +1 -1
  140. data/doc/cxxapi/inherit__graph__14.png +0 -0
  141. data/doc/cxxapi/inherit__graph__15.map +1 -1
  142. data/doc/cxxapi/inherit__graph__15.md5 +1 -1
  143. data/doc/cxxapi/inherit__graph__15.png +0 -0
  144. data/doc/cxxapi/inherit__graph__16.map +1 -1
  145. data/doc/cxxapi/inherit__graph__16.md5 +1 -1
  146. data/doc/cxxapi/inherit__graph__16.png +0 -0
  147. data/doc/cxxapi/inherit__graph__17.map +1 -1
  148. data/doc/cxxapi/inherit__graph__17.md5 +1 -1
  149. data/doc/cxxapi/inherit__graph__17.png +0 -0
  150. data/doc/cxxapi/inherit__graph__18.map +1 -1
  151. data/doc/cxxapi/inherit__graph__18.md5 +1 -1
  152. data/doc/cxxapi/inherit__graph__18.png +0 -0
  153. data/doc/cxxapi/inherit__graph__19.map +1 -1
  154. data/doc/cxxapi/inherit__graph__19.md5 +1 -1
  155. data/doc/cxxapi/inherit__graph__19.png +0 -0
  156. data/doc/cxxapi/inherit__graph__2.map +1 -1
  157. data/doc/cxxapi/inherit__graph__2.md5 +1 -1
  158. data/doc/cxxapi/inherit__graph__2.png +0 -0
  159. data/doc/cxxapi/inherit__graph__20.map +2 -2
  160. data/doc/cxxapi/inherit__graph__20.md5 +1 -1
  161. data/doc/cxxapi/inherit__graph__20.png +0 -0
  162. data/doc/cxxapi/inherit__graph__21.map +1 -1
  163. data/doc/cxxapi/inherit__graph__21.md5 +1 -1
  164. data/doc/cxxapi/inherit__graph__21.png +0 -0
  165. data/doc/cxxapi/inherit__graph__3.map +1 -1
  166. data/doc/cxxapi/inherit__graph__3.md5 +1 -1
  167. data/doc/cxxapi/inherit__graph__3.png +0 -0
  168. data/doc/cxxapi/inherit__graph__4.map +1 -1
  169. data/doc/cxxapi/inherit__graph__4.md5 +1 -1
  170. data/doc/cxxapi/inherit__graph__4.png +0 -0
  171. data/doc/cxxapi/inherit__graph__5.map +1 -2
  172. data/doc/cxxapi/inherit__graph__5.md5 +1 -1
  173. data/doc/cxxapi/inherit__graph__5.png +0 -0
  174. data/doc/cxxapi/inherit__graph__6.map +2 -1
  175. data/doc/cxxapi/inherit__graph__6.md5 +1 -1
  176. data/doc/cxxapi/inherit__graph__6.png +0 -0
  177. data/doc/cxxapi/inherit__graph__7.map +1 -1
  178. data/doc/cxxapi/inherit__graph__7.md5 +1 -1
  179. data/doc/cxxapi/inherit__graph__7.png +0 -0
  180. data/doc/cxxapi/inherit__graph__8.map +1 -1
  181. data/doc/cxxapi/inherit__graph__8.md5 +1 -1
  182. data/doc/cxxapi/inherit__graph__8.png +0 -0
  183. data/doc/cxxapi/inherit__graph__9.map +1 -1
  184. data/doc/cxxapi/inherit__graph__9.md5 +1 -1
  185. data/doc/cxxapi/inherit__graph__9.png +0 -0
  186. data/doc/cxxapi/inherits.html +41 -41
  187. data/doc/cxxapi/main.html +4 -4
  188. data/doc/cxxapi/modules.html +4 -5
  189. data/doc/cxxapi/structPassenger_1_1AnythingToString-members.html +4 -4
  190. data/doc/cxxapi/structPassenger_1_1AnythingToString.html +13 -10
  191. data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4-members.html +5 -5
  192. data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4.html +16 -13
  193. data/doc/cxxapi/structPassenger_1_1PoolOptions-members.html +4 -4
  194. data/doc/cxxapi/structPassenger_1_1PoolOptions.html +63 -60
  195. data/doc/cxxapi/tabs.css +5 -2
  196. data/doc/cxxapi/tree.html +7 -81
  197. data/doc/rdoc/classes/ConditionVariable.html +59 -59
  198. data/doc/rdoc/classes/Exception.html +11 -11
  199. data/doc/rdoc/classes/GC.html +4 -4
  200. data/doc/rdoc/classes/IO.html +14 -14
  201. data/doc/rdoc/classes/PhusionPassenger.html +75 -20
  202. data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +153 -0
  203. data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +125 -130
  204. data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +236 -236
  205. data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +213 -213
  206. data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +28 -28
  207. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +91 -75
  208. data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +10 -10
  209. data/doc/rdoc/classes/PhusionPassenger/Application.html +64 -64
  210. data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +34 -34
  211. data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +13 -13
  212. data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +30 -30
  213. data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +10 -10
  214. data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +136 -136
  215. data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +24 -24
  216. data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +42 -42
  217. data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +55 -53
  218. data/doc/rdoc/classes/PhusionPassenger/Railz.html +1 -1
  219. data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +25 -30
  220. data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +23 -23
  221. data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +116 -117
  222. data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +22 -22
  223. data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +118 -124
  224. data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +10 -10
  225. data/doc/rdoc/classes/PhusionPassenger/Utils.html +354 -354
  226. data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +9 -9
  227. data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +37 -37
  228. data/doc/rdoc/classes/PlatformInfo.html +282 -261
  229. data/doc/rdoc/classes/RakeExtensions.html +7 -7
  230. data/doc/rdoc/classes/Signal.html +26 -26
  231. data/doc/rdoc/created.rid +1 -1
  232. data/doc/rdoc/files/DEVELOPERS_TXT.html +6 -1
  233. data/doc/rdoc/files/README.html +15 -6
  234. data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +1 -1
  235. data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +129 -0
  236. data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +20 -13
  237. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +19 -13
  238. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +19 -13
  239. data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +31 -1
  240. data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +31 -1
  241. data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +19 -13
  242. data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +19 -13
  243. data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +21 -12
  244. data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +19 -13
  245. data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +19 -13
  246. data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +19 -13
  247. data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +19 -13
  248. data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +19 -13
  249. data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +122 -0
  250. data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +19 -13
  251. data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +22 -12
  252. data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +21 -12
  253. data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +19 -13
  254. data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +1 -1
  255. data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +19 -13
  256. data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +21 -12
  257. data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +19 -13
  258. data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +19 -13
  259. data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +27 -21
  260. data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +21 -12
  261. data/doc/rdoc/files/misc/rake/extensions_rb.html +21 -12
  262. data/doc/rdoc/fr_class_index.html +1 -0
  263. data/doc/rdoc/fr_file_index.html +2 -0
  264. data/doc/rdoc/fr_method_index.html +116 -112
  265. data/doc/users_guide_snippets/analysis_and_system_maintenance_tools.txt +144 -0
  266. data/doc/users_guide_snippets/appendix_a_about.txt +13 -0
  267. data/doc/users_guide_snippets/appendix_b_terminology.txt +63 -0
  268. data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +304 -0
  269. data/doc/users_guide_snippets/global_queueing_explained.txt +78 -0
  270. data/doc/users_guide_snippets/rackup_specifications.txt +75 -0
  271. data/doc/users_guide_snippets/rails_spawn_method.txt +48 -0
  272. data/doc/users_guide_snippets/tips.txt +173 -0
  273. data/ext/apache2/Bucket.cpp +17 -12
  274. data/ext/apache2/Bucket.h +17 -12
  275. data/ext/apache2/Configuration.cpp +17 -12
  276. data/ext/apache2/Configuration.h +27 -14
  277. data/ext/apache2/DirectoryMapper.h +21 -12
  278. data/ext/apache2/Hooks.cpp +67 -21
  279. data/ext/apache2/Hooks.h +17 -12
  280. data/ext/apache2/mod_passenger.c +17 -12
  281. data/ext/{apache2 → common}/Application.h +19 -14
  282. data/ext/{apache2 → common}/ApplicationPool.h +17 -12
  283. data/ext/{apache2 → common}/ApplicationPoolServer.h +18 -72
  284. data/ext/{apache2 → common}/ApplicationPoolServerExecutable.cpp +45 -104
  285. data/ext/common/ApplicationPoolStatusReporter.h +212 -0
  286. data/ext/{apache2 → common}/CachedFileStat.cpp +17 -12
  287. data/ext/{apache2 → common}/CachedFileStat.h +17 -12
  288. data/ext/{apache2 → common}/DummySpawnManager.h +17 -12
  289. data/ext/{apache2 → common}/Exceptions.h +17 -12
  290. data/ext/{apache2 → common}/FileChecker.h +17 -12
  291. data/ext/common/Logging.cpp +65 -0
  292. data/ext/{apache2 → common}/Logging.h +17 -12
  293. data/ext/{apache2 → common}/MessageChannel.h +17 -12
  294. data/ext/{apache2 → common}/PoolOptions.h +17 -12
  295. data/ext/{apache2 → common}/SpawnManager.h +17 -12
  296. data/ext/{apache2 → common}/StandardApplicationPool.h +17 -12
  297. data/ext/common/StaticString.h +147 -0
  298. data/ext/common/SystemTime.cpp +33 -0
  299. data/ext/{apache2 → common}/SystemTime.h +17 -12
  300. data/ext/{apache2 → common}/Utils.cpp +69 -12
  301. data/ext/{apache2 → common}/Utils.h +41 -12
  302. data/ext/nginx/Configuration.c +1091 -0
  303. data/ext/nginx/Configuration.h +71 -0
  304. data/ext/nginx/ContentHandler.c +1154 -0
  305. data/ext/nginx/ContentHandler.h +64 -0
  306. data/ext/nginx/HelperServer.cpp +857 -0
  307. data/ext/nginx/HttpStatusExtractor.h +161 -0
  308. data/ext/nginx/ScgiRequestParser.h +317 -0
  309. data/ext/nginx/StaticContentHandler.c +222 -0
  310. data/ext/nginx/StaticContentHandler.h +37 -0
  311. data/ext/nginx/config +41 -0
  312. data/ext/nginx/ngx_http_passenger_module.c +572 -0
  313. data/ext/nginx/ngx_http_passenger_module.h +72 -0
  314. data/ext/oxt/backtrace.cpp +8 -1
  315. data/ext/oxt/system_calls.cpp +40 -0
  316. data/ext/oxt/system_calls.hpp +14 -7
  317. data/ext/phusion_passenger/extconf.rb +17 -12
  318. data/ext/phusion_passenger/native_support.c +19 -12
  319. data/lib/phusion_passenger/abstract_installer.rb +196 -0
  320. data/lib/phusion_passenger/abstract_request_handler.rb +19 -24
  321. data/lib/phusion_passenger/abstract_server.rb +17 -12
  322. data/lib/phusion_passenger/abstract_server_collection.rb +17 -12
  323. data/lib/phusion_passenger/admin_tools.rb +23 -0
  324. data/lib/phusion_passenger/admin_tools/control_process.rb +39 -13
  325. data/lib/phusion_passenger/application.rb +17 -12
  326. data/lib/phusion_passenger/console_text_template.rb +17 -12
  327. data/lib/phusion_passenger/constants.rb +22 -11
  328. data/lib/phusion_passenger/dependencies.rb +47 -12
  329. data/lib/phusion_passenger/events.rb +17 -12
  330. data/lib/phusion_passenger/exceptions.rb +17 -12
  331. data/lib/phusion_passenger/html_template.rb +17 -12
  332. data/lib/phusion_passenger/message_channel.rb +17 -12
  333. data/lib/phusion_passenger/packaging.rb +39 -0
  334. data/lib/phusion_passenger/platform_info.rb +48 -22
  335. data/lib/phusion_passenger/rack/application_spawner.rb +22 -11
  336. data/lib/phusion_passenger/rack/request_handler.rb +21 -12
  337. data/lib/phusion_passenger/railz/application_spawner.rb +23 -23
  338. data/lib/phusion_passenger/railz/framework_spawner.rb +18 -14
  339. data/lib/phusion_passenger/railz/request_handler.rb +18 -11
  340. data/lib/phusion_passenger/simple_benchmarking.rb +17 -12
  341. data/lib/phusion_passenger/spawn_manager.rb +17 -20
  342. data/lib/phusion_passenger/templates/{apache_must_be_compiled_with_compatible_mpm.txt.erb → apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb} +0 -0
  343. data/lib/phusion_passenger/templates/{apache2_config_snippets.txt.erb → apache2/config_snippets.txt.erb} +0 -0
  344. data/lib/phusion_passenger/templates/{deployment_example.txt.erb → apache2/deployment_example.txt.erb} +0 -0
  345. data/lib/phusion_passenger/templates/{no_write_permission_to_passenger_root.txt.erb → apache2/no_write_permission_to_passenger_root.txt.erb} +0 -0
  346. data/lib/phusion_passenger/templates/{possible_solutions_for_compilation_and_installation_problems.txt.erb → apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb} +0 -0
  347. data/lib/phusion_passenger/templates/{run_installer_as_root.txt.erb → apache2/run_installer_as_root.txt.erb} +0 -0
  348. data/lib/phusion_passenger/templates/{welcome.txt.erb → apache2/welcome.txt.erb} +0 -0
  349. data/lib/phusion_passenger/templates/nginx/ask_for_extra_configure_flags.txt.erb +8 -0
  350. data/lib/phusion_passenger/templates/nginx/cannot_write_to_dir.txt.erb +11 -0
  351. data/lib/phusion_passenger/templates/nginx/config_snippets.txt.erb +17 -0
  352. data/lib/phusion_passenger/templates/nginx/config_snippets_inserted.txt.erb +20 -0
  353. data/lib/phusion_passenger/templates/nginx/confirm_extra_configure_flags.txt.erb +5 -0
  354. data/lib/phusion_passenger/templates/nginx/deployment_example.txt.erb +22 -0
  355. data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_downloaded.txt.erb +11 -0
  356. data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_extracted.txt.erb +11 -0
  357. data/lib/phusion_passenger/templates/nginx/possible_solutions_for_compilation_and_installation_problems.txt.erb +11 -0
  358. data/lib/phusion_passenger/templates/nginx/possible_solutions_for_download_and_extraction_problems.txt.erb +20 -0
  359. data/lib/phusion_passenger/templates/nginx/query_download_and_install.txt.erb +21 -0
  360. data/lib/phusion_passenger/templates/nginx/run_installer_as_root.txt.erb +8 -0
  361. data/lib/phusion_passenger/templates/nginx/welcome.txt.erb +15 -0
  362. data/lib/phusion_passenger/utils.rb +20 -15
  363. data/lib/phusion_passenger/wsgi/application_spawner.rb +18 -11
  364. data/lib/phusion_passenger/wsgi/request_handler.py +23 -0
  365. data/misc/copy_boost_headers.rb +23 -0
  366. data/misc/find_owner_pipe_leaks.rb +18 -11
  367. data/misc/rake/cplusplus.rb +18 -11
  368. data/misc/rake/extensions.rb +21 -14
  369. data/misc/render_error_pages.rb +18 -11
  370. data/test/ApplicationPoolServerTest.cpp +1 -3
  371. data/test/ApplicationPoolServer_ApplicationPoolTest.cpp +1 -1
  372. data/test/CxxTestMain.cpp +19 -3
  373. data/test/HttpStatusExtractorTest.cpp +181 -0
  374. data/test/ScgiRequestParserTest.cpp +337 -0
  375. data/test/StaticStringTest.cpp +51 -0
  376. data/test/UtilsTest.cpp +32 -0
  377. data/test/config.yml.example +5 -0
  378. data/test/{integration_tests.rb → integration_tests/apache2_tests.rb} +7 -299
  379. data/test/integration_tests/hello_world_rack_spec.rb +36 -0
  380. data/test/integration_tests/hello_world_wsgi_spec.rb +41 -0
  381. data/test/integration_tests/mycook_spec.rb +192 -0
  382. data/test/integration_tests/nginx_tests.rb +98 -0
  383. data/test/ruby/rack/application_spawner_spec.rb +40 -0
  384. data/test/stub/nginx/koi-utf +109 -0
  385. data/test/stub/nginx/koi-win +103 -0
  386. data/test/stub/nginx/mime.types +70 -0
  387. data/test/stub/nginx/nginx.conf.erb +57 -0
  388. data/test/stub/nginx/win-utf +126 -0
  389. data/test/stub/rails_apps/mycook/app/controllers/uploads_controller.rb +4 -0
  390. data/test/stub/rails_apps/mycook/config/routes.rb +1 -1
  391. data/test/stub/wsgi/passenger_wsgi.pyc +0 -0
  392. data/test/support/Support.h +40 -0
  393. data/test/support/nginx_controller.rb +98 -0
  394. data/test/support/test_helper.rb +79 -0
  395. metadata +1091 -1028
  396. data/benchmark/DummyRequestHandler.cpp +0 -101
  397. data/ext/apache2/Logging.cpp +0 -60
  398. data/ext/apache2/SystemTime.cpp +0 -28
@@ -85,9 +85,9 @@ fascade for the rest of the spawn manager system.
85
85
  <p>
86
86
  <b>Note</b>: <a href="SpawnManager.html">SpawnManager</a> may only be
87
87
  started synchronously with <a
88
- href="AbstractServer.html#M000125">AbstractServer#start_synchronously</a>.
88
+ href="AbstractServer.html#M000127">AbstractServer#start_synchronously</a>.
89
89
  Starting asynchronously has not been tested. Don&#8216;t forget to call <a
90
- href="SpawnManager.html#M000118">cleanup</a> after the server&#8216;s main
90
+ href="SpawnManager.html#M000115">cleanup</a> after the server&#8216;s main
91
91
  loop has finished.
92
92
  </p>
93
93
  <h2>Ruby on Rails optimizations</h2>
@@ -116,10 +116,10 @@ work around an obscure bug in ActiveSupport&#8216;s Dispatcher.
116
116
 
117
117
  <div class="sectiontitle">Methods</div>
118
118
  <ul>
119
- <li><a href="#M000118">cleanup</a></li>
120
- <li><a href="#M000115">new</a></li>
121
- <li><a href="#M000117">reload</a></li>
122
- <li><a href="#M000116">spawn_application</a></li>
119
+ <li><a href="#M000115">cleanup</a></li>
120
+ <li><a href="#M000112">new</a></li>
121
+ <li><a href="#M000114">reload</a></li>
122
+ <li><a href="#M000113">spawn_application</a></li>
123
123
  </ul>
124
124
 
125
125
  <div class="sectiontitle">Included Modules</div>
@@ -134,45 +134,45 @@ work around an obscure bug in ActiveSupport&#8216;s Dispatcher.
134
134
  <div class="sectiontitle">Public Class methods</div>
135
135
  <div class="method">
136
136
  <div class="title">
137
- <a name="M000115"></a><b>new</b>()
137
+ <a name="M000112"></a><b>new</b>()
138
138
  </div>
139
139
  <div class="sourcecode">
140
- <p class="source-link">[ <a href="javascript:toggleSource('M000115_source')" id="l_M000115_source">show source</a> ]</p>
141
- <div id="M000115_source" class="dyn-source">
140
+ <p class="source-link">[ <a href="javascript:toggleSource('M000112_source')" id="l_M000112_source">show source</a> ]</p>
141
+ <div id="M000112_source" class="dyn-source">
142
142
  <pre>
143
- <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 55</span>
144
- 55: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
145
- 56: <span class="ruby-keyword kw">super</span>()
146
- 57: <span class="ruby-ivar">@spawners</span> = <span class="ruby-constant">AbstractServerCollection</span>.<span class="ruby-identifier">new</span>
147
- 58: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:spawn_application</span>, <span class="ruby-identifier">:handle_spawn_application</span>)
148
- 59: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:reload</span>, <span class="ruby-identifier">:handle_reload</span>)
149
- 60: <span class="ruby-identifier">define_signal_handler</span>(<span class="ruby-value str">'SIGHUP'</span>, <span class="ruby-identifier">:reload</span>)
150
- 61:
151
- 62: <span class="ruby-comment cmt"># Start garbage collector in order to free up some existing</span>
152
- 63: <span class="ruby-comment cmt"># heap slots. This prevents the heap from growing unnecessarily</span>
153
- 64: <span class="ruby-comment cmt"># during the startup phase.</span>
154
- 65: <span class="ruby-constant">GC</span>.<span class="ruby-identifier">start</span>
155
- 66: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">GC</span>.<span class="ruby-identifier">copy_on_write_friendly?</span>
156
- 67: <span class="ruby-comment cmt"># Preload libraries for copy-on-write semantics.</span>
157
- 68: <span class="ruby-identifier">require</span> <span class="ruby-value str">'base64'</span>
158
- 69: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span>
159
- 70: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span>
160
- 71: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span>
161
- 72: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span>
162
- 73: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/html_template'</span>
163
- 74: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/platform_info'</span>
164
- 75: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/exceptions'</span>
165
- 76:
166
- 77: <span class="ruby-comment cmt"># Commonly used libraries.</span>
167
- 78: [<span class="ruby-value str">'mysql'</span>, <span class="ruby-value str">'sqlite3'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lib</span><span class="ruby-operator">|</span>
168
- 79: <span class="ruby-keyword kw">begin</span>
169
- 80: <span class="ruby-identifier">require</span> <span class="ruby-identifier">lib</span>
170
- 81: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span>
171
- 82: <span class="ruby-comment cmt"># Do nothing; ignore if not present.</span>
172
- 83: <span class="ruby-keyword kw">end</span>
173
- 84: <span class="ruby-keyword kw">end</span>
174
- 85: <span class="ruby-keyword kw">end</span>
175
- 86: <span class="ruby-keyword kw">end</span>
143
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 60</span>
144
+ 60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
145
+ 61: <span class="ruby-keyword kw">super</span>()
146
+ 62: <span class="ruby-ivar">@spawners</span> = <span class="ruby-constant">AbstractServerCollection</span>.<span class="ruby-identifier">new</span>
147
+ 63: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:spawn_application</span>, <span class="ruby-identifier">:handle_spawn_application</span>)
148
+ 64: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:reload</span>, <span class="ruby-identifier">:handle_reload</span>)
149
+ 65: <span class="ruby-identifier">define_signal_handler</span>(<span class="ruby-value str">'SIGHUP'</span>, <span class="ruby-identifier">:reload</span>)
150
+ 66:
151
+ 67: <span class="ruby-comment cmt"># Start garbage collector in order to free up some existing</span>
152
+ 68: <span class="ruby-comment cmt"># heap slots. This prevents the heap from growing unnecessarily</span>
153
+ 69: <span class="ruby-comment cmt"># during the startup phase.</span>
154
+ 70: <span class="ruby-constant">GC</span>.<span class="ruby-identifier">start</span>
155
+ 71: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">GC</span>.<span class="ruby-identifier">copy_on_write_friendly?</span>
156
+ 72: <span class="ruby-comment cmt"># Preload libraries for copy-on-write semantics.</span>
157
+ 73: <span class="ruby-identifier">require</span> <span class="ruby-value str">'base64'</span>
158
+ 74: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span>
159
+ 75: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span>
160
+ 76: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span>
161
+ 77: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span>
162
+ 78: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/html_template'</span>
163
+ 79: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/platform_info'</span>
164
+ 80: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/exceptions'</span>
165
+ 81:
166
+ 82: <span class="ruby-comment cmt"># Commonly used libraries.</span>
167
+ 83: [<span class="ruby-value str">'mysql'</span>, <span class="ruby-value str">'sqlite3'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lib</span><span class="ruby-operator">|</span>
168
+ 84: <span class="ruby-keyword kw">begin</span>
169
+ 85: <span class="ruby-identifier">require</span> <span class="ruby-identifier">lib</span>
170
+ 86: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span>
171
+ 87: <span class="ruby-comment cmt"># Do nothing; ignore if not present.</span>
172
+ 88: <span class="ruby-keyword kw">end</span>
173
+ 89: <span class="ruby-keyword kw">end</span>
174
+ 90: <span class="ruby-keyword kw">end</span>
175
+ 91: <span class="ruby-keyword kw">end</span>
176
176
  </pre>
177
177
  </div>
178
178
  </div>
@@ -180,7 +180,7 @@ work around an obscure bug in ActiveSupport&#8216;s Dispatcher.
180
180
  <div class="sectiontitle">Public Instance methods</div>
181
181
  <div class="method">
182
182
  <div class="title">
183
- <a name="M000118"></a><b>cleanup</b>()
183
+ <a name="M000115"></a><b>cleanup</b>()
184
184
  </div>
185
185
  <div class="description">
186
186
  <p>
@@ -189,20 +189,20 @@ href="SpawnManager.html">SpawnManager</a> is no longer needed.
189
189
  </p>
190
190
  </div>
191
191
  <div class="sourcecode">
192
- <p class="source-link">[ <a href="javascript:toggleSource('M000118_source')" id="l_M000118_source">show source</a> ]</p>
193
- <div id="M000118_source" class="dyn-source">
192
+ <p class="source-link">[ <a href="javascript:toggleSource('M000115_source')" id="l_M000115_source">show source</a> ]</p>
193
+ <div id="M000115_source" class="dyn-source">
194
194
  <pre>
195
- <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 215</span>
196
- 215: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup</span>
197
- 216: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">cleanup</span>
198
- 217: <span class="ruby-keyword kw">end</span>
195
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 214</span>
196
+ 214: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup</span>
197
+ 215: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">cleanup</span>
198
+ 216: <span class="ruby-keyword kw">end</span>
199
199
  </pre>
200
200
  </div>
201
201
  </div>
202
202
  </div>
203
203
  <div class="method">
204
204
  <div class="title">
205
- <a name="M000117"></a><b>reload</b>(app_root = nil)
205
+ <a name="M000114"></a><b>reload</b>(app_root = nil)
206
206
  </div>
207
207
  <div class="description">
208
208
  <p>
@@ -213,8 +213,8 @@ will be removed, no matter the application root.
213
213
  <p>
214
214
  <b>Long description:</b> <a href="Application.html">Application</a> code
215
215
  might be cached in memory. But once it a while, it will be necessary to <a
216
- href="SpawnManager.html#M000117">reload</a> the code for an application,
217
- such as after deploying a <a href="SpawnManager.html#M000115">new</a>
216
+ href="SpawnManager.html#M000114">reload</a> the code for an application,
217
+ such as after deploying a <a href="SpawnManager.html#M000112">new</a>
218
218
  version of the application. This method makes sure that any cached
219
219
  application code is removed, so that the next time an application instance
220
220
  is spawned, the application code will be freshly loaded into memory.
@@ -224,48 +224,42 @@ Raises AbstractServer::SpawnError if something went wrong.
224
224
  </p>
225
225
  </div>
226
226
  <div class="sourcecode">
227
- <p class="source-link">[ <a href="javascript:toggleSource('M000117_source')" id="l_M000117_source">show source</a> ]</p>
228
- <div id="M000117_source" class="dyn-source">
227
+ <p class="source-link">[ <a href="javascript:toggleSource('M000114_source')" id="l_M000114_source">show source</a> ]</p>
228
+ <div id="M000114_source" class="dyn-source">
229
229
  <pre>
230
- <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 182</span>
231
- 182: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span> = <span class="ruby-keyword kw">nil</span>)
232
- 183: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app_root</span>
233
- 184: <span class="ruby-keyword kw">begin</span>
234
- 185: <span class="ruby-identifier">app_root</span> = <span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">app_root</span>)
235
- 186: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">InvalidPath</span>
236
- 187: <span class="ruby-keyword kw">end</span>
237
- 188: <span class="ruby-keyword kw">end</span>
238
- 189: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
239
- 190: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app_root</span>
240
- 191: <span class="ruby-comment cmt"># Delete associated ApplicationSpawner.</span>
241
- 192: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-node">&quot;app:#{app_root}&quot;</span>)
242
- 193: <span class="ruby-keyword kw">else</span>
243
- 194: <span class="ruby-comment cmt"># Delete all ApplicationSpawners.</span>
244
- 195: <span class="ruby-identifier">keys_to_delete</span> = []
245
- 196: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span>
246
- 197: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Railz</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>)
247
- 198: <span class="ruby-identifier">keys_to_delete</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">key</span>
248
- 199: <span class="ruby-keyword kw">end</span>
249
- 200: <span class="ruby-keyword kw">end</span>
250
- 201: <span class="ruby-identifier">keys_to_delete</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
251
- 202: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
252
- 203: <span class="ruby-keyword kw">end</span>
253
- 204: <span class="ruby-keyword kw">end</span>
254
- 205: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span>
255
- 206: <span class="ruby-comment cmt"># Reload all FrameworkSpawners.</span>
256
- 207: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:reload</span>)
257
- 208: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span>)
258
- 209: <span class="ruby-keyword kw">end</span>
259
- 210: <span class="ruby-keyword kw">end</span>
260
- 211: <span class="ruby-keyword kw">end</span>
261
- 212: <span class="ruby-keyword kw">end</span>
230
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 187</span>
231
+ 187: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span> = <span class="ruby-keyword kw">nil</span>)
232
+ 188: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
233
+ 189: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app_root</span>
234
+ 190: <span class="ruby-comment cmt"># Delete associated ApplicationSpawner.</span>
235
+ 191: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-node">&quot;app:#{app_root}&quot;</span>)
236
+ 192: <span class="ruby-keyword kw">else</span>
237
+ 193: <span class="ruby-comment cmt"># Delete all ApplicationSpawners.</span>
238
+ 194: <span class="ruby-identifier">keys_to_delete</span> = []
239
+ 195: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span>
240
+ 196: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Railz</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>)
241
+ 197: <span class="ruby-identifier">keys_to_delete</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">key</span>
242
+ 198: <span class="ruby-keyword kw">end</span>
243
+ 199: <span class="ruby-keyword kw">end</span>
244
+ 200: <span class="ruby-identifier">keys_to_delete</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
245
+ 201: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
246
+ 202: <span class="ruby-keyword kw">end</span>
247
+ 203: <span class="ruby-keyword kw">end</span>
248
+ 204: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span>
249
+ 205: <span class="ruby-comment cmt"># Reload all FrameworkSpawners.</span>
250
+ 206: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:reload</span>)
251
+ 207: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span>)
252
+ 208: <span class="ruby-keyword kw">end</span>
253
+ 209: <span class="ruby-keyword kw">end</span>
254
+ 210: <span class="ruby-keyword kw">end</span>
255
+ 211: <span class="ruby-keyword kw">end</span>
262
256
  </pre>
263
257
  </div>
264
258
  </div>
265
259
  </div>
266
260
  <div class="method">
267
261
  <div class="title">
268
- <a name="M000116"></a><b>spawn_application</b>(options)
262
+ <a name="M000113"></a><b>spawn_application</b>(options)
269
263
  </div>
270
264
  <div class="description">
271
265
  <p>
@@ -294,12 +288,12 @@ must do one of these things:
294
288
 
295
289
  <ul>
296
290
  <li>Restart this <a href="SpawnManager.html">SpawnManager</a> by calling <a
297
- href="AbstractServer.html#M000126">AbstractServer#stop</a>, then <a
298
- href="AbstractServer.html#M000124">AbstractServer#start</a>.
291
+ href="AbstractServer.html#M000128">AbstractServer#stop</a>, then <a
292
+ href="AbstractServer.html#M000126">AbstractServer#start</a>.
299
293
 
300
294
  </li>
301
295
  <li>Reload the application by calling <a
302
- href="SpawnManager.html#M000117">reload</a> with the correct app_root
296
+ href="SpawnManager.html#M000114">reload</a> with the correct app_root
303
297
  argument.
304
298
 
305
299
  </li>
@@ -360,42 +354,42 @@ exception or called exit() during startup.
360
354
  </ul>
361
355
  </div>
362
356
  <div class="sourcecode">
363
- <p class="source-link">[ <a href="javascript:toggleSource('M000116_source')" id="l_M000116_source">show source</a> ]</p>
364
- <div id="M000116_source" class="dyn-source">
357
+ <p class="source-link">[ <a href="javascript:toggleSource('M000113_source')" id="l_M000113_source">show source</a> ]</p>
358
+ <div id="M000113_source" class="dyn-source">
365
359
  <pre>
366
- <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 136</span>
367
- 136: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">spawn_application</span>(<span class="ruby-identifier">options</span>)
368
- 137: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>]
369
- 138: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;The 'app_root' option must be given.&quot;</span>
370
- 139: <span class="ruby-keyword kw">end</span>
371
- 140: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>)
372
- 141:
373
- 142: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;rails&quot;</span>
374
- 143: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Railz</span><span class="ruby-operator">::</span><span class="ruby-constant">FrameworkSpawner</span>)
375
- 144: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span>
376
- 145: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span>
377
- 146: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span>
378
- 147: <span class="ruby-keyword kw">end</span>
379
- 148: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">spawn_rails_application</span>(<span class="ruby-identifier">options</span>)
380
- 149: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;rack&quot;</span>
381
- 150: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>)
382
- 151: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span>
360
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 141</span>
361
+ 141: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">spawn_application</span>(<span class="ruby-identifier">options</span>)
362
+ 142: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>]
363
+ 143: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;The 'app_root' option must be given.&quot;</span>
364
+ 144: <span class="ruby-keyword kw">end</span>
365
+ 145: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>)
366
+ 146:
367
+ 147: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;rails&quot;</span>
368
+ 148: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Railz</span><span class="ruby-operator">::</span><span class="ruby-constant">FrameworkSpawner</span>)
369
+ 149: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span>
370
+ 150: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span>
371
+ 151: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span>
383
372
  152: <span class="ruby-keyword kw">end</span>
384
- 153: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>.<span class="ruby-identifier">spawn_application</span>(
385
- 154: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>], <span class="ruby-identifier">options</span>
386
- 155: )
387
- 156: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;wsgi&quot;</span>
388
- 157: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/wsgi/application_spawner'</span>
389
- 158: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">WSGI</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>.<span class="ruby-identifier">spawn_application</span>(
390
- 159: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>],
391
- 160: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>],
392
- 161: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lowest_user&quot;</span>],
393
- 162: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;environment&quot;</span>]
394
- 163: )
395
- 164: <span class="ruby-keyword kw">else</span>
396
- 165: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Unknown 'app_type' value '#{options[&quot;app_type&quot;]}'.&quot;</span>
397
- 166: <span class="ruby-keyword kw">end</span>
398
- 167: <span class="ruby-keyword kw">end</span>
373
+ 153: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">spawn_rails_application</span>(<span class="ruby-identifier">options</span>)
374
+ 154: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;rack&quot;</span>
375
+ 155: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>)
376
+ 156: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span>
377
+ 157: <span class="ruby-keyword kw">end</span>
378
+ 158: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>.<span class="ruby-identifier">spawn_application</span>(
379
+ 159: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>], <span class="ruby-identifier">options</span>
380
+ 160: )
381
+ 161: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_type&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;wsgi&quot;</span>
382
+ 162: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/wsgi/application_spawner'</span>
383
+ 163: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">WSGI</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>.<span class="ruby-identifier">spawn_application</span>(
384
+ 164: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_root&quot;</span>],
385
+ 165: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>],
386
+ 166: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lowest_user&quot;</span>],
387
+ 167: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;environment&quot;</span>]
388
+ 168: )
389
+ 169: <span class="ruby-keyword kw">else</span>
390
+ 170: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;Unknown 'app_type' value '#{options[&quot;app_type&quot;]}'.&quot;</span>
391
+ 171: <span class="ruby-keyword kw">end</span>
392
+ 172: <span class="ruby-keyword kw">end</span>
399
393
  </pre>
400
394
  </div>
401
395
  </div>
@@ -80,7 +80,7 @@ StandardError
80
80
 
81
81
  <div class="sectiontitle">Methods</div>
82
82
  <ul>
83
- <li><a href="#M000122">new</a></li>
83
+ <li><a href="#M000121">new</a></li>
84
84
  </ul>
85
85
 
86
86
 
@@ -101,18 +101,18 @@ StandardError
101
101
  <div class="sectiontitle">Public Class methods</div>
102
102
  <div class="method">
103
103
  <div class="title">
104
- <a name="M000122"></a><b>new</b>(message, class_name, backtrace)
104
+ <a name="M000121"></a><b>new</b>(message, class_name, backtrace)
105
105
  </div>
106
106
  <div class="sourcecode">
107
- <p class="source-link">[ <a href="javascript:toggleSource('M000122_source')" id="l_M000122_source">show source</a> ]</p>
108
- <div id="M000122_source" class="dyn-source">
107
+ <p class="source-link">[ <a href="javascript:toggleSource('M000121_source')" id="l_M000121_source">show source</a> ]</p>
108
+ <div id="M000121_source" class="dyn-source">
109
109
  <pre>
110
- <span class="ruby-comment cmt"># File lib/phusion_passenger/exceptions.rb, line 88</span>
111
- 88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">class_name</span>, <span class="ruby-identifier">backtrace</span>)
112
- 89: <span class="ruby-keyword kw">super</span>(<span class="ruby-node">&quot;#{message} (#{class_name})&quot;</span>)
113
- 90: <span class="ruby-identifier">set_backtrace</span>(<span class="ruby-identifier">backtrace</span>)
114
- 91: <span class="ruby-ivar">@real_class_name</span> = <span class="ruby-identifier">class_name</span>
115
- 92: <span class="ruby-keyword kw">end</span>
110
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/exceptions.rb, line 93</span>
111
+ 93: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">class_name</span>, <span class="ruby-identifier">backtrace</span>)
112
+ 94: <span class="ruby-keyword kw">super</span>(<span class="ruby-node">&quot;#{message} (#{class_name})&quot;</span>)
113
+ 95: <span class="ruby-identifier">set_backtrace</span>(<span class="ruby-identifier">backtrace</span>)
114
+ 96: <span class="ruby-ivar">@real_class_name</span> = <span class="ruby-identifier">class_name</span>
115
+ 97: <span class="ruby-keyword kw">end</span>
116
116
  </pre>
117
117
  </div>
118
118
  </div>
@@ -78,23 +78,23 @@ Utility functions.
78
78
 
79
79
  <div class="sectiontitle">Methods</div>
80
80
  <ul>
81
- <li><a href="#M000072">assert_valid_app_root</a></li>
82
- <li><a href="#M000073">assert_valid_directory</a></li>
83
- <li><a href="#M000074">assert_valid_file</a></li>
84
- <li><a href="#M000076">assert_valid_groupname</a></li>
85
- <li><a href="#M000075">assert_valid_username</a></li>
86
- <li><a href="#M000077">close_all_io_objects_for_fds</a></li>
87
- <li><a href="#M000084">lower_privilege</a></li>
88
- <li><a href="#M000078">marshal_exception</a></li>
89
- <li><a href="#M000071">normalize_path</a></li>
90
- <li><a href="#M000087">passenger_tmpdir</a></li>
91
- <li><a href="#M000080">print_exception</a></li>
92
- <li><a href="#M000082">report_app_init_status</a></li>
93
- <li><a href="#M000081">safe_fork</a></li>
94
- <li><a href="#M000086">sanitize_spawn_options</a></li>
95
- <li><a href="#M000085">switch_to_user</a></li>
96
- <li><a href="#M000083">unmarshal_and_raise_errors</a></li>
97
- <li><a href="#M000079">unmarshal_exception</a></li>
81
+ <li><a href="#M000074">assert_valid_app_root</a></li>
82
+ <li><a href="#M000075">assert_valid_directory</a></li>
83
+ <li><a href="#M000076">assert_valid_file</a></li>
84
+ <li><a href="#M000078">assert_valid_groupname</a></li>
85
+ <li><a href="#M000077">assert_valid_username</a></li>
86
+ <li><a href="#M000073">canonicalize_path</a></li>
87
+ <li><a href="#M000079">close_all_io_objects_for_fds</a></li>
88
+ <li><a href="#M000086">lower_privilege</a></li>
89
+ <li><a href="#M000080">marshal_exception</a></li>
90
+ <li><a href="#M000089">passenger_tmpdir</a></li>
91
+ <li><a href="#M000082">print_exception</a></li>
92
+ <li><a href="#M000084">report_app_init_status</a></li>
93
+ <li><a href="#M000083">safe_fork</a></li>
94
+ <li><a href="#M000088">sanitize_spawn_options</a></li>
95
+ <li><a href="#M000087">switch_to_user</a></li>
96
+ <li><a href="#M000085">unmarshal_and_raise_errors</a></li>
97
+ <li><a href="#M000081">unmarshal_exception</a></li>
98
98
  </ul>
99
99
 
100
100
 
@@ -105,7 +105,7 @@ Utility functions.
105
105
  <div class="sectiontitle">Protected Instance methods</div>
106
106
  <div class="method">
107
107
  <div class="title">
108
- <a name="M000072"></a><b>assert_valid_app_root</b>(app_root)
108
+ <a name="M000074"></a><b>assert_valid_app_root</b>(app_root)
109
109
  </div>
110
110
  <div class="description">
111
111
  <p>
@@ -114,21 +114,21 @@ Raises <a href="InvalidPath.html">InvalidPath</a> if that is not the case.
114
114
  </p>
115
115
  </div>
116
116
  <div class="sourcecode">
117
- <p class="source-link">[ <a href="javascript:toggleSource('M000072_source')" id="l_M000072_source">show source</a> ]</p>
118
- <div id="M000072_source" class="dyn-source">
117
+ <p class="source-link">[ <a href="javascript:toggleSource('M000074_source')" id="l_M000074_source">show source</a> ]</p>
118
+ <div id="M000074_source" class="dyn-source">
119
119
  <pre>
120
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 54</span>
121
- 54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_app_root</span>(<span class="ruby-identifier">app_root</span>)
122
- 55: <span class="ruby-identifier">assert_valid_directory</span>(<span class="ruby-identifier">app_root</span>)
123
- 56: <span class="ruby-identifier">assert_valid_file</span>(<span class="ruby-node">&quot;#{app_root}/config/environment.rb&quot;</span>)
124
- 57: <span class="ruby-keyword kw">end</span>
120
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 59</span>
121
+ 59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_app_root</span>(<span class="ruby-identifier">app_root</span>)
122
+ 60: <span class="ruby-identifier">assert_valid_directory</span>(<span class="ruby-identifier">app_root</span>)
123
+ 61: <span class="ruby-identifier">assert_valid_file</span>(<span class="ruby-node">&quot;#{app_root}/config/environment.rb&quot;</span>)
124
+ 62: <span class="ruby-keyword kw">end</span>
125
125
  </pre>
126
126
  </div>
127
127
  </div>
128
128
  </div>
129
129
  <div class="method">
130
130
  <div class="title">
131
- <a name="M000073"></a><b>assert_valid_directory</b>(path)
131
+ <a name="M000075"></a><b>assert_valid_directory</b>(path)
132
132
  </div>
133
133
  <div class="description">
134
134
  <p>
@@ -137,22 +137,22 @@ href="InvalidPath.html">InvalidPath</a></tt> if it isn&#8216;t.
137
137
  </p>
138
138
  </div>
139
139
  <div class="sourcecode">
140
- <p class="source-link">[ <a href="javascript:toggleSource('M000073_source')" id="l_M000073_source">show source</a> ]</p>
141
- <div id="M000073_source" class="dyn-source">
140
+ <p class="source-link">[ <a href="javascript:toggleSource('M000075_source')" id="l_M000075_source">show source</a> ]</p>
141
+ <div id="M000075_source" class="dyn-source">
142
142
  <pre>
143
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 60</span>
144
- 60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_directory</span>(<span class="ruby-identifier">path</span>)
145
- 61: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">path</span>)
146
- 62: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidPath</span>, <span class="ruby-node">&quot;'#{path}' is not a valid directory.&quot;</span>
147
- 63: <span class="ruby-keyword kw">end</span>
148
- 64: <span class="ruby-keyword kw">end</span>
143
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 65</span>
144
+ 65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_directory</span>(<span class="ruby-identifier">path</span>)
145
+ 66: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">path</span>)
146
+ 67: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidPath</span>, <span class="ruby-node">&quot;'#{path}' is not a valid directory.&quot;</span>
147
+ 68: <span class="ruby-keyword kw">end</span>
148
+ 69: <span class="ruby-keyword kw">end</span>
149
149
  </pre>
150
150
  </div>
151
151
  </div>
152
152
  </div>
153
153
  <div class="method">
154
154
  <div class="title">
155
- <a name="M000074"></a><b>assert_valid_file</b>(path)
155
+ <a name="M000076"></a><b>assert_valid_file</b>(path)
156
156
  </div>
157
157
  <div class="description">
158
158
  <p>
@@ -161,22 +161,22 @@ href="InvalidPath.html">InvalidPath</a></tt> if it isn&#8216;t.
161
161
  </p>
162
162
  </div>
163
163
  <div class="sourcecode">
164
- <p class="source-link">[ <a href="javascript:toggleSource('M000074_source')" id="l_M000074_source">show source</a> ]</p>
165
- <div id="M000074_source" class="dyn-source">
164
+ <p class="source-link">[ <a href="javascript:toggleSource('M000076_source')" id="l_M000076_source">show source</a> ]</p>
165
+ <div id="M000076_source" class="dyn-source">
166
166
  <pre>
167
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 67</span>
168
- 67: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_file</span>(<span class="ruby-identifier">path</span>)
169
- 68: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">path</span>)
170
- 69: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidPath</span>, <span class="ruby-node">&quot;'#{path}' is not a valid file.&quot;</span>
171
- 70: <span class="ruby-keyword kw">end</span>
172
- 71: <span class="ruby-keyword kw">end</span>
167
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 72</span>
168
+ 72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_file</span>(<span class="ruby-identifier">path</span>)
169
+ 73: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">path</span>)
170
+ 74: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidPath</span>, <span class="ruby-node">&quot;'#{path}' is not a valid file.&quot;</span>
171
+ 75: <span class="ruby-keyword kw">end</span>
172
+ 76: <span class="ruby-keyword kw">end</span>
173
173
  </pre>
174
174
  </div>
175
175
  </div>
176
176
  </div>
177
177
  <div class="method">
178
178
  <div class="title">
179
- <a name="M000076"></a><b>assert_valid_groupname</b>(groupname)
179
+ <a name="M000078"></a><b>assert_valid_groupname</b>(groupname)
180
180
  </div>
181
181
  <div class="description">
182
182
  <p>
@@ -185,21 +185,21 @@ if that is not the case.
185
185
  </p>
186
186
  </div>
187
187
  <div class="sourcecode">
188
- <p class="source-link">[ <a href="javascript:toggleSource('M000076_source')" id="l_M000076_source">show source</a> ]</p>
189
- <div id="M000076_source" class="dyn-source">
188
+ <p class="source-link">[ <a href="javascript:toggleSource('M000078_source')" id="l_M000078_source">show source</a> ]</p>
189
+ <div id="M000078_source" class="dyn-source">
190
190
  <pre>
191
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 82</span>
192
- 82: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_groupname</span>(<span class="ruby-identifier">groupname</span>)
193
- 83: <span class="ruby-comment cmt"># If groupname does not exist then getgrnam() will raise an ArgumentError.</span>
194
- 84: <span class="ruby-identifier">groupname</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getgrnam</span>(<span class="ruby-identifier">groupname</span>)
195
- 85: <span class="ruby-keyword kw">end</span>
191
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 87</span>
192
+ 87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_groupname</span>(<span class="ruby-identifier">groupname</span>)
193
+ 88: <span class="ruby-comment cmt"># If groupname does not exist then getgrnam() will raise an ArgumentError.</span>
194
+ 89: <span class="ruby-identifier">groupname</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getgrnam</span>(<span class="ruby-identifier">groupname</span>)
195
+ 90: <span class="ruby-keyword kw">end</span>
196
196
  </pre>
197
197
  </div>
198
198
  </div>
199
199
  </div>
200
200
  <div class="method">
201
201
  <div class="title">
202
- <a name="M000075"></a><b>assert_valid_username</b>(username)
202
+ <a name="M000077"></a><b>assert_valid_username</b>(username)
203
203
  </div>
204
204
  <div class="description">
205
205
  <p>
@@ -207,140 +207,140 @@ Assert that <tt>username</tt> is a valid username. Raises ArgumentError if
207
207
  that is not the case.
208
208
  </p>
209
209
  </div>
210
- <div class="sourcecode">
211
- <p class="source-link">[ <a href="javascript:toggleSource('M000075_source')" id="l_M000075_source">show source</a> ]</p>
212
- <div id="M000075_source" class="dyn-source">
213
- <pre>
214
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 75</span>
215
- 75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_username</span>(<span class="ruby-identifier">username</span>)
216
- 76: <span class="ruby-comment cmt"># If username does not exist then getpwnam() will raise an ArgumentError.</span>
217
- 77: <span class="ruby-identifier">username</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwnam</span>(<span class="ruby-identifier">username</span>)
218
- 78: <span class="ruby-keyword kw">end</span>
219
- </pre>
220
- </div>
221
- </div>
222
- </div>
223
- <div class="method">
224
- <div class="title">
225
- <a name="M000077"></a><b>close_all_io_objects_for_fds</b>(file_descriptors_to_leave_open)
226
- </div>
227
210
  <div class="sourcecode">
228
211
  <p class="source-link">[ <a href="javascript:toggleSource('M000077_source')" id="l_M000077_source">show source</a> ]</p>
229
212
  <div id="M000077_source" class="dyn-source">
230
213
  <pre>
231
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 87</span>
232
- 87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close_all_io_objects_for_fds</span>(<span class="ruby-identifier">file_descriptors_to_leave_open</span>)
233
- 88: <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">each_object</span>(<span class="ruby-constant">IO</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
234
- 89: <span class="ruby-keyword kw">begin</span>
235
- 90: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">file_descriptors_to_leave_open</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">io</span>.<span class="ruby-identifier">fileno</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">io</span>.<span class="ruby-identifier">closed?</span>
236
- 91: <span class="ruby-identifier">io</span>.<span class="ruby-identifier">close</span>
237
- 92: <span class="ruby-keyword kw">end</span>
238
- 93: <span class="ruby-keyword kw">rescue</span>
239
- 94: <span class="ruby-keyword kw">end</span>
240
- 95: <span class="ruby-keyword kw">end</span>
241
- 96: <span class="ruby-keyword kw">end</span>
214
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 80</span>
215
+ 80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_username</span>(<span class="ruby-identifier">username</span>)
216
+ 81: <span class="ruby-comment cmt"># If username does not exist then getpwnam() will raise an ArgumentError.</span>
217
+ 82: <span class="ruby-identifier">username</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwnam</span>(<span class="ruby-identifier">username</span>)
218
+ 83: <span class="ruby-keyword kw">end</span>
242
219
  </pre>
243
220
  </div>
244
221
  </div>
245
222
  </div>
246
223
  <div class="method">
247
224
  <div class="title">
248
- <a name="M000084"></a><b>lower_privilege</b>(filename, lowest_user = &quot;nobody&quot;)
225
+ <a name="M000073"></a><b>canonicalize_path</b>(path)
249
226
  </div>
250
227
  <div class="description">
251
228
  <p>
252
- Lower the current process&#8216;s privilege to the owner of the given file.
253
- No exceptions will be raised in the event that privilege lowering fails.
229
+ Return the canonicalized version of <tt>path</tt>. This path is guaranteed
230
+ to to be &quot;normal&quot;, i.e. it doesn&#8216;t contain stuff like
231
+ &quot;..&quot; or &quot;/&quot;, and it fully resolves symbolic links.
232
+ </p>
233
+ <p>
234
+ Raises SystemCallError if something went wrong. Raises ArgumentError if
235
+ <tt>path</tt> is nil. Raises <a href="InvalidPath.html">InvalidPath</a> if
236
+ <tt>path</tt> does not appear to be a valid path.
254
237
  </p>
255
238
  </div>
256
239
  <div class="sourcecode">
257
- <p class="source-link">[ <a href="javascript:toggleSource('M000084_source')" id="l_M000084_source">show source</a> ]</p>
258
- <div id="M000084_source" class="dyn-source">
240
+ <p class="source-link">[ <a href="javascript:toggleSource('M000073_source')" id="l_M000073_source">show source</a> ]</p>
241
+ <div id="M000073_source" class="dyn-source">
259
242
  <pre>
260
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 274</span>
261
- 274: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lower_privilege</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">lowest_user</span> = <span class="ruby-value str">&quot;nobody&quot;</span>)
262
- 275: <span class="ruby-identifier">stat</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">lstat</span>(<span class="ruby-identifier">filename</span>)
263
- 276: <span class="ruby-keyword kw">begin</span>
264
- 277: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">stat</span>.<span class="ruby-identifier">uid</span>)
265
- 278: <span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">lowest_user</span>)
266
- 279: <span class="ruby-keyword kw">end</span>
267
- 280: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPERM</span>
268
- 281: <span class="ruby-comment cmt"># No problem if we were unable to switch user.</span>
269
- 282: <span class="ruby-keyword kw">end</span>
270
- 283: <span class="ruby-keyword kw">end</span>
243
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 50</span>
244
+ 50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">canonicalize_path</span>(<span class="ruby-identifier">path</span>)
245
+ 51: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;The 'path' argument may not be nil&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">nil?</span>
246
+ 52: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">realpath</span>.<span class="ruby-identifier">to_s</span>
247
+ 53: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
248
+ 54: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidAPath</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
249
+ 55: <span class="ruby-keyword kw">end</span>
271
250
  </pre>
272
251
  </div>
273
252
  </div>
274
253
  </div>
275
254
  <div class="method">
276
255
  <div class="title">
277
- <a name="M000078"></a><b>marshal_exception</b>(exception)
256
+ <a name="M000079"></a><b>close_all_io_objects_for_fds</b>(file_descriptors_to_leave_open)
278
257
  </div>
279
258
  <div class="sourcecode">
280
- <p class="source-link">[ <a href="javascript:toggleSource('M000078_source')" id="l_M000078_source">show source</a> ]</p>
281
- <div id="M000078_source" class="dyn-source">
259
+ <p class="source-link">[ <a href="javascript:toggleSource('M000079_source')" id="l_M000079_source">show source</a> ]</p>
260
+ <div id="M000079_source" class="dyn-source">
282
261
  <pre>
283
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 98</span>
284
- 98: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">exception</span>)
285
- 99: <span class="ruby-identifier">data</span> = {
286
- 100: <span class="ruby-identifier">:message</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>,
287
- 101: <span class="ruby-identifier">:class</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>,
288
- 102: <span class="ruby-identifier">:backtrace</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>
289
- 103: }
290
- 104: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">InitializationError</span>)
291
- 105: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:is_initialization_error</span>] = <span class="ruby-keyword kw">true</span>
292
- 106: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">child_exception</span>
293
- 107: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:child_exception</span>] = <span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">child_exception</span>)
294
- 108: <span class="ruby-keyword kw">end</span>
295
- 109: <span class="ruby-keyword kw">else</span>
296
- 110: <span class="ruby-keyword kw">begin</span>
297
- 111: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">exception</span>)
298
- 112: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
299
- 113: <span class="ruby-identifier">e</span> = <span class="ruby-constant">UnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>,
300
- 114: <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>)
301
- 115: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">e</span>)
302
- 116: <span class="ruby-keyword kw">end</span>
303
- 117: <span class="ruby-keyword kw">end</span>
304
- 118: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">data</span>)
305
- 119: <span class="ruby-keyword kw">end</span>
262
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 92</span>
263
+ 92: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close_all_io_objects_for_fds</span>(<span class="ruby-identifier">file_descriptors_to_leave_open</span>)
264
+ 93: <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">each_object</span>(<span class="ruby-constant">IO</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
265
+ 94: <span class="ruby-keyword kw">begin</span>
266
+ 95: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">file_descriptors_to_leave_open</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">io</span>.<span class="ruby-identifier">fileno</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">io</span>.<span class="ruby-identifier">closed?</span>
267
+ 96: <span class="ruby-identifier">io</span>.<span class="ruby-identifier">close</span>
268
+ 97: <span class="ruby-keyword kw">end</span>
269
+ 98: <span class="ruby-keyword kw">rescue</span>
270
+ 99: <span class="ruby-keyword kw">end</span>
271
+ 100: <span class="ruby-keyword kw">end</span>
272
+ 101: <span class="ruby-keyword kw">end</span>
306
273
  </pre>
307
274
  </div>
308
275
  </div>
309
276
  </div>
310
277
  <div class="method">
311
278
  <div class="title">
312
- <a name="M000071"></a><b>normalize_path</b>(path)
279
+ <a name="M000086"></a><b>lower_privilege</b>(filename, lowest_user = &quot;nobody&quot;)
313
280
  </div>
314
281
  <div class="description">
315
282
  <p>
316
- Return the absolute version of <tt>path</tt>. This path is guaranteed to to
317
- be &quot;normal&quot;, i.e. it doesn&#8216;t contain stuff like
318
- &quot;..&quot; or &quot;/&quot;, and it correctly respects symbolic links.
319
- </p>
320
- <p>
321
- Raises SystemCallError if something went wrong. Raises ArgumentError if
322
- <tt>path</tt> is nil. Raises <a href="InvalidPath.html">InvalidPath</a> if
323
- <tt>path</tt> does not appear to be a valid path.
283
+ Lower the current process&#8216;s privilege to the owner of the given file.
284
+ No exceptions will be raised in the event that privilege lowering fails.
324
285
  </p>
325
286
  </div>
326
287
  <div class="sourcecode">
327
- <p class="source-link">[ <a href="javascript:toggleSource('M000071_source')" id="l_M000071_source">show source</a> ]</p>
328
- <div id="M000071_source" class="dyn-source">
288
+ <p class="source-link">[ <a href="javascript:toggleSource('M000086_source')" id="l_M000086_source">show source</a> ]</p>
289
+ <div id="M000086_source" class="dyn-source">
329
290
  <pre>
330
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 45</span>
331
- 45: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">path</span>)
332
- 46: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;The 'path' argument may not be nil&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">nil?</span>
333
- 47: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">realpath</span>.<span class="ruby-identifier">to_s</span>
334
- 48: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
335
- 49: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidAPath</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
336
- 50: <span class="ruby-keyword kw">end</span>
291
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 279</span>
292
+ 279: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lower_privilege</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">lowest_user</span> = <span class="ruby-value str">&quot;nobody&quot;</span>)
293
+ 280: <span class="ruby-identifier">stat</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">lstat</span>(<span class="ruby-identifier">filename</span>)
294
+ 281: <span class="ruby-keyword kw">begin</span>
295
+ 282: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">stat</span>.<span class="ruby-identifier">uid</span>)
296
+ 283: <span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">lowest_user</span>)
297
+ 284: <span class="ruby-keyword kw">end</span>
298
+ 285: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPERM</span>
299
+ 286: <span class="ruby-comment cmt"># No problem if we were unable to switch user.</span>
300
+ 287: <span class="ruby-keyword kw">end</span>
301
+ 288: <span class="ruby-keyword kw">end</span>
337
302
  </pre>
338
303
  </div>
339
304
  </div>
340
305
  </div>
341
306
  <div class="method">
342
307
  <div class="title">
343
- <a name="M000087"></a><b>passenger_tmpdir</b>(create = true)
308
+ <a name="M000080"></a><b>marshal_exception</b>(exception)
309
+ </div>
310
+ <div class="sourcecode">
311
+ <p class="source-link">[ <a href="javascript:toggleSource('M000080_source')" id="l_M000080_source">show source</a> ]</p>
312
+ <div id="M000080_source" class="dyn-source">
313
+ <pre>
314
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 103</span>
315
+ 103: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">exception</span>)
316
+ 104: <span class="ruby-identifier">data</span> = {
317
+ 105: <span class="ruby-identifier">:message</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>,
318
+ 106: <span class="ruby-identifier">:class</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>,
319
+ 107: <span class="ruby-identifier">:backtrace</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>
320
+ 108: }
321
+ 109: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">InitializationError</span>)
322
+ 110: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:is_initialization_error</span>] = <span class="ruby-keyword kw">true</span>
323
+ 111: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">child_exception</span>
324
+ 112: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:child_exception</span>] = <span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">child_exception</span>)
325
+ 113: <span class="ruby-keyword kw">end</span>
326
+ 114: <span class="ruby-keyword kw">else</span>
327
+ 115: <span class="ruby-keyword kw">begin</span>
328
+ 116: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">exception</span>)
329
+ 117: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
330
+ 118: <span class="ruby-identifier">e</span> = <span class="ruby-constant">UnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>,
331
+ 119: <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>)
332
+ 120: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">e</span>)
333
+ 121: <span class="ruby-keyword kw">end</span>
334
+ 122: <span class="ruby-keyword kw">end</span>
335
+ 123: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">data</span>)
336
+ 124: <span class="ruby-keyword kw">end</span>
337
+ </pre>
338
+ </div>
339
+ </div>
340
+ </div>
341
+ <div class="method">
342
+ <div class="title">
343
+ <a name="M000089"></a><b>passenger_tmpdir</b>(create = true)
344
344
  </div>
345
345
  <div class="description">
346
346
  <p>
@@ -350,34 +350,34 @@ directory if it doesn&#8216;t exist.
350
350
  </p>
351
351
  </div>
352
352
  <div class="sourcecode">
353
- <p class="source-link">[ <a href="javascript:toggleSource('M000087_source')" id="l_M000087_source">show source</a> ]</p>
354
- <div id="M000087_source" class="dyn-source">
353
+ <p class="source-link">[ <a href="javascript:toggleSource('M000089_source')" id="l_M000089_source">show source</a> ]</p>
354
+ <div id="M000089_source" class="dyn-source">
355
355
  <pre>
356
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 338</span>
357
- 338: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">passenger_tmpdir</span>(<span class="ruby-identifier">create</span> = <span class="ruby-keyword kw">true</span>)
358
- 339: <span class="ruby-identifier">dir</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PASSENGER_INSTANCE_TEMP_DIR'</span>]
359
- 340: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">empty?</span>
360
- 341: <span class="ruby-identifier">dir</span> = <span class="ruby-node">&quot;#{Dir.tmpdir}/passenger.#{Process.pid}&quot;</span>
361
- 342: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PASSENGER_INSTANCE_TEMP_DIR'</span>] = <span class="ruby-identifier">dir</span>
362
- 343: <span class="ruby-keyword kw">end</span>
363
- 344: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">create</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">dir</span>)
364
- 345: <span class="ruby-comment cmt"># This is a very minimal implementation of the function</span>
365
- 346: <span class="ruby-comment cmt"># passengerCreateTempDir() in Utils.cpp. This implementation</span>
366
- 347: <span class="ruby-comment cmt"># is only meant to make the unit tests pass. For production</span>
367
- 348: <span class="ruby-comment cmt"># systems one should pre-create the temp directory with</span>
368
- 349: <span class="ruby-comment cmt"># passengerCreateTempDir().</span>
369
- 350: <span class="ruby-identifier">system</span>(<span class="ruby-value str">&quot;mkdir&quot;</span>, <span class="ruby-value str">&quot;-p&quot;</span>, <span class="ruby-value str">&quot;-m&quot;</span>, <span class="ruby-value str">&quot;u=wxs,g=wx,o=wx&quot;</span>, <span class="ruby-identifier">dir</span>)
370
- 351: <span class="ruby-identifier">system</span>(<span class="ruby-value str">&quot;mkdir&quot;</span>, <span class="ruby-value str">&quot;-p&quot;</span>, <span class="ruby-value str">&quot;-m&quot;</span>, <span class="ruby-value str">&quot;u=wxs,g=wx,o=wx&quot;</span>, <span class="ruby-node">&quot;#{dir}/backends&quot;</span>)
371
- 352: <span class="ruby-keyword kw">end</span>
372
- 353: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">dir</span>
373
- 354: <span class="ruby-keyword kw">end</span>
356
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 343</span>
357
+ 343: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">passenger_tmpdir</span>(<span class="ruby-identifier">create</span> = <span class="ruby-keyword kw">true</span>)
358
+ 344: <span class="ruby-identifier">dir</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PASSENGER_INSTANCE_TEMP_DIR'</span>]
359
+ 345: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">empty?</span>
360
+ 346: <span class="ruby-identifier">dir</span> = <span class="ruby-node">&quot;#{Dir.tmpdir}/passenger.#{Process.pid}&quot;</span>
361
+ 347: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PASSENGER_INSTANCE_TEMP_DIR'</span>] = <span class="ruby-identifier">dir</span>
362
+ 348: <span class="ruby-keyword kw">end</span>
363
+ 349: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">create</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">dir</span>)
364
+ 350: <span class="ruby-comment cmt"># This is a very minimal implementation of the function</span>
365
+ 351: <span class="ruby-comment cmt"># passengerCreateTempDir() in Utils.cpp. This implementation</span>
366
+ 352: <span class="ruby-comment cmt"># is only meant to make the unit tests pass. For production</span>
367
+ 353: <span class="ruby-comment cmt"># systems one should pre-create the temp directory with</span>
368
+ 354: <span class="ruby-comment cmt"># passengerCreateTempDir().</span>
369
+ 355: <span class="ruby-identifier">system</span>(<span class="ruby-value str">&quot;mkdir&quot;</span>, <span class="ruby-value str">&quot;-p&quot;</span>, <span class="ruby-value str">&quot;-m&quot;</span>, <span class="ruby-value str">&quot;u=wxs,g=wx,o=wx&quot;</span>, <span class="ruby-identifier">dir</span>)
370
+ 356: <span class="ruby-identifier">system</span>(<span class="ruby-value str">&quot;mkdir&quot;</span>, <span class="ruby-value str">&quot;-p&quot;</span>, <span class="ruby-value str">&quot;-m&quot;</span>, <span class="ruby-value str">&quot;u=wxs,g=wx,o=wx&quot;</span>, <span class="ruby-node">&quot;#{dir}/backends&quot;</span>)
371
+ 357: <span class="ruby-keyword kw">end</span>
372
+ 358: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">dir</span>
373
+ 359: <span class="ruby-keyword kw">end</span>
374
374
  </pre>
375
375
  </div>
376
376
  </div>
377
377
  </div>
378
378
  <div class="method">
379
379
  <div class="title">
380
- <a name="M000080"></a><b>print_exception</b>(current_location, exception)
380
+ <a name="M000082"></a><b>print_exception</b>(current_location, exception)
381
381
  </div>
382
382
  <div class="description">
383
383
  <p>
@@ -389,23 +389,23 @@ currently at. Usually the current class name will be enough.
389
389
  </p>
390
390
  </div>
391
391
  <div class="sourcecode">
392
- <p class="source-link">[ <a href="javascript:toggleSource('M000080_source')" id="l_M000080_source">show source</a> ]</p>
393
- <div id="M000080_source" class="dyn-source">
392
+ <p class="source-link">[ <a href="javascript:toggleSource('M000082_source')" id="l_M000082_source">show source</a> ]</p>
393
+ <div id="M000082_source" class="dyn-source">
394
394
  <pre>
395
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 152</span>
396
- 152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_exception</span>(<span class="ruby-identifier">current_location</span>, <span class="ruby-identifier">exception</span>)
397
- 153: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">SystemExit</span>)
398
- 154: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace_string</span>(<span class="ruby-identifier">current_location</span>))
399
- 155: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">flush</span>
400
- 156: <span class="ruby-keyword kw">end</span>
401
- 157: <span class="ruby-keyword kw">end</span>
395
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 157</span>
396
+ 157: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_exception</span>(<span class="ruby-identifier">current_location</span>, <span class="ruby-identifier">exception</span>)
397
+ 158: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">SystemExit</span>)
398
+ 159: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace_string</span>(<span class="ruby-identifier">current_location</span>))
399
+ 160: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">flush</span>
400
+ 161: <span class="ruby-keyword kw">end</span>
401
+ 162: <span class="ruby-keyword kw">end</span>
402
402
  </pre>
403
403
  </div>
404
404
  </div>
405
405
  </div>
406
406
  <div class="method">
407
407
  <div class="title">
408
- <a name="M000082"></a><b>report_app_init_status</b>(channel) {|| ...}
408
+ <a name="M000084"></a><b>report_app_init_status</b>(channel) {|| ...}
409
409
  </div>
410
410
  <div class="description">
411
411
  <p>
@@ -417,55 +417,55 @@ for SystemExit.
417
417
  </p>
418
418
  </div>
419
419
  <div class="sourcecode">
420
- <p class="source-link">[ <a href="javascript:toggleSource('M000082_source')" id="l_M000082_source">show source</a> ]</p>
421
- <div id="M000082_source" class="dyn-source">
420
+ <p class="source-link">[ <a href="javascript:toggleSource('M000084_source')" id="l_M000084_source">show source</a> ]</p>
421
+ <div id="M000084_source" class="dyn-source">
422
422
  <pre>
423
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 201</span>
424
- 201: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">report_app_init_status</span>(<span class="ruby-identifier">channel</span>)
425
- 202: <span class="ruby-keyword kw">begin</span>
426
- 203: <span class="ruby-identifier">old_global_stderr</span> = <span class="ruby-identifier">$stderr</span>
427
- 204: <span class="ruby-identifier">old_stderr</span> = <span class="ruby-constant">STDERR</span>
428
- 205: <span class="ruby-identifier">stderr_output</span> = <span class="ruby-value str">&quot;&quot;</span>
429
- 206: <span class="ruby-identifier">tempfile</span> = <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'passenger-stderr'</span>)
430
- 207: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">unlink</span>
431
- 208: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:remove_const</span>, <span class="ruby-value str">'STDERR'</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
432
- 209: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-value str">'STDERR'</span>, <span class="ruby-identifier">tempfile</span>)
433
- 210: <span class="ruby-keyword kw">begin</span>
434
- 211: <span class="ruby-keyword kw">yield</span>
435
- 212: <span class="ruby-keyword kw">ensure</span>
436
- 213: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:remove_const</span>, <span class="ruby-value str">'STDERR'</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
437
- 214: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-value str">'STDERR'</span>, <span class="ruby-identifier">old_stderr</span>)
438
- 215: <span class="ruby-identifier">$stderr</span> = <span class="ruby-identifier">old_global_stderr</span>
439
- 216: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tempfile</span>
440
- 217: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">rewind</span>
441
- 218: <span class="ruby-identifier">stderr_output</span> = <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">read</span>
442
- 219: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
443
- 220: <span class="ruby-keyword kw">end</span>
444
- 221: <span class="ruby-keyword kw">end</span>
445
- 222: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'success'</span>)
446
- 223: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
447
- 224: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-constant">ScriptError</span>, <span class="ruby-constant">NoMemoryError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
448
- 225: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TESTING_PASSENGER'</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'1'</span>
449
- 226: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">e</span>)
450
- 227: <span class="ruby-keyword kw">end</span>
451
- 228: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'exception'</span>)
452
- 229: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">e</span>))
453
- 230: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">stderr_output</span>)
454
- 231: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
455
- 232: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SystemExit</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
456
- 233: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'exit'</span>)
423
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 206</span>
424
+ 206: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">report_app_init_status</span>(<span class="ruby-identifier">channel</span>)
425
+ 207: <span class="ruby-keyword kw">begin</span>
426
+ 208: <span class="ruby-identifier">old_global_stderr</span> = <span class="ruby-identifier">$stderr</span>
427
+ 209: <span class="ruby-identifier">old_stderr</span> = <span class="ruby-constant">STDERR</span>
428
+ 210: <span class="ruby-identifier">stderr_output</span> = <span class="ruby-value str">&quot;&quot;</span>
429
+ 211: <span class="ruby-identifier">tempfile</span> = <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'passenger-stderr'</span>)
430
+ 212: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">unlink</span>
431
+ 213: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:remove_const</span>, <span class="ruby-value str">'STDERR'</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
432
+ 214: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-value str">'STDERR'</span>, <span class="ruby-identifier">tempfile</span>)
433
+ 215: <span class="ruby-keyword kw">begin</span>
434
+ 216: <span class="ruby-keyword kw">yield</span>
435
+ 217: <span class="ruby-keyword kw">ensure</span>
436
+ 218: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:remove_const</span>, <span class="ruby-value str">'STDERR'</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
437
+ 219: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-value str">'STDERR'</span>, <span class="ruby-identifier">old_stderr</span>)
438
+ 220: <span class="ruby-identifier">$stderr</span> = <span class="ruby-identifier">old_global_stderr</span>
439
+ 221: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tempfile</span>
440
+ 222: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">rewind</span>
441
+ 223: <span class="ruby-identifier">stderr_output</span> = <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">read</span>
442
+ 224: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
443
+ 225: <span class="ruby-keyword kw">end</span>
444
+ 226: <span class="ruby-keyword kw">end</span>
445
+ 227: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'success'</span>)
446
+ 228: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
447
+ 229: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-constant">ScriptError</span>, <span class="ruby-constant">NoMemoryError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
448
+ 230: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TESTING_PASSENGER'</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'1'</span>
449
+ 231: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">e</span>)
450
+ 232: <span class="ruby-keyword kw">end</span>
451
+ 233: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'exception'</span>)
457
452
  234: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">e</span>))
458
453
  235: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">stderr_output</span>)
459
- 236: <span class="ruby-identifier">raise</span>
460
- 237: <span class="ruby-keyword kw">end</span>
461
- 238: <span class="ruby-keyword kw">end</span>
454
+ 236: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
455
+ 237: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SystemExit</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
456
+ 238: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'exit'</span>)
457
+ 239: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">e</span>))
458
+ 240: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">stderr_output</span>)
459
+ 241: <span class="ruby-identifier">raise</span>
460
+ 242: <span class="ruby-keyword kw">end</span>
461
+ 243: <span class="ruby-keyword kw">end</span>
462
462
  </pre>
463
463
  </div>
464
464
  </div>
465
465
  </div>
466
466
  <div class="method">
467
467
  <div class="title">
468
- <a name="M000081"></a><b>safe_fork</b>(current_location = self.class, double_fork = false) {|| ...}
468
+ <a name="M000083"></a><b>safe_fork</b>(current_location = self.class, double_fork = false) {|| ...}
469
469
  </div>
470
470
  <div class="description">
471
471
  <p>
@@ -484,122 +484,122 @@ the expense of not being able to waitpid() the second child.
484
484
  </p>
485
485
  </div>
486
486
  <div class="sourcecode">
487
- <p class="source-link">[ <a href="javascript:toggleSource('M000081_source')" id="l_M000081_source">show source</a> ]</p>
488
- <div id="M000081_source" class="dyn-source">
487
+ <p class="source-link">[ <a href="javascript:toggleSource('M000083_source')" id="l_M000083_source">show source</a> ]</p>
488
+ <div id="M000083_source" class="dyn-source">
489
489
  <pre>
490
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 169</span>
491
- 169: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">safe_fork</span>(<span class="ruby-identifier">current_location</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>, <span class="ruby-identifier">double_fork</span> = <span class="ruby-keyword kw">false</span>)
492
- 170: <span class="ruby-identifier">pid</span> = <span class="ruby-identifier">fork</span>
493
- 171: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid</span>.<span class="ruby-identifier">nil?</span>
494
- 172: <span class="ruby-keyword kw">begin</span>
495
- 173: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_fork</span>
496
- 174: <span class="ruby-identifier">pid2</span> = <span class="ruby-identifier">fork</span>
497
- 175: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid2</span>.<span class="ruby-identifier">nil?</span>
498
- 176: <span class="ruby-keyword kw">yield</span>
499
- 177: <span class="ruby-keyword kw">end</span>
500
- 178: <span class="ruby-keyword kw">else</span>
501
- 179: <span class="ruby-keyword kw">yield</span>
502
- 180: <span class="ruby-keyword kw">end</span>
503
- 181: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
504
- 182: <span class="ruby-identifier">print_exception</span>(<span class="ruby-identifier">current_location</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">e</span>)
505
- 183: <span class="ruby-keyword kw">ensure</span>
506
- 184: <span class="ruby-identifier">exit!</span>
507
- 185: <span class="ruby-keyword kw">end</span>
508
- 186: <span class="ruby-keyword kw">else</span>
509
- 187: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_fork</span>
510
- 188: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">waitpid</span>(<span class="ruby-identifier">pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
511
- 189: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pid</span>
512
- 190: <span class="ruby-keyword kw">else</span>
513
- 191: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pid</span>
514
- 192: <span class="ruby-keyword kw">end</span>
515
- 193: <span class="ruby-keyword kw">end</span>
516
- 194: <span class="ruby-keyword kw">end</span>
490
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 174</span>
491
+ 174: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">safe_fork</span>(<span class="ruby-identifier">current_location</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>, <span class="ruby-identifier">double_fork</span> = <span class="ruby-keyword kw">false</span>)
492
+ 175: <span class="ruby-identifier">pid</span> = <span class="ruby-identifier">fork</span>
493
+ 176: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid</span>.<span class="ruby-identifier">nil?</span>
494
+ 177: <span class="ruby-keyword kw">begin</span>
495
+ 178: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_fork</span>
496
+ 179: <span class="ruby-identifier">pid2</span> = <span class="ruby-identifier">fork</span>
497
+ 180: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid2</span>.<span class="ruby-identifier">nil?</span>
498
+ 181: <span class="ruby-keyword kw">yield</span>
499
+ 182: <span class="ruby-keyword kw">end</span>
500
+ 183: <span class="ruby-keyword kw">else</span>
501
+ 184: <span class="ruby-keyword kw">yield</span>
502
+ 185: <span class="ruby-keyword kw">end</span>
503
+ 186: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
504
+ 187: <span class="ruby-identifier">print_exception</span>(<span class="ruby-identifier">current_location</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">e</span>)
505
+ 188: <span class="ruby-keyword kw">ensure</span>
506
+ 189: <span class="ruby-identifier">exit!</span>
507
+ 190: <span class="ruby-keyword kw">end</span>
508
+ 191: <span class="ruby-keyword kw">else</span>
509
+ 192: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_fork</span>
510
+ 193: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">waitpid</span>(<span class="ruby-identifier">pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
511
+ 194: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pid</span>
512
+ 195: <span class="ruby-keyword kw">else</span>
513
+ 196: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pid</span>
514
+ 197: <span class="ruby-keyword kw">end</span>
515
+ 198: <span class="ruby-keyword kw">end</span>
516
+ 199: <span class="ruby-keyword kw">end</span>
517
517
  </pre>
518
518
  </div>
519
519
  </div>
520
520
  </div>
521
521
  <div class="method">
522
522
  <div class="title">
523
- <a name="M000086"></a><b>sanitize_spawn_options</b>(options)
523
+ <a name="M000088"></a><b>sanitize_spawn_options</b>(options)
524
524
  </div>
525
525
  <div class="sourcecode">
526
- <p class="source-link">[ <a href="javascript:toggleSource('M000086_source')" id="l_M000086_source">show source</a> ]</p>
527
- <div id="M000086_source" class="dyn-source">
526
+ <p class="source-link">[ <a href="javascript:toggleSource('M000088_source')" id="l_M000088_source">show source</a> ]</p>
527
+ <div id="M000088_source" class="dyn-source">
528
528
  <pre>
529
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 318</span>
530
- 318: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>)
531
- 319: <span class="ruby-identifier">defaults</span> = {
532
- 320: <span class="ruby-value str">&quot;lower_privilege&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
533
- 321: <span class="ruby-value str">&quot;lowest_user&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;nobody&quot;</span>,
534
- 322: <span class="ruby-value str">&quot;environment&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;production&quot;</span>,
535
- 323: <span class="ruby-value str">&quot;app_type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;rails&quot;</span>,
536
- 324: <span class="ruby-value str">&quot;spawn_method&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;smart-lv2&quot;</span>,
537
- 325: <span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">-1</span>,
538
- 326: <span class="ruby-value str">&quot;app_spawner_timeout&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">-1</span>
539
- 327: }
540
- 328: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
541
- 329: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;true&quot;</span>
542
- 330: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span>].<span class="ruby-identifier">to_i</span>
543
- 331: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_spawner_timeout&quot;</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_spawner_timeout&quot;</span>].<span class="ruby-identifier">to_i</span>
544
- 332: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">options</span>
545
- 333: <span class="ruby-keyword kw">end</span>
529
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 323</span>
530
+ 323: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>)
531
+ 324: <span class="ruby-identifier">defaults</span> = {
532
+ 325: <span class="ruby-value str">&quot;lower_privilege&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">true</span>,
533
+ 326: <span class="ruby-value str">&quot;lowest_user&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;nobody&quot;</span>,
534
+ 327: <span class="ruby-value str">&quot;environment&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;production&quot;</span>,
535
+ 328: <span class="ruby-value str">&quot;app_type&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;rails&quot;</span>,
536
+ 329: <span class="ruby-value str">&quot;spawn_method&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value str">&quot;smart-lv2&quot;</span>,
537
+ 330: <span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">-1</span>,
538
+ 331: <span class="ruby-value str">&quot;app_spawner_timeout&quot;</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-value">-1</span>
539
+ 332: }
540
+ 333: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
541
+ 334: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;true&quot;</span>
542
+ 335: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;framework_spawner_timeout&quot;</span>].<span class="ruby-identifier">to_i</span>
543
+ 336: <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_spawner_timeout&quot;</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">&quot;app_spawner_timeout&quot;</span>].<span class="ruby-identifier">to_i</span>
544
+ 337: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">options</span>
545
+ 338: <span class="ruby-keyword kw">end</span>
546
546
  </pre>
547
547
  </div>
548
548
  </div>
549
549
  </div>
550
550
  <div class="method">
551
551
  <div class="title">
552
- <a name="M000085"></a><b>switch_to_user</b>(user)
552
+ <a name="M000087"></a><b>switch_to_user</b>(user)
553
553
  </div>
554
554
  <div class="sourcecode">
555
- <p class="source-link">[ <a href="javascript:toggleSource('M000085_source')" id="l_M000085_source">show source</a> ]</p>
556
- <div id="M000085_source" class="dyn-source">
555
+ <p class="source-link">[ <a href="javascript:toggleSource('M000087_source')" id="l_M000087_source">show source</a> ]</p>
556
+ <div id="M000087_source" class="dyn-source">
557
557
  <pre>
558
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 285</span>
559
- 285: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">user</span>)
560
- 286: <span class="ruby-keyword kw">begin</span>
561
- 287: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
562
- 288: <span class="ruby-identifier">pw</span> = <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwnam</span>(<span class="ruby-identifier">user</span>)
563
- 289: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">user</span>
564
- 290: <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">uid</span>
565
- 291: <span class="ruby-identifier">gid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">gid</span>
566
- 292: <span class="ruby-keyword kw">else</span>
567
- 293: <span class="ruby-identifier">pw</span> = <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwuid</span>(<span class="ruby-identifier">user</span>)
568
- 294: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">name</span>
569
- 295: <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">user</span>
558
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 290</span>
559
+ 290: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">user</span>)
560
+ 291: <span class="ruby-keyword kw">begin</span>
561
+ 292: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
562
+ 293: <span class="ruby-identifier">pw</span> = <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwnam</span>(<span class="ruby-identifier">user</span>)
563
+ 294: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">user</span>
564
+ 295: <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">uid</span>
570
565
  296: <span class="ruby-identifier">gid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">gid</span>
571
- 297: <span class="ruby-keyword kw">end</span>
572
- 298: <span class="ruby-keyword kw">rescue</span>
573
- 299: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
574
- 300: <span class="ruby-keyword kw">end</span>
575
- 301: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uid</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
576
- 302: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
577
- 303: <span class="ruby-keyword kw">else</span>
578
- 304: <span class="ruby-comment cmt"># Some systems are broken. initgroups can fail because of</span>
579
- 305: <span class="ruby-comment cmt"># all kinds of stupid reasons. So we ignore any errors</span>
580
- 306: <span class="ruby-comment cmt"># raised by initgroups.</span>
581
- 307: <span class="ruby-keyword kw">begin</span>
582
- 308: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">groups</span> = <span class="ruby-constant">Process</span>.<span class="ruby-identifier">initgroups</span>(<span class="ruby-identifier">username</span>, <span class="ruby-identifier">gid</span>)
583
- 309: <span class="ruby-keyword kw">rescue</span>
584
- 310: <span class="ruby-keyword kw">end</span>
585
- 311: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">Sys</span>.<span class="ruby-identifier">setgid</span>(<span class="ruby-identifier">gid</span>)
586
- 312: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">Sys</span>.<span class="ruby-identifier">setuid</span>(<span class="ruby-identifier">uid</span>)
587
- 313: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'HOME'</span>] = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">dir</span>
588
- 314: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
589
- 315: <span class="ruby-keyword kw">end</span>
590
- 316: <span class="ruby-keyword kw">end</span>
566
+ 297: <span class="ruby-keyword kw">else</span>
567
+ 298: <span class="ruby-identifier">pw</span> = <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwuid</span>(<span class="ruby-identifier">user</span>)
568
+ 299: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">name</span>
569
+ 300: <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">user</span>
570
+ 301: <span class="ruby-identifier">gid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">gid</span>
571
+ 302: <span class="ruby-keyword kw">end</span>
572
+ 303: <span class="ruby-keyword kw">rescue</span>
573
+ 304: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
574
+ 305: <span class="ruby-keyword kw">end</span>
575
+ 306: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uid</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
576
+ 307: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
577
+ 308: <span class="ruby-keyword kw">else</span>
578
+ 309: <span class="ruby-comment cmt"># Some systems are broken. initgroups can fail because of</span>
579
+ 310: <span class="ruby-comment cmt"># all kinds of stupid reasons. So we ignore any errors</span>
580
+ 311: <span class="ruby-comment cmt"># raised by initgroups.</span>
581
+ 312: <span class="ruby-keyword kw">begin</span>
582
+ 313: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">groups</span> = <span class="ruby-constant">Process</span>.<span class="ruby-identifier">initgroups</span>(<span class="ruby-identifier">username</span>, <span class="ruby-identifier">gid</span>)
583
+ 314: <span class="ruby-keyword kw">rescue</span>
584
+ 315: <span class="ruby-keyword kw">end</span>
585
+ 316: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">Sys</span>.<span class="ruby-identifier">setgid</span>(<span class="ruby-identifier">gid</span>)
586
+ 317: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">Sys</span>.<span class="ruby-identifier">setuid</span>(<span class="ruby-identifier">uid</span>)
587
+ 318: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'HOME'</span>] = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">dir</span>
588
+ 319: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
589
+ 320: <span class="ruby-keyword kw">end</span>
590
+ 321: <span class="ruby-keyword kw">end</span>
591
591
  </pre>
592
592
  </div>
593
593
  </div>
594
594
  </div>
595
595
  <div class="method">
596
596
  <div class="title">
597
- <a name="M000083"></a><b>unmarshal_and_raise_errors</b>(channel, app_type = &quot;rails&quot;)
597
+ <a name="M000085"></a><b>unmarshal_and_raise_errors</b>(channel, app_type = &quot;rails&quot;)
598
598
  </div>
599
599
  <div class="description">
600
600
  <p>
601
601
  Receive status information that was sent to <tt>channel</tt> by <a
602
- href="Utils.html#M000082">report_app_init_status</a>. If an error occured
602
+ href="Utils.html#M000084">report_app_init_status</a>. If an error occured
603
603
  according to the received information, then an appropriate exception will
604
604
  be raised.
605
605
  </p>
@@ -616,72 +616,72 @@ Raises:
616
616
  </ul>
617
617
  </div>
618
618
  <div class="sourcecode">
619
- <p class="source-link">[ <a href="javascript:toggleSource('M000083_source')" id="l_M000083_source">show source</a> ]</p>
620
- <div id="M000083_source" class="dyn-source">
619
+ <p class="source-link">[ <a href="javascript:toggleSource('M000085_source')" id="l_M000085_source">show source</a> ]</p>
620
+ <div id="M000085_source" class="dyn-source">
621
621
  <pre>
622
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 248</span>
623
- 248: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshal_and_raise_errors</span>(<span class="ruby-identifier">channel</span>, <span class="ruby-identifier">app_type</span> = <span class="ruby-value str">&quot;rails&quot;</span>)
624
- 249: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read</span>
625
- 250: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">nil?</span>
626
- 251: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EOFError</span>, <span class="ruby-value str">&quot;Unexpected end-of-file detected.&quot;</span>
627
- 252: <span class="ruby-keyword kw">end</span>
628
- 253: <span class="ruby-identifier">status</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
629
- 254: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exception'</span>
630
- 255: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>)
631
- 256: <span class="ruby-identifier">stderr</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>
632
- 257: <span class="ruby-comment cmt">#print_exception(self.class.to_s, child_exception)</span>
633
- 258: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">new</span>(
634
- 259: <span class="ruby-node">&quot;Application '#{@app_root}' raised an exception: &quot;</span> <span class="ruby-operator">&lt;&lt;</span>
635
- 260: <span class="ruby-node">&quot;#{child_exception.class} (#{child_exception.message})&quot;</span>,
636
- 261: <span class="ruby-identifier">child_exception</span>,
637
- 262: <span class="ruby-identifier">app_type</span>,
638
- 263: <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">stderr</span>)
639
- 264: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exit'</span>
640
- 265: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>)
641
- 266: <span class="ruby-identifier">stderr</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>
642
- 267: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Application '#{@app_root}' exited during startup&quot;</span>,
643
- 268: <span class="ruby-identifier">child_exception</span>, <span class="ruby-identifier">app_type</span>, <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">stderr</span>)
644
- 269: <span class="ruby-keyword kw">end</span>
645
- 270: <span class="ruby-keyword kw">end</span>
622
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 253</span>
623
+ 253: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshal_and_raise_errors</span>(<span class="ruby-identifier">channel</span>, <span class="ruby-identifier">app_type</span> = <span class="ruby-value str">&quot;rails&quot;</span>)
624
+ 254: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read</span>
625
+ 255: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">nil?</span>
626
+ 256: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EOFError</span>, <span class="ruby-value str">&quot;Unexpected end-of-file detected.&quot;</span>
627
+ 257: <span class="ruby-keyword kw">end</span>
628
+ 258: <span class="ruby-identifier">status</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
629
+ 259: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exception'</span>
630
+ 260: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>)
631
+ 261: <span class="ruby-identifier">stderr</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>
632
+ 262: <span class="ruby-comment cmt">#print_exception(self.class.to_s, child_exception)</span>
633
+ 263: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">new</span>(
634
+ 264: <span class="ruby-node">&quot;Application '#{@app_root}' raised an exception: &quot;</span> <span class="ruby-operator">&lt;&lt;</span>
635
+ 265: <span class="ruby-node">&quot;#{child_exception.class} (#{child_exception.message})&quot;</span>,
636
+ 266: <span class="ruby-identifier">child_exception</span>,
637
+ 267: <span class="ruby-identifier">app_type</span>,
638
+ 268: <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">stderr</span>)
639
+ 269: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exit'</span>
640
+ 270: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>)
641
+ 271: <span class="ruby-identifier">stderr</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>
642
+ 272: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">&quot;Application '#{@app_root}' exited during startup&quot;</span>,
643
+ 273: <span class="ruby-identifier">child_exception</span>, <span class="ruby-identifier">app_type</span>, <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">stderr</span>)
644
+ 274: <span class="ruby-keyword kw">end</span>
645
+ 275: <span class="ruby-keyword kw">end</span>
646
646
  </pre>
647
647
  </div>
648
648
  </div>
649
649
  </div>
650
650
  <div class="method">
651
651
  <div class="title">
652
- <a name="M000079"></a><b>unmarshal_exception</b>(data)
652
+ <a name="M000081"></a><b>unmarshal_exception</b>(data)
653
653
  </div>
654
654
  <div class="sourcecode">
655
- <p class="source-link">[ <a href="javascript:toggleSource('M000079_source')" id="l_M000079_source">show source</a> ]</p>
656
- <div id="M000079_source" class="dyn-source">
655
+ <p class="source-link">[ <a href="javascript:toggleSource('M000081_source')" id="l_M000081_source">show source</a> ]</p>
656
+ <div id="M000081_source" class="dyn-source">
657
657
  <pre>
658
- <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 121</span>
659
- 121: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">data</span>)
660
- 122: <span class="ruby-identifier">hash</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">data</span>)
661
- 123: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:is_initialization_error</span>]
662
- 124: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:child_exception</span>]
663
- 125: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:child_exception</span>])
664
- 126: <span class="ruby-keyword kw">else</span>
665
- 127: <span class="ruby-identifier">child_exception</span> = <span class="ruby-keyword kw">nil</span>
666
- 128: <span class="ruby-keyword kw">end</span>
667
- 129:
668
- 130: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:class</span>]
669
- 131: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">to_s</span>
670
- 132: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">AppInitError</span>
671
- 133: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">FrameworkInitError</span>.<span class="ruby-identifier">to_s</span>
672
- 134: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">FrameworkInitError</span>
673
- 135: <span class="ruby-keyword kw">else</span>
674
- 136: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">InitializationError</span>
675
- 137: <span class="ruby-keyword kw">end</span>
676
- 138: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">exception_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:message</span>], <span class="ruby-identifier">child_exception</span>)
677
- 139: <span class="ruby-keyword kw">else</span>
678
- 140: <span class="ruby-keyword kw">begin</span>
679
- 141: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:exception</span>])
680
- 142: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
681
- 143: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">UnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:message</span>], <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:class</span>], <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:backtrace</span>])
682
- 144: <span class="ruby-keyword kw">end</span>
683
- 145: <span class="ruby-keyword kw">end</span>
684
- 146: <span class="ruby-keyword kw">end</span>
658
+ <span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 126</span>
659
+ 126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">data</span>)
660
+ 127: <span class="ruby-identifier">hash</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">data</span>)
661
+ 128: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:is_initialization_error</span>]
662
+ 129: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:child_exception</span>]
663
+ 130: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:child_exception</span>])
664
+ 131: <span class="ruby-keyword kw">else</span>
665
+ 132: <span class="ruby-identifier">child_exception</span> = <span class="ruby-keyword kw">nil</span>
666
+ 133: <span class="ruby-keyword kw">end</span>
667
+ 134:
668
+ 135: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:class</span>]
669
+ 136: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">to_s</span>
670
+ 137: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">AppInitError</span>
671
+ 138: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">FrameworkInitError</span>.<span class="ruby-identifier">to_s</span>
672
+ 139: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">FrameworkInitError</span>
673
+ 140: <span class="ruby-keyword kw">else</span>
674
+ 141: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">InitializationError</span>
675
+ 142: <span class="ruby-keyword kw">end</span>
676
+ 143: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">exception_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:message</span>], <span class="ruby-identifier">child_exception</span>)
677
+ 144: <span class="ruby-keyword kw">else</span>
678
+ 145: <span class="ruby-keyword kw">begin</span>
679
+ 146: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:exception</span>])
680
+ 147: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
681
+ 148: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">UnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:message</span>], <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:class</span>], <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:backtrace</span>])
682
+ 149: <span class="ruby-keyword kw">end</span>
683
+ 150: <span class="ruby-keyword kw">end</span>
684
+ 151: <span class="ruby-keyword kw">end</span>
685
685
  </pre>
686
686
  </div>
687
687
  </div>