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
@@ -0,0 +1,103 @@
1
+
2
+ charset_map koi8-r windows-1251 {
3
+
4
+ 80 88 ; # euro
5
+
6
+ 95 95 ; # bullet
7
+
8
+ 9A A0 ; #  
9
+
10
+ 9E B7 ; # ·
11
+
12
+ A3 B8 ; # small yo
13
+ A4 BA ; # small Ukrainian ye
14
+
15
+ A6 B3 ; # small Ukrainian i
16
+ A7 BF ; # small Ukrainian yi
17
+
18
+ AD B4 ; # small Ukrainian soft g
19
+ AE A2 ; # small Byelorussian short u
20
+
21
+ B0 B0 ; # °
22
+
23
+ B3 A8 ; # capital YO
24
+ B4 AA ; # capital Ukrainian YE
25
+
26
+ B6 B2 ; # capital Ukrainian I
27
+ B7 AF ; # capital Ukrainian YI
28
+
29
+ B9 B9 ; # numero sign
30
+
31
+ BD A5 ; # capital Ukrainian soft G
32
+ BE A1 ; # capital Byelorussian short U
33
+
34
+ BF A9 ; # (C)
35
+
36
+ C0 FE ; # small yu
37
+ C1 E0 ; # small a
38
+ C2 E1 ; # small b
39
+ C3 F6 ; # small ts
40
+ C4 E4 ; # small d
41
+ C5 E5 ; # small ye
42
+ C6 F4 ; # small f
43
+ C7 E3 ; # small g
44
+ C8 F5 ; # small kh
45
+ C9 E8 ; # small i
46
+ CA E9 ; # small j
47
+ CB EA ; # small k
48
+ CC EB ; # small l
49
+ CD EC ; # small m
50
+ CE ED ; # small n
51
+ CF EE ; # small o
52
+
53
+ D0 EF ; # small p
54
+ D1 FF ; # small ya
55
+ D2 F0 ; # small r
56
+ D3 F1 ; # small s
57
+ D4 F2 ; # small t
58
+ D5 F3 ; # small u
59
+ D6 E6 ; # small zh
60
+ D7 E2 ; # small v
61
+ D8 FC ; # small soft sign
62
+ D9 FB ; # small y
63
+ DA E7 ; # small z
64
+ DB F8 ; # small sh
65
+ DC FD ; # small e
66
+ DD F9 ; # small shch
67
+ DE F7 ; # small ch
68
+ DF FA ; # small hard sign
69
+
70
+ E0 DE ; # capital YU
71
+ E1 C0 ; # capital A
72
+ E2 C1 ; # capital B
73
+ E3 D6 ; # capital TS
74
+ E4 C4 ; # capital D
75
+ E5 C5 ; # capital YE
76
+ E6 D4 ; # capital F
77
+ E7 C3 ; # capital G
78
+ E8 D5 ; # capital KH
79
+ E9 C8 ; # capital I
80
+ EA C9 ; # capital J
81
+ EB CA ; # capital K
82
+ EC CB ; # capital L
83
+ ED CC ; # capital M
84
+ EE CD ; # capital N
85
+ EF CE ; # capital O
86
+
87
+ F0 CF ; # capital P
88
+ F1 DF ; # capital YA
89
+ F2 D0 ; # capital R
90
+ F3 D1 ; # capital S
91
+ F4 D2 ; # capital T
92
+ F5 D3 ; # capital U
93
+ F6 C6 ; # capital ZH
94
+ F7 C2 ; # capital V
95
+ F8 DC ; # capital soft sign
96
+ F9 DB ; # capital Y
97
+ FA C7 ; # capital Z
98
+ FB D8 ; # capital SH
99
+ FC DD ; # capital E
100
+ FD D9 ; # capital SHCH
101
+ FE D7 ; # capital CH
102
+ FF DA ; # capital hard sign
103
+ }
@@ -0,0 +1,70 @@
1
+
2
+ types {
3
+ text/html html htm shtml;
4
+ text/css css;
5
+ text/xml xml rss;
6
+ image/gif gif;
7
+ image/jpeg jpeg jpg;
8
+ application/x-javascript js;
9
+ application/atom+xml atom;
10
+
11
+ text/mathml mml;
12
+ text/plain txt;
13
+ text/vnd.sun.j2me.app-descriptor jad;
14
+ text/vnd.wap.wml wml;
15
+ text/x-component htc;
16
+
17
+ image/png png;
18
+ image/tiff tif tiff;
19
+ image/vnd.wap.wbmp wbmp;
20
+ image/x-icon ico;
21
+ image/x-jng jng;
22
+ image/x-ms-bmp bmp;
23
+ image/svg+xml svg;
24
+
25
+ application/java-archive jar war ear;
26
+ application/mac-binhex40 hqx;
27
+ application/msword doc;
28
+ application/pdf pdf;
29
+ application/postscript ps eps ai;
30
+ application/rtf rtf;
31
+ application/vnd.ms-excel xls;
32
+ application/vnd.ms-powerpoint ppt;
33
+ application/vnd.wap.wmlc wmlc;
34
+ application/vnd.wap.xhtml+xml xhtml;
35
+ application/x-cocoa cco;
36
+ application/x-java-archive-diff jardiff;
37
+ application/x-java-jnlp-file jnlp;
38
+ application/x-makeself run;
39
+ application/x-perl pl pm;
40
+ application/x-pilot prc pdb;
41
+ application/x-rar-compressed rar;
42
+ application/x-redhat-package-manager rpm;
43
+ application/x-sea sea;
44
+ application/x-shockwave-flash swf;
45
+ application/x-stuffit sit;
46
+ application/x-tcl tcl tk;
47
+ application/x-x509-ca-cert der pem crt;
48
+ application/x-xpinstall xpi;
49
+ application/zip zip;
50
+
51
+ application/octet-stream bin exe dll;
52
+ application/octet-stream deb;
53
+ application/octet-stream dmg;
54
+ application/octet-stream eot;
55
+ application/octet-stream iso img;
56
+ application/octet-stream msi msp msm;
57
+
58
+ audio/midi mid midi kar;
59
+ audio/mpeg mp3;
60
+ audio/x-realaudio ra;
61
+
62
+ video/3gpp 3gpp 3gp;
63
+ video/mpeg mpeg mpg;
64
+ video/quicktime mov;
65
+ video/x-flv flv;
66
+ video/x-mng mng;
67
+ video/x-ms-asf asx asf;
68
+ video/x-ms-wmv wmv;
69
+ video/x-msvideo avi;
70
+ }
@@ -0,0 +1,57 @@
1
+ worker_processes 2;
2
+
3
+ error_log <%= @passenger_root %>/test/test.log;
4
+ pid <%= @nginx_root %>/nginx.pid;
5
+
6
+ events {
7
+ worker_connections 1024;
8
+ }
9
+
10
+ http {
11
+ include <%= TEMPLATE_DIR %>/mime.types;
12
+ default_type application/octet-stream;
13
+ sendfile on;
14
+ keepalive_timeout 65;
15
+
16
+ log_format main '$remote_addr - $remote_user [$time_local] $request '
17
+ '"$status" $body_bytes_sent "$http_referer" '
18
+ '"$http_user_agent" "$http_x_forwarded_for"';
19
+ access_log <%= @nginx_root %>/access.log main;
20
+
21
+ passenger_root <%= @passenger_root %>;
22
+ passenger_ruby <%= PlatformInfo::RUBY %>;
23
+ passenger_default_user <%= CONFIG['lowest_user'] %>;
24
+
25
+ <% for server in @servers %>
26
+ server {
27
+ listen <%= @port %>;
28
+ <% server.values.each_pair do |key, value| %>
29
+ <%= key %> <%= value %>;
30
+ <% end %>
31
+ <%= server.extra %>
32
+ }
33
+ <% end %>
34
+
35
+ # HTTPS server
36
+ #
37
+ #server {
38
+ # listen 443;
39
+ # server_name localhost;
40
+
41
+ # ssl on;
42
+ # ssl_certificate cert.pem;
43
+ # ssl_certificate_key cert.key;
44
+
45
+ # ssl_session_timeout 5m;
46
+
47
+ # ssl_protocols SSLv2 SSLv3 TLSv1;
48
+ # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
49
+ # ssl_prefer_server_ciphers on;
50
+
51
+ # location / {
52
+ # root html;
53
+ # index index.html index.htm;
54
+ # }
55
+ #}
56
+
57
+ }
@@ -0,0 +1,126 @@
1
+
2
+ # This map is not a full windows-1251 <> utf8 map: it does not
3
+ # contain Serbian and Macedonian letters. If you need a full map,
4
+ # use contrib/unicode2nginx/win-utf map instead.
5
+
6
+ charset_map windows-1251 utf-8 {
7
+
8
+ 82 E2809A ; # single low-9 quotation mark
9
+
10
+ 84 E2809E ; # double low-9 quotation mark
11
+ 85 E280A6 ; # ellipsis
12
+ 86 E280A0 ; # dagger
13
+ 87 E280A1 ; # double dagger
14
+ 88 E282AC ; # euro
15
+ 89 E280B0 ; # per mille
16
+
17
+ 91 E28098 ; # left single quotation mark
18
+ 92 E28099 ; # right single quotation mark
19
+ 93 E2809C ; # left double quotation mark
20
+ 94 E2809D ; # right double quotation mark
21
+ 95 E280A2 ; # bullet
22
+ 96 E28093 ; # en dash
23
+ 97 E28094 ; # em dash
24
+
25
+ 99 E284A2 ; # trade mark sign
26
+
27
+ A0 C2A0 ; # &nbsp;
28
+ A1 D18E ; # capital Byelorussian short U
29
+ A2 D19E ; # small Byelorussian short u
30
+
31
+ A4 C2A4 ; # currency sign
32
+ A5 D290 ; # capital Ukrainian soft G
33
+ A6 C2A6 ; # borken bar
34
+ A7 C2A7 ; # section sign
35
+ A8 D081 ; # capital YO
36
+ A9 C2A9 ; # (C)
37
+ AA D084 ; # capital Ukrainian YE
38
+ AB C2AB ; # left-pointing double angle quotation mark
39
+ AC C2AC ; # not sign
40
+ AD C2AD ; # soft hypen
41
+ AE C2AE ; # (R)
42
+ AF D087 ; # capital Ukrainian YI
43
+
44
+ B0 C2B0 ; # &deg;
45
+ B1 C2B1 ; # plus-minus sign
46
+ B2 D086 ; # capital Ukrainian I
47
+ B3 D196 ; # small Ukrainian i
48
+ B4 D291 ; # small Ukrainian soft g
49
+ B5 C2B5 ; # micro sign
50
+ B6 C2B6 ; # pilcrow sign
51
+ B7 C2B7 ; # &middot;
52
+ B8 D191 ; # small yo
53
+ B9 E28496 ; # numero sign
54
+ BA D194 ; # small Ukrainian ye
55
+ BB C2BB ; # right-pointing double angle quotation mark
56
+
57
+ BF D197 ; # small Ukrainian yi
58
+
59
+ C0 D090 ; # capital A
60
+ C1 D091 ; # capital B
61
+ C2 D092 ; # capital V
62
+ C3 D093 ; # capital G
63
+ C4 D094 ; # capital D
64
+ C5 D095 ; # capital YE
65
+ C6 D096 ; # capital ZH
66
+ C7 D097 ; # capital Z
67
+ C8 D098 ; # capital I
68
+ C9 D099 ; # capital J
69
+ CA D09A ; # capital K
70
+ CB D09B ; # capital L
71
+ CC D09C ; # capital M
72
+ CD D09D ; # capital N
73
+ CE D09E ; # capital O
74
+ CF D09F ; # capital P
75
+
76
+ D0 D0A0 ; # capital R
77
+ D1 D0A1 ; # capital S
78
+ D2 D0A2 ; # capital T
79
+ D3 D0A3 ; # capital U
80
+ D4 D0A4 ; # capital F
81
+ D5 D0A5 ; # capital KH
82
+ D6 D0A6 ; # capital TS
83
+ D7 D0A7 ; # capital CH
84
+ D8 D0A8 ; # capital SH
85
+ D9 D0A9 ; # capital SHCH
86
+ DA D0AA ; # capital hard sign
87
+ DB D0AB ; # capital Y
88
+ DC D0AC ; # capital soft sign
89
+ DD D0AD ; # capital E
90
+ DE D0AE ; # capital YU
91
+ DF D0AF ; # capital YA
92
+
93
+ E0 D0B0 ; # small a
94
+ E1 D0B1 ; # small b
95
+ E2 D0B2 ; # small v
96
+ E3 D0B3 ; # small g
97
+ E4 D0B4 ; # small d
98
+ E5 D0B5 ; # small ye
99
+ E6 D0B6 ; # small zh
100
+ E7 D0B7 ; # small z
101
+ E8 D0B8 ; # small i
102
+ E9 D0B9 ; # small j
103
+ EA D0BA ; # small k
104
+ EB D0BB ; # small l
105
+ EC D0BC ; # small m
106
+ ED D0BD ; # small n
107
+ EE D0BE ; # small o
108
+ EF D0BF ; # small p
109
+
110
+ F0 D180 ; # small r
111
+ F1 D181 ; # small s
112
+ F2 D182 ; # small t
113
+ F3 D183 ; # small u
114
+ F4 D184 ; # small f
115
+ F5 D185 ; # small kh
116
+ F6 D186 ; # small ts
117
+ F7 D187 ; # small ch
118
+ F8 D188 ; # small sh
119
+ F9 D189 ; # small shch
120
+ FA D18A ; # small hard sign
121
+ FB D18B ; # small y
122
+ FC D18C ; # small soft sign
123
+ FD D18D ; # small e
124
+ FE D18E ; # small yu
125
+ FF D18F ; # small ya
126
+ }
@@ -8,4 +8,8 @@ class UploadsController < ApplicationController
8
8
  "name 2 = " + params[:upload][:name2] + "\n" +
9
9
  "data = " + params[:upload][:data].read
10
10
  end
11
+
12
+ def single
13
+ render :text => params[:foo]
14
+ end
11
15
  end
@@ -25,7 +25,7 @@ ActionController::Routing::Routes.draw do |map|
25
25
  # end
26
26
 
27
27
  map.resources :recipes
28
- map.resources :uploads
28
+ map.resources :uploads, :collection => { :single => :post }
29
29
 
30
30
  # You can have the root of your site routed with map.root -- just remember to delete public/index.html.
31
31
  map.root :controller => "welcome"
Binary file
@@ -0,0 +1,40 @@
1
+ #ifndef _TEST_SUPPORT_H_
2
+ #define _TEST_SUPPORT_H_
3
+
4
+ #include <sys/stat.h>
5
+ #include <sys/types.h>
6
+ #include <iostream>
7
+ #include <string>
8
+ #include <exception>
9
+ #include <cerrno>
10
+ #include <cstring>
11
+
12
+ namespace Test {
13
+
14
+ using namespace std;
15
+
16
+ class TempDir {
17
+ private:
18
+ string name;
19
+ public:
20
+ TempDir(const string &name) {
21
+ this->name = name;
22
+ if (mkdir(name.c_str(), S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) != 0) {
23
+ int e = errno;
24
+ cerr << "Cannot create directory '" << name << "': " <<
25
+ strerror(e) <<" (" << e << ")" << endl;
26
+ throw exception();
27
+ }
28
+ }
29
+
30
+ ~TempDir() {
31
+ string command("rm -rf \"");
32
+ command.append(name);
33
+ command.append("\"");
34
+ system(command.c_str());
35
+ }
36
+ };
37
+
38
+ } // namespace Test
39
+
40
+ #endif /* _TEST_SUPPORT_H_ */
@@ -0,0 +1,98 @@
1
+ require 'erb'
2
+ require 'phusion_passenger/platform_info'
3
+ begin
4
+ require 'daemon_controller'
5
+ rescue LoadError
6
+ STDERR.puts "*** ERROR: daemon_controller is not installed. Please install with: "
7
+ STDERR.puts
8
+ STDERR.puts " gem install FooBarWidget-daemon_controller -s http://gems.github.com"
9
+ STDERR.puts
10
+ exit!(1)
11
+ end
12
+
13
+ class NginxController
14
+ PASSENGER_ROOT = File.expand_path(File.dirname(__FILE__) + "/../..")
15
+ TEMPLATE_DIR = File.expand_path(File.dirname(__FILE__) + "/../stub/nginx")
16
+ PORT = 64507
17
+
18
+ def initialize(root_dir)
19
+ root_dir = File.expand_path(root_dir)
20
+ @passenger_root = PASSENGER_ROOT
21
+ @nginx_root = root_dir
22
+ @port = PORT
23
+ @config_file = "#{root_dir}/nginx.conf"
24
+ @pid_file = "#{root_dir}/nginx.pid"
25
+ @log_file = "#{root_dir}/error.log"
26
+ @controller = DaemonController.new(
27
+ :identifier => 'Nginx',
28
+ :start_command => "#{CONFIG['nginx']} -c '#{@config_file}'",
29
+ :ping_command => lambda { TCPSocket.new('localhost', PORT) },
30
+ :pid_file => @pid_file,
31
+ :log_file => @log_file,
32
+ :timeout => 25,
33
+ :before_start => method(:write_nginx_config_files)
34
+ )
35
+
36
+ @servers = []
37
+ end
38
+
39
+ def set(options)
40
+ options.each_pair do |key, value|
41
+ instance_variable_set("@#{key}", value)
42
+ end
43
+ end
44
+
45
+ def start
46
+ @controller.stop
47
+ @controller.start
48
+ end
49
+
50
+ def stop
51
+ @controller.stop
52
+ end
53
+
54
+ def running?
55
+ return @controller.running?
56
+ end
57
+
58
+ def port
59
+ return @port
60
+ end
61
+
62
+ def add_server
63
+ server = Server.new
64
+ yield server
65
+ @servers << server
66
+ end
67
+
68
+ private
69
+ class Server
70
+ attr_accessor :values
71
+ attr_accessor :extra
72
+
73
+ def initialize
74
+ @values = { :passenger_enabled => "on" }
75
+ end
76
+
77
+ def [](key)
78
+ return @values[key]
79
+ end
80
+
81
+ def []=(key, value)
82
+ @values[key] = value
83
+ end
84
+
85
+ def <<(text)
86
+ @extra = text
87
+ end
88
+ end
89
+
90
+ def write_nginx_config_files
91
+ template = ERB.new(File.read("#{TEMPLATE_DIR}/nginx.conf.erb"))
92
+ File.write(@config_file, template.result(get_binding))
93
+ end
94
+
95
+ def get_binding
96
+ return binding
97
+ end
98
+ end