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) 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.
@@ -23,15 +23,15 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
24
  * THE SOFTWARE.
25
25
  */
26
- #ifndef _PASSENGER_STRING_MAP_H_
27
- #define _PASSENGER_STRING_MAP_H_
26
+ #ifndef _PASSENGER_DATA_STRUCTURES_STRING_MAP_H_
27
+ #define _PASSENGER_DATA_STRUCTURES_STRING_MAP_H_
28
28
 
29
29
  #include <string>
30
30
  #include <map>
31
31
  #include <utility>
32
32
 
33
33
  #include <StaticString.h>
34
- #include <Utils/HashMap.h>
34
+ #include <DataStructures/HashMap.h>
35
35
 
36
36
  namespace Passenger {
37
37
 
@@ -54,106 +54,106 @@ private:
54
54
  string key;
55
55
  pair<StaticString, T> thePair;
56
56
  };
57
-
57
+
58
58
  typedef HashMap<StaticString, Entry, StaticString::Hash> InternalMap;
59
59
  typedef typename InternalMap::iterator InternalIterator;
60
60
  typedef typename InternalMap::const_iterator InternalConstIterator;
61
61
  typedef typename InternalMap::value_type ValueType;
62
62
  InternalMap store;
63
-
63
+
64
64
  public:
65
65
  class const_iterator {
66
66
  private:
67
67
  InternalConstIterator it;
68
-
68
+
69
69
  public:
70
70
  const_iterator() { }
71
-
71
+
72
72
  const_iterator(const InternalConstIterator &_it)
73
73
  : it(_it)
74
74
  { }
75
-
75
+
76
76
  const_iterator &operator=(const const_iterator &value) {
77
77
  it = value.it;
78
78
  return *this;
79
79
  }
80
-
80
+
81
81
  const_iterator &operator++() {
82
82
  it++;
83
83
  return *this;
84
84
  }
85
-
85
+
86
86
  const_iterator operator++(int) {
87
87
  const_iterator copy(*this);
88
88
  operator++();
89
89
  return copy;
90
90
  }
91
-
91
+
92
92
  bool operator==(const const_iterator &other) {
93
93
  return it == other.it;
94
94
  }
95
-
95
+
96
96
  bool operator!=(const const_iterator &other) {
97
97
  return it != other.it;
98
98
  }
99
-
99
+
100
100
  const pair<const StaticString, const T> &operator*() {
101
101
  return (pair<const StaticString, const T> &) it->second.thePair;
102
102
  }
103
-
103
+
104
104
  const pair<const StaticString, const T> *operator->() {
105
105
  return &(**this);
106
106
  }
107
107
  };
108
-
108
+
109
109
  class iterator {
110
110
  private:
111
111
  InternalIterator it;
112
-
112
+
113
113
  public:
114
114
  iterator() { }
115
-
115
+
116
116
  iterator(const InternalIterator &_it)
117
117
  : it(_it)
118
118
  { }
119
-
119
+
120
120
  iterator &operator=(const iterator &value) {
121
121
  it = value.it;
122
122
  return *this;
123
123
  }
124
-
124
+
125
125
  iterator &operator++() {
126
126
  it++;
127
127
  return *this;
128
128
  }
129
-
129
+
130
130
  iterator operator++(int) {
131
131
  iterator copy(*this);
132
132
  operator++();
133
133
  return copy;
134
134
  }
135
-
135
+
136
136
  bool operator==(const iterator &other) {
137
137
  return it == other.it;
138
138
  }
139
-
139
+
140
140
  bool operator!=(const iterator &other) {
141
141
  return it != other.it;
142
142
  }
143
-
143
+
144
144
  pair<StaticString, T> &operator*() {
145
145
  return it->second.thePair;
146
146
  }
147
-
147
+
148
148
  pair<StaticString, T> *operator->() {
149
149
  return &(**this);
150
150
  }
151
-
151
+
152
152
  operator const_iterator() const {
153
153
  return const_iterator(it);
154
154
  }
155
155
  };
156
-
156
+
157
157
  T get(const StaticString &key) const {
158
158
  InternalConstIterator it = store.find(key);
159
159
  if (it == store.end()) {
@@ -175,7 +175,7 @@ public:
175
175
  bool has(const StaticString &key) const {
176
176
  return store.find(key) != store.end();
177
177
  }
178
-
178
+
179
179
  bool set(const StaticString &key, const T &value) {
180
180
  pair<InternalIterator, bool> result = store.insert(make_pair(key, Entry()));
181
181
  if (result.second) {
@@ -196,31 +196,31 @@ public:
196
196
  return false;
197
197
  }
198
198
  }
199
-
199
+
200
200
  bool remove(const StaticString &key) {
201
201
  return store.erase(key) > 0;
202
202
  }
203
-
203
+
204
204
  unsigned int size() const {
205
205
  return store.size();
206
206
  }
207
-
207
+
208
208
  bool empty() const {
209
209
  return store.empty();
210
210
  }
211
-
211
+
212
212
  iterator begin() {
213
213
  return iterator(store.begin());
214
214
  }
215
-
215
+
216
216
  const_iterator begin() const {
217
217
  return const_iterator(store.begin());
218
218
  }
219
-
219
+
220
220
  iterator end() {
221
221
  return iterator(store.end());
222
222
  }
223
-
223
+
224
224
  const_iterator end() const {
225
225
  return const_iterator(store.end());
226
226
  }
@@ -229,4 +229,4 @@ public:
229
229
 
230
230
  } // namespace Passenger
231
231
 
232
- #endif /* _PASSENGER_STRING_MAP_H_ */
232
+ #endif /* _PASSENGER_DATA_STRUCTURES_STRING_MAP_H_ */
@@ -44,7 +44,7 @@
44
44
  #include <ProcessManagement/Utils.h>
45
45
  #include <Utils.h> // parseModeString
46
46
  #include <Utils/CachedFileStat.hpp>
47
- #include <Utils/IOUtils.h>
47
+ #include <IOTools/IOUtils.h>
48
48
  #include <Utils/ScopeGuard.h>
49
49
 
50
50
  namespace Passenger {
@@ -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.
@@ -36,7 +36,7 @@
36
36
 
37
37
  #include <FileTools/PathManip.h>
38
38
  #include <Exceptions.h>
39
- #include <Utils/StrIntUtils.h>
39
+ #include <StrIntTools/StrIntUtils.h>
40
40
 
41
41
  namespace Passenger {
42
42
 
@@ -33,7 +33,7 @@
33
33
  #include <FileTools/PathManip.h>
34
34
  #include <SystemTools/UserDatabase.h>
35
35
  #include <Utils.h>
36
- #include <Utils/StrIntUtils.h>
36
+ #include <StrIntTools/StrIntUtils.h>
37
37
 
38
38
  namespace Passenger {
39
39
 
@@ -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.
@@ -46,7 +46,7 @@
46
46
  #include <ProcessManagement/Spawn.h>
47
47
  #include <ProcessManagement/Utils.h>
48
48
  #include <Utils.h>
49
- #include <Utils/StrIntUtils.h>
49
+ #include <StrIntTools/StrIntUtils.h>
50
50
 
51
51
  namespace Passenger {
52
52
 
@@ -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.
@@ -23,8 +23,8 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
24
  * THE SOFTWARE.
25
25
  */
26
- #ifndef _PASSENGER_BUFFERED_IO_H_
27
- #define _PASSENGER_BUFFERED_IO_H_
26
+ #ifndef _PASSENGER_IOTOOLS_BUFFERED_IO_H_
27
+ #define _PASSENGER_IOTOOLS_BUFFERED_IO_H_
28
28
 
29
29
  #include <string>
30
30
  #include <utility>
@@ -38,7 +38,7 @@
38
38
  #include <FileDescriptor.h>
39
39
  #include <Exceptions.h>
40
40
  #include <StaticString.h>
41
- #include <Utils/IOUtils.h>
41
+ #include <IOTools/IOUtils.h>
42
42
 
43
43
  namespace Passenger {
44
44
 
@@ -249,4 +249,4 @@ public:
249
249
 
250
250
  } // namespace Passenger
251
251
 
252
- #endif /* _PASSENGER_BUFFERED_IO_H_ */
252
+ #endif /* _PASSENGER_IOTOOLS_BUFFERED_IO_H_ */
@@ -68,8 +68,8 @@
68
68
  #include <Exceptions.h>
69
69
  #include <Constants.h>
70
70
  #include <Utils/Timer.h>
71
- #include <Utils/IOUtils.h>
72
- #include <Utils/StrIntUtils.h>
71
+ #include <IOTools/IOUtils.h>
72
+ #include <StrIntTools/StrIntUtils.h>
73
73
  #include <Utils/ScopeGuard.h>
74
74
 
75
75
  namespace Passenger {
@@ -1363,7 +1363,8 @@ readAll(int fd, size_t maxSize) {
1363
1363
 
1364
1364
  while (result.size() < maxSize) {
1365
1365
  do {
1366
- ret = read(fd, buf, sizeof(buf));
1366
+ ret = read(fd, buf, std::min<size_t>(sizeof(buf),
1367
+ maxSize - result.size()));
1367
1368
  } while (ret == -1 && errno == EINTR);
1368
1369
  if (ret == 0) {
1369
1370
  eofReached = true;
@@ -23,8 +23,8 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
24
  * THE SOFTWARE.
25
25
  */
26
- #ifndef _PASSENGER_IO_UTILS_H_
27
- #define _PASSENGER_IO_UTILS_H_
26
+ #ifndef _PASSENGER_IOTOOLS_IO_UTILS_H_
27
+ #define _PASSENGER_IOTOOLS_IO_UTILS_H_
28
28
 
29
29
  #include <sys/types.h>
30
30
  #include <sys/socket.h>
@@ -658,4 +658,4 @@ pair<string, bool> readAll(int fd, size_t maxSize);
658
658
 
659
659
  } // namespace Passenger
660
660
 
661
- #endif /* _PASSENGER_IO_UTILS_H_ */
661
+ #endif /* _PASSENGER_IOTOOLS_IO_UTILS_H_ */
@@ -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.
@@ -23,8 +23,8 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
24
  * THE SOFTWARE.
25
25
  */
26
- #ifndef _PASSENGER_MESSAGE_IO_H_
27
- #define _PASSENGER_MESSAGE_IO_H_
26
+ #ifndef _PASSENGER_IOTOOLS_MESSAGE_IO_H_
27
+ #define _PASSENGER_IOTOOLS_MESSAGE_IO_H_
28
28
 
29
29
  /**
30
30
  * This file contains functions for reading and writing structured messages over
@@ -90,10 +90,10 @@
90
90
 
91
91
  #include <StaticString.h>
92
92
  #include <Exceptions.h>
93
- #include <Utils/MemZeroGuard.h>
93
+ #include <SecurityKit/MemZeroGuard.h>
94
94
  #include <Utils/ScopeGuard.h>
95
- #include <Utils/IOUtils.h>
96
- #include <Utils/StrIntUtils.h>
95
+ #include <IOTools/IOUtils.h>
96
+ #include <StrIntTools/StrIntUtils.h>
97
97
 
98
98
 
99
99
  namespace Passenger {
@@ -664,4 +664,4 @@ writeFileDescriptorWithNegotiation(int fd, int fdToPass, unsigned long long *tim
664
664
 
665
665
  } // namespace Passenger
666
666
 
667
- #endif /* _PASSENGER_MESSAGE_IO_H_ */
667
+ #endif /* _PASSENGER_IOTOOLS_MESSAGE_IO_H_ */
@@ -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.
@@ -23,8 +23,8 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
24
  * THE SOFTWARE.
25
25
  */
26
- #ifndef _PASSENGER_MESSAGE_READERS_WRITERS_H_
27
- #define _PASSENGER_MESSAGE_READERS_WRITERS_H_
26
+ #ifndef _PASSENGER_IOTOOLS_MESSAGE_SERIALIZATION_H_
27
+ #define _PASSENGER_IOTOOLS_MESSAGE_SERIALIZATION_H_
28
28
 
29
29
  #include <boost/cstdint.hpp>
30
30
  #include <oxt/macros.hpp>
@@ -36,7 +36,7 @@
36
36
  #include <arpa/inet.h>
37
37
  #include <StaticString.h>
38
38
  #include <Exceptions.h>
39
- #include <Utils/MemZeroGuard.h>
39
+ #include <SecurityKit/MemZeroGuard.h>
40
40
 
41
41
  /**
42
42
  * This file provides a bunch of classes for reading and writing messages in the
@@ -544,4 +544,4 @@ public:
544
544
 
545
545
  } // namespace Passenger
546
546
 
547
- #endif /* _PASSENGER_MESSAGE_READERS_WRITERS_H_ */
547
+ #endif /* _PASSENGER_IOTOOLS_MESSAGE_SERIALIZATION_H_ */
@@ -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.
@@ -44,9 +44,9 @@
44
44
  #include <RandomGenerator.h>
45
45
  #include <FileTools/FileManip.h>
46
46
  #include <Utils.h>
47
- #include <Utils/StrIntUtils.h>
48
- #include <Utils/IOUtils.h>
49
- #include <Utils/SystemTime.h>
47
+ #include <StrIntTools/StrIntUtils.h>
48
+ #include <IOTools/IOUtils.h>
49
+ #include <SystemTools/SystemTime.h>
50
50
  #include <jsoncpp/json.h>
51
51
 
52
52
  namespace Passenger {
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2016-2017 Phusion Holding B.V.
3
+ * Copyright (c) 2016-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.
@@ -30,8 +30,8 @@
30
30
  #include <jsoncpp/json.h>
31
31
  #include <cstring>
32
32
  #include <ctime>
33
- #include <Utils/StrIntUtils.h>
34
- #include <Utils/SystemTime.h>
33
+ #include <StrIntTools/StrIntUtils.h>
34
+ #include <SystemTools/SystemTime.h>
35
35
 
36
36
  namespace Passenger {
37
37
 
@@ -23,8 +23,8 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
24
  * THE SOFTWARE.
25
25
  */
26
- #ifndef _PASSENGER_UTILS_JSON_UTILS_H_
27
- #define _PASSENGER_UTILS_JSON_UTILS_H_
26
+ #ifndef _PASSENGER_JSON_TOOLS_JSON_UTILS_H_
27
+ #define _PASSENGER_JSON_TOOLS_JSON_UTILS_H_
28
28
 
29
29
  #include <string>
30
30
  #include <cstdio>
@@ -33,8 +33,8 @@
33
33
  #include <jsoncpp/json.h>
34
34
  #include <boost/cstdint.hpp>
35
35
  #include <StaticString.h>
36
- #include <Utils/SystemTime.h>
37
- #include <Utils/StrIntUtils.h>
36
+ #include <SystemTools/SystemTime.h>
37
+ #include <StrIntTools/StrIntUtils.h>
38
38
  #include <Utils/VariantMap.h>
39
39
 
40
40
  namespace Passenger {
@@ -467,4 +467,4 @@ byteSizeAndCountToJson(size_t size, unsigned int count) {
467
467
 
468
468
  } // namespace Passenger
469
469
 
470
- #endif /* _PASSENGER_UTILS_JSON_UTILS_H_ */
470
+ #endif /* _PASSENGER_JSON_TOOLS_JSON_UTILS_H_ */
@@ -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.
@@ -37,7 +37,7 @@
37
37
  #include <ConfigKit/ConfigKit.h>
38
38
  #include <LoggingKit/Forward.h>
39
39
  #include <LoggingKit/Config.h>
40
- #include <Utils/SystemTime.h>
40
+ #include <SystemTools/SystemTime.h>
41
41
  #include <DataStructures/StringKeyTable.h>
42
42
 
43
43
  namespace Passenger {
@@ -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.
@@ -56,8 +56,8 @@
56
56
  #include <ConfigKit/ConfigKit.h>
57
57
  #include <FileTools/PathManip.h>
58
58
  #include <Utils.h>
59
- #include <Utils/StrIntUtils.h>
60
- #include <Utils/SystemTime.h>
59
+ #include <StrIntTools/StrIntUtils.h>
60
+ #include <SystemTools/SystemTime.h>
61
61
 
62
62
  namespace Passenger {
63
63
  namespace LoggingKit {
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * twemproxy - A fast and lightweight proxy for memcached protocol.
3
3
  * Copyright (C) 2011 Twitter, Inc.
4
- * Copyright (C) 2014-2017 Phusion Holding B.V.
4
+ * Copyright (C) 2014-2018 Phusion Holding B.V.
5
5
  *
6
6
  * Licensed under the Apache License, Version 2.0 (the "License");
7
7
  * you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
26
26
  #include <MemoryKit/mbuf.h>
27
27
  #include <LoggingKit/LoggingKit.h>
28
28
  #include <StaticString.h>
29
- #include <Utils/StrIntUtils.h>
29
+ #include <StrIntTools/StrIntUtils.h>
30
30
 
31
31
  namespace Passenger {
32
32
  namespace MemoryKit {
@@ -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.
@@ -42,7 +42,7 @@ using namespace std;
42
42
  void
43
43
  runInternalRubyTool(const ResourceLocator &resourceLocator,
44
44
  const string &ruby, const vector<string> &args, int *status,
45
- string *output)
45
+ SubprocessOutput *output, size_t maxOutputSize)
46
46
  {
47
47
  string locationConfigFileEnv = "PASSENGER_LOCATION_CONFIGURATION_FILE="
48
48
  + resourceLocator.getInstallSpec();
@@ -95,7 +95,7 @@ runInternalRubyTool(const ResourceLocator &resourceLocator,
95
95
  if (output == NULL) {
96
96
  runCommand(command, info);
97
97
  } else {
98
- runCommandAndCaptureOutput(command, info, *output);
98
+ runCommandAndCaptureOutput(command, info, *output, maxOutputSize);
99
99
  }
100
100
  if (status != NULL) {
101
101
  *status = info.status;
@@ -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.
@@ -28,6 +28,7 @@
28
28
 
29
29
  #include <string>
30
30
  #include <vector>
31
+ #include <limits>
31
32
  #include <cstddef>
32
33
 
33
34
  namespace Passenger {
@@ -35,6 +36,7 @@ namespace Passenger {
35
36
  using namespace std;
36
37
 
37
38
  class ResourceLocator;
39
+ struct SubprocessOutput;
38
40
 
39
41
 
40
42
  /**
@@ -48,12 +50,15 @@ class ResourceLocator;
48
50
  * When unable to waitpid() the child process because of an ECHILD
49
51
  * or ESRCH, this will be set to -1.
50
52
  * @param output The output of the child process will be stored here, if non-NULL.
53
+ * @param maxOutputSize The maximum number of output bytes to read. Only applicable if
54
+ * `output` is non-NULL.
51
55
  * @throws RuntimeException
52
56
  * @throws SystemException
53
57
  */
54
58
  void runInternalRubyTool(const ResourceLocator &resourceLocator,
55
59
  const string &ruby, const vector<string> &args,
56
- int *status = NULL, string *output = NULL);
60
+ int *status = NULL, SubprocessOutput *output = NULL,
61
+ size_t maxOutputSize = std::numeric_limits<size_t>::max());
57
62
 
58
63
 
59
64
  } // namespace Passenger