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
@@ -1,10 +1,10 @@
1
1
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
2
  <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3
3
  <title>Passenger: StandardApplicationPool.h Source File</title>
4
- <link href="doxygen.css" rel="stylesheet" type="text/css">
5
4
  <link href="tabs.css" rel="stylesheet" type="text/css">
5
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
6
6
  </head><body>
7
- <!-- Generated by Doxygen 1.5.5 -->
7
+ <!-- Generated by Doxygen 1.5.8 -->
8
8
  <div class="navigation" id="top">
9
9
  <div class="tabs">
10
10
  <ul>
@@ -14,6 +14,11 @@
14
14
  <li class="current"><a href="files.html"><span>Files</span></a></li>
15
15
  </ul>
16
16
  </div>
17
+ <div class="tabs">
18
+ <ul>
19
+ <li><a href="files.html"><span>File&nbsp;List</span></a></li>
20
+ </ul>
21
+ </div>
17
22
  <h1>StandardApplicationPool.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
18
23
  <a name="l00002"></a>00002 <span class="comment"> * Phusion Passenger - http://www.modrails.com/</span>
19
24
  <a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 2008 Phusion</span>
@@ -664,7 +669,7 @@
664
669
  <a name="l00648"></a>00648 }
665
670
  <a name="l00649"></a>00649
666
671
  <a name="l00650"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#5a33f0766bbcfb2a48e08fc27bd1b684">00650</a> <span class="keyword">virtual</span> <a class="code" href="classPassenger_1_1Application.html#d14f673494991460b16246a527ad8ad9" title="Convenient alias for Session smart pointer.">Application::SessionPtr</a> <span class="keyword">get</span>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;appRoot) {
667
- <a name="l00651"></a>00651 <span class="keywordflow">return</span> <a class="code" href="classPassenger_1_1ApplicationPool.html#0b206eb4eb2869423d75c042a0653c67" title="Open a new session with the application specified by PoolOptions.appRoot.">ApplicationPool::get</a>(appRoot);
672
+ <a name="l00651"></a>00651 <span class="keywordflow">return</span> <a class="code" href="classPassenger_1_1StandardApplicationPool.html#5a33f0766bbcfb2a48e08fc27bd1b684" title="Convenience shortcut for calling get() with default spawn options.">ApplicationPool::get</a>(appRoot);
668
673
  <a name="l00652"></a>00652 }
669
674
  <a name="l00653"></a>00653
670
675
  <a name="l00654"></a><a class="code" href="classPassenger_1_1StandardApplicationPool.html#ffc8f3ef8b1d925d203794d191d7fef4">00654</a> <span class="keyword">virtual</span> <a class="code" href="classPassenger_1_1Application.html#d14f673494991460b16246a527ad8ad9" title="Convenient alias for Session smart pointer.">Application::SessionPtr</a> <span class="keyword">get</span>(<span class="keyword">const</span> <a class="code" href="structPassenger_1_1PoolOptions.html" title="This struct encapsulates information for ApplicationPool::get() and for SpawnManager::spawn()...">PoolOptions</a> &amp;options) {
@@ -830,8 +835,8 @@
830
835
  <a name="l00814"></a>00814 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_STANDARD_APPLICATION_POOL_H_ */</span>
831
836
  <a name="l00815"></a>00815
832
837
  </pre></div></div>
833
- <hr size="1"><address style="text-align: right;"><small>Generated on Tue Mar 31 14:00:28 2009 for Passenger by&nbsp;
838
+ <hr size="1"><address style="text-align: right;"><small>Generated on Wed Apr 8 22:35:10 2009 for Passenger by&nbsp;
834
839
  <a href="http://www.doxygen.org/index.html">
835
- <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
840
+ <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
836
841
  </body>
837
842
  </html>
@@ -1,10 +1,10 @@
1
1
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
2
  <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3
3
  <title>Passenger: SystemTime.h Source File</title>
4
- <link href="doxygen.css" rel="stylesheet" type="text/css">
5
4
  <link href="tabs.css" rel="stylesheet" type="text/css">
5
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
6
6
  </head><body>
7
- <!-- Generated by Doxygen 1.5.5 -->
7
+ <!-- Generated by Doxygen 1.5.8 -->
8
8
  <div class="navigation" id="top">
9
9
  <div class="tabs">
10
10
  <ul>
@@ -14,6 +14,11 @@
14
14
  <li class="current"><a href="files.html"><span>Files</span></a></li>
15
15
  </ul>
16
16
  </div>
17
+ <div class="tabs">
18
+ <ul>
19
+ <li><a href="files.html"><span>File&nbsp;List</span></a></li>
20
+ </ul>
21
+ </div>
17
22
  <h1>SystemTime.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
18
23
  <a name="l00002"></a>00002 <span class="comment"> * Phusion Passenger - http://www.modrails.com/</span>
19
24
  <a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 2009 Phusion</span>
@@ -97,8 +102,8 @@
97
102
  <a name="l00081"></a>00081
98
103
  <a name="l00082"></a>00082 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_SYSTEM_TIME_H_ */</span>
99
104
  </pre></div></div>
100
- <hr size="1"><address style="text-align: right;"><small>Generated on Tue Mar 31 14:00:28 2009 for Passenger by&nbsp;
105
+ <hr size="1"><address style="text-align: right;"><small>Generated on Wed Apr 8 22:35:10 2009 for Passenger by&nbsp;
101
106
  <a href="http://www.doxygen.org/index.html">
102
- <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
107
+ <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
103
108
  </body>
104
109
  </html>
@@ -1,10 +1,10 @@
1
1
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
2
  <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
3
3
  <title>Passenger: Utils.h Source File</title>
4
- <link href="doxygen.css" rel="stylesheet" type="text/css">
5
4
  <link href="tabs.css" rel="stylesheet" type="text/css">
5
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
6
6
  </head><body>
7
- <!-- Generated by Doxygen 1.5.5 -->
7
+ <!-- Generated by Doxygen 1.5.8 -->
8
8
  <div class="navigation" id="top">
9
9
  <div class="tabs">
10
10
  <ul>
@@ -14,6 +14,11 @@
14
14
  <li class="current"><a href="files.html"><span>Files</span></a></li>
15
15
  </ul>
16
16
  </div>
17
+ <div class="tabs">
18
+ <ul>
19
+ <li><a href="files.html"><span>File&nbsp;List</span></a></li>
20
+ </ul>
21
+ </div>
17
22
  <h1>Utils.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
18
23
  <a name="l00002"></a>00002 <span class="comment"> * Phusion Passenger - http://www.modrails.com/</span>
19
24
  <a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 2008 Phusion</span>
@@ -227,222 +232,245 @@
227
232
  <a name="l00211"></a>00211 <span class="keywordtype">string</span> <a class="code" href="group__Support.html#gf3b0a483f0a252ae08d9de9f8b267d36" title="Returns a canonical version of the specified path.">canonicalizePath</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;path);
228
233
  <a name="l00212"></a>00212 <span class="comment"></span>
229
234
  <a name="l00213"></a>00213 <span class="comment">/**</span>
230
- <a name="l00214"></a>00214 <span class="comment"> * Escape the given raw string into an XML value.</span>
231
- <a name="l00215"></a>00215 <span class="comment"> *</span>
232
- <a name="l00216"></a>00216 <span class="comment"> * @throws std::bad_alloc Something went wrong.</span>
233
- <a name="l00217"></a>00217 <span class="comment"> * @ingroup Support</span>
234
- <a name="l00218"></a>00218 <span class="comment"> */</span>
235
- <a name="l00219"></a>00219 <span class="keywordtype">string</span> <a class="code" href="group__Support.html#ge74addedf73782a1eb1f6dd48d6fce06" title="Escape the given raw string into an XML value.">escapeForXml</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;input);
236
- <a name="l00220"></a>00220 <span class="comment"></span>
237
- <a name="l00221"></a>00221 <span class="comment">/**</span>
238
- <a name="l00222"></a>00222 <span class="comment"> * Given a username that's supposed to be the "lowest user" in the user switching mechanism,</span>
239
- <a name="l00223"></a>00223 <span class="comment"> * checks whether this username exists. If so, this users's UID and GID will be stored into</span>
240
- <a name="l00224"></a>00224 <span class="comment"> * the arguments of the same names. If not, &lt;em&gt;uid&lt;/em&gt; and &lt;em&gt;gid&lt;/em&gt; will be set to</span>
241
- <a name="l00225"></a>00225 <span class="comment"> * the UID and GID of the "nobody" user. If that user doesn't exist either, then &lt;em&gt;uid&lt;/em&gt;</span>
242
- <a name="l00226"></a>00226 <span class="comment"> * and &lt;em&gt;gid&lt;/em&gt; will be set to -1.</span>
243
- <a name="l00227"></a>00227 <span class="comment"> */</span>
244
- <a name="l00228"></a>00228 <span class="keywordtype">void</span> determineLowestUserAndGroup(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;user, uid_t &amp;uid, gid_t &amp;gid);
245
- <a name="l00229"></a>00229 <span class="comment"></span>
246
- <a name="l00230"></a>00230 <span class="comment">/**</span>
247
- <a name="l00231"></a>00231 <span class="comment"> * Return the path name for the directory in which the system stores general</span>
248
- <a name="l00232"></a>00232 <span class="comment"> * temporary files. This is usually "/tmp", but might be something else depending</span>
249
- <a name="l00233"></a>00233 <span class="comment"> * on some environment variables.</span>
250
- <a name="l00234"></a>00234 <span class="comment"> *</span>
251
- <a name="l00235"></a>00235 <span class="comment"> * @ensure result != NULL</span>
252
- <a name="l00236"></a>00236 <span class="comment"> * @ingroup Support</span>
253
- <a name="l00237"></a>00237 <span class="comment"> */</span>
254
- <a name="l00238"></a>00238 <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="group__Support.html#g68f4105c5a8e510520b5ea3eecb66213" title="Return the path name for the directory in which the system stores general temporary...">getSystemTempDir</a>();
255
- <a name="l00239"></a>00239 <span class="comment"></span>
256
- <a name="l00240"></a>00240 <span class="comment">/**</span>
257
- <a name="l00241"></a>00241 <span class="comment"> * Return the path name for the directory in which Phusion Passenger-specific</span>
258
- <a name="l00242"></a>00242 <span class="comment"> * temporary files are to be stored. This directory is unique for this instance</span>
259
- <a name="l00243"></a>00243 <span class="comment"> * of the web server in which Phusion Passenger is running.</span>
260
- <a name="l00244"></a>00244 <span class="comment"> *</span>
261
- <a name="l00245"></a>00245 <span class="comment"> * If the environment variable PASSENGER_INSTANCE_TEMP_DIR is set, then that value</span>
262
- <a name="l00246"></a>00246 <span class="comment"> * will be returned. If this environment variable is not set, then it will be set</span>
263
- <a name="l00247"></a>00247 <span class="comment"> * with the return value.</span>
264
- <a name="l00248"></a>00248 <span class="comment"> *</span>
265
- <a name="l00249"></a>00249 <span class="comment"> * To bypass the usage of the PASSENGER_INSTANCE_TEMP_DIR environment variable,</span>
266
- <a name="l00250"></a>00250 <span class="comment"> * set 'bypassCache' to true.</span>
267
- <a name="l00251"></a>00251 <span class="comment"> *</span>
268
- <a name="l00252"></a>00252 <span class="comment"> * @param bypassCache Whether PASSENGER_INSTANCE_TEMP_DIR should be bypassed.</span>
269
- <a name="l00253"></a>00253 <span class="comment"> * @param systemTempDir The directory under which the Phusion Passenger-specific</span>
270
- <a name="l00254"></a>00254 <span class="comment"> * temp directory should be located. If set to the empty string,</span>
271
- <a name="l00255"></a>00255 <span class="comment"> * then the return value of getSystemTempDir() will be used.</span>
272
- <a name="l00256"></a>00256 <span class="comment"> * @ensure !result.empty()</span>
273
- <a name="l00257"></a>00257 <span class="comment"> * @ingroup Support</span>
274
- <a name="l00258"></a>00258 <span class="comment"> */</span>
275
- <a name="l00259"></a>00259 <span class="keywordtype">string</span> <a class="code" href="group__Support.html#g69deb6b299b45039dc24b60ad9175541" title="Return the path name for the directory in which Phusion Passenger-specific temporary...">getPassengerTempDir</a>(<span class="keywordtype">bool</span> bypassCache = <span class="keyword">false</span>, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;systemTempDir = <span class="stringliteral">""</span>);
276
- <a name="l00260"></a>00260
277
- <a name="l00261"></a>00261 <span class="comment">/* Create a temp directory under &lt;em&gt;systemTempDir&lt;/em&gt;, for storing Phusion</span>
278
- <a name="l00262"></a>00262 <span class="comment"> * Passenger-specific temp files, such as temporarily buffered uploads,</span>
279
- <a name="l00263"></a>00263 <span class="comment"> * sockets for backend processes, etc. This call also sets the</span>
280
- <a name="l00264"></a>00264 <span class="comment"> * PASSENGER_INSTANCE_TEMP_DIR environment variable, which allows subprocesses</span>
281
- <a name="l00265"></a>00265 <span class="comment"> * to find this temp directory.</span>
282
- <a name="l00266"></a>00266 <span class="comment"> *</span>
283
- <a name="l00267"></a>00267 <span class="comment"> * The created temp directory will have several subdirectories:</span>
284
- <a name="l00268"></a>00268 <span class="comment"> * - webserver_private - for storing the web server's buffered uploads.</span>
285
- <a name="l00269"></a>00269 <span class="comment"> * - info - for storing files that allow external tools to query information</span>
286
- <a name="l00270"></a>00270 <span class="comment"> * about a running Phusion Passenger instance.</span>
287
- <a name="l00271"></a>00271 <span class="comment"> * - backends - for storing Unix sockets created by backend processes.</span>
288
- <a name="l00272"></a>00272 <span class="comment"> * - var - for storing all other kinds of temp files that the backend processes</span>
289
- <a name="l00273"></a>00273 <span class="comment"> * create.</span>
235
+ <a name="l00214"></a>00214 <span class="comment"> * If &lt;em&gt;path&lt;/em&gt; refers to a symlink, then this function resolves the</span>
236
+ <a name="l00215"></a>00215 <span class="comment"> * symlink for 1 level. That is, if the symlink points to another symlink,</span>
237
+ <a name="l00216"></a>00216 <span class="comment"> * then the other symlink will not be resolved. The resolved path is returned.</span>
238
+ <a name="l00217"></a>00217 <span class="comment"> *</span>
239
+ <a name="l00218"></a>00218 <span class="comment"> * If the symlink doesn't point to an absolute path, then this function will</span>
240
+ <a name="l00219"></a>00219 <span class="comment"> * prepend &lt;em&gt;path&lt;/em&gt;'s directory to the result.</span>
241
+ <a name="l00220"></a>00220 <span class="comment"> *</span>
242
+ <a name="l00221"></a>00221 <span class="comment"> * If &lt;em&gt;path&lt;/em&gt; doesn't refer to a symlink then this method will return</span>
243
+ <a name="l00222"></a>00222 <span class="comment"> * &lt;em&gt;path&lt;/em&gt;.</span>
244
+ <a name="l00223"></a>00223 <span class="comment"> *</span>
245
+ <a name="l00224"></a>00224 <span class="comment"> * @throws FileSystemException Something went wrong.</span>
246
+ <a name="l00225"></a>00225 <span class="comment"> * @ingroup Support</span>
247
+ <a name="l00226"></a>00226 <span class="comment"> */</span>
248
+ <a name="l00227"></a>00227 <span class="keywordtype">string</span> <a class="code" href="group__Support.html#gc3d2b3d608188527d888e63d22c5163c" title="If path refers to a symlink, then this function resolves the symlink for 1 level...">resolveSymlink</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;path);
249
+ <a name="l00228"></a>00228 <span class="comment"></span>
250
+ <a name="l00229"></a>00229 <span class="comment">/**</span>
251
+ <a name="l00230"></a>00230 <span class="comment"> * Given a path, extracts its directory name.</span>
252
+ <a name="l00231"></a>00231 <span class="comment"> *</span>
253
+ <a name="l00232"></a>00232 <span class="comment"> * @ingroup Support</span>
254
+ <a name="l00233"></a>00233 <span class="comment"> */</span>
255
+ <a name="l00234"></a>00234 <span class="keywordtype">string</span> <a class="code" href="group__Support.html#g744cb849cb47dbcf5f22a46ead48ae94" title="Given a path, extracts its directory name.">extractDirName</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;path);
256
+ <a name="l00235"></a>00235 <span class="comment"></span>
257
+ <a name="l00236"></a>00236 <span class="comment">/**</span>
258
+ <a name="l00237"></a>00237 <span class="comment"> * Escape the given raw string into an XML value.</span>
259
+ <a name="l00238"></a>00238 <span class="comment"> *</span>
260
+ <a name="l00239"></a>00239 <span class="comment"> * @throws std::bad_alloc Something went wrong.</span>
261
+ <a name="l00240"></a>00240 <span class="comment"> * @ingroup Support</span>
262
+ <a name="l00241"></a>00241 <span class="comment"> */</span>
263
+ <a name="l00242"></a>00242 <span class="keywordtype">string</span> <a class="code" href="group__Support.html#ge74addedf73782a1eb1f6dd48d6fce06" title="Escape the given raw string into an XML value.">escapeForXml</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;input);
264
+ <a name="l00243"></a>00243 <span class="comment"></span>
265
+ <a name="l00244"></a>00244 <span class="comment">/**</span>
266
+ <a name="l00245"></a>00245 <span class="comment"> * Given a username that's supposed to be the "lowest user" in the user switching mechanism,</span>
267
+ <a name="l00246"></a>00246 <span class="comment"> * checks whether this username exists. If so, this users's UID and GID will be stored into</span>
268
+ <a name="l00247"></a>00247 <span class="comment"> * the arguments of the same names. If not, &lt;em&gt;uid&lt;/em&gt; and &lt;em&gt;gid&lt;/em&gt; will be set to</span>
269
+ <a name="l00248"></a>00248 <span class="comment"> * the UID and GID of the "nobody" user. If that user doesn't exist either, then &lt;em&gt;uid&lt;/em&gt;</span>
270
+ <a name="l00249"></a>00249 <span class="comment"> * and &lt;em&gt;gid&lt;/em&gt; will be set to -1.</span>
271
+ <a name="l00250"></a>00250 <span class="comment"> */</span>
272
+ <a name="l00251"></a>00251 <span class="keywordtype">void</span> determineLowestUserAndGroup(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;user, uid_t &amp;uid, gid_t &amp;gid);
273
+ <a name="l00252"></a>00252 <span class="comment"></span>
274
+ <a name="l00253"></a>00253 <span class="comment">/**</span>
275
+ <a name="l00254"></a>00254 <span class="comment"> * Return the path name for the directory in which the system stores general</span>
276
+ <a name="l00255"></a>00255 <span class="comment"> * temporary files. This is usually "/tmp", but might be something else depending</span>
277
+ <a name="l00256"></a>00256 <span class="comment"> * on some environment variables.</span>
278
+ <a name="l00257"></a>00257 <span class="comment"> *</span>
279
+ <a name="l00258"></a>00258 <span class="comment"> * @ensure result != NULL</span>
280
+ <a name="l00259"></a>00259 <span class="comment"> * @ingroup Support</span>
281
+ <a name="l00260"></a>00260 <span class="comment"> */</span>
282
+ <a name="l00261"></a>00261 <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="group__Support.html#g68f4105c5a8e510520b5ea3eecb66213" title="Return the path name for the directory in which the system stores general temporary...">getSystemTempDir</a>();
283
+ <a name="l00262"></a>00262 <span class="comment"></span>
284
+ <a name="l00263"></a>00263 <span class="comment">/**</span>
285
+ <a name="l00264"></a>00264 <span class="comment"> * Return the path name for the directory in which Phusion Passenger-specific</span>
286
+ <a name="l00265"></a>00265 <span class="comment"> * temporary files are to be stored. This directory is unique for this instance</span>
287
+ <a name="l00266"></a>00266 <span class="comment"> * of the web server in which Phusion Passenger is running.</span>
288
+ <a name="l00267"></a>00267 <span class="comment"> *</span>
289
+ <a name="l00268"></a>00268 <span class="comment"> * If the environment variable PASSENGER_INSTANCE_TEMP_DIR is set, then that value</span>
290
+ <a name="l00269"></a>00269 <span class="comment"> * will be returned. If this environment variable is not set, then it will be set</span>
291
+ <a name="l00270"></a>00270 <span class="comment"> * with the return value.</span>
292
+ <a name="l00271"></a>00271 <span class="comment"> *</span>
293
+ <a name="l00272"></a>00272 <span class="comment"> * To bypass the usage of the PASSENGER_INSTANCE_TEMP_DIR environment variable,</span>
294
+ <a name="l00273"></a>00273 <span class="comment"> * set 'bypassCache' to true.</span>
290
295
  <a name="l00274"></a>00274 <span class="comment"> *</span>
291
- <a name="l00275"></a>00275 <span class="comment"> * If a (sub)directory already exists, then it will not result in an error.</span>
292
- <a name="l00276"></a>00276 <span class="comment"> *</span>
293
- <a name="l00277"></a>00277 <span class="comment"> * The &lt;em&gt;userSwitching&lt;/em&gt; and &lt;em&gt;lowestUser&lt;/em&gt; arguments passed to</span>
294
- <a name="l00278"></a>00278 <span class="comment"> * this method are used for determining the optimal permissions for the</span>
295
- <a name="l00279"></a>00279 <span class="comment"> * (sub)directories. The permissions will be set as tightly as possible based</span>
296
- <a name="l00280"></a>00280 <span class="comment"> * on the values. The &lt;em&gt;workerUid&lt;/em&gt; and &lt;em&gt;workerGid&lt;/em&gt; arguments</span>
297
- <a name="l00281"></a>00281 <span class="comment"> * will be used for determining the owner of certain subdirectories.</span>
298
- <a name="l00282"></a>00282 <span class="comment"> *</span>
299
- <a name="l00283"></a>00283 <span class="comment"> * @note You should only call this method inside the web server's master</span>
300
- <a name="l00284"></a>00284 <span class="comment"> * process. In case of Apache, this is the Apache control process,</span>
301
- <a name="l00285"></a>00285 <span class="comment"> * the one that tends to run as root. This is because this function</span>
302
- <a name="l00286"></a>00286 <span class="comment"> * will set directory permissions and owners/groups, which may require</span>
303
- <a name="l00287"></a>00287 <span class="comment"> * root privileges.</span>
304
- <a name="l00288"></a>00288 <span class="comment"> *</span>
305
- <a name="l00289"></a>00289 <span class="comment"> * @param systemTempDir The directory under which the Phusion Passenger-specific</span>
306
- <a name="l00290"></a>00290 <span class="comment"> * temp directory should be created. You should normally</span>
307
- <a name="l00291"></a>00291 <span class="comment"> * specify the return value of getSystemTempDir().</span>
308
- <a name="l00292"></a>00292 <span class="comment"> * @param userSwitching Whether user switching is turned on.</span>
309
- <a name="l00293"></a>00293 <span class="comment"> * @param lowestUser The user that the spawn manager and the pool server will</span>
310
- <a name="l00294"></a>00294 <span class="comment"> * run as, if user switching is turned off.</span>
311
- <a name="l00295"></a>00295 <span class="comment"> * @param workerUid The UID that the web server's worker processes are running</span>
312
- <a name="l00296"></a>00296 <span class="comment"> * as. On Apache, this is the UID that's associated with the</span>
313
- <a name="l00297"></a>00297 <span class="comment"> * 'User' directive.</span>
314
- <a name="l00298"></a>00298 <span class="comment"> * @param workerGid The GID that the web server's worker processes are running</span>
315
- <a name="l00299"></a>00299 <span class="comment"> * as. On Apache, this is the GID that's associated with the</span>
316
- <a name="l00300"></a>00300 <span class="comment"> * 'Group' directive.</span>
317
- <a name="l00301"></a>00301 <span class="comment"> * @throws IOException Something went wrong.</span>
318
- <a name="l00302"></a>00302 <span class="comment"> * @throws SystemException Something went wrong.</span>
319
- <a name="l00303"></a>00303 <span class="comment"> * @throws FileSystemException Something went wrong.</span>
320
- <a name="l00304"></a>00304 <span class="comment"> */</span>
321
- <a name="l00305"></a>00305 <span class="keywordtype">void</span> createPassengerTempDir(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;systemTempDir, <span class="keywordtype">bool</span> userSwitching,
322
- <a name="l00306"></a>00306 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;lowestUser,
323
- <a name="l00307"></a>00307 uid_t workerUid, gid_t workerGid);
324
- <a name="l00308"></a>00308 <span class="comment"></span>
325
- <a name="l00309"></a>00309 <span class="comment">/**</span>
326
- <a name="l00310"></a>00310 <span class="comment"> * Create the directory at the given path, creating intermediate directories</span>
327
- <a name="l00311"></a>00311 <span class="comment"> * if necessary. The created directories' permissions are as specified by the</span>
328
- <a name="l00312"></a>00312 <span class="comment"> * 'mode' parameter. You can specify this directory's owner and group through</span>
329
- <a name="l00313"></a>00313 <span class="comment"> * the 'owner' and 'group' parameters. A value of -1 for 'owner' or 'group'</span>
330
- <a name="l00314"></a>00314 <span class="comment"> * means that the owner/group should not be changed.</span>
331
- <a name="l00315"></a>00315 <span class="comment"> *</span>
332
- <a name="l00316"></a>00316 <span class="comment"> * If 'path' already exists, then nothing will happen.</span>
333
- <a name="l00317"></a>00317 <span class="comment"> *</span>
334
- <a name="l00318"></a>00318 <span class="comment"> * @throws IOException Something went wrong.</span>
335
- <a name="l00319"></a>00319 <span class="comment"> * @throws SystemException Something went wrong.</span>
336
- <a name="l00320"></a>00320 <span class="comment"> * @throws FileSystemException Something went wrong.</span>
337
- <a name="l00321"></a>00321 <span class="comment"> */</span>
338
- <a name="l00322"></a>00322 <span class="keywordtype">void</span> makeDirTree(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;path, <span class="keyword">const</span> <span class="keywordtype">char</span> *mode = <span class="stringliteral">"u=rwx,g=,o="</span>, uid_t owner = -1, gid_t group = -1);
339
- <a name="l00323"></a>00323 <span class="comment"></span>
340
- <a name="l00324"></a>00324 <span class="comment">/**</span>
341
- <a name="l00325"></a>00325 <span class="comment"> * Remove an entire directory tree recursively.</span>
342
- <a name="l00326"></a>00326 <span class="comment"> *</span>
343
- <a name="l00327"></a>00327 <span class="comment"> * @throws FileSystemException Something went wrong.</span>
344
- <a name="l00328"></a>00328 <span class="comment"> */</span>
345
- <a name="l00329"></a>00329 <span class="keywordtype">void</span> removeDirTree(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;path);
346
- <a name="l00330"></a>00330 <span class="comment"></span>
347
- <a name="l00331"></a>00331 <span class="comment">/**</span>
348
- <a name="l00332"></a>00332 <span class="comment"> * Check whether the specified directory is a valid Ruby on Rails</span>
349
- <a name="l00333"></a>00333 <span class="comment"> * application root directory.</span>
350
- <a name="l00334"></a>00334 <span class="comment"> *</span>
351
- <a name="l00335"></a>00335 <span class="comment"> * @param mstat A CachedMultiFileStat object, if you want to use cached statting.</span>
352
- <a name="l00336"></a>00336 <span class="comment"> * @param throttleRate A throttle rate for mstat. Only applicable if mstat is not NULL.</span>
353
- <a name="l00337"></a>00337 <span class="comment"> * @throws FileSystemException Unable to check because of a system error.</span>
354
- <a name="l00338"></a>00338 <span class="comment"> * @ingroup Support</span>
355
- <a name="l00339"></a>00339 <span class="comment"> */</span>
356
- <a name="l00340"></a>00340 <span class="keywordtype">bool</span> <a class="code" href="group__Support.html#g02c80bd02d38cea295f24250ca8e2502" title="Check whether the specified directory is a valid Ruby on Rails application root directory...">verifyRailsDir</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;dir, CachedMultiFileStat *mstat = 0,
357
- <a name="l00341"></a>00341 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> throttleRate = 0);
358
- <a name="l00342"></a>00342 <span class="comment"></span>
359
- <a name="l00343"></a>00343 <span class="comment">/**</span>
360
- <a name="l00344"></a>00344 <span class="comment"> * Check whether the specified directory is a valid Rack application</span>
361
- <a name="l00345"></a>00345 <span class="comment"> * root directory.</span>
362
- <a name="l00346"></a>00346 <span class="comment"> *</span>
363
- <a name="l00347"></a>00347 <span class="comment"> * @param mstat A CachedMultiFileStat object, if you want to use cached statting.</span>
364
- <a name="l00348"></a>00348 <span class="comment"> * @param throttleRate A throttle rate for mstat. Only applicable if mstat is not NULL.</span>
365
- <a name="l00349"></a>00349 <span class="comment"> * @throws FileSystemException Unable to check because of a filesystem error.</span>
366
- <a name="l00350"></a>00350 <span class="comment"> * @ingroup Support</span>
296
+ <a name="l00275"></a>00275 <span class="comment"> * @param bypassCache Whether PASSENGER_INSTANCE_TEMP_DIR should be bypassed.</span>
297
+ <a name="l00276"></a>00276 <span class="comment"> * @param systemTempDir The directory under which the Phusion Passenger-specific</span>
298
+ <a name="l00277"></a>00277 <span class="comment"> * temp directory should be located. If set to the empty string,</span>
299
+ <a name="l00278"></a>00278 <span class="comment"> * then the return value of getSystemTempDir() will be used.</span>
300
+ <a name="l00279"></a>00279 <span class="comment"> * @ensure !result.empty()</span>
301
+ <a name="l00280"></a>00280 <span class="comment"> * @ingroup Support</span>
302
+ <a name="l00281"></a>00281 <span class="comment"> */</span>
303
+ <a name="l00282"></a>00282 <span class="keywordtype">string</span> <a class="code" href="group__Support.html#g69deb6b299b45039dc24b60ad9175541" title="Return the path name for the directory in which Phusion Passenger-specific temporary...">getPassengerTempDir</a>(<span class="keywordtype">bool</span> bypassCache = <span class="keyword">false</span>, <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;systemTempDir = <span class="stringliteral">""</span>);
304
+ <a name="l00283"></a>00283
305
+ <a name="l00284"></a>00284 <span class="comment">/* Create a temp directory under &lt;em&gt;systemTempDir&lt;/em&gt;, for storing Phusion</span>
306
+ <a name="l00285"></a>00285 <span class="comment"> * Passenger-specific temp files, such as temporarily buffered uploads,</span>
307
+ <a name="l00286"></a>00286 <span class="comment"> * sockets for backend processes, etc. This call also sets the</span>
308
+ <a name="l00287"></a>00287 <span class="comment"> * PASSENGER_INSTANCE_TEMP_DIR environment variable, which allows subprocesses</span>
309
+ <a name="l00288"></a>00288 <span class="comment"> * to find this temp directory.</span>
310
+ <a name="l00289"></a>00289 <span class="comment"> *</span>
311
+ <a name="l00290"></a>00290 <span class="comment"> * The created temp directory will have several subdirectories:</span>
312
+ <a name="l00291"></a>00291 <span class="comment"> * - webserver_private - for storing the web server's buffered uploads.</span>
313
+ <a name="l00292"></a>00292 <span class="comment"> * - info - for storing files that allow external tools to query information</span>
314
+ <a name="l00293"></a>00293 <span class="comment"> * about a running Phusion Passenger instance.</span>
315
+ <a name="l00294"></a>00294 <span class="comment"> * - backends - for storing Unix sockets created by backend processes.</span>
316
+ <a name="l00295"></a>00295 <span class="comment"> * - var - for storing all other kinds of temp files that the backend processes</span>
317
+ <a name="l00296"></a>00296 <span class="comment"> * create.</span>
318
+ <a name="l00297"></a>00297 <span class="comment"> *</span>
319
+ <a name="l00298"></a>00298 <span class="comment"> * If a (sub)directory already exists, then it will not result in an error.</span>
320
+ <a name="l00299"></a>00299 <span class="comment"> *</span>
321
+ <a name="l00300"></a>00300 <span class="comment"> * The &lt;em&gt;userSwitching&lt;/em&gt; and &lt;em&gt;lowestUser&lt;/em&gt; arguments passed to</span>
322
+ <a name="l00301"></a>00301 <span class="comment"> * this method are used for determining the optimal permissions for the</span>
323
+ <a name="l00302"></a>00302 <span class="comment"> * (sub)directories. The permissions will be set as tightly as possible based</span>
324
+ <a name="l00303"></a>00303 <span class="comment"> * on the values. The &lt;em&gt;workerUid&lt;/em&gt; and &lt;em&gt;workerGid&lt;/em&gt; arguments</span>
325
+ <a name="l00304"></a>00304 <span class="comment"> * will be used for determining the owner of certain subdirectories.</span>
326
+ <a name="l00305"></a>00305 <span class="comment"> *</span>
327
+ <a name="l00306"></a>00306 <span class="comment"> * @note You should only call this method inside the web server's master</span>
328
+ <a name="l00307"></a>00307 <span class="comment"> * process. In case of Apache, this is the Apache control process,</span>
329
+ <a name="l00308"></a>00308 <span class="comment"> * the one that tends to run as root. This is because this function</span>
330
+ <a name="l00309"></a>00309 <span class="comment"> * will set directory permissions and owners/groups, which may require</span>
331
+ <a name="l00310"></a>00310 <span class="comment"> * root privileges.</span>
332
+ <a name="l00311"></a>00311 <span class="comment"> *</span>
333
+ <a name="l00312"></a>00312 <span class="comment"> * @param systemTempDir The directory under which the Phusion Passenger-specific</span>
334
+ <a name="l00313"></a>00313 <span class="comment"> * temp directory should be created. You should normally</span>
335
+ <a name="l00314"></a>00314 <span class="comment"> * specify the return value of getSystemTempDir().</span>
336
+ <a name="l00315"></a>00315 <span class="comment"> * @param userSwitching Whether user switching is turned on.</span>
337
+ <a name="l00316"></a>00316 <span class="comment"> * @param lowestUser The user that the spawn manager and the pool server will</span>
338
+ <a name="l00317"></a>00317 <span class="comment"> * run as, if user switching is turned off.</span>
339
+ <a name="l00318"></a>00318 <span class="comment"> * @param workerUid The UID that the web server's worker processes are running</span>
340
+ <a name="l00319"></a>00319 <span class="comment"> * as. On Apache, this is the UID that's associated with the</span>
341
+ <a name="l00320"></a>00320 <span class="comment"> * 'User' directive.</span>
342
+ <a name="l00321"></a>00321 <span class="comment"> * @param workerGid The GID that the web server's worker processes are running</span>
343
+ <a name="l00322"></a>00322 <span class="comment"> * as. On Apache, this is the GID that's associated with the</span>
344
+ <a name="l00323"></a>00323 <span class="comment"> * 'Group' directive.</span>
345
+ <a name="l00324"></a>00324 <span class="comment"> * @throws IOException Something went wrong.</span>
346
+ <a name="l00325"></a>00325 <span class="comment"> * @throws SystemException Something went wrong.</span>
347
+ <a name="l00326"></a>00326 <span class="comment"> * @throws FileSystemException Something went wrong.</span>
348
+ <a name="l00327"></a>00327 <span class="comment"> */</span>
349
+ <a name="l00328"></a>00328 <span class="keywordtype">void</span> createPassengerTempDir(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;systemTempDir, <span class="keywordtype">bool</span> userSwitching,
350
+ <a name="l00329"></a>00329 <span class="keyword">const</span> <span class="keywordtype">string</span> &amp;lowestUser,
351
+ <a name="l00330"></a>00330 uid_t workerUid, gid_t workerGid);
352
+ <a name="l00331"></a>00331 <span class="comment"></span>
353
+ <a name="l00332"></a>00332 <span class="comment">/**</span>
354
+ <a name="l00333"></a>00333 <span class="comment"> * Create the directory at the given path, creating intermediate directories</span>
355
+ <a name="l00334"></a>00334 <span class="comment"> * if necessary. The created directories' permissions are as specified by the</span>
356
+ <a name="l00335"></a>00335 <span class="comment"> * 'mode' parameter. You can specify this directory's owner and group through</span>
357
+ <a name="l00336"></a>00336 <span class="comment"> * the 'owner' and 'group' parameters. A value of -1 for 'owner' or 'group'</span>
358
+ <a name="l00337"></a>00337 <span class="comment"> * means that the owner/group should not be changed.</span>
359
+ <a name="l00338"></a>00338 <span class="comment"> *</span>
360
+ <a name="l00339"></a>00339 <span class="comment"> * If 'path' already exists, then nothing will happen.</span>
361
+ <a name="l00340"></a>00340 <span class="comment"> *</span>
362
+ <a name="l00341"></a>00341 <span class="comment"> * @throws IOException Something went wrong.</span>
363
+ <a name="l00342"></a>00342 <span class="comment"> * @throws SystemException Something went wrong.</span>
364
+ <a name="l00343"></a>00343 <span class="comment"> * @throws FileSystemException Something went wrong.</span>
365
+ <a name="l00344"></a>00344 <span class="comment"> */</span>
366
+ <a name="l00345"></a>00345 <span class="keywordtype">void</span> makeDirTree(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;path, <span class="keyword">const</span> <span class="keywordtype">char</span> *mode = <span class="stringliteral">"u=rwx,g=,o="</span>, uid_t owner = -1, gid_t group = -1);
367
+ <a name="l00346"></a>00346 <span class="comment"></span>
368
+ <a name="l00347"></a>00347 <span class="comment">/**</span>
369
+ <a name="l00348"></a>00348 <span class="comment"> * Remove an entire directory tree recursively.</span>
370
+ <a name="l00349"></a>00349 <span class="comment"> *</span>
371
+ <a name="l00350"></a>00350 <span class="comment"> * @throws FileSystemException Something went wrong.</span>
367
372
  <a name="l00351"></a>00351 <span class="comment"> */</span>
368
- <a name="l00352"></a>00352 <span class="keywordtype">bool</span> <a class="code" href="group__Support.html#g7bb22ba786fa3c88dbbd9f84aaaed59a" title="Check whether the specified directory is a valid Rack application root directory...">verifyRackDir</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;dir, CachedMultiFileStat *mstat = 0,
369
- <a name="l00353"></a>00353 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> throttleRate = 0);
370
- <a name="l00354"></a>00354 <span class="comment"></span>
371
- <a name="l00355"></a>00355 <span class="comment">/**</span>
372
- <a name="l00356"></a>00356 <span class="comment"> * Check whether the specified directory is a valid WSGI application</span>
373
- <a name="l00357"></a>00357 <span class="comment"> * root directory.</span>
374
- <a name="l00358"></a>00358 <span class="comment"> *</span>
375
- <a name="l00359"></a>00359 <span class="comment"> * @param mstat A CachedMultiFileStat object, if you want to use cached statting.</span>
376
- <a name="l00360"></a>00360 <span class="comment"> * @param throttleRate A throttle rate for mstat. Only applicable if mstat is not NULL.</span>
377
- <a name="l00361"></a>00361 <span class="comment"> * @throws FileSystemException Unable to check because of a filesystem error.</span>
378
- <a name="l00362"></a>00362 <span class="comment"> * @ingroup Support</span>
379
- <a name="l00363"></a>00363 <span class="comment"> */</span>
380
- <a name="l00364"></a>00364 <span class="keywordtype">bool</span> <a class="code" href="group__Support.html#g8bfea2692733dfd80703707a120bce86" title="Check whether the specified directory is a valid WSGI application root directory...">verifyWSGIDir</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;dir, CachedMultiFileStat *mstat = 0,
381
- <a name="l00365"></a>00365 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> throttleRate = 0);
382
- <a name="l00366"></a>00366 <span class="comment"></span>
383
- <a name="l00367"></a>00367 <span class="comment">/**</span>
384
- <a name="l00368"></a>00368 <span class="comment"> * Represents a buffered upload file.</span>
373
+ <a name="l00352"></a>00352 <span class="keywordtype">void</span> removeDirTree(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;path);
374
+ <a name="l00353"></a>00353 <span class="comment"></span>
375
+ <a name="l00354"></a>00354 <span class="comment">/**</span>
376
+ <a name="l00355"></a>00355 <span class="comment"> * Check whether the specified directory is a valid Ruby on Rails</span>
377
+ <a name="l00356"></a>00356 <span class="comment"> * application root directory.</span>
378
+ <a name="l00357"></a>00357 <span class="comment"> *</span>
379
+ <a name="l00358"></a>00358 <span class="comment"> * @param mstat A CachedMultiFileStat object, if you want to use cached statting.</span>
380
+ <a name="l00359"></a>00359 <span class="comment"> * @param throttleRate A throttle rate for mstat. Only applicable if mstat is not NULL.</span>
381
+ <a name="l00360"></a>00360 <span class="comment"> * @throws FileSystemException Unable to check because of a system error.</span>
382
+ <a name="l00361"></a>00361 <span class="comment"> * @ingroup Support</span>
383
+ <a name="l00362"></a>00362 <span class="comment"> */</span>
384
+ <a name="l00363"></a>00363 <span class="keywordtype">bool</span> <a class="code" href="group__Support.html#g02c80bd02d38cea295f24250ca8e2502" title="Check whether the specified directory is a valid Ruby on Rails application root directory...">verifyRailsDir</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;dir, CachedMultiFileStat *mstat = 0,
385
+ <a name="l00364"></a>00364 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> throttleRate = 0);
386
+ <a name="l00365"></a>00365 <span class="comment"></span>
387
+ <a name="l00366"></a>00366 <span class="comment">/**</span>
388
+ <a name="l00367"></a>00367 <span class="comment"> * Check whether the specified directory is a valid Rack application</span>
389
+ <a name="l00368"></a>00368 <span class="comment"> * root directory.</span>
385
390
  <a name="l00369"></a>00369 <span class="comment"> *</span>
386
- <a name="l00370"></a>00370 <span class="comment"> * @ingroup Support</span>
387
- <a name="l00371"></a>00371 <span class="comment"> */</span>
388
- <a name="l00372"></a><a class="code" href="classPassenger_1_1BufferedUpload.html">00372</a> <span class="keyword">class </span><a class="code" href="classPassenger_1_1BufferedUpload.html" title="Represents a buffered upload file.">BufferedUpload</a> {
389
- <a name="l00373"></a>00373 <span class="keyword">public</span>:<span class="comment"></span>
390
- <a name="l00374"></a>00374 <span class="comment"> /** The file handle. */</span>
391
- <a name="l00375"></a><a class="code" href="classPassenger_1_1BufferedUpload.html#0a340f2d972ae791f56f893901109dac">00375</a> FILE *<a class="code" href="classPassenger_1_1BufferedUpload.html#0a340f2d972ae791f56f893901109dac" title="The file handle.">handle</a>;
392
- <a name="l00376"></a>00376 <span class="comment"></span>
393
- <a name="l00377"></a>00377 <span class="comment"> /**</span>
394
- <a name="l00378"></a>00378 <span class="comment"> * Create an empty upload bufer file, and open it for reading and writing.</span>
395
- <a name="l00379"></a>00379 <span class="comment"> *</span>
396
- <a name="l00380"></a>00380 <span class="comment"> * @throws SystemException Something went wrong.</span>
397
- <a name="l00381"></a>00381 <span class="comment"> */</span>
398
- <a name="l00382"></a><a class="code" href="classPassenger_1_1BufferedUpload.html#b85f5986340242fd2389b81ce4304e6b">00382</a> <a class="code" href="classPassenger_1_1BufferedUpload.html#b85f5986340242fd2389b81ce4304e6b" title="Create an empty upload bufer file, and open it for reading and writing.">BufferedUpload</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *identifier = <span class="stringliteral">"temp"</span>) {
399
- <a name="l00383"></a>00383 <span class="keywordtype">char</span> templ[PATH_MAX];
400
- <a name="l00384"></a>00384 <span class="keywordtype">int</span> fd;
401
- <a name="l00385"></a>00385
402
- <a name="l00386"></a>00386 snprintf(templ, <span class="keyword">sizeof</span>(templ), <span class="stringliteral">"%s/%s.XXXXXX"</span>, <a class="code" href="classPassenger_1_1BufferedUpload.html#fab496fee959db6320d909069ca6c2b9" title="Returns the directory in which upload buffer files are stored.">getDir</a>().c_str(), identifier);
403
- <a name="l00387"></a>00387 templ[<span class="keyword">sizeof</span>(templ) - 1] = <span class="charliteral">'\0'</span>;
404
- <a name="l00388"></a>00388 fd = mkstemp(templ);
405
- <a name="l00389"></a>00389 <span class="keywordflow">if</span> (fd == -1) {
406
- <a name="l00390"></a>00390 <span class="keywordtype">char</span> message[1024];
407
- <a name="l00391"></a>00391 <span class="keywordtype">int</span> e = errno;
408
- <a name="l00392"></a>00392
409
- <a name="l00393"></a>00393 snprintf(message, <span class="keyword">sizeof</span>(message), <span class="stringliteral">"Cannot create a temporary file '%s'"</span>, templ);
410
- <a name="l00394"></a>00394 message[<span class="keyword">sizeof</span>(message) - 1] = <span class="charliteral">'\0'</span>;
411
- <a name="l00395"></a>00395 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a>(message, e);
412
- <a name="l00396"></a>00396 }
413
- <a name="l00397"></a>00397
414
- <a name="l00398"></a>00398 <span class="comment">/* We use a POSIX trick here: the file's permissions are set to "u=,g=,o="</span>
415
- <a name="l00399"></a>00399 <span class="comment"> * and the file is deleted immediately from the filesystem, while we</span>
416
- <a name="l00400"></a>00400 <span class="comment"> * keep its file handle open. The result is that no other processes</span>
417
- <a name="l00401"></a>00401 <span class="comment"> * will be able to access this file's contents anymore, except us.</span>
418
- <a name="l00402"></a>00402 <span class="comment"> * We now have an anonymous disk-backed buffer.</span>
419
- <a name="l00403"></a>00403 <span class="comment"> */</span>
420
- <a name="l00404"></a>00404 fchmod(fd, 0000);
421
- <a name="l00405"></a>00405 unlink(templ);
422
- <a name="l00406"></a>00406
423
- <a name="l00407"></a>00407 <a class="code" href="classPassenger_1_1BufferedUpload.html#0a340f2d972ae791f56f893901109dac" title="The file handle.">handle</a> = fdopen(fd, <span class="stringliteral">"w+"</span>);
424
- <a name="l00408"></a>00408 }
425
- <a name="l00409"></a>00409
426
- <a name="l00410"></a>00410 ~<a class="code" href="classPassenger_1_1BufferedUpload.html" title="Represents a buffered upload file.">BufferedUpload</a>() {
427
- <a name="l00411"></a>00411 fclose(<a class="code" href="classPassenger_1_1BufferedUpload.html#0a340f2d972ae791f56f893901109dac" title="The file handle.">handle</a>);
428
- <a name="l00412"></a>00412 }
429
- <a name="l00413"></a>00413 <span class="comment"></span>
430
- <a name="l00414"></a>00414 <span class="comment"> /**</span>
431
- <a name="l00415"></a>00415 <span class="comment"> * Returns the directory in which upload buffer files are stored.</span>
432
- <a name="l00416"></a>00416 <span class="comment"> * This is a subdirectory of the directory returned by getPassengerTempDir(). </span>
433
- <a name="l00417"></a>00417 <span class="comment"> */</span>
434
- <a name="l00418"></a><a class="code" href="classPassenger_1_1BufferedUpload.html#fab496fee959db6320d909069ca6c2b9">00418</a> <span class="keyword">static</span> <span class="keywordtype">string</span> <a class="code" href="classPassenger_1_1BufferedUpload.html#fab496fee959db6320d909069ca6c2b9" title="Returns the directory in which upload buffer files are stored.">getDir</a>() {
435
- <a name="l00419"></a>00419 <span class="keywordflow">return</span> <a class="code" href="group__Support.html#g69deb6b299b45039dc24b60ad9175541" title="Return the path name for the directory in which Phusion Passenger-specific temporary...">getPassengerTempDir</a>() + <span class="stringliteral">"/webserver_private"</span>;
436
- <a name="l00420"></a>00420 }
437
- <a name="l00421"></a>00421 };
438
- <a name="l00422"></a>00422
439
- <a name="l00423"></a>00423 } <span class="comment">// namespace Passenger</span>
440
- <a name="l00424"></a>00424
441
- <a name="l00425"></a>00425 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_UTILS_H_ */</span>
442
- <a name="l00426"></a>00426
391
+ <a name="l00370"></a>00370 <span class="comment"> * @param mstat A CachedMultiFileStat object, if you want to use cached statting.</span>
392
+ <a name="l00371"></a>00371 <span class="comment"> * @param throttleRate A throttle rate for mstat. Only applicable if mstat is not NULL.</span>
393
+ <a name="l00372"></a>00372 <span class="comment"> * @throws FileSystemException Unable to check because of a filesystem error.</span>
394
+ <a name="l00373"></a>00373 <span class="comment"> * @ingroup Support</span>
395
+ <a name="l00374"></a>00374 <span class="comment"> */</span>
396
+ <a name="l00375"></a>00375 <span class="keywordtype">bool</span> <a class="code" href="group__Support.html#g7bb22ba786fa3c88dbbd9f84aaaed59a" title="Check whether the specified directory is a valid Rack application root directory...">verifyRackDir</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;dir, CachedMultiFileStat *mstat = 0,
397
+ <a name="l00376"></a>00376 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> throttleRate = 0);
398
+ <a name="l00377"></a>00377 <span class="comment"></span>
399
+ <a name="l00378"></a>00378 <span class="comment">/**</span>
400
+ <a name="l00379"></a>00379 <span class="comment"> * Check whether the specified directory is a valid WSGI application</span>
401
+ <a name="l00380"></a>00380 <span class="comment"> * root directory.</span>
402
+ <a name="l00381"></a>00381 <span class="comment"> *</span>
403
+ <a name="l00382"></a>00382 <span class="comment"> * @param mstat A CachedMultiFileStat object, if you want to use cached statting.</span>
404
+ <a name="l00383"></a>00383 <span class="comment"> * @param throttleRate A throttle rate for mstat. Only applicable if mstat is not NULL.</span>
405
+ <a name="l00384"></a>00384 <span class="comment"> * @throws FileSystemException Unable to check because of a filesystem error.</span>
406
+ <a name="l00385"></a>00385 <span class="comment"> * @ingroup Support</span>
407
+ <a name="l00386"></a>00386 <span class="comment"> */</span>
408
+ <a name="l00387"></a>00387 <span class="keywordtype">bool</span> <a class="code" href="group__Support.html#g8bfea2692733dfd80703707a120bce86" title="Check whether the specified directory is a valid WSGI application root directory...">verifyWSGIDir</a>(<span class="keyword">const</span> <span class="keywordtype">string</span> &amp;dir, CachedMultiFileStat *mstat = 0,
409
+ <a name="l00388"></a>00388 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> throttleRate = 0);
410
+ <a name="l00389"></a>00389 <span class="comment"></span>
411
+ <a name="l00390"></a>00390 <span class="comment">/**</span>
412
+ <a name="l00391"></a>00391 <span class="comment"> * Represents a buffered upload file.</span>
413
+ <a name="l00392"></a>00392 <span class="comment"> *</span>
414
+ <a name="l00393"></a>00393 <span class="comment"> * @ingroup Support</span>
415
+ <a name="l00394"></a>00394 <span class="comment"> */</span>
416
+ <a name="l00395"></a><a class="code" href="classPassenger_1_1BufferedUpload.html">00395</a> <span class="keyword">class </span><a class="code" href="classPassenger_1_1BufferedUpload.html" title="Represents a buffered upload file.">BufferedUpload</a> {
417
+ <a name="l00396"></a>00396 <span class="keyword">public</span>:<span class="comment"></span>
418
+ <a name="l00397"></a>00397 <span class="comment"> /** The file handle. */</span>
419
+ <a name="l00398"></a><a class="code" href="classPassenger_1_1BufferedUpload.html#0a340f2d972ae791f56f893901109dac">00398</a> FILE *<a class="code" href="classPassenger_1_1BufferedUpload.html#0a340f2d972ae791f56f893901109dac" title="The file handle.">handle</a>;
420
+ <a name="l00399"></a>00399 <span class="comment"></span>
421
+ <a name="l00400"></a>00400 <span class="comment"> /**</span>
422
+ <a name="l00401"></a>00401 <span class="comment"> * Create an empty upload bufer file, and open it for reading and writing.</span>
423
+ <a name="l00402"></a>00402 <span class="comment"> *</span>
424
+ <a name="l00403"></a>00403 <span class="comment"> * @throws SystemException Something went wrong.</span>
425
+ <a name="l00404"></a>00404 <span class="comment"> */</span>
426
+ <a name="l00405"></a><a class="code" href="classPassenger_1_1BufferedUpload.html#b85f5986340242fd2389b81ce4304e6b">00405</a> <a class="code" href="classPassenger_1_1BufferedUpload.html#b85f5986340242fd2389b81ce4304e6b" title="Create an empty upload bufer file, and open it for reading and writing.">BufferedUpload</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *identifier = <span class="stringliteral">"temp"</span>) {
427
+ <a name="l00406"></a>00406 <span class="keywordtype">char</span> templ[PATH_MAX];
428
+ <a name="l00407"></a>00407 <span class="keywordtype">int</span> fd;
429
+ <a name="l00408"></a>00408
430
+ <a name="l00409"></a>00409 snprintf(templ, <span class="keyword">sizeof</span>(templ), <span class="stringliteral">"%s/%s.XXXXXX"</span>, <a class="code" href="classPassenger_1_1BufferedUpload.html#fab496fee959db6320d909069ca6c2b9" title="Returns the directory in which upload buffer files are stored.">getDir</a>().c_str(), identifier);
431
+ <a name="l00410"></a>00410 templ[<span class="keyword">sizeof</span>(templ) - 1] = <span class="charliteral">'\0'</span>;
432
+ <a name="l00411"></a>00411 fd = mkstemp(templ);
433
+ <a name="l00412"></a>00412 <span class="keywordflow">if</span> (fd == -1) {
434
+ <a name="l00413"></a>00413 <span class="keywordtype">char</span> message[1024];
435
+ <a name="l00414"></a>00414 <span class="keywordtype">int</span> e = errno;
436
+ <a name="l00415"></a>00415
437
+ <a name="l00416"></a>00416 snprintf(message, <span class="keyword">sizeof</span>(message), <span class="stringliteral">"Cannot create a temporary file '%s'"</span>, templ);
438
+ <a name="l00417"></a>00417 message[<span class="keyword">sizeof</span>(message) - 1] = <span class="charliteral">'\0'</span>;
439
+ <a name="l00418"></a>00418 <span class="keywordflow">throw</span> <a class="code" href="classPassenger_1_1SystemException.html" title="Represents an error returned by a system call or a standard library call.">SystemException</a>(message, e);
440
+ <a name="l00419"></a>00419 }
441
+ <a name="l00420"></a>00420
442
+ <a name="l00421"></a>00421 <span class="comment">/* We use a POSIX trick here: the file's permissions are set to "u=,g=,o="</span>
443
+ <a name="l00422"></a>00422 <span class="comment"> * and the file is deleted immediately from the filesystem, while we</span>
444
+ <a name="l00423"></a>00423 <span class="comment"> * keep its file handle open. The result is that no other processes</span>
445
+ <a name="l00424"></a>00424 <span class="comment"> * will be able to access this file's contents anymore, except us.</span>
446
+ <a name="l00425"></a>00425 <span class="comment"> * We now have an anonymous disk-backed buffer.</span>
447
+ <a name="l00426"></a>00426 <span class="comment"> */</span>
448
+ <a name="l00427"></a>00427 fchmod(fd, 0000);
449
+ <a name="l00428"></a>00428 unlink(templ);
450
+ <a name="l00429"></a>00429
451
+ <a name="l00430"></a>00430 <a class="code" href="classPassenger_1_1BufferedUpload.html#0a340f2d972ae791f56f893901109dac" title="The file handle.">handle</a> = fdopen(fd, <span class="stringliteral">"w+"</span>);
452
+ <a name="l00431"></a>00431 }
453
+ <a name="l00432"></a>00432
454
+ <a name="l00433"></a>00433 ~<a class="code" href="classPassenger_1_1BufferedUpload.html" title="Represents a buffered upload file.">BufferedUpload</a>() {
455
+ <a name="l00434"></a>00434 fclose(<a class="code" href="classPassenger_1_1BufferedUpload.html#0a340f2d972ae791f56f893901109dac" title="The file handle.">handle</a>);
456
+ <a name="l00435"></a>00435 }
457
+ <a name="l00436"></a>00436 <span class="comment"></span>
458
+ <a name="l00437"></a>00437 <span class="comment"> /**</span>
459
+ <a name="l00438"></a>00438 <span class="comment"> * Returns the directory in which upload buffer files are stored.</span>
460
+ <a name="l00439"></a>00439 <span class="comment"> * This is a subdirectory of the directory returned by getPassengerTempDir(). </span>
461
+ <a name="l00440"></a>00440 <span class="comment"> */</span>
462
+ <a name="l00441"></a><a class="code" href="classPassenger_1_1BufferedUpload.html#fab496fee959db6320d909069ca6c2b9">00441</a> <span class="keyword">static</span> <span class="keywordtype">string</span> <a class="code" href="classPassenger_1_1BufferedUpload.html#fab496fee959db6320d909069ca6c2b9" title="Returns the directory in which upload buffer files are stored.">getDir</a>() {
463
+ <a name="l00442"></a>00442 <span class="keywordflow">return</span> <a class="code" href="group__Support.html#g69deb6b299b45039dc24b60ad9175541" title="Return the path name for the directory in which Phusion Passenger-specific temporary...">getPassengerTempDir</a>() + <span class="stringliteral">"/webserver_private"</span>;
464
+ <a name="l00443"></a>00443 }
465
+ <a name="l00444"></a>00444 };
466
+ <a name="l00445"></a>00445
467
+ <a name="l00446"></a>00446 } <span class="comment">// namespace Passenger</span>
468
+ <a name="l00447"></a>00447
469
+ <a name="l00448"></a>00448 <span class="preprocessor">#endif </span><span class="comment">/* _PASSENGER_UTILS_H_ */</span>
470
+ <a name="l00449"></a>00449
443
471
  </pre></div></div>
444
- <hr size="1"><address style="text-align: right;"><small>Generated on Tue Mar 31 14:00:28 2009 for Passenger by&nbsp;
472
+ <hr size="1"><address style="text-align: right;"><small>Generated on Wed Apr 8 22:35:10 2009 for Passenger by&nbsp;
445
473
  <a href="http://www.doxygen.org/index.html">
446
- <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
474
+ <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
447
475
  </body>
448
476
  </html>