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
@@ -29,6 +29,8 @@
29
29
  #include <psg_sysqueue.h>
30
30
 
31
31
  #include <boost/cstdint.hpp>
32
+ #include <boost/config.hpp>
33
+ #include <boost/scoped_ptr.hpp>
32
34
  #include <oxt/system_calls.hpp>
33
35
  #include <oxt/backtrace.hpp>
34
36
  #include <oxt/macros.hpp>
@@ -36,6 +38,12 @@
36
38
  #include <new>
37
39
  #include <ev++.h>
38
40
 
41
+ // for std::swap()
42
+ #if __cplusplus >= 201103L
43
+ #include <utility>
44
+ #else
45
+ #include <algorithm>
46
+ #endif
39
47
  #include <sys/socket.h>
40
48
  #include <sys/un.h>
41
49
  #include <netinet/in.h>
@@ -48,7 +56,7 @@
48
56
  #include <jsoncpp/json.h>
49
57
  #include <SmallVector.h>
50
58
 
51
- #include <Logging.h>
59
+ #include <LoggingKit/LoggingKit.h>
52
60
  #include <SafeLibev.h>
53
61
  #include <Constants.h>
54
62
  #include <ServerKit/Context.h>
@@ -73,7 +81,7 @@ using namespace oxt;
73
81
 
74
82
 
75
83
  // We use 'this' so that the macros work in derived template classes like HttpServer<>.
76
- #define SKS_LOG(level, file, line, expr) P_LOG(level, file, line, "[" << this->getServerName() << "] " << expr)
84
+ #define SKS_LOG(level, file, line, expr) P_LOG(Passenger::LoggingKit::context, level, file, line, "[" << this->getServerName() << "] " << expr)
77
85
  #define SKS_ERROR(expr) P_ERROR("[" << this->getServerName() << "] " << expr)
78
86
  #define SKS_WARN(expr) P_WARN("[" << this->getServerName() << "] " << expr)
79
87
  #define SKS_INFO(expr) P_INFO("[" << this->getServerName() << "] " << expr)
@@ -97,26 +105,26 @@ using namespace oxt;
97
105
 
98
106
  #define SKC_LOG_FROM_STATIC(server, client, level, expr) \
99
107
  do { \
100
- if (Passenger::getLogLevel() >= level) { \
108
+ if (Passenger::LoggingKit::getLevel() >= level) { \
101
109
  char _clientName[16]; \
102
110
  int _clientNameSize = server->getClientName((client), _clientName, sizeof(_clientName)); \
103
- P_LOG(level, __FILE__, __LINE__, \
111
+ P_LOG(LoggingKit::context, level, __FILE__, __LINE__, \
104
112
  "[Client " << StaticString(_clientName, _clientNameSize) << "] " << expr); \
105
113
  } \
106
114
  } while (0)
107
115
  #define SKC_ERROR_FROM_STATIC(server, client, expr) \
108
- SKC_LOG_FROM_STATIC(server, client, LVL_ERROR, expr)
116
+ SKC_LOG_FROM_STATIC(server, client, Passenger::LoggingKit::ERROR, expr)
109
117
  #define SKC_WARN_FROM_STATIC(server, client, expr) \
110
- SKC_LOG_FROM_STATIC(server, client, LVL_WARN, expr)
118
+ SKC_LOG_FROM_STATIC(server, client, Passenger::LoggingKit::WARN, expr)
111
119
  #define SKC_NOTICE_FROM_STATIC(server, client, expr) \
112
- SKC_LOG_FROM_STATIC(server, client, LVL_NOTICE, expr)
120
+ SKC_LOG_FROM_STATIC(server, client, Passenger::LoggingKit::NOTICE, expr)
113
121
  #define SKC_INFO_FROM_STATIC(server, client, expr) \
114
- SKC_LOG_FROM_STATIC(server, client, LVL_INFO, expr)
122
+ SKC_LOG_FROM_STATIC(server, client, Passenger::LoggingKit::INFO, expr)
115
123
  #define SKC_DEBUG_FROM_STATIC(server, client, expr) \
116
- SKC_LOG_FROM_STATIC(server, client, LVL_DEBUG, expr)
124
+ SKC_LOG_FROM_STATIC(server, client, Passenger::LoggingKit::DEBUG, expr)
117
125
  #define SKC_DEBUG_FROM_STATIC_WITH_POS(server, client, file, line, expr) \
118
126
  do { \
119
- if (OXT_UNLIKELY(Passenger::getLogLevel() >= LVL_DEBUG)) { \
127
+ if (OXT_UNLIKELY(Passenger::LoggingKit::getLevel() >= Passenger::LoggingKit::DEBUG)) { \
120
128
  char _clientName[16]; \
121
129
  int _clientNameSize = server->getClientName((client), _clientName, sizeof(_clientName)); \
122
130
  P_DEBUG_WITH_POS(file, line, \
@@ -127,7 +135,7 @@ using namespace oxt;
127
135
  SKC_TRACE_FROM_STATIC_WITH_POS(server, client, level, __FILE__, __LINE__, expr)
128
136
  #define SKC_TRACE_FROM_STATIC_WITH_POS(server, client, level, file, line, expr) \
129
137
  do { \
130
- if (OXT_UNLIKELY(Passenger::getLogLevel() >= level)) { \
138
+ if (OXT_UNLIKELY(Passenger::LoggingKit::getLevel() >= Passenger::LoggingKit::INFO + level)) { \
131
139
  char _clientName[16]; \
132
140
  int _clientNameSize = server->getClientName((client), _clientName, sizeof(_clientName)); \
133
141
  P_TRACE_WITH_POS(level, file, line, \
@@ -163,6 +171,41 @@ public:
163
171
  }
164
172
  };
165
173
 
174
+ struct BaseServerConfigRealization {
175
+ unsigned int acceptBurstCount: 7;
176
+ bool startReadingAfterAccept: 1;
177
+ unsigned int minSpareClients: 12;
178
+ unsigned int clientFreelistLimit: 12;
179
+
180
+ BaseServerConfigRealization(const ConfigKit::Store &config)
181
+ : acceptBurstCount(config["accept_burst_count"].asUInt()),
182
+ startReadingAfterAccept(config["start_reading_after_accept"].asBool()),
183
+ minSpareClients(config["min_spare_clients"].asUInt()),
184
+ clientFreelistLimit(config["client_freelist_limit"].asUInt())
185
+ { }
186
+
187
+ void swap(BaseServerConfigRealization &other) BOOST_NOEXCEPT_OR_NOTHROW {
188
+ #define SWAP_BITFIELD(Type, name) \
189
+ do { \
190
+ Type tmp = name; \
191
+ name = other.name; \
192
+ other.name = tmp; \
193
+ } while (false)
194
+
195
+ SWAP_BITFIELD(unsigned int, acceptBurstCount);
196
+ SWAP_BITFIELD(bool, startReadingAfterAccept);
197
+ SWAP_BITFIELD(unsigned int, minSpareClients);
198
+ SWAP_BITFIELD(unsigned int, clientFreelistLimit);
199
+
200
+ #undef SWAP_BITFIELD
201
+ }
202
+ };
203
+
204
+ struct BaseServerConfigChangeRequest {
205
+ boost::scoped_ptr<ConfigKit::Store> config;
206
+ boost::scoped_ptr<BaseServerConfigRealization> configRlz;
207
+ };
208
+
166
209
 
167
210
  /**
168
211
  * A highly optimized generic base class for evented socket servers, implementing basic,
@@ -226,13 +269,11 @@ public:
226
269
  static const unsigned int MAX_ACCEPT_BURST_COUNT = 127;
227
270
 
228
271
  typedef void (*Callback)(DerivedServer *server);
272
+ typedef BaseServerConfigChangeRequest ConfigChangeRequest;
229
273
 
230
274
  /***** Configuration *****/
231
275
  ConfigKit::Store config;
232
- unsigned int acceptBurstCount: 7;
233
- bool startReadingAfterAccept: 1;
234
- unsigned int minSpareClients: 12;
235
- unsigned int clientFreelistLimit: 12;
276
+ BaseServerConfigRealization configRlz;
236
277
  Callback shutdownFinishCallback;
237
278
 
238
279
  /***** Working state and statistics (do not modify) *****/
@@ -273,7 +314,7 @@ private:
273
314
  P_ASSERT_EQ(serverState, ACTIVE);
274
315
  SKS_DEBUG("New clients can be accepted on a server socket");
275
316
 
276
- for (unsigned int i = 0; i < acceptBurstCount; i++) {
317
+ for (unsigned int i = 0; i < configRlz.acceptBurstCount; i++) {
277
318
  fd = acceptNonBlockingSocket(io->fd);
278
319
  if (fd == -1) {
279
320
  error = true;
@@ -441,7 +482,7 @@ private:
441
482
  }
442
483
 
443
484
  bool addClientToFreelist(Client *client) {
444
- if (freeClientCount < clientFreelistLimit) {
485
+ if (freeClientCount < configRlz.clientFreelistLimit) {
445
486
  STAILQ_INSERT_HEAD(&freeClients, client, nextClient.freeClient);
446
487
  freeClientCount++;
447
488
  client->refcount.store(2, boost::memory_order_relaxed);
@@ -482,7 +523,7 @@ private:
482
523
 
483
524
  void finishShutdown() {
484
525
  TRACE_POINT();
485
- compact(LVL_INFO);
526
+ compact(LoggingKit::INFO);
486
527
 
487
528
  acceptResumptionWatcher.stop();
488
529
  statisticsUpdateWatcher.stop();
@@ -565,7 +606,7 @@ protected:
565
606
 
566
607
  onClientAccepted(client);
567
608
  if (client->connected()) {
568
- if (startReadingAfterAccept) {
609
+ if (configRlz.startReadingAfterAccept) {
569
610
  client->input.startReading();
570
611
  } else {
571
612
  client->input.startReadingInNextTick();
@@ -613,10 +654,10 @@ protected:
613
654
  getClientOutputErrorDisconnectionLogLevel(client, errcode));
614
655
  }
615
656
 
616
- virtual PassengerLogLevel getClientOutputErrorDisconnectionLogLevel(
657
+ virtual LoggingKit::Level getClientOutputErrorDisconnectionLogLevel(
617
658
  Client *client, int errcode) const
618
659
  {
619
- return LVL_WARN;
660
+ return LoggingKit::WARN;
620
661
  }
621
662
 
622
663
  virtual void onUpdateStatistics() {
@@ -658,23 +699,13 @@ protected:
658
699
  // Do nothing.
659
700
  }
660
701
 
661
- virtual void onConfigChange(const ConfigKit::Store *oldConfig) {
662
- acceptBurstCount = config["accept_burst_count"].asUInt();
663
- startReadingAfterAccept = config["start_reading_after_accept"].asBool();
664
- minSpareClients = config["min_spare_clients"].asUInt();
665
- clientFreelistLimit = config["client_freelist_limit"].asUInt();
666
- }
667
-
668
702
  public:
669
703
  /***** Public methods *****/
670
704
 
671
705
  BaseServer(Context *context, const BaseServerSchema &schema,
672
706
  const Json::Value &initialConfig = Json::Value())
673
- : config(schema),
674
- acceptBurstCount(0),
675
- startReadingAfterAccept(true),
676
- minSpareClients(0),
677
- clientFreelistLimit(0),
707
+ : config(schema, initialConfig),
708
+ configRlz(config),
678
709
  shutdownFinishCallback(NULL),
679
710
  serverState(ACTIVE),
680
711
  freeClientCount(0),
@@ -692,12 +723,6 @@ public:
692
723
  nEndpoints(0),
693
724
  accept4Available(true)
694
725
  {
695
- vector<ConfigKit::Error> errors;
696
- if (!config.update(initialConfig, errors)) {
697
- throw ArgumentException("Invalid initial configuration: " +
698
- toString(errors));
699
- }
700
-
701
726
  STAILQ_INIT(&freeClients);
702
727
  TAILQ_INIT(&activeClients);
703
728
  TAILQ_INIT(&disconnectedClients);
@@ -721,7 +746,6 @@ public:
721
746
  /***** Initialization, listening and shutdown *****/
722
747
 
723
748
  virtual void initialize() {
724
- onConfigChange(NULL);
725
749
  statisticsUpdateWatcher.set(5, 5);
726
750
  statisticsUpdateWatcher.start();
727
751
  }
@@ -729,7 +753,7 @@ public:
729
753
  // Pre-create multiple client objects so that they get allocated
730
754
  // near each other in memory. Hopefully increases CPU cache locality.
731
755
  void createSpareClients() {
732
- for (unsigned int i = 0; i < minSpareClients; i++) {
756
+ for (unsigned int i = 0; i < configRlz.minSpareClients; i++) {
733
757
  Client *client = createNewClientObject();
734
758
  client->setConnState(Client::IN_FREELIST);
735
759
  STAILQ_INSERT_HEAD(&freeClients, client, nextClient.freeClient);
@@ -845,7 +869,7 @@ public:
845
869
 
846
870
  /***** Server management *****/
847
871
 
848
- virtual void compact(int logLevel = LVL_NOTICE) {
872
+ virtual void compact(LoggingKit::Level logLevel = LoggingKit::NOTICE) {
849
873
  unsigned int count = freeClientCount;
850
874
 
851
875
  while (!STAILQ_EMPTY(&freeClients)) {
@@ -1034,7 +1058,7 @@ public:
1034
1058
  }
1035
1059
 
1036
1060
  void disconnectWithError(Client **client, const StaticString &message,
1037
- PassengerLogLevel logLevel = LVL_WARN)
1061
+ LoggingKit::Level logLevel = LoggingKit::WARN)
1038
1062
  {
1039
1063
  SKC_LOG(*client, logLevel, "Disconnecting client with error: " << message);
1040
1064
  disconnect(client);
@@ -1062,20 +1086,23 @@ public:
1062
1086
  return P_STATIC_STRING("Server");
1063
1087
  }
1064
1088
 
1065
- virtual Json::Value previewConfigUpdate(const Json::Value &updates,
1066
- vector<ConfigKit::Error> &errors)
1089
+ bool prepareConfigChange(const Json::Value &updates,
1090
+ vector<ConfigKit::Error> &errors, BaseServerConfigChangeRequest &req)
1067
1091
  {
1068
- return config.previewUpdate(updates, errors);
1069
- }
1070
-
1071
- virtual bool configure(const Json::Value &updates, vector<ConfigKit::Error> &errors) {
1072
- ConfigKit::Store oldConfig = config;
1073
- if (config.update(updates, errors)) {
1074
- onConfigChange(&oldConfig);
1092
+ req.config.reset(new ConfigKit::Store(config, updates, errors));
1093
+ if (errors.empty()) {
1094
+ req.configRlz.reset(new BaseServerConfigRealization(*req.config));
1075
1095
  }
1076
1096
  return errors.empty();
1077
1097
  }
1078
1098
 
1099
+ void commitConfigChange(BaseServerConfigChangeRequest &req)
1100
+ BOOST_NOEXCEPT_OR_NOTHROW
1101
+ {
1102
+ config.swap(*req.config);
1103
+ configRlz.swap(*req.configRlz);
1104
+ }
1105
+
1079
1106
  virtual Json::Value inspectConfig() const {
1080
1107
  return config.inspect();
1081
1108
  }
@@ -26,6 +26,13 @@
26
26
  #ifndef _PASSENGER_STATIC_STRING_H_
27
27
  #define _PASSENGER_STATIC_STRING_H_
28
28
 
29
+ // for std::swap()
30
+ #if __cplusplus >= 201103L
31
+ #include <utility>
32
+ #else
33
+ #include <algorithm>
34
+ #endif
35
+ #include <boost/config.hpp>
29
36
  #include <oxt/macros.hpp>
30
37
  #include <sys/types.h>
31
38
  #include <string>
@@ -248,6 +255,11 @@ public:
248
255
  }
249
256
  }
250
257
 
258
+ void swap(StaticString &other) BOOST_NOEXCEPT_OR_NOTHROW {
259
+ std::swap(content, other.content);
260
+ std::swap(len, other.len);
261
+ }
262
+
251
263
  bool operator==(const StaticString &other) const {
252
264
  return len == other.len && memcmp(content, other.content, len) == 0;
253
265
  }
@@ -47,9 +47,16 @@
47
47
  * don't do anything.
48
48
  */
49
49
 
50
+ // for std::swap()
51
+ #if __cplusplus >= 201103L
52
+ #include <utility>
53
+ #else
54
+ #include <algorithm>
55
+ #endif
50
56
  #include <string>
51
57
  #include <cstring>
52
58
  #include <curl/curl.h>
59
+ #include <boost/config.hpp>
53
60
  #include <boost/foreach.hpp>
54
61
  #include <Exceptions.h>
55
62
  #include <Utils.h>
@@ -78,6 +85,15 @@ struct CurlProxyInfo {
78
85
  httpTunnel(false),
79
86
  valid(valid)
80
87
  { }
88
+
89
+ void swap(CurlProxyInfo &other) BOOST_NOEXCEPT_OR_NOTHROW {
90
+ hostAndPort.swap(other.hostAndPort);
91
+ credentials.swap(other.credentials);
92
+ std::swap(type, other.type);
93
+ std::swap(none, other.none);
94
+ std::swap(httpTunnel, other.httpTunnel);
95
+ std::swap(valid, other.valid);
96
+ }
81
97
  };
82
98
 
83
99
  inline const CurlProxyInfo
@@ -169,7 +169,12 @@ public:
169
169
  *
170
170
  * This class is implemented using FastStdStringBuf.
171
171
  */
172
- template<size_t staticCapacity = 1024>
172
+ #ifndef _PASSENGER_FAST_STRING_STREAM_FORWARD_DECLARED_
173
+ #define _PASSENGER_FAST_STRING_STREAM_FORWARD_DECLARED_
174
+ template<size_t staticCapacity = 1024>
175
+ #else
176
+ template<size_t staticCapacity>
177
+ #endif
173
178
  class FastStringStream: public FastStdStringBuf<staticCapacity>, public ostream {
174
179
  public:
175
180
  FastStringStream(unsigned int initialCapacity = 0)
@@ -31,7 +31,7 @@
31
31
  #include <boost/thread.hpp>
32
32
  #include <oxt/system_calls.hpp>
33
33
  #include <cstdio>
34
- #include <Logging.h>
34
+ #include <LoggingKit/LoggingKit.h>
35
35
 
36
36
  namespace Passenger {
37
37
 
@@ -24,6 +24,7 @@
24
24
  * THE SOFTWARE.
25
25
  */
26
26
 
27
+ #include <boost/cstdint.hpp>
27
28
  #include <cstdio>
28
29
  #include <cstdlib>
29
30
  #include <cctype>
@@ -207,25 +208,7 @@ toString(const vector<StaticString> &vec) {
207
208
 
208
209
  string
209
210
  pointerToIntString(void *pointer) {
210
- // Use wierd union construction to avoid compiler warnings.
211
- if (sizeof(void *) == sizeof(unsigned int)) {
212
- union {
213
- void *pointer;
214
- unsigned int value;
215
- } u;
216
- u.pointer = pointer;
217
- return toString(u.value);
218
- } else if (sizeof(void *) == sizeof(unsigned long long)) {
219
- union {
220
- void *pointer;
221
- unsigned long long value;
222
- } u;
223
- u.pointer = pointer;
224
- return toString(u.value);
225
- } else {
226
- fprintf(stderr, "Pointer size unsupported...\n");
227
- abort();
228
- }
211
+ return toString((boost::uintptr_t) pointer);
229
212
  }
230
213
 
231
214
  template<typename Numeric>
@@ -104,7 +104,8 @@ void psg_watchdog_launcher_free(PsgWatchdogLauncher *launcher);
104
104
  #include <MessageClient.h>
105
105
  #include <Exceptions.h>
106
106
  #include <ResourceLocator.h>
107
- #include <Logging.h>
107
+ #include <LoggingKit/LoggingKit.h>
108
+ #include <LoggingKit/Context.h>
108
109
  #include <Utils.h>
109
110
  #include <Utils/IOUtils.h>
110
111
  #include <Utils/MessageIO.h>
@@ -364,7 +365,7 @@ public:
364
365
  .set ("web_server_passenger_version", PASSENGER_VERSION)
365
366
  .set ("integration_mode", getIntegrationModeString())
366
367
  .set ("passenger_root", passengerRoot)
367
- .setInt ("log_level", getLogLevel());
368
+ .setInt ("log_level", (int) LoggingKit::getLevel());
368
369
  extraParams.addTo(params);
369
370
 
370
371
  if (!params.getBool("user_switching", false, true)
@@ -31,15 +31,15 @@ module PhusionPassenger
31
31
 
32
32
  PACKAGE_NAME = 'passenger'
33
33
  # Run 'rake src/cxx_supportlib/Constants.h' after changing this number.
34
- VERSION_STRING = '5.1.7'
34
+ VERSION_STRING = '5.1.8'
35
35
 
36
36
  PREFERRED_NGINX_VERSION = '1.12.1'
37
37
  NGINX_SHA256_CHECKSUM = '8793bf426485a30f91021b6b945a9fd8a84d87d17b566562c3797aba8fac76fb'
38
38
 
39
39
  # Packaging may be locked to an older version due to the specific module configuration being
40
40
  # incompatible with the version we prefer (latest stable).
41
- PACKAGING_PREFERRED_NGINX_VERSION = '1.10.3'
42
- PACKAGING_NGINX_SHA256_CHECKSUM = '75020f1364cac459cb733c4e1caed2d00376e40ea05588fb8793076a4c69dd90'
41
+ PACKAGING_PREFERRED_NGINX_VERSION = '1.12.1'
42
+ PACKAGING_NGINX_SHA256_CHECKSUM = '8793bf426485a30f91021b6b945a9fd8a84d87d17b566562c3797aba8fac76fb'
43
43
 
44
44
  PREFERRED_PCRE_VERSION = '8.39'
45
45
  PCRE_SHA256_CHECKSUM = 'ccdf7e788769838f8285b3ee672ed573358202305ee361cfec7a4a4fb005bbc7'
@@ -267,10 +267,10 @@ end
267
267
 
268
268
 
269
269
  COMMON_LIBRARY = CommonLibraryBuilder.new do
270
- define_component 'Logging.o',
271
- :source => 'Logging.cpp',
270
+ define_component 'LoggingKit.o',
271
+ :source => 'LoggingKit/Implementation.cpp',
272
272
  :category => :base,
273
- :optimize => :light
273
+ :optimize => :very_heavy
274
274
  define_component 'Exceptions.o',
275
275
  :source => 'Exceptions.cpp',
276
276
  :category => :base
@@ -291,9 +291,18 @@ COMMON_LIBRARY = CommonLibraryBuilder.new do
291
291
  :source => 'Utils/IOUtils.cpp',
292
292
  :optimize => :light,
293
293
  :category => :base
294
+ define_component 'Utils/Hasher.o',
295
+ :source => 'Utils/Hasher.cpp',
296
+ :category => :base,
297
+ :optimize => :very_heavy
294
298
  define_component 'Utils.o',
295
299
  :source => 'Utils.cpp',
296
300
  :category => :base
301
+ define_component 'jsoncpp.o',
302
+ :source => 'vendor-modified/jsoncpp/jsoncpp.cpp',
303
+ :category => :base,
304
+ :optimize => true
305
+
297
306
  define_component 'Crypto.o',
298
307
  :source => 'Crypto.cpp',
299
308
  :category => :other,
@@ -326,19 +335,10 @@ COMMON_LIBRARY = CommonLibraryBuilder.new do
326
335
  define_component 'DataStructures/LString.o',
327
336
  :source => 'DataStructures/LString.cpp',
328
337
  :category => :other
329
-
330
- define_component 'Utils/Hasher.o',
331
- :source => 'Utils/Hasher.cpp',
332
- :category => :other,
333
- :optimize => :very_heavy
334
338
  define_component 'AppTypes.o',
335
339
  :source => 'AppTypes.cpp',
336
340
  :category => :other
337
341
 
338
- define_component 'jsoncpp.o',
339
- :source => 'vendor-modified/jsoncpp/jsoncpp.cpp',
340
- :category => :json,
341
- :optimize => true
342
342
  define_component 'vendor-modified/modp_b64.o',
343
343
  :source => 'vendor-modified/modp_b64.cpp',
344
344
  :category => :bas64,