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,147 @@
1
+ /*
2
+ * Phusion Passenger - http://www.modrails.com/
3
+ * Copyright (c) 2009 Phusion
4
+ *
5
+ * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
+ #ifndef _PASSENGER_STATIC_STRING_H_
26
+ #define _PASSENGER_STATIC_STRING_H_
27
+
28
+ #include <string>
29
+
30
+ namespace Passenger {
31
+
32
+ using namespace std;
33
+
34
+ /**
35
+ * An immutable, static byte buffer. This class will never copy data:
36
+ * it just holds a pointer to the data. So a StaticString will become unusable
37
+ * once the data it refers to has been freed.
38
+ *
39
+ * StaticString will never modify the data.
40
+ */
41
+ class StaticString {
42
+ private:
43
+ const char *content;
44
+ string::size_type len;
45
+
46
+ public:
47
+ StaticString() {
48
+ content = "";
49
+ len = 0;
50
+ }
51
+
52
+ StaticString(const StaticString &b) {
53
+ content = b.content;
54
+ len = b.len;
55
+ }
56
+
57
+ StaticString(const string &s) {
58
+ content = s.data();
59
+ len = s.size();
60
+ }
61
+
62
+ StaticString(const char *data) {
63
+ content = data;
64
+ len = strlen(data);
65
+ }
66
+
67
+ StaticString(const char *data, string::size_type len) {
68
+ content = data;
69
+ this->len = len;
70
+ }
71
+
72
+ bool empty() const {
73
+ return len == 0;
74
+ }
75
+
76
+ string::size_type size() const {
77
+ return len;
78
+ }
79
+
80
+ const char *c_str() const {
81
+ return content;
82
+ }
83
+
84
+ const char *data() const {
85
+ return content;
86
+ }
87
+
88
+ bool equals(const StaticString &other) const {
89
+ return len == other.len && memcmp(content, other.content, len) == 0;
90
+ }
91
+
92
+ bool equals(const string &other) const {
93
+ return len == other.size() && memcmp(content, other.data(), len) == 0;
94
+ }
95
+
96
+ bool operator==(const StaticString &other) const {
97
+ return len == other.len && memcmp(content, other.content, len) == 0;
98
+ }
99
+
100
+ bool operator==(const char *other) const {
101
+ return memcmp(content, other, strlen(other)) == 0;
102
+ }
103
+
104
+ bool operator!=(const StaticString &other) const {
105
+ return len == other.len && memcmp(content, other.content, len) != 0;
106
+ }
107
+
108
+ bool operator!=(const char *other) const {
109
+ return memcmp(content, other, strlen(other)) != 0;
110
+ }
111
+
112
+ bool operator<(const StaticString &other) const {
113
+ size_t size = (len < other.size()) ? len : other.size();
114
+ int result = memcmp(content, other.data(), size);
115
+ if (result == 0) {
116
+ return len < other.size();
117
+ } else {
118
+ return result < 0;
119
+ }
120
+ }
121
+
122
+ bool operator<(const char *other) const {
123
+ return *this < StaticString(other);
124
+ }
125
+
126
+ string operator+(const char *other) const {
127
+ return string(content, len) + other;
128
+ }
129
+
130
+ string operator+(const string &other) const {
131
+ return string(content, len) + other;
132
+ }
133
+
134
+ string operator+(const StaticString &other) const {
135
+ string result(content, len);
136
+ result.append(other.data(), other.size());
137
+ return result;
138
+ }
139
+
140
+ operator string() const {
141
+ return string(content, len);
142
+ }
143
+ };
144
+
145
+ } // namespace Passenger
146
+
147
+ #endif /* _PASSENGER_STATIC_STRING_H_ */
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Phusion Passenger - http://www.modrails.com/
3
+ * Copyright (c) 2009 Phusion
4
+ *
5
+ * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ */
25
+
26
+ #include <time.h>
27
+
28
+ namespace Passenger {
29
+ namespace SystemTimeData {
30
+ bool hasForcedValue = false;
31
+ time_t forcedValue = 0;
32
+ }
33
+ }
@@ -1,21 +1,26 @@
1
1
  /*
2
2
  * Phusion Passenger - http://www.modrails.com/
3
- * Copyright (C) 2009 Phusion
3
+ * Copyright (c) 2009 Phusion
4
4
  *
5
- * Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
5
+ * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; version 2 of the License.
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
10
13
  *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
15
16
  *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
19
24
  */
20
25
  #ifndef _PASSENGER_SYSTEM_TIME_H_
21
26
  #define _PASSENGER_SYSTEM_TIME_H_
@@ -1,24 +1,30 @@
1
1
  /*
2
2
  * Phusion Passenger - http://www.modrails.com/
3
- * Copyright (C) 2008 Phusion
3
+ * Copyright (c) 2008, 2009 Phusion
4
4
  *
5
- * Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
5
+ * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; version 2 of the License.
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
10
13
  *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
15
16
  *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
19
24
  */
20
25
 
21
26
  #include <cassert>
27
+ #include <libgen.h>
22
28
  #include <pwd.h>
23
29
  #include "CachedFileStat.h"
24
30
  #include "Utils.h"
@@ -179,6 +185,47 @@ canonicalizePath(const string &path) {
179
185
  #endif
180
186
  }
181
187
 
188
+ string
189
+ resolveSymlink(const string &path) {
190
+ char buf[PATH_MAX];
191
+ ssize_t size;
192
+
193
+ size = readlink(path.c_str(), buf, sizeof(buf) - 1);
194
+ if (size == -1) {
195
+ if (errno == EINVAL) {
196
+ return path;
197
+ } else {
198
+ int e = errno;
199
+ string message = "Cannot resolve possible symlink '";
200
+ message.append(path);
201
+ message.append("'");
202
+ throw FileSystemException(message, e, path);
203
+ }
204
+ } else {
205
+ buf[size] = '\0';
206
+ if (buf[0] == '\0') {
207
+ string message = "The file '";
208
+ message.append(path);
209
+ message.append("' is a symlink, and it refers to an empty filename. This is not allowed.");
210
+ throw FileSystemException(message, ENOENT, path);
211
+ } else if (buf[0] == '/') {
212
+ // Symlink points to an absolute path.
213
+ return buf;
214
+ } else {
215
+ return extractDirName(path) + "/" + buf;
216
+ }
217
+ }
218
+ }
219
+
220
+ string
221
+ extractDirName(const string &path) {
222
+ char *path_copy = strdup(path.c_str());
223
+ char *result = dirname(path_copy);
224
+ string result_string(result);
225
+ free(path_copy);
226
+ return result_string;
227
+ }
228
+
182
229
  string
183
230
  escapeForXml(const string &input) {
184
231
  string result(input);
@@ -319,6 +366,16 @@ createPassengerTempDir(const string &systemTempDir, bool userSwitching,
319
366
  makeDirTree(tmpDir + "/info", "u=rwxs,g=,o=");
320
367
  }
321
368
 
369
+ if (geteuid() == 0) {
370
+ if (userSwitching) {
371
+ makeDirTree(tmpDir + "/master", "u=wxs,g=,o=", workerUid, workerGid);
372
+ } else {
373
+ makeDirTree(tmpDir + "/master", "u=wxs,g=x,o=x", lowestUid, lowestGid);
374
+ }
375
+ } else {
376
+ makeDirTree(tmpDir + "/master", "u=wxs,g=,o=");
377
+ }
378
+
322
379
  if (geteuid() == 0) {
323
380
  if (userSwitching) {
324
381
  /* If user switching is possible and turned on, then each backend
@@ -1,21 +1,26 @@
1
1
  /*
2
2
  * Phusion Passenger - http://www.modrails.com/
3
- * Copyright (C) 2008 Phusion
3
+ * Copyright (c) 2008, 2009 Phusion
4
4
  *
5
- * Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
5
+ * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; version 2 of the License.
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
10
13
  *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
15
16
  *
16
- * You should have received a copy of the GNU General Public License along
17
- * with this program; if not, write to the Free Software Foundation, Inc.,
18
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
19
24
  */
20
25
  #ifndef _PASSENGER_UTILS_H_
21
26
  #define _PASSENGER_UTILS_H_
@@ -210,6 +215,29 @@ string findApplicationPoolServer(const char *passengerRoot);
210
215
  */
211
216
  string canonicalizePath(const string &path);
212
217
 
218
+ /**
219
+ * If <em>path</em> refers to a symlink, then this function resolves the
220
+ * symlink for 1 level. That is, if the symlink points to another symlink,
221
+ * then the other symlink will not be resolved. The resolved path is returned.
222
+ *
223
+ * If the symlink doesn't point to an absolute path, then this function will
224
+ * prepend <em>path</em>'s directory to the result.
225
+ *
226
+ * If <em>path</em> doesn't refer to a symlink then this method will return
227
+ * <em>path</em>.
228
+ *
229
+ * @throws FileSystemException Something went wrong.
230
+ * @ingroup Support
231
+ */
232
+ string resolveSymlink(const string &path);
233
+
234
+ /**
235
+ * Given a path, extracts its directory name.
236
+ *
237
+ * @ingroup Support
238
+ */
239
+ string extractDirName(const string &path);
240
+
213
241
  /**
214
242
  * Escape the given raw string into an XML value.
215
243
  *
@@ -269,6 +297,7 @@ string getPassengerTempDir(bool bypassCache = false, const string &systemTempDir
269
297
  * - info - for storing files that allow external tools to query information
270
298
  * about a running Phusion Passenger instance.
271
299
  * - backends - for storing Unix sockets created by backend processes.
300
+ * - master - for storing files such as the Passenger HelperServer socket.
272
301
  * - var - for storing all other kinds of temp files that the backend processes
273
302
  * create.
274
303
  *
@@ -0,0 +1,1091 @@
1
+ /*
2
+ * Copyright (C) Igor Sysoev
3
+ * Copyright (C) 2007 Manlio Perillo (manlio.perillo@gmail.com)
4
+ * Copyright (C) 2008, 2009 Phusion
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions
8
+ * are met:
9
+ * 1. Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
19
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25
+ * SUCH DAMAGE.
26
+ */
27
+
28
+ #include <ngx_config.h>
29
+ #include <ngx_core.h>
30
+ #include <ngx_http.h>
31
+
32
+ #include "ngx_http_passenger_module.h"
33
+ #include "Configuration.h"
34
+ #include "ContentHandler.h"
35
+
36
+
37
+ static ngx_str_t headers_to_hide[] = {
38
+ /* NOTE: Do not hide the "Status" header; some broken HTTP clients
39
+ * expect this header. See http://tinyurl.com/87rezm
40
+ */
41
+ ngx_string("X-Accel-Expires"),
42
+ ngx_string("X-Accel-Redirect"),
43
+ ngx_string("X-Accel-Limit-Rate"),
44
+ ngx_string("X-Accel-Buffer"),
45
+ ngx_null_string
46
+ };
47
+
48
+ passenger_main_conf_t passenger_main_conf;
49
+
50
+
51
+ void *
52
+ passenger_create_main_conf(ngx_conf_t *cf)
53
+ {
54
+ passenger_main_conf_t *conf;
55
+
56
+ conf = ngx_pcalloc(cf->pool, sizeof(passenger_main_conf_t));
57
+ if (conf == NULL) {
58
+ return NGX_CONF_ERROR;
59
+ }
60
+
61
+ conf->log_level = (ngx_uint_t) NGX_CONF_UNSET;
62
+ conf->max_pool_size = (ngx_uint_t) NGX_CONF_UNSET;
63
+ conf->max_instances_per_app = (ngx_uint_t) NGX_CONF_UNSET;
64
+ conf->pool_idle_time = (ngx_uint_t) NGX_CONF_UNSET;
65
+ conf->user_switching = NGX_CONF_UNSET;
66
+ conf->default_user.data = NULL;
67
+ conf->default_user.len = 0;
68
+
69
+ return conf;
70
+ }
71
+
72
+ char *
73
+ passenger_init_main_conf(ngx_conf_t *cf, void *conf_pointer)
74
+ {
75
+ passenger_main_conf_t *conf;
76
+
77
+ conf = &passenger_main_conf;
78
+ *conf = *((passenger_main_conf_t *) conf_pointer);
79
+
80
+ if (conf->root_dir.len == 0) {
81
+ return "-- The 'passenger_root' directive must be set";
82
+ }
83
+
84
+ if (conf->ruby.len == 0) {
85
+ conf->ruby.data = (u_char *) "ruby";
86
+ conf->ruby.len = sizeof("ruby") - 1;
87
+ }
88
+
89
+ if (conf->log_level == (ngx_uint_t) NGX_CONF_UNSET) {
90
+ conf->log_level = 0;
91
+ }
92
+
93
+ if (conf->max_pool_size == (ngx_uint_t) NGX_CONF_UNSET) {
94
+ conf->max_pool_size = 6;
95
+ }
96
+
97
+ if (conf->max_instances_per_app == (ngx_uint_t) NGX_CONF_UNSET) {
98
+ conf->max_instances_per_app = 0;
99
+ }
100
+
101
+ if (conf->pool_idle_time == (ngx_uint_t) NGX_CONF_UNSET) {
102
+ conf->pool_idle_time = 300;
103
+ }
104
+
105
+ if (conf->user_switching == NGX_CONF_UNSET) {
106
+ conf->user_switching = 1;
107
+ }
108
+
109
+ if (conf->default_user.len == 0) {
110
+ conf->default_user.len = sizeof("nobody") - 1;
111
+ conf->default_user.data = (u_char *) "nobody";
112
+ }
113
+
114
+ return NGX_CONF_OK;
115
+ }
116
+
117
+ void *
118
+ passenger_create_loc_conf(ngx_conf_t *cf)
119
+ {
120
+ passenger_loc_conf_t *conf;
121
+ ngx_keyval_t *kv;
122
+
123
+ conf = ngx_pcalloc(cf->pool, sizeof(passenger_loc_conf_t));
124
+ if (conf == NULL) {
125
+ return NGX_CONF_ERROR;
126
+ }
127
+
128
+ /*
129
+ * set by ngx_pcalloc():
130
+ *
131
+ * conf->upstream.bufs.num = 0;
132
+ * conf->upstream.next_upstream = 0;
133
+ * conf->upstream.temp_path = NULL;
134
+ * conf->upstream.hide_headers_hash = { NULL, 0 };
135
+ * conf->upstream.hide_headers = NULL;
136
+ * conf->upstream.pass_headers = NULL;
137
+ * conf->upstream.schema = { 0, NULL };
138
+ * conf->upstream.uri = { 0, NULL };
139
+ * conf->upstream.location = NULL;
140
+ * conf->upstream.store_lengths = NULL;
141
+ * conf->upstream.store_values = NULL;
142
+ *
143
+ * conf->index.len = 0;
144
+ * conf->index.data = NULL;
145
+ */
146
+
147
+ conf->enabled = NGX_CONF_UNSET;
148
+ conf->use_global_queue = NGX_CONF_UNSET;
149
+ conf->environment.data = NULL;
150
+ conf->environment.len = 0;
151
+ conf->spawn_method.data = NULL;
152
+ conf->spawn_method.len = 0;
153
+ conf->base_uris = NGX_CONF_UNSET_PTR;
154
+ conf->framework_spawner_idle_time = -1;
155
+ conf->app_spawner_idle_time = -1;
156
+
157
+ conf->upstream.store = NGX_CONF_UNSET;
158
+ conf->upstream.store_access = NGX_CONF_UNSET_UINT;
159
+ conf->upstream.buffering = NGX_CONF_UNSET;
160
+ conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
161
+
162
+ conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
163
+ conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
164
+ conf->upstream.read_timeout = NGX_CONF_UNSET_MSEC;
165
+
166
+ conf->upstream.send_lowat = NGX_CONF_UNSET_SIZE;
167
+ conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
168
+
169
+ conf->upstream.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
170
+ conf->upstream.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
171
+ conf->upstream.temp_file_write_size_conf = NGX_CONF_UNSET_SIZE;
172
+
173
+ conf->upstream.pass_request_headers = NGX_CONF_UNSET;
174
+ conf->upstream.pass_request_body = NGX_CONF_UNSET;
175
+
176
+ conf->upstream.intercept_errors = NGX_CONF_UNSET;
177
+
178
+ conf->upstream.cyclic_temp_file = 0;
179
+
180
+ #define DEFINE_VAR_TO_PASS(header_name, var_name) \
181
+ kv = ngx_array_push(conf->vars_source); \
182
+ kv->key.data = (u_char *) header_name; \
183
+ kv->key.len = strlen(header_name) + 1; \
184
+ kv->value.data = (u_char *) var_name; \
185
+ kv->value.len = strlen(var_name) + 1
186
+
187
+ conf->vars_source = ngx_array_create(cf->pool, 4, sizeof(ngx_keyval_t));
188
+ if (conf->vars_source == NULL) {
189
+ return NGX_CONF_ERROR;
190
+ }
191
+
192
+ DEFINE_VAR_TO_PASS("SCGI", "1");
193
+ DEFINE_VAR_TO_PASS("QUERY_STRING", "$query_string");
194
+ DEFINE_VAR_TO_PASS("REQUEST_METHOD", "$request_method");
195
+ DEFINE_VAR_TO_PASS("REQUEST_URI", "$request_uri");
196
+ DEFINE_VAR_TO_PASS("SERVER_PROTOCOL", "$server_protocol");
197
+ DEFINE_VAR_TO_PASS("SERVER_SOFTWARE", "nginx/$nginx_version");
198
+ DEFINE_VAR_TO_PASS("REMOTE_ADDR", "$remote_addr");
199
+ DEFINE_VAR_TO_PASS("REMOTE_PORT", "$remote_port");
200
+ DEFINE_VAR_TO_PASS("SERVER_ADDR", "$server_addr");
201
+ DEFINE_VAR_TO_PASS("SERVER_PORT", "$server_port");
202
+ DEFINE_VAR_TO_PASS("SERVER_NAME", "$server_name");
203
+
204
+ return conf;
205
+ }
206
+
207
+ char *
208
+ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
209
+ {
210
+ passenger_loc_conf_t *prev = parent;
211
+ passenger_loc_conf_t *conf = child;
212
+
213
+ u_char *p;
214
+ size_t size;
215
+ uintptr_t *code;
216
+ ngx_str_t *header;
217
+ ngx_uint_t i, j;
218
+ ngx_array_t hide_headers;
219
+ ngx_str_t *prev_base_uris, *base_uri;
220
+ ngx_keyval_t *src;
221
+ ngx_hash_key_t *hk;
222
+ ngx_hash_init_t hash;
223
+ ngx_http_script_compile_t sc;
224
+ ngx_http_script_copy_code_t *copy;
225
+ u_char *temp_path;
226
+
227
+ ngx_conf_merge_value(conf->enabled, prev->enabled, 0);
228
+ ngx_conf_merge_value(conf->use_global_queue, prev->use_global_queue, 0);
229
+ ngx_conf_merge_str_value(conf->environment, prev->environment, "production");
230
+ ngx_conf_merge_str_value(conf->spawn_method, prev->spawn_method, "smart-lv2");
231
+ if (conf->framework_spawner_idle_time == -1 && prev->framework_spawner_idle_time != -1) {
232
+ conf->framework_spawner_idle_time = prev->framework_spawner_idle_time;
233
+ }
234
+ if (conf->app_spawner_idle_time == -1 && prev->app_spawner_idle_time != -1) {
235
+ conf->app_spawner_idle_time = prev->app_spawner_idle_time;
236
+ }
237
+
238
+ if (prev->base_uris != NGX_CONF_UNSET_PTR) {
239
+ if (conf->base_uris == NGX_CONF_UNSET_PTR) {
240
+ conf->base_uris = ngx_array_create(cf->pool, 4, sizeof(ngx_str_t));
241
+ if (conf->base_uris == NULL) {
242
+ return NGX_CONF_ERROR;
243
+ }
244
+ }
245
+
246
+ prev_base_uris = (ngx_str_t *) prev->base_uris->elts;
247
+ for (i = 0; i < prev->base_uris->nelts; i++) {
248
+ base_uri = (ngx_str_t *) ngx_array_push(conf->base_uris);
249
+ if (base_uri == NULL) {
250
+ return NGX_CONF_ERROR;
251
+ }
252
+ *base_uri = prev_base_uris[i];
253
+ }
254
+ }
255
+
256
+
257
+ if (conf->upstream.store != 0) {
258
+ ngx_conf_merge_value(conf->upstream.store,
259
+ prev->upstream.store, 0);
260
+
261
+ if (conf->upstream.store_lengths == NULL) {
262
+ conf->upstream.store_lengths = prev->upstream.store_lengths;
263
+ conf->upstream.store_values = prev->upstream.store_values;
264
+ }
265
+ }
266
+
267
+ ngx_conf_merge_uint_value(conf->upstream.store_access,
268
+ prev->upstream.store_access, 0600);
269
+
270
+ ngx_conf_merge_value(conf->upstream.buffering,
271
+ prev->upstream.buffering, 1);
272
+
273
+ ngx_conf_merge_value(conf->upstream.ignore_client_abort,
274
+ prev->upstream.ignore_client_abort, 0);
275
+
276
+ ngx_conf_merge_msec_value(conf->upstream.connect_timeout,
277
+ prev->upstream.connect_timeout, 60000);
278
+
279
+ ngx_conf_merge_msec_value(conf->upstream.send_timeout,
280
+ prev->upstream.send_timeout, 60000);
281
+
282
+ ngx_conf_merge_msec_value(conf->upstream.read_timeout,
283
+ prev->upstream.read_timeout, 60000);
284
+
285
+ ngx_conf_merge_size_value(conf->upstream.send_lowat,
286
+ prev->upstream.send_lowat, 0);
287
+
288
+ ngx_conf_merge_size_value(conf->upstream.buffer_size,
289
+ prev->upstream.buffer_size,
290
+ (size_t) ngx_pagesize);
291
+
292
+
293
+ ngx_conf_merge_bufs_value(conf->upstream.bufs, prev->upstream.bufs,
294
+ 8, ngx_pagesize);
295
+
296
+ if (conf->upstream.bufs.num < 2) {
297
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
298
+ "there must be at least 2 \"scgi_buffers\"");
299
+ return NGX_CONF_ERROR;
300
+ }
301
+
302
+
303
+ size = conf->upstream.buffer_size;
304
+ if (size < conf->upstream.bufs.size) {
305
+ size = conf->upstream.bufs.size;
306
+ }
307
+
308
+
309
+ ngx_conf_merge_size_value(conf->upstream.busy_buffers_size_conf,
310
+ prev->upstream.busy_buffers_size_conf,
311
+ NGX_CONF_UNSET_SIZE);
312
+
313
+ if (conf->upstream.busy_buffers_size_conf == NGX_CONF_UNSET_SIZE) {
314
+ conf->upstream.busy_buffers_size = 2 * size;
315
+ } else {
316
+ conf->upstream.busy_buffers_size =
317
+ conf->upstream.busy_buffers_size_conf;
318
+ }
319
+
320
+ if (conf->upstream.busy_buffers_size < size) {
321
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
322
+ "\"scgi_busy_buffers_size\" must be equal or bigger than "
323
+ "maximum of the value of \"scgi_buffer_size\" and "
324
+ "one of the \"scgi_buffers\"");
325
+
326
+ return NGX_CONF_ERROR;
327
+ }
328
+
329
+ if (conf->upstream.busy_buffers_size
330
+ > (conf->upstream.bufs.num - 1) * conf->upstream.bufs.size)
331
+ {
332
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
333
+ "\"scgi_busy_buffers_size\" must be less than "
334
+ "the size of all \"scgi_buffers\" minus one buffer");
335
+
336
+ return NGX_CONF_ERROR;
337
+ }
338
+
339
+
340
+ ngx_conf_merge_size_value(conf->upstream.temp_file_write_size_conf,
341
+ prev->upstream.temp_file_write_size_conf,
342
+ NGX_CONF_UNSET_SIZE);
343
+
344
+ if (conf->upstream.temp_file_write_size_conf == NGX_CONF_UNSET_SIZE) {
345
+ conf->upstream.temp_file_write_size = 2 * size;
346
+ } else {
347
+ conf->upstream.temp_file_write_size =
348
+ conf->upstream.temp_file_write_size_conf;
349
+ }
350
+
351
+ if (conf->upstream.temp_file_write_size < size) {
352
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
353
+ "\"scgi_temp_file_write_size\" must be equal or bigger than "
354
+ "maximum of the value of \"scgi_buffer_size\" and "
355
+ "one of the \"scgi_buffers\"");
356
+
357
+ return NGX_CONF_ERROR;
358
+ }
359
+
360
+
361
+ ngx_conf_merge_size_value(conf->upstream.max_temp_file_size_conf,
362
+ prev->upstream.max_temp_file_size_conf,
363
+ NGX_CONF_UNSET_SIZE);
364
+
365
+ if (conf->upstream.max_temp_file_size_conf == NGX_CONF_UNSET_SIZE) {
366
+ conf->upstream.max_temp_file_size = 1024 * 1024 * 1024;
367
+ } else {
368
+ conf->upstream.max_temp_file_size =
369
+ conf->upstream.max_temp_file_size_conf;
370
+ }
371
+
372
+ if (conf->upstream.max_temp_file_size != 0
373
+ && conf->upstream.max_temp_file_size < size)
374
+ {
375
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
376
+ "\"scgi_max_temp_file_size\" must be equal to zero to disable "
377
+ "the temporary files usage or must be equal or bigger than "
378
+ "maximum of the value of \"scgi_buffer_size\" and "
379
+ "one of the \"scgi_buffers\"");
380
+
381
+ return NGX_CONF_ERROR;
382
+ }
383
+
384
+
385
+ ngx_conf_merge_bitmask_value(conf->upstream.next_upstream,
386
+ prev->upstream.next_upstream,
387
+ (NGX_CONF_BITMASK_SET
388
+ |NGX_HTTP_UPSTREAM_FT_ERROR
389
+ |NGX_HTTP_UPSTREAM_FT_TIMEOUT));
390
+
391
+ if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) {
392
+ conf->upstream.next_upstream = NGX_CONF_BITMASK_SET
393
+ |NGX_HTTP_UPSTREAM_FT_OFF;
394
+ }
395
+
396
+ temp_path = ngx_palloc(cf->pool, NGX_MAX_PATH);
397
+ ngx_memzero(temp_path, NGX_MAX_PATH);
398
+ ngx_snprintf(temp_path, NGX_MAX_PATH, "%s/webserver_private", passenger_temp_dir);
399
+ ngx_conf_merge_path_value(conf->upstream.temp_path,
400
+ prev->upstream.temp_path,
401
+ temp_path, 1, 2, 0,
402
+ ngx_garbage_collector_temp_handler, cf);
403
+ conf->upstream.temp_path->name.len = ngx_strlen(conf->upstream.temp_path->name.data);
404
+
405
+ ngx_conf_merge_value(conf->upstream.pass_request_headers,
406
+ prev->upstream.pass_request_headers, 1);
407
+ ngx_conf_merge_value(conf->upstream.pass_request_body,
408
+ prev->upstream.pass_request_body, 1);
409
+
410
+ ngx_conf_merge_value(conf->upstream.intercept_errors,
411
+ prev->upstream.intercept_errors, 0);
412
+
413
+
414
+
415
+ ngx_conf_merge_str_value(conf->index, prev->index, "");
416
+
417
+ if (conf->upstream.hide_headers == NULL
418
+ && conf->upstream.pass_headers == NULL)
419
+ {
420
+ conf->upstream.hide_headers = prev->upstream.hide_headers;
421
+ conf->upstream.pass_headers = prev->upstream.pass_headers;
422
+ conf->upstream.hide_headers_hash = prev->upstream.hide_headers_hash;
423
+
424
+ if (conf->upstream.hide_headers_hash.buckets) {
425
+ goto peers;
426
+ }
427
+
428
+ } else {
429
+ if (conf->upstream.hide_headers == NULL) {
430
+ conf->upstream.hide_headers = prev->upstream.hide_headers;
431
+ }
432
+
433
+ if (conf->upstream.pass_headers == NULL) {
434
+ conf->upstream.pass_headers = prev->upstream.pass_headers;
435
+ }
436
+ }
437
+
438
+ if (ngx_array_init(&hide_headers, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
439
+ != NGX_OK)
440
+ {
441
+ return NGX_CONF_ERROR;
442
+ }
443
+
444
+ for (header = headers_to_hide; header->len; header++) {
445
+ hk = ngx_array_push(&hide_headers);
446
+ if (hk == NULL) {
447
+ return NGX_CONF_ERROR;
448
+ }
449
+
450
+ hk->key = *header;
451
+ hk->key_hash = ngx_hash_key_lc(header->data, header->len);
452
+ hk->value = (void *) 1;
453
+ }
454
+
455
+ if (conf->upstream.hide_headers) {
456
+
457
+ header = conf->upstream.hide_headers->elts;
458
+
459
+ for (i = 0; i < conf->upstream.hide_headers->nelts; i++) {
460
+
461
+ hk = hide_headers.elts;
462
+
463
+ for (j = 0; j < hide_headers.nelts; j++) {
464
+ if (ngx_strcasecmp(header[i].data, hk[j].key.data) == 0) {
465
+ goto exist;
466
+ }
467
+ }
468
+
469
+ hk = ngx_array_push(&hide_headers);
470
+ if (hk == NULL) {
471
+ return NGX_CONF_ERROR;
472
+ }
473
+
474
+ hk->key = header[i];
475
+ hk->key_hash = ngx_hash_key_lc(header[i].data, header[i].len);
476
+ hk->value = (void *) 1;
477
+
478
+ exist:
479
+
480
+ continue;
481
+ }
482
+ }
483
+
484
+ if (conf->upstream.pass_headers) {
485
+
486
+ hk = hide_headers.elts;
487
+ header = conf->upstream.pass_headers->elts;
488
+
489
+ for (i = 0; i < conf->upstream.pass_headers->nelts; i++) {
490
+
491
+ for (j = 0; j < hide_headers.nelts; j++) {
492
+
493
+ if (hk[j].key.data == NULL) {
494
+ continue;
495
+ }
496
+
497
+ if (ngx_strcasecmp(header[i].data, hk[j].key.data) == 0) {
498
+ hk[j].key.data = NULL;
499
+ break;
500
+ }
501
+ }
502
+ }
503
+ }
504
+
505
+ hash.hash = &conf->upstream.hide_headers_hash;
506
+ hash.key = ngx_hash_key_lc;
507
+ hash.max_size = 512;
508
+ hash.bucket_size = ngx_align(64, ngx_cacheline_size);
509
+ hash.name = "passenger_hide_headers_hash";
510
+ hash.pool = cf->pool;
511
+ hash.temp_pool = NULL;
512
+
513
+ if (ngx_hash_init(&hash, hide_headers.elts, hide_headers.nelts) != NGX_OK) {
514
+ return NGX_CONF_ERROR;
515
+ }
516
+
517
+ peers:
518
+
519
+ if (conf->upstream.upstream == NULL) {
520
+ conf->upstream.upstream = prev->upstream.upstream;
521
+ #if NGINX_VERSION_NUM < 7000
522
+ conf->upstream.schema = prev->upstream.schema;
523
+ #endif
524
+ }
525
+
526
+ if (conf->vars_source == NULL) {
527
+ conf->flushes = prev->flushes;
528
+ conf->vars_len = prev->vars_len;
529
+ conf->vars = prev->vars;
530
+ conf->vars_source = prev->vars_source;
531
+
532
+ if (conf->vars_source == NULL) {
533
+ return NGX_CONF_OK;
534
+ }
535
+ }
536
+
537
+ conf->vars_len = ngx_array_create(cf->pool, 64, 1);
538
+ if (conf->vars_len == NULL) {
539
+ return NGX_CONF_ERROR;
540
+ }
541
+
542
+ conf->vars = ngx_array_create(cf->pool, 512, 1);
543
+ if (conf->vars == NULL) {
544
+ return NGX_CONF_ERROR;
545
+ }
546
+
547
+ src = conf->vars_source->elts;
548
+ for (i = 0; i < conf->vars_source->nelts; i++) {
549
+
550
+ if (ngx_http_script_variables_count(&src[i].value) == 0) {
551
+ copy = ngx_array_push_n(conf->vars_len,
552
+ sizeof(ngx_http_script_copy_code_t));
553
+ if (copy == NULL) {
554
+ return NGX_CONF_ERROR;
555
+ }
556
+
557
+ copy->code = (ngx_http_script_code_pt)
558
+ ngx_http_script_copy_len_code;
559
+ copy->len = src[i].key.len;
560
+
561
+
562
+ copy = ngx_array_push_n(conf->vars_len,
563
+ sizeof(ngx_http_script_copy_code_t));
564
+ if (copy == NULL) {
565
+ return NGX_CONF_ERROR;
566
+ }
567
+
568
+ copy->code = (ngx_http_script_code_pt)
569
+ ngx_http_script_copy_len_code;
570
+ copy->len = src[i].value.len;
571
+
572
+
573
+ size = (sizeof(ngx_http_script_copy_code_t)
574
+ + src[i].key.len + src[i].value.len
575
+ + sizeof(uintptr_t) - 1)
576
+ & ~(sizeof(uintptr_t) - 1);
577
+
578
+ copy = ngx_array_push_n(conf->vars, size);
579
+ if (copy == NULL) {
580
+ return NGX_CONF_ERROR;
581
+ }
582
+
583
+ copy->code = ngx_http_script_copy_code;
584
+ copy->len = src[i].key.len + src[i].value.len;
585
+
586
+ p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
587
+
588
+ p = ngx_cpymem(p, src[i].key.data, src[i].key.len);
589
+ ngx_memcpy(p, src[i].value.data, src[i].value.len);
590
+
591
+ } else {
592
+ copy = ngx_array_push_n(conf->vars_len,
593
+ sizeof(ngx_http_script_copy_code_t));
594
+ if (copy == NULL) {
595
+ return NGX_CONF_ERROR;
596
+ }
597
+
598
+ copy->code = (ngx_http_script_code_pt)
599
+ ngx_http_script_copy_len_code;
600
+ copy->len = src[i].key.len;
601
+
602
+
603
+ size = (sizeof(ngx_http_script_copy_code_t)
604
+ + src[i].key.len + sizeof(uintptr_t) - 1)
605
+ & ~(sizeof(uintptr_t) - 1);
606
+
607
+ copy = ngx_array_push_n(conf->vars, size);
608
+ if (copy == NULL) {
609
+ return NGX_CONF_ERROR;
610
+ }
611
+
612
+ copy->code = ngx_http_script_copy_code;
613
+ copy->len = src[i].key.len;
614
+
615
+ p = (u_char *) copy + sizeof(ngx_http_script_copy_code_t);
616
+ ngx_memcpy(p, src[i].key.data, src[i].key.len);
617
+
618
+
619
+ ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
620
+
621
+ sc.cf = cf;
622
+ sc.source = &src[i].value;
623
+ sc.flushes = &conf->flushes;
624
+ sc.lengths = &conf->vars_len;
625
+ sc.values = &conf->vars;
626
+
627
+ if (ngx_http_script_compile(&sc) != NGX_OK) {
628
+ return NGX_CONF_ERROR;
629
+ }
630
+ }
631
+
632
+ code = ngx_array_push_n(conf->vars_len, sizeof(uintptr_t));
633
+ if (code == NULL) {
634
+ return NGX_CONF_ERROR;
635
+ }
636
+
637
+ *code = (uintptr_t) NULL;
638
+
639
+
640
+ code = ngx_array_push_n(conf->vars, sizeof(uintptr_t));
641
+ if (code == NULL) {
642
+ return NGX_CONF_ERROR;
643
+ }
644
+
645
+ *code = (uintptr_t) NULL;
646
+ }
647
+
648
+ code = ngx_array_push_n(conf->vars_len, sizeof(uintptr_t));
649
+ if (code == NULL) {
650
+ return NGX_CONF_ERROR;
651
+ }
652
+
653
+ *code = (uintptr_t) NULL;
654
+
655
+ return NGX_CONF_OK;
656
+ }
657
+
658
+ static char *
659
+ passenger_enabled(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
660
+ {
661
+ passenger_loc_conf_t *lcf = conf;
662
+
663
+ ngx_url_t u;
664
+ ngx_http_core_loc_conf_t *clcf;
665
+ ngx_str_t *value;
666
+
667
+ value = cf->args->elts;
668
+ if (ngx_strcasecmp(value[1].data, (u_char *) "on") == 0) {
669
+ #if NGINX_VERSION_NUM < 7000
670
+ if (lcf->upstream.schema.len) {
671
+ return "is duplicate";
672
+ }
673
+ #endif
674
+
675
+ lcf->enabled = 1;
676
+
677
+ ngx_memzero(&u, sizeof(ngx_url_t));
678
+ u.url.data = (u_char *) passenger_helper_server_socket;
679
+ u.url.len = strlen(passenger_helper_server_socket);
680
+ u.no_resolve = 1;
681
+
682
+ lcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0);
683
+ if (lcf->upstream.upstream == NULL) {
684
+ return NGX_CONF_ERROR;
685
+ }
686
+
687
+ #if NGINX_VERSION_NUM < 7000
688
+ lcf->upstream.schema = passenger_schema_string;
689
+ #endif
690
+
691
+ clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
692
+ clcf->handler = passenger_content_handler;
693
+
694
+ if (clcf->name.data != NULL
695
+ && clcf->name.data[clcf->name.len - 1] == '/') {
696
+ clcf->auto_redirect = 1;
697
+ }
698
+ } else {
699
+ lcf->enabled = 0;
700
+ }
701
+
702
+ return NGX_CONF_OK;
703
+ }
704
+
705
+ #if 0
706
+ static char *
707
+ ngx_http_scgi_lowat_check(ngx_conf_t *cf, void *post, void *data)
708
+ {
709
+ #if (NGX_FREEBSD)
710
+ ssize_t *np = data;
711
+
712
+ if ((u_long) *np >= ngx_freebsd_net_inet_tcp_sendspace) {
713
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
714
+ "\"scgi_send_lowat\" must be less than %d "
715
+ "(sysctl net.inet.tcp.sendspace)",
716
+ ngx_freebsd_net_inet_tcp_sendspace);
717
+
718
+ return NGX_CONF_ERROR;
719
+ }
720
+
721
+ #elif !(NGX_HAVE_SO_SNDLOWAT)
722
+ ssize_t *np = data;
723
+
724
+ ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
725
+ "\"scgi_send_lowat\" is not supported, ignored");
726
+
727
+ *np = 0;
728
+
729
+ #endif
730
+
731
+ return NGX_CONF_OK;
732
+ }
733
+
734
+ static char *
735
+ ngx_http_scgi_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
736
+ {
737
+ passenger_loc_conf_t *slcf = conf;
738
+
739
+ ngx_str_t *value;
740
+ ngx_http_script_compile_t sc;
741
+
742
+ if (slcf->upstream.store != NGX_CONF_UNSET || slcf->upstream.store_lengths)
743
+ {
744
+ return "is duplicate";
745
+ }
746
+
747
+ value = cf->args->elts;
748
+
749
+ if (ngx_strcmp(value[1].data, "on") == 0) {
750
+ slcf->upstream.store = 1;
751
+ return NGX_CONF_OK;
752
+ }
753
+
754
+ if (ngx_strcmp(value[1].data, "off") == 0) {
755
+ slcf->upstream.store = 0;
756
+ return NGX_CONF_OK;
757
+ }
758
+
759
+ /* include the terminating '\0' into script */
760
+ value[1].len++;
761
+
762
+ ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
763
+
764
+ sc.cf = cf;
765
+ sc.source = &value[1];
766
+ sc.lengths = &slcf->upstream.store_lengths;
767
+ sc.values = &slcf->upstream.store_values;
768
+ sc.variables = ngx_http_script_variables_count(&value[1]);
769
+ sc.complete_lengths = 1;
770
+ sc.complete_values = 1;
771
+
772
+ if (ngx_http_script_compile(&sc) != NGX_OK) {
773
+ return NGX_CONF_ERROR;
774
+ }
775
+
776
+ return NGX_CONF_OK;
777
+ }
778
+
779
+ char *
780
+ ngx_scgi_set_keyval_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
781
+ {
782
+ /*
783
+ * Like ngx_conf_set_keyval_slot but keeps the \0 at the end of
784
+ * the strings.
785
+ */
786
+
787
+ char *p = conf;
788
+
789
+ ngx_str_t *value;
790
+ ngx_array_t **a;
791
+ ngx_keyval_t *kv;
792
+ ngx_conf_post_t *post;
793
+
794
+ a = (ngx_array_t **) (p + cmd->offset);
795
+
796
+ if (*a == NULL) {
797
+ *a = ngx_array_create(cf->pool, 4, sizeof(ngx_keyval_t));
798
+ if (*a == NULL) {
799
+ return NGX_CONF_ERROR;
800
+ }
801
+ }
802
+
803
+ kv = ngx_array_push(*a);
804
+ if (kv == NULL) {
805
+ return NGX_CONF_ERROR;
806
+ }
807
+
808
+ value = cf->args->elts;
809
+
810
+ /* strings are null terminated */
811
+ value[1].len += 1;
812
+ value[2].len += 1;
813
+
814
+ kv->key = value[1];
815
+ kv->value = value[2];
816
+
817
+ if (cmd->post) {
818
+ post = cmd->post;
819
+ return post->post_handler(cf, post, kv);
820
+ }
821
+
822
+ return NGX_CONF_OK;
823
+ }
824
+
825
+
826
+ static ngx_conf_post_t ngx_http_scgi_lowat_post =
827
+ { ngx_http_scgi_lowat_check };
828
+
829
+ #endif /* 0 */
830
+
831
+ const ngx_command_t passenger_commands[] = {
832
+
833
+ { ngx_string("passenger_enabled"),
834
+ NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
835
+ passenger_enabled,
836
+ NGX_HTTP_LOC_CONF_OFFSET,
837
+ 0,
838
+ NULL },
839
+
840
+ { ngx_string("passenger_root"),
841
+ NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
842
+ ngx_conf_set_str_slot,
843
+ NGX_HTTP_MAIN_CONF_OFFSET,
844
+ offsetof(passenger_main_conf_t, root_dir),
845
+ NULL },
846
+
847
+ { ngx_string("passenger_ruby"),
848
+ NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
849
+ ngx_conf_set_str_slot,
850
+ NGX_HTTP_MAIN_CONF_OFFSET,
851
+ offsetof(passenger_main_conf_t, ruby),
852
+ NULL },
853
+
854
+ { ngx_string("passenger_log_level"),
855
+ NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
856
+ ngx_conf_set_num_slot,
857
+ NGX_HTTP_MAIN_CONF_OFFSET,
858
+ offsetof(passenger_main_conf_t, log_level),
859
+ NULL },
860
+
861
+ { ngx_string("passenger_use_global_queue"),
862
+ NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
863
+ ngx_conf_set_flag_slot,
864
+ NGX_HTTP_LOC_CONF_OFFSET,
865
+ offsetof(passenger_loc_conf_t, use_global_queue),
866
+ NULL },
867
+
868
+ { ngx_string("passenger_max_pool_size"),
869
+ NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
870
+ ngx_conf_set_num_slot,
871
+ NGX_HTTP_MAIN_CONF_OFFSET,
872
+ offsetof(passenger_main_conf_t, max_pool_size),
873
+ NULL },
874
+
875
+ { ngx_string("passenger_max_instances_per_app"),
876
+ NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
877
+ ngx_conf_set_num_slot,
878
+ NGX_HTTP_MAIN_CONF_OFFSET,
879
+ offsetof(passenger_main_conf_t, max_instances_per_app),
880
+ NULL },
881
+
882
+ { ngx_string("passenger_pool_idle_time"),
883
+ NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
884
+ ngx_conf_set_num_slot,
885
+ NGX_HTTP_MAIN_CONF_OFFSET,
886
+ offsetof(passenger_main_conf_t, pool_idle_time),
887
+ NULL },
888
+
889
+ { ngx_string("passenger_base_uri"),
890
+ NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
891
+ ngx_conf_set_str_array_slot,
892
+ NGX_HTTP_LOC_CONF_OFFSET,
893
+ offsetof(passenger_loc_conf_t, base_uris),
894
+ NULL },
895
+
896
+ { ngx_string("passenger_user_switching"),
897
+ NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
898
+ ngx_conf_set_flag_slot,
899
+ NGX_HTTP_MAIN_CONF_OFFSET,
900
+ offsetof(passenger_main_conf_t, user_switching),
901
+ NULL },
902
+
903
+ { ngx_string("passenger_default_user"),
904
+ NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
905
+ ngx_conf_set_str_slot,
906
+ NGX_HTTP_MAIN_CONF_OFFSET,
907
+ offsetof(passenger_main_conf_t, default_user),
908
+ NULL },
909
+
910
+ { ngx_string("rails_env"),
911
+ NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
912
+ ngx_conf_set_str_slot,
913
+ NGX_HTTP_LOC_CONF_OFFSET,
914
+ offsetof(passenger_loc_conf_t, environment),
915
+ NULL },
916
+
917
+ { ngx_string("rails_spawn_method"),
918
+ NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
919
+ ngx_conf_set_str_slot,
920
+ NGX_HTTP_LOC_CONF_OFFSET,
921
+ offsetof(passenger_loc_conf_t, spawn_method),
922
+ NULL },
923
+
924
+ { ngx_string("rails_framework_spawner_idle_time"),
925
+ NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
926
+ ngx_conf_set_num_slot,
927
+ NGX_HTTP_LOC_CONF_OFFSET,
928
+ offsetof(passenger_loc_conf_t, framework_spawner_idle_time),
929
+ NULL },
930
+
931
+ { ngx_string("rails_app_spawner_idle_time"),
932
+ NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
933
+ ngx_conf_set_num_slot,
934
+ NGX_HTTP_LOC_CONF_OFFSET,
935
+ offsetof(passenger_loc_conf_t, app_spawner_idle_time),
936
+ NULL },
937
+
938
+ { ngx_string("rack_env"),
939
+ NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
940
+ ngx_conf_set_str_slot,
941
+ NGX_HTTP_LOC_CONF_OFFSET,
942
+ offsetof(passenger_loc_conf_t, environment),
943
+ NULL },
944
+
945
+ /*
946
+
947
+ { ngx_string("scgi_index"),
948
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
949
+ ngx_conf_set_str_slot,
950
+ NGX_HTTP_LOC_CONF_OFFSET,
951
+ offsetof(passenger_loc_conf_t, index),
952
+ NULL },
953
+
954
+ { ngx_string("scgi_store"),
955
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
956
+ ngx_http_scgi_store,
957
+ NGX_HTTP_LOC_CONF_OFFSET,
958
+ 0,
959
+ NULL },
960
+
961
+ { ngx_string("scgi_store_access"),
962
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123,
963
+ ngx_conf_set_access_slot,
964
+ NGX_HTTP_LOC_CONF_OFFSET,
965
+ offsetof(passenger_loc_conf_t, upstream.store_access),
966
+ NULL },
967
+
968
+ { ngx_string("scgi_ignore_client_abort"),
969
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
970
+ ngx_conf_set_flag_slot,
971
+ NGX_HTTP_LOC_CONF_OFFSET,
972
+ offsetof(passenger_loc_conf_t, upstream.ignore_client_abort),
973
+ NULL },
974
+
975
+ { ngx_string("scgi_connect_timeout"),
976
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
977
+ ngx_conf_set_msec_slot,
978
+ NGX_HTTP_LOC_CONF_OFFSET,
979
+ offsetof(passenger_loc_conf_t, upstream.connect_timeout),
980
+ NULL },
981
+
982
+ { ngx_string("scgi_send_timeout"),
983
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
984
+ ngx_conf_set_msec_slot,
985
+ NGX_HTTP_LOC_CONF_OFFSET,
986
+ offsetof(passenger_loc_conf_t, upstream.send_timeout),
987
+ NULL },
988
+
989
+ { ngx_string("scgi_send_lowat"),
990
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
991
+ ngx_conf_set_size_slot,
992
+ NGX_HTTP_LOC_CONF_OFFSET,
993
+ offsetof(passenger_loc_conf_t, upstream.send_lowat),
994
+ &ngx_http_scgi_lowat_post },
995
+
996
+ { ngx_string("scgi_buffer_size"),
997
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
998
+ ngx_conf_set_size_slot,
999
+ NGX_HTTP_LOC_CONF_OFFSET,
1000
+ offsetof(passenger_loc_conf_t, upstream.buffer_size),
1001
+ NULL },
1002
+
1003
+ { ngx_string("scgi_pass_request_headers"),
1004
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
1005
+ ngx_conf_set_flag_slot,
1006
+ NGX_HTTP_LOC_CONF_OFFSET,
1007
+ offsetof(passenger_loc_conf_t, upstream.pass_request_headers),
1008
+ NULL },
1009
+
1010
+ { ngx_string("scgi_pass_request_body"),
1011
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
1012
+ ngx_conf_set_flag_slot,
1013
+ NGX_HTTP_LOC_CONF_OFFSET,
1014
+ offsetof(passenger_loc_conf_t, upstream.pass_request_body),
1015
+ NULL },
1016
+
1017
+ { ngx_string("scgi_intercept_errors"),
1018
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
1019
+ ngx_conf_set_flag_slot,
1020
+ NGX_HTTP_LOC_CONF_OFFSET,
1021
+ offsetof(passenger_loc_conf_t, upstream.intercept_errors),
1022
+ NULL },
1023
+
1024
+ { ngx_string("scgi_read_timeout"),
1025
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
1026
+ ngx_conf_set_msec_slot,
1027
+ NGX_HTTP_LOC_CONF_OFFSET,
1028
+ offsetof(passenger_loc_conf_t, upstream.read_timeout),
1029
+ NULL },
1030
+
1031
+ { ngx_string("scgi_buffers"),
1032
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
1033
+ ngx_conf_set_bufs_slot,
1034
+ NGX_HTTP_LOC_CONF_OFFSET,
1035
+ offsetof(passenger_loc_conf_t, upstream.bufs),
1036
+ NULL },
1037
+
1038
+ { ngx_string("scgi_busy_buffers_size"),
1039
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
1040
+ ngx_conf_set_size_slot,
1041
+ NGX_HTTP_LOC_CONF_OFFSET,
1042
+ offsetof(passenger_loc_conf_t, upstream.busy_buffers_size_conf),
1043
+ NULL },
1044
+
1045
+ { ngx_string("scgi_temp_path"),
1046
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1234,
1047
+ ngx_conf_set_path_slot,
1048
+ NGX_HTTP_LOC_CONF_OFFSET,
1049
+ offsetof(passenger_loc_conf_t, upstream.temp_path),
1050
+ (void *) ngx_garbage_collector_temp_handler },
1051
+
1052
+ { ngx_string("scgi_max_temp_file_size"),
1053
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
1054
+ ngx_conf_set_size_slot,
1055
+ NGX_HTTP_LOC_CONF_OFFSET,
1056
+ offsetof(passenger_loc_conf_t, upstream.max_temp_file_size_conf),
1057
+ NULL },
1058
+
1059
+ { ngx_string("scgi_temp_file_write_size"),
1060
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
1061
+ ngx_conf_set_size_slot,
1062
+ NGX_HTTP_LOC_CONF_OFFSET,
1063
+ offsetof(passenger_loc_conf_t, upstream.temp_file_write_size_conf),
1064
+ NULL },
1065
+
1066
+ { ngx_string("scgi_var"),
1067
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
1068
+ ngx_scgi_set_keyval_slot,
1069
+ NGX_HTTP_LOC_CONF_OFFSET,
1070
+ offsetof(passenger_loc_conf_t, vars_source),
1071
+ NULL },
1072
+
1073
+ { ngx_string("scgi_pass_header"),
1074
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
1075
+ ngx_conf_set_str_array_slot,
1076
+ NGX_HTTP_LOC_CONF_OFFSET,
1077
+ offsetof(passenger_loc_conf_t, upstream.pass_headers),
1078
+ NULL },
1079
+
1080
+ { ngx_string("scgi_hide_header"),
1081
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
1082
+ ngx_conf_set_str_array_slot,
1083
+ NGX_HTTP_LOC_CONF_OFFSET,
1084
+ offsetof(passenger_loc_conf_t, upstream.hide_headers),
1085
+ NULL },
1086
+
1087
+ */
1088
+
1089
+ ngx_null_command
1090
+ };
1091
+