passenger 5.1.7 → 5.1.8

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 (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +13 -2
  3. data/CONTRIBUTING.md +1 -1
  4. data/build/agent.rb +1 -1
  5. data/build/cxx_tests.rb +6 -0
  6. data/build/support/cxx_dependency_map.rb +1286 -391
  7. data/build/support/general.rb +0 -26
  8. data/resources/templates/standalone/rails_asset_pipeline.erb +2 -2
  9. data/src/agent/Core/ApiServer.h +49 -44
  10. data/src/agent/Core/ApplicationPool/Pool.h +1 -1
  11. data/src/agent/Core/ApplicationPool/Process.h +1 -1
  12. data/src/agent/Core/ApplicationPool/Socket.h +1 -1
  13. data/src/agent/Core/Controller.h +16 -8
  14. data/src/agent/Core/Controller/CheckoutSession.cpp +1 -1
  15. data/src/agent/Core/Controller/Config.cpp +68 -0
  16. data/src/agent/Core/Controller/Config.h +70 -34
  17. data/src/agent/Core/Controller/ForwardResponse.cpp +5 -5
  18. data/src/agent/Core/Controller/Hooks.cpp +5 -14
  19. data/src/agent/Core/Controller/Implementation.cpp +1 -1
  20. data/src/agent/Core/Controller/InitRequest.cpp +31 -29
  21. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +4 -4
  22. data/src/agent/Core/Controller/InternalUtils.cpp +3 -3
  23. data/src/agent/Core/Controller/Miscellaneous.cpp +1 -1
  24. data/src/agent/Core/Controller/Request.h +2 -2
  25. data/src/agent/Core/Controller/SendRequest.cpp +5 -5
  26. data/src/agent/Core/Controller/StateInspection.cpp +1 -1
  27. data/src/agent/Core/Controller/TurboCaching.h +2 -2
  28. data/src/agent/Core/CoreMain.cpp +2 -2
  29. data/src/agent/Core/ResponseCache.h +3 -3
  30. data/src/agent/Core/SpawningKit/BackgroundIOCapturer.h +3 -3
  31. data/src/agent/Core/SpawningKit/DirectSpawner.h +2 -2
  32. data/src/agent/Core/SpawningKit/PipeWatcher.h +3 -3
  33. data/src/agent/Core/SpawningKit/SmartSpawner.h +2 -2
  34. data/src/agent/Core/SpawningKit/Spawner.h +1 -1
  35. data/src/agent/Core/UnionStation/Connection.h +1 -1
  36. data/src/agent/Core/UnionStation/Context.h +1 -1
  37. data/src/agent/Core/UnionStation/Transaction.h +1 -1
  38. data/src/agent/Shared/ApiServerUtils.h +73 -27
  39. data/src/agent/Shared/Base.cpp +61 -73
  40. data/src/agent/UstRouter/ApiServer.h +34 -45
  41. data/src/agent/UstRouter/Controller.h +86 -60
  42. data/src/agent/UstRouter/RemoteSender.h +1 -1
  43. data/src/agent/UstRouter/RemoteSink.h +1 -1
  44. data/src/agent/Watchdog/ApiServer.h +42 -50
  45. data/src/agent/Watchdog/WatchdogMain.cpp +1 -1
  46. data/src/apache2_module/Configuration.hpp +1 -1
  47. data/src/apache2_module/Hooks.cpp +27 -13
  48. data/src/cxx_supportlib/AppTypes.h +1 -1
  49. data/src/cxx_supportlib/BackgroundEventLoop.cpp +1 -1
  50. data/src/cxx_supportlib/ConfigKit/AsyncUtils.h +86 -0
  51. data/src/cxx_supportlib/ConfigKit/Common.h +6 -3
  52. data/src/cxx_supportlib/ConfigKit/IN_PRACTICE.md +1039 -0
  53. data/src/cxx_supportlib/ConfigKit/README.md +112 -497
  54. data/src/cxx_supportlib/ConfigKit/Schema.h +78 -15
  55. data/src/cxx_supportlib/ConfigKit/Store.h +272 -53
  56. data/src/cxx_supportlib/ConfigKit/SubComponentUtils.h +59 -0
  57. data/src/cxx_supportlib/ConfigKit/Utils.h +26 -65
  58. data/src/cxx_supportlib/ConfigKit/ValidationUtils.h +69 -0
  59. data/src/cxx_supportlib/ConfigKit/VariantMapUtils.h +7 -4
  60. data/src/cxx_supportlib/Constants.h +4 -1
  61. data/src/cxx_supportlib/Crypto.cpp +1 -1
  62. data/src/cxx_supportlib/DataStructures/StringKeyTable.h +26 -7
  63. data/src/cxx_supportlib/FileDescriptor.h +1 -1
  64. data/src/cxx_supportlib/Hooks.h +1 -1
  65. data/src/cxx_supportlib/LoggingKit/Assert.h +130 -0
  66. data/src/cxx_supportlib/LoggingKit/Config.h +97 -0
  67. data/src/cxx_supportlib/LoggingKit/Context.h +94 -0
  68. data/src/cxx_supportlib/LoggingKit/Forward.h +95 -0
  69. data/src/cxx_supportlib/LoggingKit/Implementation.cpp +695 -0
  70. data/src/cxx_supportlib/LoggingKit/Logging.h +204 -0
  71. data/src/cxx_supportlib/LoggingKit/LoggingKit.h +33 -0
  72. data/src/cxx_supportlib/LveLoggingDecorator.h +1 -1
  73. data/src/cxx_supportlib/MemoryKit/mbuf.cpp +1 -1
  74. data/src/cxx_supportlib/RandomGenerator.h +1 -1
  75. data/src/cxx_supportlib/SafeLibev.h +1 -1
  76. data/src/cxx_supportlib/ServerKit/AcceptLoadBalancer.h +1 -1
  77. data/src/cxx_supportlib/ServerKit/Channel.h +1 -1
  78. data/src/cxx_supportlib/ServerKit/FileBufferedChannel.h +1 -1
  79. data/src/cxx_supportlib/ServerKit/FileBufferedFdSinkChannel.h +1 -1
  80. data/src/cxx_supportlib/ServerKit/HttpChunkedBodyParser.h +1 -1
  81. data/src/cxx_supportlib/ServerKit/HttpHeaderParser.h +1 -1
  82. data/src/cxx_supportlib/ServerKit/HttpServer.h +48 -15
  83. data/src/cxx_supportlib/ServerKit/Server.h +79 -52
  84. data/src/cxx_supportlib/StaticString.h +12 -0
  85. data/src/cxx_supportlib/Utils/Curl.h +16 -0
  86. data/src/cxx_supportlib/Utils/FastStringStream.h +6 -1
  87. data/src/cxx_supportlib/Utils/ScopeGuard.h +1 -1
  88. data/src/cxx_supportlib/Utils/StrIntUtils.cpp +2 -19
  89. data/src/cxx_supportlib/WatchdogLauncher.h +3 -2
  90. data/src/ruby_supportlib/phusion_passenger.rb +3 -3
  91. data/src/ruby_supportlib/phusion_passenger/common_library.rb +12 -12
  92. data/src/ruby_supportlib/phusion_passenger/constants.rb +6 -3
  93. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +1 -0
  94. data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +1 -0
  95. metadata +14 -4
  96. data/src/cxx_supportlib/Logging.cpp +0 -295
  97. data/src/cxx_supportlib/Logging.h +0 -385
@@ -808,7 +808,7 @@ Controller::sendResponseHeaderWithWritev(Client *client, Request *req,
808
808
  {
809
809
  TRACE_POINT();
810
810
 
811
- if (OXT_UNLIKELY(mainConfigCache.benchmarkMode == BM_RESPONSE_BEGIN)) {
811
+ if (OXT_UNLIKELY(mainConfig.benchmarkMode == BM_RESPONSE_BEGIN)) {
812
812
  writeBenchmarkResponse(&client, &req, false);
813
813
  return true;
814
814
  }
@@ -887,7 +887,7 @@ void
887
887
  Controller::logResponseHeaders(Client *client, Request *req, struct iovec *buffers,
888
888
  unsigned int nbuffers, unsigned int dataSize)
889
889
  {
890
- if (OXT_UNLIKELY(getLogLevel() >= LVL_DEBUG3)) {
890
+ if (OXT_UNLIKELY(LoggingKit::getLevel() >= LoggingKit::DEBUG3)) {
891
891
  TRACE_POINT();
892
892
  char *buffer = (char *) psg_pnalloc(req->pool, dataSize);
893
893
  gatherBuffers(buffer, dataSize, buffers, nbuffers);
@@ -983,7 +983,7 @@ void
983
983
  Controller::writeResponseAndMarkForTurboCaching(Client *client, Request *req,
984
984
  const MemoryKit::mbuf &buffer)
985
985
  {
986
- if (OXT_LIKELY(mainConfigCache.benchmarkMode != BM_RESPONSE_BEGIN)) {
986
+ if (OXT_LIKELY(mainConfig.benchmarkMode != BM_RESPONSE_BEGIN)) {
987
987
  writeResponse(client, buffer);
988
988
  }
989
989
  markResponsePartForTurboCaching(client, req, buffer);
@@ -1015,8 +1015,8 @@ Controller::maybeThrottleAppSource(Client *client, Request *req) {
1015
1015
  if (!req->ended()) {
1016
1016
  assert(client->output.getBuffersFlushedCallback() == NULL);
1017
1017
  assert(client->output.getDataFlushedCallback() == getClientOutputDataFlushedCallback());
1018
- if (mainConfigCache.responseBufferHighWatermark > 0
1019
- && client->output.getTotalBytesBuffered() >= mainConfigCache.responseBufferHighWatermark)
1018
+ if (mainConfig.responseBufferHighWatermark > 0
1019
+ && client->output.getTotalBytesBuffered() >= mainConfig.responseBufferHighWatermark)
1020
1020
  {
1021
1021
  SKC_TRACE(client, 2, "Application is sending response data quicker than the client "
1022
1022
  "can keep up with. Throttling application socket");
@@ -135,7 +135,7 @@ Controller::reinitializeRequest(Client *client, Request *req) {
135
135
  req->strip100ContinueHeader = false;
136
136
  req->hasPragmaHeader = false;
137
137
  req->host = NULL;
138
- req->configCache = requestConfigCache;
138
+ req->config = requestConfig;
139
139
  req->bodyBytesBuffered = 0;
140
140
  req->cacheKey = HashedStaticString();
141
141
  req->cacheControl = NULL;
@@ -155,7 +155,7 @@ Controller::reinitializeRequest(Client *client, Request *req) {
155
155
  void
156
156
  Controller::deinitializeRequest(Client *client, Request *req) {
157
157
  req->session.reset();
158
- req->configCache.reset();
158
+ req->config.reset();
159
159
 
160
160
  req->endStopwatchLog(&req->stopwatchLogs.getFromPool, false);
161
161
  req->endStopwatchLog(&req->stopwatchLogs.bufferingRequestBody, false);
@@ -277,7 +277,7 @@ Controller::onNextRequestEarlyReadError(Client *client, Request *req, int errcod
277
277
  bool
278
278
  Controller::shouldDisconnectClientOnShutdown(Client *client) {
279
279
  return ParentClass::shouldDisconnectClientOnShutdown(client)
280
- || !mainConfigCache.gracefulExit;
280
+ || !mainConfig.gracefulExit;
281
281
  }
282
282
 
283
283
  bool
@@ -285,15 +285,6 @@ Controller::supportsUpgrade(Client *client, Request *req) {
285
285
  return true;
286
286
  }
287
287
 
288
- void
289
- Controller::onConfigChange(const ConfigKit::Store *oldConfig) {
290
- ParentClass::onConfigChange(oldConfig);
291
- mainConfigCache.update(config);
292
- requestConfigCache.reset(new ControllerRequestConfigCache(config));
293
- getContext()->defaultFileBufferedChannelConfig.bufferDir =
294
- config["data_buffer_dir"].asString();
295
- }
296
-
297
288
 
298
289
  /****************************
299
290
  *
@@ -308,7 +299,7 @@ Controller::getClientName(const Client *client, char *buf, size_t size) const {
308
299
  const char *end = buf + size - 1;
309
300
  // WARNING: If you change the format, be sure to change
310
301
  // ApiServer::extractThreadNumberFromClientName() too.
311
- pos += uintToString(mainConfigCache.threadNumber, pos, end - pos);
302
+ pos += uintToString(mainConfig.threadNumber, pos, end - pos);
312
303
  pos = appendData(pos, end, "-", 1);
313
304
  pos += uintToString(client->number, pos, end - pos);
314
305
  *pos = '\0';
@@ -317,7 +308,7 @@ Controller::getClientName(const Client *client, char *buf, size_t size) const {
317
308
 
318
309
  StaticString
319
310
  Controller::getServerName() const {
320
- return mainConfigCache.serverLogName;
311
+ return mainConfig.serverLogName;
321
312
  }
322
313
 
323
314
 
@@ -34,5 +34,5 @@
34
34
  #include <Core/Controller/InitializationAndShutdown.cpp>
35
35
  #include <Core/Controller/InternalUtils.cpp>
36
36
  #include <Core/Controller/Miscellaneous.cpp>
37
+ #include <Core/Controller/Config.cpp>
37
38
  #include <Core/Controller/StateInspection.cpp>
38
-
@@ -82,7 +82,7 @@ Controller::initializeFlags(Client *client, Request *req, RequestAnalysis &analy
82
82
  part = part->next;
83
83
  }
84
84
 
85
- if (OXT_UNLIKELY(getLogLevel() >= LVL_DEBUG2)) {
85
+ if (OXT_UNLIKELY(LoggingKit::getLevel() >= LoggingKit::DEBUG2)) {
86
86
  if (req->dechunkResponse) {
87
87
  SKC_TRACE(client, 2, "Dechunk flag detected");
88
88
  }
@@ -136,7 +136,7 @@ void
136
136
  Controller::initializePoolOptions(Client *client, Request *req, RequestAnalysis &analysis) {
137
137
  boost::shared_ptr<Options> *options;
138
138
 
139
- if (req->configCache->singleAppMode) {
139
+ if (req->config->singleAppMode) {
140
140
  P_ASSERT_EQ(poolOptionsCache.size(), 1);
141
141
  poolOptionsCache.lookupRandom(NULL, &options);
142
142
  req->options = **options;
@@ -172,36 +172,38 @@ Controller::initializePoolOptions(Client *client, Request *req, RequestAnalysis
172
172
  req->envvars->size);
173
173
  }
174
174
 
175
+ // Allow certain options to be overriden on a per-request basis
175
176
  fillPoolOption(req, req->options.maxRequests, PASSENGER_MAX_REQUESTS);
176
177
  }
177
178
  }
178
179
 
179
180
  void
180
181
  Controller::fillPoolOptionsFromConfigCaches(Options &options,
181
- const ControllerRequestConfigCachePtr &requestConfigCache)
182
+ psg_pool_t *pool, const ControllerRequestConfigPtr &requestConfig)
182
183
  {
183
- options.ruby = requestConfigCache->defaultRuby;
184
- options.nodejs = requestConfigCache->defaultNodejs;
185
- options.python = requestConfigCache->defaultPython;
186
- options.meteorAppSettings = requestConfigCache->meteorAppSettings;
187
- options.fileDescriptorUlimit = requestConfigCache->fileDescriptorUlimit;
188
-
189
- options.logLevel = getLogLevel();
190
- options.integrationMode = mainConfigCache.integrationMode;
191
- options.ustRouterAddress = requestConfigCache->ustRouterAddress;
184
+ options.ruby = requestConfig->defaultRuby;
185
+ options.nodejs = requestConfig->defaultNodejs;
186
+ options.python = requestConfig->defaultPython;
187
+ options.meteorAppSettings = requestConfig->meteorAppSettings;
188
+ options.fileDescriptorUlimit = requestConfig->fileDescriptorUlimit;
189
+
190
+ options.logLevel = int(LoggingKit::getLevel());
191
+ options.integrationMode = psg_pstrdup(pool, mainConfig.integrationMode);
192
+ options.ustRouterAddress = requestConfig->ustRouterAddress;
192
193
  options.ustRouterUsername = P_STATIC_STRING("logging");
193
- options.ustRouterPassword = requestConfigCache->ustRouterPassword;
194
- options.userSwitching = mainConfigCache.userSwitching;
195
- options.defaultUser = requestConfigCache->defaultUser;
196
- options.defaultGroup = requestConfigCache->defaultGroup;
197
- options.minProcesses = requestConfigCache->minInstances;
198
- options.maxPreloaderIdleTime = requestConfigCache->maxPreloaderIdleTime;
199
- options.maxRequestQueueSize = requestConfigCache->maxRequestQueueSize;
200
- options.abortWebsocketsOnProcessShutdown = requestConfigCache->abortWebsocketsOnProcessShutdown;
201
- options.forceMaxConcurrentRequestsPerProcess = requestConfigCache->forceMaxConcurrentRequestsPerProcess;
202
- options.spawnMethod = requestConfigCache->spawnMethod;
203
- options.loadShellEnvvars = requestConfigCache->loadShellEnvvars;
204
- options.statThrottleRate = mainConfigCache.statThrottleRate;
194
+ options.ustRouterPassword = requestConfig->ustRouterPassword;
195
+ options.userSwitching = mainConfig.userSwitching;
196
+ options.defaultUser = requestConfig->defaultUser;
197
+ options.defaultGroup = requestConfig->defaultGroup;
198
+ options.minProcesses = requestConfig->minInstances;
199
+ options.maxPreloaderIdleTime = requestConfig->maxPreloaderIdleTime;
200
+ options.maxRequestQueueSize = requestConfig->maxRequestQueueSize;
201
+ options.abortWebsocketsOnProcessShutdown = requestConfig->abortWebsocketsOnProcessShutdown;
202
+ options.forceMaxConcurrentRequestsPerProcess = requestConfig->forceMaxConcurrentRequestsPerProcess;
203
+ options.spawnMethod = requestConfig->spawnMethod;
204
+ options.loadShellEnvvars = requestConfig->loadShellEnvvars;
205
+ options.statThrottleRate = mainConfig.statThrottleRate;
206
+ options.maxRequests = requestConfig->maxRequests;
205
207
 
206
208
  /******************************/
207
209
  }
@@ -333,7 +335,7 @@ Controller::createNewPoolOptions(Client *client, Request *req,
333
335
  options.baseURI = StaticString(scriptName->start->data, scriptName->size);
334
336
  }
335
337
 
336
- fillPoolOptionsFromConfigCaches(options, req->configCache);
338
+ fillPoolOptionsFromConfigCaches(options, req->pool, req->config);
337
339
 
338
340
  const LString *appType = secureHeaders.lookup("!~PASSENGER_APP_TYPE");
339
341
  if (appType == NULL || appType->size == 0) {
@@ -446,7 +448,7 @@ Controller::getStickySessionCookieName(Request *req) {
446
448
  const LString *value = req->headers.lookup(PASSENGER_STICKY_SESSIONS_COOKIE_NAME);
447
449
  if (value == NULL || value->size == 0) {
448
450
  return psg_lstr_create(req->pool,
449
- req->configCache->defaultStickySessionsCookieName);
451
+ req->config->defaultStickySessionsCookieName);
450
452
  } else {
451
453
  return value;
452
454
  }
@@ -471,15 +473,15 @@ Controller::onRequestBegin(Client *client, Request *req) {
471
473
  // and localize them as much as possible, for better CPU caching.
472
474
  RequestAnalysis analysis;
473
475
  analysis.flags = req->secureHeaders.lookup(FLAGS);
474
- analysis.appGroupNameCell = req->configCache->singleAppMode
476
+ analysis.appGroupNameCell = req->config->singleAppMode
475
477
  ? NULL
476
478
  : req->secureHeaders.lookupCell(PASSENGER_APP_GROUP_NAME);
477
479
  analysis.unionStationSupport = unionStationContext != NULL
478
480
  && getBoolOption(req, UNION_STATION_SUPPORT, false);
479
481
  req->stickySession = getBoolOption(req, PASSENGER_STICKY_SESSIONS,
480
- mainConfigCache.stickySessions);
482
+ mainConfig.stickySessions);
481
483
  req->showVersionInHeader = getBoolOption(req, PASSENGER_SHOW_VERSION_IN_HEADER,
482
- req->configCache->showVersionInHeader);
484
+ req->config->showVersionInHeader);
483
485
  req->host = req->headers.lookup(HTTP_HOST);
484
486
 
485
487
  /***************/
@@ -49,8 +49,8 @@ Controller::Controller(ServerKit::Context *context, const ControllerSchema &sche
49
49
  const Json::Value &initialConfig)
50
50
  : ParentClass(context, schema, initialConfig),
51
51
 
52
- mainConfigCache(config),
53
- requestConfigCache(new ControllerRequestConfigCache(config)),
52
+ mainConfig(config),
53
+ requestConfig(new ControllerRequestConfig(config)),
54
54
  poolOptionsCache(4),
55
55
 
56
56
  PASSENGER_APP_GROUP_NAME("!~PASSENGER_APP_GROUP_NAME"),
@@ -115,9 +115,9 @@ Controller::initialize() {
115
115
  getContext()->defaultFileBufferedChannelConfig.bufferDir =
116
116
  config["data_buffer_dir"].asString();
117
117
 
118
- if (requestConfigCache->singleAppMode) {
118
+ if (requestConfig->singleAppMode) {
119
119
  boost::shared_ptr<Options> options = boost::make_shared<Options>();
120
- fillPoolOptionsFromConfigCaches(*options, requestConfigCache);
120
+ fillPoolOptionsFromConfigCaches(*options, mainConfig.pool, requestConfig);
121
121
 
122
122
  string appRoot = config["app_root"].asString();
123
123
  string environment = config["environment"].asString();
@@ -48,14 +48,14 @@ using namespace boost;
48
48
  void
49
49
  Controller::disconnectWithClientSocketWriteError(Client **client, int e) {
50
50
  stringstream message;
51
- PassengerLogLevel logLevel;
51
+ LoggingKit::Level logLevel;
52
52
  message << "client socket write error: ";
53
53
  message << ServerKit::getErrorDesc(e);
54
54
  message << " (errno=" << e << ")";
55
55
  if (e == EPIPE || e == ECONNRESET) {
56
- logLevel = LVL_INFO;
56
+ logLevel = LoggingKit::INFO;
57
57
  } else {
58
- logLevel = LVL_WARN;
58
+ logLevel = LoggingKit::WARN;
59
59
  }
60
60
  disconnectWithError(client, message.str(), logLevel);
61
61
  }
@@ -63,7 +63,7 @@ Controller::disconnectLongRunningConnections(const StaticString &gupid) {
63
63
  && req->session != NULL
64
64
  && req->session->getGupid() == gupid)
65
65
  {
66
- if (getLogLevel() >= LVL_INFO) {
66
+ if (LoggingKit::getLevel() >= LoggingKit::INFO) {
67
67
  char clientName[32];
68
68
  unsigned int size;
69
69
  const LString *host;
@@ -33,7 +33,7 @@
33
33
  #include <ServerKit/HttpRequest.h>
34
34
  #include <ServerKit/FdSinkChannel.h>
35
35
  #include <ServerKit/FdSourceChannel.h>
36
- #include <Logging.h>
36
+ #include <LoggingKit/LoggingKit.h>
37
37
  #include <Core/ApplicationPool/Pool.h>
38
38
  #include <Core/UnionStation/Context.h>
39
39
  #include <Core/UnionStation/Transaction.h>
@@ -86,7 +86,7 @@ public:
86
86
  Options options;
87
87
  AbstractSessionPtr session;
88
88
  const LString *host;
89
- ControllerRequestConfigCachePtr configCache;
89
+ ControllerRequestConfigPtr config;
90
90
 
91
91
  ServerKit::FdSinkChannel appSink;
92
92
  ServerKit::FdSourceChannel appSource;
@@ -393,8 +393,8 @@ Controller::determineHeaderSizeForSessionProtocol(Request *req,
393
393
  }
394
394
  }
395
395
  } else {
396
- state.serverName = req->configCache->defaultServerName;
397
- state.serverPort = req->configCache->defaultServerPort;
396
+ state.serverName = req->config->defaultServerName;
397
+ state.serverPort = req->config->defaultServerPort;
398
398
  }
399
399
 
400
400
  dataSize += sizeof("SERVER_NAME");
@@ -404,7 +404,7 @@ Controller::determineHeaderSizeForSessionProtocol(Request *req,
404
404
  dataSize += state.serverPort.size() + 1;
405
405
 
406
406
  dataSize += sizeof("SERVER_SOFTWARE");
407
- dataSize += req->configCache->serverSoftware.size() + 1;
407
+ dataSize += req->config->serverSoftware.size() + 1;
408
408
 
409
409
  dataSize += sizeof("SERVER_PROTOCOL");
410
410
  dataSize += sizeof("HTTP/1.1");
@@ -515,7 +515,7 @@ Controller::constructHeaderForSessionProtocol(Request *req, char * restrict buff
515
515
  pos = appendData(pos, end, "", 1);
516
516
 
517
517
  pos = appendData(pos, end, P_STATIC_STRING_WITH_NULL("SERVER_SOFTWARE"));
518
- pos = appendData(pos, end, req->configCache->serverSoftware);
518
+ pos = appendData(pos, end, req->config->serverSoftware);
519
519
  pos = appendData(pos, end, "", 1);
520
520
 
521
521
  pos = appendData(pos, end, P_STATIC_STRING_WITH_NULL("SERVER_PROTOCOL"));
@@ -635,7 +635,7 @@ Controller::sendHeaderToAppWithHttpProtocol(Client *client, Request *req) {
635
635
 
636
636
  cache.cached = false;
637
637
 
638
- if (OXT_UNLIKELY(getLogLevel() >= LVL_DEBUG3)) {
638
+ if (OXT_UNLIKELY(LoggingKit::getLevel() >= LoggingKit::DEBUG3)) {
639
639
  struct iovec *buffers;
640
640
  unsigned int nbuffers, dataSize;
641
641
  bool ok;
@@ -48,7 +48,7 @@ using namespace boost;
48
48
 
49
49
  unsigned int
50
50
  Controller::getThreadNumber() const {
51
- return mainConfigCache.threadNumber;
51
+ return mainConfig.threadNumber;
52
52
  }
53
53
 
54
54
  Json::Value
@@ -34,7 +34,7 @@
34
34
  #include <MemoryKit/mbuf.h>
35
35
  #include <ServerKit/Context.h>
36
36
  #include <Constants.h>
37
- #include <Logging.h>
37
+ #include <LoggingKit/LoggingKit.h>
38
38
  #include <Utils/StrIntUtils.h>
39
39
  #include <Core/ResponseCache.h>
40
40
 
@@ -113,7 +113,7 @@ private:
113
113
 
114
114
  prep.ageValueSize = integerSizeInOtherBase<time_t, 10>(prep.age);
115
115
  prep.contentLengthStrSize = uintSizeAsString(entry.body->httpBodySize);
116
- prep.showVersionInHeader = req->configCache->showVersionInHeader;
116
+ prep.showVersionInHeader = req->config->showVersionInHeader;
117
117
  }
118
118
 
119
119
  template<typename Server>
@@ -678,6 +678,8 @@ initializeNonPrivilegedWorkingObjects() {
678
678
  Json::Value config = ConfigKit::variantMapToJson(wo->controllerSchema,
679
679
  *agentsOptions);
680
680
  config["thread_number"] = i + 1;
681
+ config["min_spare_clients"] = 128;
682
+ config["client_freelist_limit"] = 1024;
681
683
 
682
684
  if (i == 0) {
683
685
  two.bgloop = firstLoop = new BackgroundEventLoop(true, true);
@@ -697,8 +699,6 @@ initializeNonPrivilegedWorkingObjects() {
697
699
  UPDATE_TRACE_POINT();
698
700
  two.controller = new Core::Controller(two.serverKitContext,
699
701
  wo->controllerSchema, config);
700
- two.controller->minSpareClients = 128;
701
- two.controller->clientFreelistLimit = 1024;
702
702
  two.controller->resourceLocator = &wo->resourceLocator;
703
703
  two.controller->appPool = wo->appPool;
704
704
  two.controller->unionStationContext = wo->unionStationContext;
@@ -492,12 +492,12 @@ public:
492
492
  }
493
493
 
494
494
  LString *varyCookieName = req->secureHeaders.lookup(PASSENGER_VARY_TURBOCACHE_BY_COOKIE);
495
- if (varyCookieName == NULL && !req->configCache->defaultVaryTurbocacheByCookie.empty()) {
495
+ if (varyCookieName == NULL && !req->config->defaultVaryTurbocacheByCookie.empty()) {
496
496
  varyCookieName = (LString *) psg_palloc(req->pool, sizeof(LString));
497
497
  psg_lstr_init(varyCookieName);
498
498
  psg_lstr_append(varyCookieName, req->pool,
499
- req->configCache->defaultVaryTurbocacheByCookie.data(),
500
- req->configCache->defaultVaryTurbocacheByCookie.size());
499
+ req->config->defaultVaryTurbocacheByCookie.data(),
500
+ req->config->defaultVaryTurbocacheByCookie.size());
501
501
  }
502
502
  if (varyCookieName != NULL) {
503
503
  LString *cookieHeader = req->headers.lookup(COOKIE);
@@ -37,7 +37,7 @@
37
37
 
38
38
  #include <sys/types.h>
39
39
 
40
- #include <Logging.h>
40
+ #include <LoggingKit/LoggingKit.h>
41
41
  #include <FileDescriptor.h>
42
42
  #include <StaticString.h>
43
43
  #include <Utils.h>
@@ -89,7 +89,7 @@ private:
89
89
  }
90
90
  UPDATE_TRACE_POINT();
91
91
  if (ret == 1 && buf[0] == '\n') {
92
- printAppOutput(pid, channelName, "", 0);
92
+ LoggingKit::logAppOutput(pid, channelName, "", 0);
93
93
  } else {
94
94
  vector<StaticString> lines;
95
95
  if (ret > 0 && buf[ret - 1] == '\n') {
@@ -97,7 +97,7 @@ private:
97
97
  }
98
98
  split(StaticString(buf, ret), '\n', lines);
99
99
  foreach (const StaticString line, lines) {
100
- printAppOutput(pid, channelName, line.data(), line.size());
100
+ LoggingKit::logAppOutput(pid, channelName, line.data(), line.size());
101
101
  }
102
102
  }
103
103
  }
@@ -28,7 +28,7 @@
28
28
 
29
29
  #include <Core/SpawningKit/Spawner.h>
30
30
  #include <Constants.h>
31
- #include <Logging.h>
31
+ #include <LoggingKit/LoggingKit.h>
32
32
  #include <LveLoggingDecorator.h>
33
33
  #include <limits.h> // for PTHREAD_STACK_MIN
34
34
  #include <pthread.h>
@@ -127,7 +127,7 @@ private:
127
127
  if (shouldLoadShellEnvvars(options, preparation)) {
128
128
  command.push_back(preparation.userSwitching.shell);
129
129
  command.push_back(preparation.userSwitching.shell);
130
- if (Passenger::getLogLevel() >= LVL_DEBUG3) {
130
+ if (LoggingKit::getLevel() >= LoggingKit::DEBUG3) {
131
131
  command.push_back("-lxc");
132
132
  } else {
133
133
  command.push_back("-lc");
@@ -40,7 +40,7 @@
40
40
 
41
41
  #include <FileDescriptor.h>
42
42
  #include <Constants.h>
43
- #include <Logging.h>
43
+ #include <LoggingKit/LoggingKit.h>
44
44
  #include <Utils.h>
45
45
  #include <Utils/StrIntUtils.h>
46
46
  #include <Core/SpawningKit/Config.h>
@@ -97,7 +97,7 @@ private:
97
97
  }
98
98
  } else if (ret == 1 && buf[0] == '\n') {
99
99
  UPDATE_TRACE_POINT();
100
- printAppOutput(pid, name, "", 0);
100
+ LoggingKit::logAppOutput(pid, name, "", 0);
101
101
  } else {
102
102
  UPDATE_TRACE_POINT();
103
103
  vector<StaticString> lines;
@@ -107,7 +107,7 @@ private:
107
107
  }
108
108
  split(StaticString(buf, ret2), '\n', lines);
109
109
  foreach (const StaticString line, lines) {
110
- printAppOutput(pid, name, line.data(), line.size());
110
+ LoggingKit::logAppOutput(pid, name, line.data(), line.size());
111
111
  }
112
112
  }
113
113