passenger 5.3.4 → 6.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (283) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +69 -0
  3. data/CONTRIBUTORS +1 -0
  4. data/README.md +2 -1
  5. data/Rakefile +0 -5
  6. data/build/agent.rb +6 -3
  7. data/build/cxx_tests.rb +28 -19
  8. data/build/integration_tests.rb +6 -2
  9. data/build/misc.rb +2 -1
  10. data/build/packaging.rb +2 -0
  11. data/build/support/cplusplus.rb +2 -2
  12. data/build/support/cxx_dependency_map.rb +2651 -2189
  13. data/dev/colorize-logs +272 -0
  14. data/dev/show-latest-crashlog-dir +27 -0
  15. data/resources/templates/standalone/http.erb +2 -0
  16. data/resources/templates/standalone/server.erb +1 -0
  17. data/src/agent/AgentMain.cpp +4 -0
  18. data/src/agent/Core/AdminPanelConnector.h +6 -6
  19. data/src/agent/Core/ApiServer.h +4 -4
  20. data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +2 -2
  21. data/src/agent/Core/ApplicationPool/Context.h +5 -1
  22. data/src/agent/Core/ApplicationPool/Group/InternalUtils.cpp +2 -2
  23. data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +5 -0
  24. data/src/agent/Core/ApplicationPool/Group/Miscellaneous.cpp +2 -1
  25. data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +3 -3
  26. data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +1 -1
  27. data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +13 -20
  28. data/src/agent/Core/ApplicationPool/Group.h +4 -2
  29. data/src/agent/Core/ApplicationPool/Implementation.cpp +5 -5
  30. data/src/agent/Core/ApplicationPool/Options.h +42 -38
  31. data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +2 -1
  32. data/src/agent/Core/ApplicationPool/Pool.h +4 -4
  33. data/src/agent/Core/ApplicationPool/Process.h +13 -15
  34. data/src/agent/Core/ApplicationPool/Socket.h +5 -5
  35. data/src/agent/Core/ApplicationPool/TestSession.h +3 -3
  36. data/src/agent/Core/Config.h +50 -10
  37. data/src/agent/Core/ConfigChange.cpp +13 -1
  38. data/src/agent/Core/Controller/Config.h +41 -17
  39. data/src/agent/Core/Controller/ForwardResponse.cpp +4 -0
  40. data/src/agent/Core/Controller/InitRequest.cpp +14 -8
  41. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +5 -0
  42. data/src/agent/Core/Controller/SendRequest.cpp +9 -9
  43. data/src/agent/Core/Controller/TurboCaching.h +2 -2
  44. data/src/agent/Core/Controller.h +7 -5
  45. data/src/agent/Core/CoreMain.cpp +204 -60
  46. data/src/agent/Core/OptionParser.h +20 -3
  47. data/src/agent/Core/ResponseCache.h +3 -3
  48. data/src/agent/Core/SecurityUpdateChecker.h +4 -2
  49. data/src/agent/Core/SpawningKit/Config/AutoGeneratedCode.h +1 -1
  50. data/src/agent/Core/SpawningKit/Config.h +3 -2
  51. data/src/agent/Core/SpawningKit/Context.h +8 -2
  52. data/src/agent/Core/SpawningKit/DirectSpawner.h +4 -4
  53. data/src/agent/Core/SpawningKit/DummySpawner.h +3 -3
  54. data/src/agent/Core/SpawningKit/ErrorRenderer.h +1 -1
  55. data/src/agent/Core/SpawningKit/Exceptions.h +21 -14
  56. data/src/agent/Core/SpawningKit/Factory.h +1 -1
  57. data/src/agent/Core/SpawningKit/Handshake/BackgroundIOCapturer.h +1 -1
  58. data/src/agent/Core/SpawningKit/Handshake/Perform.h +14 -2
  59. data/src/agent/Core/SpawningKit/Handshake/Prepare.h +3 -3
  60. data/src/agent/Core/SpawningKit/Handshake/WorkDir.h +1 -1
  61. data/src/agent/Core/SpawningKit/Journey.h +4 -5
  62. data/src/agent/Core/SpawningKit/PipeWatcher.h +1 -1
  63. data/src/agent/Core/SpawningKit/README.md +34 -17
  64. data/src/agent/Core/SpawningKit/Result/AutoGeneratedCode.h +1 -1
  65. data/src/agent/Core/SpawningKit/Result.h +20 -8
  66. data/src/agent/Core/SpawningKit/SmartSpawner.h +7 -7
  67. data/src/agent/Core/SpawningKit/Spawner.h +25 -8
  68. data/src/agent/Core/SpawningKit/UserSwitchingRules.h +17 -7
  69. data/src/agent/Core/TelemetryCollector.h +681 -0
  70. data/src/agent/ExecHelper/ExecHelperMain.cpp +1 -1
  71. data/src/agent/FileReadHelper/FileReadHelperMain.cpp +198 -0
  72. data/src/agent/README.md +1 -1
  73. data/src/agent/Shared/ApiAccountUtils.h +1 -1
  74. data/src/agent/Shared/ApiServerUtils.h +3 -3
  75. data/src/agent/Shared/ApplicationPoolApiKey.h +2 -2
  76. data/src/agent/Shared/Fundamentals/AbortHandler.cpp +324 -98
  77. data/src/agent/Shared/Fundamentals/AbortHandler.h +31 -4
  78. data/src/agent/Shared/Fundamentals/Initialization.cpp +4 -5
  79. data/src/agent/Shared/Fundamentals/Initialization.h +9 -1
  80. data/src/agent/SpawnEnvSetupper/SpawnEnvSetupperMain.cpp +1 -1
  81. data/src/agent/SystemMetrics/SystemMetricsMain.cpp +4 -3
  82. data/src/agent/TempDirToucher/TempDirToucherMain.cpp +3 -3
  83. data/src/agent/Watchdog/ApiServer.h +3 -3
  84. data/src/agent/Watchdog/Config.h +24 -5
  85. data/src/agent/Watchdog/CoreWatcher.cpp +2 -2
  86. data/src/agent/Watchdog/WatchdogMain.cpp +97 -28
  87. data/src/apache2_module/Config.cpp +14 -14
  88. data/src/apache2_module/Config.h +8 -16
  89. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +510 -481
  90. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp.cxxcodebuilder +39 -17
  91. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
  92. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +69 -1
  93. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp.cxxcodebuilder +31 -1
  94. data/src/apache2_module/ConfigGeneral/Common.h +45 -0
  95. data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +17 -1
  96. data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp.cxxcodebuilder +16 -1
  97. data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +19 -5
  98. data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp.cxxcodebuilder +26 -9
  99. data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +19 -1
  100. data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp.cxxcodebuilder +10 -1
  101. data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +14 -1
  102. data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp.cxxcodebuilder +11 -1
  103. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +36 -1
  104. data/src/apache2_module/DirConfig/AutoGeneratedStruct.h.cxxcodebuilder +34 -1
  105. data/src/apache2_module/DirectoryMapper.h +36 -37
  106. data/src/apache2_module/Hooks.cpp +27 -8
  107. data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +20 -0
  108. data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +48 -1
  109. data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h.cxxcodebuilder +36 -1
  110. data/src/cxx_supportlib/{Utils → Algorithms}/Hasher.cpp +2 -2
  111. data/src/cxx_supportlib/{Utils → Algorithms}/Hasher.h +4 -4
  112. data/src/cxx_supportlib/AppLocalConfigFileUtils.h +148 -0
  113. data/src/cxx_supportlib/AppTypeDetector/CBindings.cpp +147 -0
  114. data/src/cxx_supportlib/AppTypeDetector/CBindings.h +75 -0
  115. data/src/cxx_supportlib/{AppTypes.h → AppTypeDetector/Detector.h} +92 -131
  116. data/src/cxx_supportlib/ConfigKit/README.md +90 -2
  117. data/src/cxx_supportlib/ConfigKit/Schema.h +60 -15
  118. data/src/cxx_supportlib/ConfigKit/Store.h +129 -5
  119. data/src/cxx_supportlib/Constants.h +1 -1
  120. data/src/cxx_supportlib/{Utils → DataStructures}/HashMap.h +4 -4
  121. data/src/cxx_supportlib/DataStructures/HashedStaticString.h +5 -5
  122. data/src/cxx_supportlib/DataStructures/LString.h +3 -3
  123. data/src/cxx_supportlib/{Utils → DataStructures}/StringMap.h +36 -36
  124. data/src/cxx_supportlib/FileTools/FileManip.cpp +1 -1
  125. data/src/cxx_supportlib/FileTools/PathManip.cpp +2 -2
  126. data/src/cxx_supportlib/FileTools/PathSecurityCheck.cpp +1 -1
  127. data/src/cxx_supportlib/Hooks.h +2 -2
  128. data/src/cxx_supportlib/{Utils → IOTools}/BufferedIO.h +5 -5
  129. data/src/cxx_supportlib/{Utils → IOTools}/IOUtils.cpp +4 -3
  130. data/src/cxx_supportlib/{Utils → IOTools}/IOUtils.h +3 -3
  131. data/src/cxx_supportlib/{Utils → IOTools}/MessageIO.h +7 -7
  132. data/src/cxx_supportlib/{MessageReadersWriters.h → IOTools/MessageSerialization.h} +5 -5
  133. data/src/cxx_supportlib/InstanceDirectory.h +4 -4
  134. data/src/cxx_supportlib/Integrations/LibevJsonUtils.h +3 -3
  135. data/src/cxx_supportlib/{Utils → JsonTools}/JsonUtils.h +5 -5
  136. data/src/cxx_supportlib/LoggingKit/Context.h +2 -2
  137. data/src/cxx_supportlib/LoggingKit/Implementation.cpp +3 -3
  138. data/src/cxx_supportlib/MemoryKit/mbuf.cpp +2 -2
  139. data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +3 -3
  140. data/src/cxx_supportlib/ProcessManagement/Ruby.h +7 -2
  141. data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +19 -12
  142. data/src/cxx_supportlib/ProcessManagement/Spawn.h +21 -2
  143. data/src/cxx_supportlib/ProcessManagement/Utils.h +10 -0
  144. data/src/cxx_supportlib/RandomGenerator.h +2 -2
  145. data/src/cxx_supportlib/ResourceLocator.h +1 -1
  146. data/src/cxx_supportlib/{Crypto.cpp → SecurityKit/Crypto.cpp} +4 -4
  147. data/src/cxx_supportlib/{Crypto.h → SecurityKit/Crypto.h} +4 -4
  148. data/src/cxx_supportlib/{Utils → SecurityKit}/MemZeroGuard.h +0 -0
  149. data/src/cxx_supportlib/ServerKit/AcceptLoadBalancer.h +2 -2
  150. data/src/cxx_supportlib/ServerKit/Channel.h +1 -1
  151. data/src/cxx_supportlib/ServerKit/ClientRef.h +17 -7
  152. data/src/cxx_supportlib/ServerKit/Context.h +2 -2
  153. data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +1 -1
  154. data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +3 -3
  155. data/src/cxx_supportlib/ServerKit/HttpHeaderParserState.h +2 -2
  156. data/src/cxx_supportlib/ServerKit/HttpRequestRef.h +17 -7
  157. data/src/cxx_supportlib/ServerKit/HttpServer.h +16 -10
  158. data/src/cxx_supportlib/ServerKit/Server.h +3 -4
  159. data/src/cxx_supportlib/{Utils → StrIntTools}/DateParsing.h +5 -5
  160. data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtils.cpp +3 -3
  161. data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtils.h +0 -0
  162. data/src/cxx_supportlib/{Utils → StrIntTools}/StrIntUtilsNoStrictAliasing.cpp +12 -12
  163. data/src/cxx_supportlib/{Utils → StrIntTools}/StringScanning.h +5 -5
  164. data/src/cxx_supportlib/{Utils → StrIntTools}/Template.h +30 -5
  165. data/src/cxx_supportlib/SystemTools/ContainerHelpers.h +88 -0
  166. data/src/cxx_supportlib/{Utils → SystemTools}/ProcessMetricsCollector.h +15 -12
  167. data/src/cxx_supportlib/{Utils → SystemTools}/SystemMetricsCollector.h +3 -3
  168. data/src/cxx_supportlib/{Utils → SystemTools}/SystemTime.cpp +1 -1
  169. data/src/cxx_supportlib/{Utils → SystemTools}/SystemTime.h +0 -0
  170. data/src/cxx_supportlib/SystemTools/UserDatabase.h +1 -1
  171. data/src/cxx_supportlib/Utils/CachedFileStat.hpp +3 -3
  172. data/src/cxx_supportlib/Utils/Curl.h +2 -2
  173. data/src/cxx_supportlib/Utils/FileChangeChecker.h +2 -2
  174. data/src/cxx_supportlib/Utils/MessagePassing.h +1 -1
  175. data/src/cxx_supportlib/Utils/SpeedMeter.h +2 -2
  176. data/src/cxx_supportlib/Utils/Timer.h +2 -2
  177. data/src/cxx_supportlib/Utils/VariantMap.h +3 -3
  178. data/src/cxx_supportlib/Utils.cpp +2 -2
  179. data/src/cxx_supportlib/WatchdogLauncher.h +3 -3
  180. data/src/cxx_supportlib/WebSocketCommandReverseServer.h +1 -1
  181. data/src/cxx_supportlib/WrapperRegistry/CBindings.cpp +85 -0
  182. data/src/cxx_supportlib/{Utils/MemoryBarrier.h → WrapperRegistry/CBindings.h} +30 -27
  183. data/src/cxx_supportlib/WrapperRegistry/Entry.h +112 -0
  184. data/src/cxx_supportlib/WrapperRegistry/README.md +37 -0
  185. data/src/cxx_supportlib/WrapperRegistry/Registry.h +309 -0
  186. data/src/cxx_supportlib/vendor-modified/psg_sysqueue.h +3 -0
  187. data/src/helper-scripts/download_binaries/extconf.rb +6 -2
  188. data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +32 -0
  189. data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +12 -0
  190. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +36 -0
  191. data/src/nginx_module/Configuration.c +23 -3
  192. data/src/nginx_module/ContentHandler.c +331 -32
  193. data/src/nginx_module/ContentHandler.h +8 -3
  194. data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +10 -0
  195. data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +27 -0
  196. data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +3 -0
  197. data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +7 -0
  198. data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +11 -0
  199. data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +23 -0
  200. data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +8 -0
  201. data/src/nginx_module/config +2 -1
  202. data/src/nginx_module/ngx_http_passenger_module.c +9 -3
  203. data/src/nginx_module/ngx_http_passenger_module.h +10 -3
  204. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +19 -0
  205. data/src/ruby_supportlib/phusion_passenger/common_library.rb +19 -16
  206. data/src/ruby_supportlib/phusion_passenger/config/agent_compiler.rb +4 -4
  207. data/src/ruby_supportlib/phusion_passenger/config/download_agent_command.rb +6 -2
  208. data/src/ruby_supportlib/phusion_passenger/config/download_nginx_engine_command.rb +6 -2
  209. data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +1 -1
  210. data/src/ruby_supportlib/phusion_passenger/message_channel.rb +2 -2
  211. data/src/ruby_supportlib/phusion_passenger/native_support.rb +7 -3
  212. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +29 -0
  213. data/src/ruby_supportlib/phusion_passenger/packaging.rb +20 -19
  214. data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +22 -4
  215. data/src/ruby_supportlib/phusion_passenger/platform_info/ruby.rb +33 -13
  216. data/src/ruby_supportlib/phusion_passenger/standalone/app_finder.rb +1 -0
  217. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +22 -2
  218. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +4 -1
  219. data/src/ruby_supportlib/phusion_passenger.rb +7 -5
  220. data/src/schema_printer/SchemaPrinterMain.cpp +2 -0
  221. metadata +40 -89
  222. data/.editorconfig +0 -134
  223. data/CODE_OF_CONDUCT.md +0 -52
  224. data/dev/boost-patches/0001-Patch-boost-thread-so-that-oxt-thread-can-use-it.patch +0 -48
  225. data/dev/boost-patches/0002-Make-boost-thread_interrupted-derive-from-oxt-tracab.patch +0 -33
  226. data/dev/boost-patches/0003-Disable-a-Clang-pragma-to-prevent-warnings-on-OS-X.patch +0 -25
  227. data/dev/ci/README.md +0 -134
  228. data/dev/ci/lib/functions.sh +0 -129
  229. data/dev/ci/lib/set-container-envvars.sh +0 -53
  230. data/dev/ci/lib/setup-container.sh +0 -46
  231. data/dev/ci/run-tests-natively +0 -24
  232. data/dev/ci/run-tests-with-docker +0 -42
  233. data/dev/ci/scripts/debug-console-wrapper.sh +0 -29
  234. data/dev/ci/scripts/docker-entrypoint-stage2.sh +0 -17
  235. data/dev/ci/scripts/docker-entrypoint.sh +0 -17
  236. data/dev/ci/scripts/inituidgid +0 -17
  237. data/dev/ci/scripts/run-tests-natively-stage2.sh +0 -17
  238. data/dev/ci/scripts/setup-host-natively.sh +0 -11
  239. data/dev/ci/setup-host +0 -56
  240. data/dev/ci/tests/apache2/run +0 -6
  241. data/dev/ci/tests/apache2/setup +0 -4
  242. data/dev/ci/tests/binaries/Jenkinsfile +0 -105
  243. data/dev/ci/tests/binaries/build-linux +0 -38
  244. data/dev/ci/tests/binaries/build-macos +0 -40
  245. data/dev/ci/tests/binaries/prepare-macos +0 -38
  246. data/dev/ci/tests/binaries/test-linux +0 -45
  247. data/dev/ci/tests/binaries/test-macos +0 -38
  248. data/dev/ci/tests/cxx/run +0 -9
  249. data/dev/ci/tests/cxx/setup +0 -4
  250. data/dev/ci/tests/debian/Jenkinsfile +0 -89
  251. data/dev/ci/tests/debian/run +0 -60
  252. data/dev/ci/tests/nginx/run +0 -5
  253. data/dev/ci/tests/nginx/setup +0 -4
  254. data/dev/ci/tests/nginx-dynamic/run +0 -20
  255. data/dev/ci/tests/nginx-dynamic/setup +0 -4
  256. data/dev/ci/tests/nodejs/run +0 -4
  257. data/dev/ci/tests/nodejs/setup +0 -4
  258. data/dev/ci/tests/rpm/Jenkinsfile +0 -68
  259. data/dev/ci/tests/rpm/run +0 -63
  260. data/dev/ci/tests/ruby/run +0 -4
  261. data/dev/ci/tests/ruby/setup +0 -4
  262. data/dev/ci/tests/source-packaging/run +0 -4
  263. data/dev/ci/tests/source-packaging/setup +0 -4
  264. data/dev/ci/tests/standalone/run +0 -4
  265. data/dev/ci/tests/standalone/setup +0 -4
  266. data/dev/configkit-schemas/index.json +0 -1748
  267. data/dev/configkit-schemas/update_schema_inline_comments.rb +0 -118
  268. data/dev/rack.test/config.ru +0 -5
  269. data/dev/rack.test/public/asset.txt +0 -1
  270. data/dev/vagrant/apache_default_site.conf +0 -35
  271. data/dev/vagrant/apache_passenger.conf +0 -5
  272. data/dev/vagrant/apache_passenger.load +0 -1
  273. data/dev/vagrant/apache_ports.conf +0 -24
  274. data/dev/vagrant/apache_rack_test.conf +0 -9
  275. data/dev/vagrant/bashrc +0 -23
  276. data/dev/vagrant/nginx.conf +0 -39
  277. data/dev/vagrant/nginx_rakefile +0 -33
  278. data/dev/vagrant/nginx_start +0 -32
  279. data/dev/vagrant/provision.sh +0 -117
  280. data/dev/vagrant/sudoers.conf +0 -5
  281. data/resources/templates/error_renderer/.editorconfig +0 -19
  282. data/src/cxx_supportlib/AppTypes.cpp +0 -109
  283. data/src/cxx_supportlib/vendor-modified/SmallVector.h +0 -653
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010-2017 Phusion Holding B.V.
3
+ * Copyright (c) 2010-2018 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -34,7 +34,7 @@
34
34
  #include <JsonTools/Autocast.h>
35
35
  #include <Utils.h>
36
36
  #include <Utils/OptionParsing.h>
37
- #include <Utils/StrIntUtils.h>
37
+ #include <StrIntTools/StrIntUtils.h>
38
38
 
39
39
  #include <jsoncpp/json.h>
40
40
 
@@ -94,7 +94,12 @@ coreUsage() {
94
94
  printf(" Disable the periodic check and notice about\n");
95
95
  printf(" important security updates\n");
96
96
  printf(" --security-update-check-proxy PROXY\n");
97
- printf(" Use http/SOCKS proxy for the security update check:\n");
97
+ printf(" Use HTTP/SOCKS proxy for the security update check:\n");
98
+ printf(" scheme://user:password@proxy_host:proxy_port\n");
99
+ printf(" --disable-anonymous-telemetry\n");
100
+ printf(" Disable anonymous telemetry collection\n");
101
+ printf(" --anonymous-telemetry-proxy PROXY\n");
102
+ printf(" Use HTTP/SOCKS proxy for anonymous telemetry sending:\n");
98
103
  printf(" scheme://user:password@proxy_host:proxy_port\n");
99
104
  printf("\n");
100
105
  printf("Application serving options (optional):\n");
@@ -104,6 +109,9 @@ coreUsage() {
104
109
  printf(" (single-app mode only)\n");
105
110
  printf(" --startup-file PATH The path of the app's startup file, relative to\n");
106
111
  printf(" the app root directory (single-app mode only)\n");
112
+ printf(" --app-start-command COMMAND\n");
113
+ printf(" The command string with which to start the app\n");
114
+ printf(" (single-app mode only)\n");
107
115
  printf(" --spawn-method NAME Spawn method to use. Can either be 'smart' or\n");
108
116
  printf(" 'direct'. Default: %s\n", DEFAULT_SPAWN_METHOD);
109
117
  printf(" --load-shell-envvars Load shell startup files before loading application\n");
@@ -282,6 +290,12 @@ parseCoreOption(int argc, const char *argv[], int &i, Json::Value &updates) {
282
290
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--security-update-check-proxy")) {
283
291
  updates["security_update_checker_proxy_url"] = argv[i + 1];
284
292
  i += 2;
293
+ } else if (p.isFlag(argv[i], '\0', "--disable-anonymous-telemetry")) {
294
+ updates["telemetry_collector_disabled"] = true;
295
+ i++;
296
+ } else if (p.isValueFlag(argc, i, argv[i], '\0', "--anonymous-telemetry-proxy")) {
297
+ updates["telemetry_collector_proxy_url"] = argv[i + 1];
298
+ i += 2;
285
299
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--max-pool-size")) {
286
300
  updates["max_pool_size"] = atoi(argv[i + 1]);
287
301
  i += 2;
@@ -306,6 +320,9 @@ parseCoreOption(int argc, const char *argv[], int &i, Json::Value &updates) {
306
320
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--startup-file")) {
307
321
  updates["single_app_mode_startup_file"] = argv[i + 1];
308
322
  i += 2;
323
+ } else if (p.isValueFlag(argc, i, argv[i], '\0', "--app-start-command")) {
324
+ updates["single_app_mode_app_start_command"] = argv[i + 1];
325
+ i += 2;
309
326
  } else if (p.isValueFlag(argc, i, argv[i], '\0', "--spawn-method")) {
310
327
  updates["default_spawn_method"] = argv[i + 1];
311
328
  i += 2;
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2014-2017 Phusion Holding B.V.
3
+ * Copyright (c) 2014-2018 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -34,8 +34,8 @@
34
34
  #include <ServerKit/http_parser.h>
35
35
  #include <ServerKit/CookieUtils.h>
36
36
  #include <StaticString.h>
37
- #include <Utils/DateParsing.h>
38
- #include <Utils/StrIntUtils.h>
37
+ #include <StrIntTools/DateParsing.h>
38
+ #include <StrIntTools/StrIntUtils.h>
39
39
 
40
40
  namespace Passenger {
41
41
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2017 Phusion Holding B.V.
3
+ * Copyright (c) 2017-2018 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -33,7 +33,7 @@
33
33
  #include <oxt/thread.hpp>
34
34
  #include <oxt/backtrace.hpp>
35
35
 
36
- #include <Crypto.h>
36
+ #include <SecurityKit/Crypto.h>
37
37
  #include <ResourceLocator.h>
38
38
  #include <Exceptions.h>
39
39
  #include <StaticString.h>
@@ -256,9 +256,11 @@ private:
256
256
  error.append(" for proxy address " + sessionState.config["proxy_url"].asString());
257
257
  break;
258
258
 
259
+ #if LIBCURL_VERSION_NUM < 0x073e00
259
260
  case CURLE_SSL_CACERT:
260
261
  // Peer certificate cannot be authenticated with given / known CA certificates. This would happen
261
262
  // for MITM but could also be a truststore issue.
263
+ #endif
262
264
  case CURLE_PEER_FAILED_VERIFICATION:
263
265
  // The remote server's SSL certificate or SSH md5 fingerprint was deemed not OK.
264
266
  error.append(" while connecting to " + sessionState.configRlz.url
@@ -344,7 +344,7 @@ Passenger::SpawningKit::Config::getNonConfidentialFieldsToPassToApp() const {
344
344
  doc["user"] = user.toString();
345
345
  doc["group"] = group.toString();
346
346
  doc["environment_variables"] = "<SECRET>";
347
- doc["log_file"] = "<SECRET>";
347
+ doc["log_file"] = logFile.toString();
348
348
  if (!config.apiKey.empty()) {
349
349
  doc["api_key"] = "<SECRET>";
350
350
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2011-2017 Phusion Holding B.V.
3
+ * Copyright (c) 2011-2018 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -221,7 +221,7 @@ public:
221
221
  StaticString processTitle;
222
222
 
223
223
  /**
224
- * An application type name, e.g. "rack" or "node". The only use for this
224
+ * An application type name, e.g. "ruby" or "nodejs". The only use for this
225
225
  * in SpawningKit is to better format error messages.
226
226
  *
227
227
  * @hinted_parseable
@@ -299,6 +299,7 @@ public:
299
299
  * to the given log file.
300
300
  *
301
301
  * @hinted_parseable
302
+ * @non_confidential
302
303
  * @pass_during_handshake
303
304
  */
304
305
  StaticString logFile;
@@ -36,7 +36,8 @@
36
36
  #include <ResourceLocator.h>
37
37
  #include <RandomGenerator.h>
38
38
  #include <Exceptions.h>
39
- #include <Utils/JsonUtils.h>
39
+ #include <WrapperRegistry/Registry.h>
40
+ #include <JsonTools/JsonUtils.h>
40
41
  #include <ConfigKit/Store.h>
41
42
 
42
43
  namespace Passenger {
@@ -132,7 +133,8 @@ private:
132
133
  public:
133
134
  /****** Dependencies ******/
134
135
 
135
- ResourceLocator *resourceLocator;
136
+ const ResourceLocator *resourceLocator;
137
+ const WrapperRegistry::Registry *wrapperRegistry;
136
138
  RandomGeneratorPtr randomGenerator;
137
139
  string integrationMode;
138
140
  string instanceDir;
@@ -147,6 +149,7 @@ public:
147
149
  nextPort(0),
148
150
 
149
151
  resourceLocator(NULL),
152
+ wrapperRegistry(NULL),
150
153
  debugSupport(NULL)
151
154
  {
152
155
  vector<ConfigKit::Error> errors;
@@ -185,6 +188,9 @@ public:
185
188
  if (resourceLocator == NULL) {
186
189
  throw RuntimeException("ResourceLocator not initialized");
187
190
  }
191
+ if (wrapperRegistry == NULL) {
192
+ throw RuntimeException("WrapperRegistry not initialized");
193
+ }
188
194
  if (randomGenerator == NULL) {
189
195
  randomGenerator = boost::make_shared<RandomGenerator>();
190
196
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2011-2017 Phusion Holding B.V.
3
+ * Copyright (c) 2011-2018 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -36,7 +36,7 @@
36
36
  #include <Constants.h>
37
37
  #include <LoggingKit/LoggingKit.h>
38
38
  #include <LveLoggingDecorator.h>
39
- #include <Utils/IOUtils.h>
39
+ #include <IOTools/IOUtils.h>
40
40
  #include <Utils/AsyncSignalSafeUtils.h>
41
41
 
42
42
  #include <limits.h> // for PTHREAD_STACK_MIN
@@ -164,14 +164,14 @@ private:
164
164
  dup2(stdinCopy, 0);
165
165
  dup2(stdoutAndErrCopy, 1);
166
166
  dup2(stdoutAndErrCopy, 2);
167
- closeAllFileDescriptors(2, true);
167
+ closeAllFileDescriptors(2);
168
168
 
169
169
  execlp(agentFilename.c_str(),
170
170
  agentFilename.c_str(),
171
171
  "spawn-env-setupper",
172
172
  session.workDir->getPath().c_str(),
173
173
  "--before",
174
- NULL);
174
+ (char *) 0);
175
175
 
176
176
  char *pos = buf;
177
177
  e = errno;
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2011-2017 Phusion Holding B.V.
3
+ * Copyright (c) 2011-2018 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -31,7 +31,7 @@
31
31
  #include <vector>
32
32
 
33
33
  #include <StaticString.h>
34
- #include <Utils/StrIntUtils.h>
34
+ #include <StrIntTools/StrIntUtils.h>
35
35
  #include <Core/SpawningKit/Spawner.h>
36
36
  #include <Core/SpawningKit/Exceptions.h>
37
37
 
@@ -89,7 +89,7 @@ public:
89
89
 
90
90
  result.initialize(*context, &config);
91
91
  result.pid = number;
92
- result.dummy = true;
92
+ result.type = Result::DUMMY;
93
93
  result.gupid = "gupid-" + toString(number);
94
94
  result.spawnEndTime = result.spawnStartTime;
95
95
  result.spawnEndTimeMonotonic = result.spawnStartTimeMonotonic;
@@ -35,7 +35,7 @@
35
35
  #include <Constants.h>
36
36
  #include <StaticString.h>
37
37
  #include <FileTools/FileManip.h>
38
- #include <Utils/Template.h>
38
+ #include <StrIntTools/Template.h>
39
39
  #include <Core/SpawningKit/Context.h>
40
40
  #include <Core/SpawningKit/Exceptions.h>
41
41
 
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2011-2017 Phusion Holding B.V.
3
+ * Copyright (c) 2011-2018 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -29,14 +29,15 @@
29
29
  #include <oxt/tracable_exception.hpp>
30
30
  #include <string>
31
31
  #include <stdexcept>
32
+ #include <limits>
32
33
 
33
34
  #include <Constants.h>
34
35
  #include <Exceptions.h>
35
36
  #include <LoggingKit/LoggingKit.h>
36
37
  #include <DataStructures/StringKeyTable.h>
37
38
  #include <ProcessManagement/Spawn.h>
38
- #include <Utils/StrIntUtils.h>
39
- #include <Utils/SystemMetricsCollector.h>
39
+ #include <SystemTools/SystemMetricsCollector.h>
40
+ #include <StrIntTools/StrIntUtils.h>
40
41
  #include <Core/SpawningKit/Config.h>
41
42
  #include <Core/SpawningKit/Journey.h>
42
43
 
@@ -121,6 +122,7 @@ private:
121
122
  message = "A timeout occurred while spawning an application process";
122
123
  break;
123
124
  }
125
+ break;
124
126
  default:
125
127
  string categoryPhraseWithIndefiniteArticle =
126
128
  getErrorCategoryPhraseWithIndefiniteArticle(
@@ -137,6 +139,7 @@ private:
137
139
  + " occurred while starting a preloader process";
138
140
  break;
139
141
  }
142
+ break;
140
143
  default:
141
144
  switch (journey.getFirstFailedStep()) {
142
145
  case SPAWNING_KIT_PREPARATION:
@@ -172,7 +175,9 @@ private:
172
175
  + " occurred while spawning an application process";
173
176
  break;
174
177
  }
178
+ break;
175
179
  }
180
+ break;
176
181
  }
177
182
 
178
183
  if (advancedProblemDetails.empty()) {
@@ -602,7 +607,7 @@ private:
602
607
  " scripts.</p>");
603
608
  break;
604
609
  case SUBPROCESS_APP_LOAD_OR_EXEC:
605
- if (config.appType == "node") {
610
+ if (config.appType == "nodejs") {
606
611
  message.append(
607
612
  "<h3>Check whether the application calls <code>http.Server.listen()</code></h3>"
608
613
  "<p>" SHORT_PROGRAM_NAME " requires that the application calls"
@@ -736,12 +741,13 @@ private:
736
741
  const char *command[] = { "/bin/sh", "-c", "ulimit -a", NULL };
737
742
  try {
738
743
  SubprocessInfo info;
739
- string result;
740
- runCommandAndCaptureOutput(command, info, result);
741
- if (result.empty()) {
742
- result.assign("Error: command 'ulimit -a' failed");
744
+ SubprocessOutput output;
745
+ runCommandAndCaptureOutput(command, info, output,
746
+ std::numeric_limits<size_t>::max());
747
+ if (output.data.empty()) {
748
+ output.data.assign("Error: command 'ulimit -a' failed");
743
749
  }
744
- return result;
750
+ return output.data;
745
751
  } catch (const SystemException &e) {
746
752
  return P_STATIC_STRING("Error: command 'ulimit -a' failed: ") + e.what();
747
753
  }
@@ -751,12 +757,13 @@ private:
751
757
  const char *command[] = { "id", "-a", NULL };
752
758
  try {
753
759
  SubprocessInfo info;
754
- string result;
755
- runCommandAndCaptureOutput(command, info, result);
756
- if (result.empty()) {
757
- result.assign("Error: command 'id -a' failed");
760
+ SubprocessOutput output;
761
+ runCommandAndCaptureOutput(command, info, output,
762
+ std::numeric_limits<size_t>::max());
763
+ if (output.data.empty()) {
764
+ output.data.assign("Error: command 'id -a' failed");
758
765
  }
759
- return result;
766
+ return output.data;
760
767
  } catch (const SystemException &e) {
761
768
  return P_STATIC_STRING("Error: command 'id -a' failed: ") + e.what();
762
769
  }
@@ -48,7 +48,7 @@ private:
48
48
  SpawnerPtr tryCreateSmartSpawner(const AppPoolOptions &options) {
49
49
  string dir = context->resourceLocator->getHelperScriptsDir();
50
50
  vector<string> preloaderCommand;
51
- if (options.appType == "rack") {
51
+ if (options.appType == "ruby" || options.appType == "rack") {
52
52
  preloaderCommand.push_back(options.ruby);
53
53
  preloaderCommand.push_back(dir + "/rack-preloader.rb");
54
54
  } else {
@@ -42,7 +42,7 @@
42
42
  #include <FileDescriptor.h>
43
43
  #include <StaticString.h>
44
44
  #include <Utils.h>
45
- #include <Utils/StrIntUtils.h>
45
+ #include <StrIntTools/StrIntUtils.h>
46
46
 
47
47
  namespace Passenger {
48
48
  namespace SpawningKit {
@@ -52,8 +52,8 @@
52
52
  #include <FileTools/PathManip.h>
53
53
  #include <Utils.h>
54
54
  #include <Utils/ScopeGuard.h>
55
- #include <Utils/SystemTime.h>
56
- #include <Utils/StrIntUtils.h>
55
+ #include <SystemTools/SystemTime.h>
56
+ #include <StrIntTools/StrIntUtils.h>
57
57
  #include <Core/SpawningKit/Config.h>
58
58
  #include <Core/SpawningKit/Exceptions.h>
59
59
  #include <Core/SpawningKit/Handshake/BackgroundIOCapturer.h>
@@ -202,6 +202,7 @@ private:
202
202
  socketIsNowPingable = true;
203
203
  finishState = FINISH_SUCCESS;
204
204
  wakeupEventLoop();
205
+ break;
205
206
  } else {
206
207
  syscalls::usleep(50000);
207
208
  }
@@ -297,6 +298,7 @@ private:
297
298
  result.stdoutAndErrFd = stdoutAndErrFd;
298
299
  result.spawnEndTime = SystemTime::getUsec();
299
300
  result.spawnEndTimeMonotonic = SystemTime::getMonotonicUsec();
301
+ setResultType(result);
300
302
 
301
303
  if (socketIsNowPingable) {
302
304
  assert(config->genericApp || config->findFreePort);
@@ -1674,6 +1676,16 @@ private:
1674
1676
  return result;
1675
1677
  }
1676
1678
 
1679
+ void setResultType(Result &result) const {
1680
+ if (config->genericApp) {
1681
+ result.type = Result::GENERIC;
1682
+ } else if (config->startsUsingWrapper) {
1683
+ result.type = Result::AUTO_SUPPORTED;
1684
+ } else {
1685
+ result.type = Result::KURIA;
1686
+ }
1687
+ }
1688
+
1677
1689
  public:
1678
1690
  struct DebugSupport {
1679
1691
  virtual ~DebugSupport() { }
@@ -56,10 +56,10 @@
56
56
  #include <FileTools/FileManip.h>
57
57
  #include <FileTools/PathManip.h>
58
58
  #include <SystemTools/UserDatabase.h>
59
- #include <Utils/SystemTime.h>
59
+ #include <SystemTools/SystemTime.h>
60
60
  #include <Utils/Timer.h>
61
- #include <Utils/IOUtils.h>
62
- #include <Utils/StrIntUtils.h>
61
+ #include <IOTools/IOUtils.h>
62
+ #include <StrIntTools/StrIntUtils.h>
63
63
  #include <Core/SpawningKit/Context.h>
64
64
  #include <Core/SpawningKit/Config.h>
65
65
  #include <Core/SpawningKit/Journey.h>
@@ -36,7 +36,7 @@
36
36
 
37
37
  #include <Exceptions.h>
38
38
  #include <Utils.h>
39
- #include <Utils/StrIntUtils.h>
39
+ #include <StrIntTools/StrIntUtils.h>
40
40
 
41
41
  namespace Passenger {
42
42
  namespace SpawningKit {
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2017 Phusion Holding B.V.
3
+ * Copyright (c) 2017-2018 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -36,10 +36,9 @@
36
36
 
37
37
  #include <LoggingKit/LoggingKit.h>
38
38
  #include <StaticString.h>
39
- #include <Utils/SystemTime.h>
40
- #include <Utils/JsonUtils.h>
41
- #include <Utils/StrIntUtils.h>
42
- #include <Utils/SystemTime.h>
39
+ #include <SystemTools/SystemTime.h>
40
+ #include <JsonTools/JsonUtils.h>
41
+ #include <StrIntTools/StrIntUtils.h>
43
42
 
44
43
  namespace Passenger {
45
44
  namespace SpawningKit {
@@ -43,7 +43,7 @@
43
43
  #include <Constants.h>
44
44
  #include <LoggingKit/LoggingKit.h>
45
45
  #include <Utils.h>
46
- #include <Utils/StrIntUtils.h>
46
+ #include <StrIntTools/StrIntUtils.h>
47
47
 
48
48
  namespace Passenger {
49
49
  namespace SpawningKit {
@@ -6,7 +6,7 @@ Spawning an application process is complex, involving many steps and with many f
6
6
 
7
7
  Here is how SpawningKit is used. The caller supplies various parameters such as where the application is located, what language it's written in, what environment variables to apply, etc. SpawningKit then spawns the application process, checks whether the application spawned properly or whether it encountered an error, and then either returns an object that describes the resulting process or throws an exception that describes the failure.
8
8
 
9
- Reliability and visibility are core features in SpawningKit. When SpawningKit returns, you know for sure whether the process started correctly or not. If the application did not start correctly, then the resulting exception describes the failure in a detailed enough manner that allows users to pinpoint the source of the problem. SpawningKit also enforces timeouts everywhere so that stuck processes are handled as well.
9
+ Reliability and visibility are core features of SpawningKit. When SpawningKit returns, you know for sure whether the process started correctly or not. If the application did not start correctly, then the resulting exception describes the failure in a detailed enough manner that allows users to pinpoint the source of the problem. SpawningKit also enforces timeouts everywhere so that stuck processes are handled as well.
10
10
 
11
11
  **Table of contents**:
12
12
 
@@ -17,6 +17,13 @@ Reliability and visibility are core features in SpawningKit. When SpawningKit re
17
17
  - The start command
18
18
  - Summary with examples
19
19
  * API and implementation highlights
20
+ - Context
21
+ - Spawners (high-level API)
22
+ - HandshakePrepare and HandshakePerform (low-level API)
23
+ - Configuration object
24
+ - Exception object
25
+ - Journey
26
+ - ErrorRenderer
20
27
  * Overview of the spawning journey
21
28
  - When spawning a process without a preloader
22
29
  - When starting a preloader
@@ -42,19 +49,39 @@ Reliability and visibility are core features in SpawningKit. When SpawningKit re
42
49
 
43
50
  ### Generic vs SpawningKit-enabled applications
44
51
 
52
+ All applications
53
+ |
54
+ +-- Generic applications
55
+ | (without explicit SpawningKit support; `genericApp = true`)
56
+ |
57
+ +-- SpawningKit-enabled applications
58
+ (with explicit SpawningKit support; `genericApp = false`)
59
+ |
60
+ +-- Applications with SpawningKit support automatically injected
61
+ | through a "wrapper"; no manual modifications
62
+ | (`startsUsingWrapper = true`)
63
+ |
64
+ +-- Applications manually modified with SpawningKit support
65
+ (`startsUsingWrapper = false`)
66
+
45
67
  SpawningKit can be used to spawn any web application, both those with and without explicit SpawningKit support.
46
68
 
69
+ > A generic application corresponds to setting the SpawningKit config `genericApp = true`.
70
+
47
71
  When SpawningKit is used to spawn a generic application (without explicit SpawningKit support), the only requirement is that the application can be instructed to start and to listen on a specific TCP port on localhost. The user needs to specify a command string that tells SpawningKit how that is to be done. SpawningKit then looks for a free port that the application may use and executes the application using the supplied command string, telling it to listen on that specific port. (This approach is inspired by Heroku's Procfile system.) SpawningKit waits until the application is up by pinging the port. If the application fails (e.g. by terminating early or by not responding to pings in time) then SpawningKit will abort, reporting the application's stdout and stderr output.
48
72
 
73
+ > A SpawningKit-enabled application corresponds to setting the SpawningKit config `genericApp = false`.
74
+
49
75
  Applications can also be modified with explicit SpawningKit support. Such applications can improve performance by telling SpawningKit that it wishes to listen on a Unix domain socket instead of a TCP socket; and they can provide more feedback about any spawning failures, such as with HTML-formatted error messages or by providing more information about where internally in the application or web framework the failure occurred.
50
76
 
51
77
  ### Wrappers
52
78
 
53
- In general, it is better if an application has explicit SpawningKit support, because then it is able to provide a nicer experience and better performance. But having to modify the application's code is a major hurdle.
79
+ As we said, apps with explicit SpawningKit support is preferred (nicer experience, better performance). There are two ways to add SpawningKit support to an app:
54
80
 
55
- Luckily, it is not always necessary to modify the application. Wrappers are small programs that aid in loading applications written in specific languages -- in particular interpreted languages because they allow modifying application behavior without requiring code modifications. When a wrapper is used, SpawningKit executes the wrapper, not the actual application. The wrapper loads the application and modifies its behavior in such a way that SpawningKit support is added (e.g. ability to report HTML-formatted errors), without requiring modifications to the application code.
81
+ 1. By manually modifying the application's code to add SpawningKit support.
82
+ 2. By automatically injecting SpawningKit support into the app, without any manual code modifications.
56
83
 
57
- Wrappers are only applicable to apps without explicit SpawningKit support.
84
+ Option 2 is the most desirable, and is available to apps written in interpreted languages. This works by executing the application through a *wrapper* instead of directly. The wrapper, which is typically written in the same language as the app, loads the application and injects SpawningKit support.
58
85
 
59
86
  Passenger comes with a few wrappers for specific languages, but SpawningKit itself is more generic and requires the caller to specify which wrapper to use (if at all).
60
87
 
@@ -86,15 +113,7 @@ Using the preforking technique through SpawningKit requires either application c
86
113
 
87
114
  ### The start command
88
115
 
89
- Regardless of whether SpawningKit is used to spawn an application with or without explicit SpawningKit support, and regardless of whether a wrapper is used and whether the application/wrapper can function as a preloader, SpawningKit asks the caller to supply a "start command" that tells it how to execute the wrapper or the application. SpawningKit then uses the handshaking procedure (see: "Overview of the spawning journey") to communicate with the wrapper/application whether it should start in preloader mode or not.
90
-
91
- ### Summary with examples
92
-
93
- To help you better understand the concepts, the following summarizes some of the above concepts and how they map to supportable languages.
94
-
95
- SpawningKit-enabled wrappers are included in Passenger for these languages: Ruby, Python, Node.js, Meteor, and Perl.
96
-
97
- Any existing app that accepts http requests can be used by writing a wrapper, and any new app can be written with SpawningKit compatibility to avoid the need for a wrapper.
116
+ Regardless of whether SpawningKit is used to spawn an application directly with or without explicit SpawningKit support, and regardless of whether a wrapper is used and whether the application/wrapper can function as a preloader, SpawningKit asks the caller to supply a "start command" that tells it how to execute the wrapper or the application. SpawningKit then uses the handshaking procedure (see: "Overview of the spawning journey") to communicate with the wrapper/application whether it should start in preloader mode or not.
98
117
 
99
118
 
100
119
  ## API and implementation highlights
@@ -114,7 +133,7 @@ context.integrationMode = "standalone";
114
133
  context.finalize();
115
134
  ~~~
116
135
 
117
- ### Spawners
136
+ ### Spawners (high-level API)
118
137
 
119
138
  Use Spawners to spawn application processes. There are two main types of Spawners:
120
139
 
@@ -144,7 +163,7 @@ P_WARN("Application process spawned, PID is " << result.pid);
144
163
 
145
164
  There is also a DummySpawner class, which is only used during unit tests.
146
165
 
147
- ### HandshakePrepare and HandshakePerform
166
+ ### HandshakePrepare and HandshakePerform (low-level API)
148
167
 
149
168
  Inside SmartSpawner and DirectSpawner, HandshakePrepare and HandshakePerform are used to perform a lot of the heavy lifting. See "Overview of the spawning journey" -- HandshakePrepare and HandshakePerform are responsible for most of the stuff described there.
150
169
 
@@ -152,8 +171,6 @@ In fact, DirectSpawner is just a thin wrapper around HandshakePrepare and Handsh
152
171
 
153
172
  SmartSpawner is a bit bigger because it needs to implement the whole preloading mechanism (see section "Preloaders"), but it still uses HandshakePrepare and HandshakePerform to spawn the preloader, and to negotiate with the subprocess created by the preloader.
154
173
 
155
- Here are some simplified interaction diagrams.
156
-
157
174
  ### Configuration object
158
175
 
159
176
  HandshakePrepare and HandshakePerform do not accept an ApplicationPool::Options object, but a SpawningKit::Config object. It contains the configuration that HandshakePrepare/Perform need to perform a single spawn. SmartSpawner and DirectSpawner internally convert an ApplicationPool::Options into a SpawningKit::Config.
@@ -60,7 +60,7 @@ Passenger::SpawningKit::Result::validate_autoGeneratedCode(vector<StaticString>
60
60
  /*
61
61
  * Excluded:
62
62
  *
63
- * dummy
63
+ * type
64
64
  * codeRevision
65
65
  * stdinFd
66
66
  * stdoutAndErrFd