passenger 5.3.4 → 5.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +13 -0
  3. data/CODE_OF_CONDUCT.md +1 -1
  4. data/build/cxx_tests.rb +12 -1
  5. data/build/misc.rb +2 -1
  6. data/build/packaging.rb +2 -0
  7. data/build/support/cplusplus.rb +2 -2
  8. data/build/support/cxx_dependency_map.rb +653 -383
  9. data/dev/configkit-schemas/index.json +105 -3
  10. data/dev/show-latest-crashlog-dir +27 -0
  11. data/resources/templates/standalone/http.erb +2 -0
  12. data/src/agent/Core/AdminPanelConnector.h +2 -2
  13. data/src/agent/Core/ApplicationPool/Context.h +5 -1
  14. data/src/agent/Core/ApplicationPool/Group.h +2 -0
  15. data/src/agent/Core/ApplicationPool/Group/LifetimeAndBasics.cpp +5 -0
  16. data/src/agent/Core/ApplicationPool/Group/Miscellaneous.cpp +2 -1
  17. data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +1 -1
  18. data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +12 -19
  19. data/src/agent/Core/ApplicationPool/Options.h +35 -31
  20. data/src/agent/Core/ApplicationPool/Pool/GroupUtils.cpp +2 -1
  21. data/src/agent/Core/ApplicationPool/Socket.h +1 -1
  22. data/src/agent/Core/Config.h +38 -7
  23. data/src/agent/Core/ConfigChange.cpp +13 -1
  24. data/src/agent/Core/Controller.h +3 -1
  25. data/src/agent/Core/Controller/Config.h +14 -11
  26. data/src/agent/Core/Controller/InitRequest.cpp +6 -5
  27. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +3 -0
  28. data/src/agent/Core/CoreMain.cpp +149 -34
  29. data/src/agent/Core/OptionParser.h +12 -1
  30. data/src/agent/Core/SpawningKit/Config.h +1 -1
  31. data/src/agent/Core/SpawningKit/Context.h +7 -1
  32. data/src/agent/Core/SpawningKit/Exceptions.h +15 -12
  33. data/src/agent/Core/SpawningKit/README.md +34 -17
  34. data/src/agent/Core/SpawningKit/Spawner.h +5 -3
  35. data/src/agent/Core/SpawningKit/UserSwitchingRules.h +5 -2
  36. data/src/agent/Core/TelemetryCollector.h +674 -0
  37. data/src/agent/Shared/Fundamentals/AbortHandler.cpp +309 -83
  38. data/src/agent/Shared/Fundamentals/AbortHandler.h +18 -3
  39. data/src/agent/Watchdog/Config.h +21 -4
  40. data/src/agent/Watchdog/WatchdogMain.cpp +4 -1
  41. data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +10 -0
  42. data/src/apache2_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.cpp +5 -0
  43. data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +30 -0
  44. data/src/apache2_module/DirectoryMapper.h +24 -36
  45. data/src/apache2_module/Hooks.cpp +13 -5
  46. data/src/apache2_module/ServerConfig/AutoGeneratedManifestGeneration.cpp +20 -0
  47. data/src/apache2_module/ServerConfig/AutoGeneratedStruct.h +24 -0
  48. data/src/cxx_supportlib/AppTypeDetector/CBindings.cpp +136 -0
  49. data/src/cxx_supportlib/AppTypeDetector/CBindings.h +73 -0
  50. data/src/cxx_supportlib/{AppTypes.h → AppTypeDetector/Detector.h} +59 -132
  51. data/src/cxx_supportlib/ConfigKit/README.md +90 -2
  52. data/src/cxx_supportlib/ConfigKit/Schema.h +58 -13
  53. data/src/cxx_supportlib/ConfigKit/Store.h +128 -4
  54. data/src/cxx_supportlib/Constants.h +1 -1
  55. data/src/cxx_supportlib/ProcessManagement/Ruby.cpp +3 -3
  56. data/src/cxx_supportlib/ProcessManagement/Ruby.h +7 -2
  57. data/src/cxx_supportlib/ProcessManagement/Spawn.cpp +14 -7
  58. data/src/cxx_supportlib/ProcessManagement/Spawn.h +21 -2
  59. data/src/cxx_supportlib/ResourceLocator.h +1 -1
  60. data/src/cxx_supportlib/ServerKit/ClientRef.h +17 -7
  61. data/src/cxx_supportlib/ServerKit/HttpRequestRef.h +17 -7
  62. data/src/cxx_supportlib/Utils/IOUtils.cpp +2 -1
  63. data/src/cxx_supportlib/Utils/ProcessMetricsCollector.h +9 -6
  64. data/src/cxx_supportlib/WrapperRegistry/CBindings.cpp +85 -0
  65. data/src/cxx_supportlib/WrapperRegistry/CBindings.h +56 -0
  66. data/src/cxx_supportlib/WrapperRegistry/Entry.h +112 -0
  67. data/src/cxx_supportlib/WrapperRegistry/README.md +37 -0
  68. data/src/cxx_supportlib/WrapperRegistry/Registry.h +309 -0
  69. data/src/helper-scripts/download_binaries/extconf.rb +6 -2
  70. data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +16 -0
  71. data/src/nginx_module/ConfigGeneral/AutoGeneratedManifestDefaultsInitialization.c +6 -0
  72. data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +24 -0
  73. data/src/nginx_module/ContentHandler.c +34 -13
  74. data/src/nginx_module/ContentHandler.h +3 -3
  75. data/src/nginx_module/MainConfig/AutoGeneratedCreateFunction.c +11 -0
  76. data/src/nginx_module/MainConfig/AutoGeneratedManifestGeneration.c +23 -0
  77. data/src/nginx_module/MainConfig/AutoGeneratedStruct.h +8 -0
  78. data/src/nginx_module/config +2 -1
  79. data/src/nginx_module/ngx_http_passenger_module.c +9 -3
  80. data/src/nginx_module/ngx_http_passenger_module.h +4 -2
  81. data/src/ruby_supportlib/phusion_passenger.rb +2 -1
  82. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +13 -0
  83. data/src/ruby_supportlib/phusion_passenger/common_library.rb +8 -5
  84. data/src/ruby_supportlib/phusion_passenger/config/download_agent_command.rb +6 -2
  85. data/src/ruby_supportlib/phusion_passenger/config/download_nginx_engine_command.rb +6 -2
  86. data/src/ruby_supportlib/phusion_passenger/native_support.rb +7 -3
  87. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +15 -0
  88. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +11 -1
  89. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +3 -1
  90. metadata +12 -4
  91. data/src/cxx_supportlib/AppTypes.cpp +0 -109
@@ -36,7 +36,23 @@ namespace Fundamentals {
36
36
 
37
37
 
38
38
  struct AbortHandlerConfig {
39
- typedef void (*DiagnosticsDumper)(void *userData);
39
+ static const unsigned int MAX_DIAGNOSTICS_DUMPERS = 5;
40
+ typedef void (*DiagnosticsDumperFunc)(void *userData);
41
+
42
+ struct DiagnosticsDumper {
43
+ const char *name;
44
+ const char *logFileName;
45
+ DiagnosticsDumperFunc func;
46
+ void *userData;
47
+
48
+ DiagnosticsDumper()
49
+ : name(0),
50
+ logFileName(0),
51
+ func(0),
52
+ userData(0)
53
+ { }
54
+ };
55
+
40
56
 
41
57
  char *ruby;
42
58
  char **origArgv;
@@ -45,8 +61,7 @@ struct AbortHandlerConfig {
45
61
  bool beep;
46
62
  bool stopProcess;
47
63
  ResourceLocator *resourceLocator;
48
- DiagnosticsDumper diagnosticsDumper;
49
- void *diagnosticsDumperUserData;
64
+ DiagnosticsDumper diagnosticsDumpers[MAX_DIAGNOSTICS_DUMPERS];
50
65
  };
51
66
 
52
67
  void installAbortHandler(const AbortHandlerConfig *config);
@@ -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.
@@ -146,7 +146,7 @@ using namespace std;
146
146
  * security_update_checker_interval unsigned integer - default(86400)
147
147
  * security_update_checker_proxy_url string - -
148
148
  * security_update_checker_url string - default("https://securitycheck.phusionpassenger.com/v1/check.json")
149
- * server_software string - default("Phusion_Passenger/5.3.4")
149
+ * server_software string - default("Phusion_Passenger/5.3.5")
150
150
  * setsid boolean - default(false)
151
151
  * show_version_in_header boolean - default(true)
152
152
  * single_app_mode_app_root string - default,read_only
@@ -155,6 +155,17 @@ using namespace std;
155
155
  * standalone_engine string - default
156
156
  * startup_report_file string - -
157
157
  * stat_throttle_rate unsigned integer - default(10)
158
+ * telemetry_collector_ca_certificate_path string - -
159
+ * telemetry_collector_debug_curl boolean - default(false)
160
+ * telemetry_collector_disabled boolean - default(false)
161
+ * telemetry_collector_final_run_timeout unsigned integer - default(5)
162
+ * telemetry_collector_first_interval unsigned integer - default(7200)
163
+ * telemetry_collector_interval unsigned integer - default(21600)
164
+ * telemetry_collector_interval_jitter unsigned integer - default(7200)
165
+ * telemetry_collector_proxy_url string - -
166
+ * telemetry_collector_timeout unsigned integer - default(180)
167
+ * telemetry_collector_url string - default("https://anontelemetry.phusionpassenger.com/v1/collect.json")
168
+ * telemetry_collector_verify_server boolean - default(true)
158
169
  * turbocaching boolean - default(true),read_only
159
170
  * user string - default,read_only
160
171
  * user_switching boolean - default(true)
@@ -253,9 +264,13 @@ private:
253
264
  }
254
265
 
255
266
  public:
256
- struct {
267
+ struct CoreSubschemaContainer {
257
268
  Core::Schema schema;
258
269
  ConfigKit::TableTranslator translator;
270
+
271
+ CoreSubschemaContainer(const WrapperRegistry::Registry *wrapperRegistry)
272
+ : schema(wrapperRegistry)
273
+ { }
259
274
  } core;
260
275
  struct {
261
276
  ApiServer::Schema schema;
@@ -266,7 +281,9 @@ public:
266
281
  ConfigKit::PrefixTranslator translator;
267
282
  } apiServerKit;
268
283
 
269
- Schema() {
284
+ Schema(const WrapperRegistry::Registry *wrapperRegistry = NULL)
285
+ : core(wrapperRegistry)
286
+ {
270
287
  using namespace ConfigKit;
271
288
 
272
289
  // Add subschema: core
@@ -165,6 +165,7 @@ namespace Watchdog {
165
165
 
166
166
  using namespace Passenger::Watchdog;
167
167
 
168
+ static WrapperRegistry::Registry *watchdogWrapperRegistry;
168
169
  static Schema *watchdogSchema;
169
170
  static ConfigKit::Store *watchdogConfig;
170
171
  static WorkingObjects *workingObjects;
@@ -800,7 +801,9 @@ initializeBareEssentials(int argc, char *argv[], WorkingObjectsPtr &wo) {
800
801
  string oldOomScore = setOomScoreNeverKill();
801
802
  #endif
802
803
 
803
- watchdogSchema = new Schema();
804
+ watchdogWrapperRegistry = new WrapperRegistry::Registry();
805
+ watchdogWrapperRegistry->finalize();
806
+ watchdogSchema = new Schema(watchdogWrapperRegistry);
804
807
  watchdogConfig = new ConfigKit::Store(*watchdogSchema);
805
808
  initializeAgent(argc, &argv, SHORT_PROGRAM_NAME " watchdog",
806
809
  *watchdogConfig, watchdogSchema->core.schema.loggingKit.translator,
@@ -73,6 +73,11 @@ AP_INIT_TAKE1("PassengerAnalyticsLogUser",
73
73
  NULL,
74
74
  RSRC_CONF,
75
75
  "Obsolete option."),
76
+ AP_INIT_TAKE1("PassengerAnonymousTelemetryProxy",
77
+ (Take1Func) cmd_passenger_anonymous_telemetry_proxy,
78
+ NULL,
79
+ RSRC_CONF,
80
+ "Use specified HTTP/SOCKS proxy for Phusion Passenger anonymous telemetry collection."),
76
81
  AP_INIT_TAKE1("PassengerAppEnv",
77
82
  (Take1Func) cmd_passenger_app_env,
78
83
  NULL,
@@ -153,6 +158,11 @@ AP_INIT_TAKE1("PassengerDefaultUser",
153
158
  NULL,
154
159
  RSRC_CONF,
155
160
  "The user that Phusion Passenger applications must run as when user switching fails or is disabled."),
161
+ AP_INIT_FLAG("PassengerDisableAnonymousTelemetry",
162
+ (FlagFunc) cmd_passenger_disable_anonymous_telemetry,
163
+ NULL,
164
+ RSRC_CONF,
165
+ "Whether to disable Phusion Passenger anonymous telemetry."),
156
166
  AP_INIT_FLAG("PassengerDisableSecurityUpdateCheck",
157
167
  (FlagFunc) cmd_passenger_disable_security_update_check,
158
168
  NULL,
@@ -68,6 +68,11 @@ ConfigManifestGenerator::autoGenerated_setGlobalConfigDefaults() {
68
68
  "PassengerDefaultUser",
69
69
  PASSENGER_DEFAULT_USER);
70
70
 
71
+ addOptionsContainerStaticDefaultBool(
72
+ globalConfigContainer,
73
+ "PassengerDisableAnonymousTelemetry",
74
+ false);
75
+
71
76
  addOptionsContainerStaticDefaultBool(
72
77
  globalConfigContainer,
73
78
  "PassengerDisableSecurityUpdateCheck",
@@ -125,6 +125,21 @@ cmd_passenger_analytics_log_user(cmd_parms *cmd, void *pcfg, const char *arg) {
125
125
  return NULL;
126
126
  }
127
127
 
128
+ static const char *
129
+ cmd_passenger_anonymous_telemetry_proxy(cmd_parms *cmd, void *pcfg, const char *arg) {
130
+ const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
131
+ if (err != NULL) {
132
+ ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->temp_pool,
133
+ "WARNING: %s", err);
134
+ }
135
+
136
+ serverConfig.anonymousTelemetryProxySourceFile = cmd->directive->filename;
137
+ serverConfig.anonymousTelemetryProxySourceLine = cmd->directive->line_num;
138
+ serverConfig.anonymousTelemetryProxyExplicitlySet = true;
139
+ serverConfig.anonymousTelemetryProxy = arg;
140
+ return NULL;
141
+ }
142
+
128
143
  static const char *
129
144
  cmd_passenger_app_env(cmd_parms *cmd, void *pcfg, const char *arg) {
130
145
  const char *err = ap_check_cmd_context(cmd, NOT_IN_FILES);
@@ -271,6 +286,21 @@ cmd_passenger_default_user(cmd_parms *cmd, void *pcfg, const char *arg) {
271
286
  return NULL;
272
287
  }
273
288
 
289
+ static const char *
290
+ cmd_passenger_disable_anonymous_telemetry(cmd_parms *cmd, void *pcfg, const char *arg) {
291
+ const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
292
+ if (err != NULL) {
293
+ ap_log_perror(APLOG_MARK, APLOG_STARTUP, 0, cmd->temp_pool,
294
+ "WARNING: %s", err);
295
+ }
296
+
297
+ serverConfig.disableAnonymousTelemetrySourceFile = cmd->directive->filename;
298
+ serverConfig.disableAnonymousTelemetrySourceLine = cmd->directive->line_num;
299
+ serverConfig.disableAnonymousTelemetryExplicitlySet = true;
300
+ serverConfig.disableAnonymousTelemetry = arg != NULL;
301
+ return NULL;
302
+ }
303
+
274
304
  static const char *
275
305
  cmd_passenger_disable_security_update_check(cmd_parms *cmd, void *pcfg, const char *arg) {
276
306
  const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
@@ -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.
@@ -33,7 +33,7 @@
33
33
  #include <oxt/backtrace.hpp>
34
34
  #include <boost/thread.hpp>
35
35
 
36
- #include <AppTypes.h>
36
+ #include <AppTypeDetector/Detector.h>
37
37
  #include <Utils.h>
38
38
  #include <Utils/CachedFileStat.hpp>
39
39
 
@@ -72,6 +72,7 @@ public:
72
72
  */
73
73
  class DirectoryMapper {
74
74
  private:
75
+ const WrapperRegistry::Registry &registry;
75
76
  DirConfig *config;
76
77
  request_rec *r;
77
78
  CachedFileStat *cstat;
@@ -80,8 +81,8 @@ private:
80
81
  string publicDir;
81
82
  string appRoot;
82
83
  unsigned int throttleRate;
83
- PassengerAppType appType: 7;
84
- bool autoDetectionDone: 1;
84
+ AppTypeDetector::Detector::Result detectorResult;
85
+ bool autoDetectionDone;
85
86
 
86
87
  const char *findBaseURI() const {
87
88
  set<string>::const_iterator it, end = config->getBaseURIs().end();
@@ -146,30 +147,28 @@ private:
146
147
  }
147
148
 
148
149
  UPDATE_TRACE_POINT();
149
- AppTypeDetector detector(cstat, cstatMutex, throttleRate);
150
- PassengerAppType appType;
150
+ AppTypeDetector::Detector detector(registry, cstat,
151
+ cstatMutex, throttleRate);
152
+ AppTypeDetector::Detector::Result detectorResult;
151
153
  string appRoot;
152
154
  if (config->getAppType().empty()) {
153
155
  if (config->getAppRoot().empty()) {
154
- appType = detector.checkDocumentRoot(publicDir,
156
+ detectorResult = detector.checkDocumentRoot(publicDir,
155
157
  baseURI != NULL,
156
158
  &appRoot);
157
159
  } else {
158
160
  appRoot = config->getAppRoot();
159
- appType = detector.checkAppRoot(appRoot);
160
- }
161
- } else {
162
- if (config->getAppRoot().empty()) {
163
- appType = PAT_NONE;
164
- } else {
165
- appRoot = config->getAppRoot().toString();
166
- appType = getAppType(config->getAppType());
161
+ detectorResult = detector.checkAppRoot(appRoot);
167
162
  }
163
+ } else if (!config->getAppRoot().empty()) {
164
+ appRoot = config->getAppRoot().toString();
165
+ detectorResult.wrapperRegistryEntry = &registry.lookup(
166
+ config->getAppType());
168
167
  }
169
168
 
170
169
  this->appRoot = appRoot;
171
170
  this->baseURI = baseURI;
172
- this->appType = appType;
171
+ this->detectorResult = detectorResult;
173
172
  autoDetectionDone = true;
174
173
  }
175
174
 
@@ -184,14 +183,17 @@ public:
184
183
  * @warning Do not use this object after the destruction of <tt>r</tt>,
185
184
  * <tt>config</tt> or <tt>cstat</tt>.
186
185
  */
187
- DirectoryMapper(request_rec *r, DirConfig *config, CachedFileStat *cstat,
188
- boost::mutex *cstatMutex, unsigned int throttleRate) {
186
+ DirectoryMapper(request_rec *r, DirConfig *config,
187
+ const WrapperRegistry::Registry &_registry,
188
+ CachedFileStat *cstat, boost::mutex *cstatMutex,
189
+ unsigned int throttleRate)
190
+ : registry(_registry)
191
+ {
189
192
  this->r = r;
190
193
  this->config = config;
191
194
  this->cstat = cstat;
192
195
  this->cstatMutex = cstatMutex;
193
196
  this->throttleRate = throttleRate;
194
- appType = PAT_NONE;
195
197
  baseURI = NULL;
196
198
  autoDetectionDone = false;
197
199
  }
@@ -243,30 +245,16 @@ public:
243
245
  }
244
246
 
245
247
  /**
246
- * Returns the application type that's associated with the HTTP request.
247
- *
248
- * @throws FileSystemException An error occured while examening the filesystem.
249
- * @throws DocumentRootDeterminationError Unable to query the location of the document root.
250
- * @throws TimeRetrievalException
251
- * @throws boost::thread_interrupted
252
- */
253
- PassengerAppType getApplicationType() {
254
- autoDetect();
255
- return appType;
256
- }
257
-
258
- /**
259
- * Returns the application type (as a string) that's associated
260
- * with the HTTP request.
248
+ * Returns the application detector result associated with the HTTP request.
261
249
  *
262
250
  * @throws FileSystemException An error occured while examening the filesystem.
263
251
  * @throws DocumentRootDeterminationError Unable to query the location of the document root.
264
252
  * @throws TimeRetrievalException
265
253
  * @throws boost::thread_interrupted
266
254
  */
267
- const char *getApplicationTypeName() {
255
+ AppTypeDetector::Detector::Result getDetectorResult() {
268
256
  autoDetect();
269
- return getAppTypeName(appType);
257
+ return detectorResult;
270
258
  }
271
259
  };
272
260
 
@@ -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.
@@ -60,6 +60,7 @@
60
60
  #include "DirectoryMapper.h"
61
61
  #include "Utils.h"
62
62
  #include <modp_b64.h>
63
+ #include <WrapperRegistry/Registry.h>
63
64
  #include <FileTools/FileManip.h>
64
65
  #include <FileTools/FileManip.h>
65
66
  #include <Utils.h>
@@ -232,6 +233,7 @@ private:
232
233
  enum Threeway { YES, NO, UNKNOWN };
233
234
 
234
235
  Threeway m_hasModRewrite, m_hasModDir, m_hasModAutoIndex, m_hasModXsendfile;
236
+ WrapperRegistry::Registry wrapperRegistry;
235
237
  CachedFileStat cstat;
236
238
  WatchdogLauncher watchdogLauncher;
237
239
  boost::mutex cstatMutex;
@@ -443,9 +445,10 @@ private:
443
445
  bool prepareRequest(request_rec *r, DirConfig *config, const char *filename, bool coreModuleWillBeRun = false) {
444
446
  TRACE_POINT();
445
447
 
446
- DirectoryMapper mapper(r, config, &cstat, &cstatMutex, serverConfig.statThrottleRate);
448
+ DirectoryMapper mapper(r, config, wrapperRegistry, &cstat,
449
+ &cstatMutex, serverConfig.statThrottleRate);
447
450
  try {
448
- if (mapper.getApplicationType() == PAT_NONE) {
451
+ if (mapper.getDetectorResult().isNull()) {
449
452
  // (B) is not true.
450
453
  disableRequestNote(r);
451
454
  return false;
@@ -983,8 +986,10 @@ private:
983
986
  }
984
987
 
985
988
  // Phusion Passenger options.
986
- addHeader(result, P_STATIC_STRING("!~PASSENGER_APP_ROOT"), mapper.getAppRoot());
987
- addHeader(result, P_STATIC_STRING("!~PASSENGER_APP_TYPE"), mapper.getApplicationTypeName());
989
+ addHeader(result, P_STATIC_STRING("!~PASSENGER_APP_ROOT"),
990
+ mapper.getAppRoot());
991
+ addHeader(result, P_STATIC_STRING("!~PASSENGER_APP_TYPE"),
992
+ mapper.getDetectorResult().wrapperRegistryEntry->language);
988
993
  constructRequestHeaders_autoGenerated(r, config, result);
989
994
 
990
995
  /*********************/
@@ -1247,6 +1252,7 @@ public:
1247
1252
  : cstat(1024),
1248
1253
  watchdogLauncher(IM_APACHE)
1249
1254
  {
1255
+ wrapperRegistry.finalize();
1250
1256
  postprocessConfig(s, pconf, ptemp);
1251
1257
 
1252
1258
  Json::Value loggingConfig;
@@ -1319,6 +1325,8 @@ public:
1319
1325
  config["instance_registry_dir"] = nonEmptyString(serverConfig.instanceRegistryDir);
1320
1326
  config["security_update_checker_disabled"] = serverConfig.disableSecurityUpdateCheck;
1321
1327
  config["security_update_checker_proxy_url"] = nonEmptyString(serverConfig.securityUpdateCheckProxy);
1328
+ config["telemetry_collector_disabled"] = serverConfig.disableAnonymousTelemetry;
1329
+ config["telemetry_collector_proxy_url"] = nonEmptyString(serverConfig.anonymousTelemetryProxy);
1322
1330
  config["user_switching"] = serverConfig.userSwitching;
1323
1331
  config["default_user"] = serverConfig.defaultUser.toString();
1324
1332
  config["default_group"] = serverConfig.defaultGroup.toString();
@@ -91,6 +91,17 @@ ConfigManifestGenerator::autoGenerated_generateConfigManifestForServerConfig() {
91
91
  serverConfig.adminPanelUsername.data(),
92
92
  serverConfig.adminPanelUsername.data() + serverConfig.adminPanelUsername.size());
93
93
  }
94
+ if (serverConfig.anonymousTelemetryProxyExplicitlySet) {
95
+ Json::Value &optionContainer = findOrCreateOptionContainer(globalOptionsContainer,
96
+ "PassengerAnonymousTelemetryProxy",
97
+ sizeof("PassengerAnonymousTelemetryProxy") - 1);
98
+ Json::Value &hierarchyMember = addOptionContainerHierarchyMember(optionContainer,
99
+ serverConfig.anonymousTelemetryProxySourceFile,
100
+ serverConfig.anonymousTelemetryProxySourceLine);
101
+ hierarchyMember["value"] = Json::Value(
102
+ serverConfig.anonymousTelemetryProxy.data(),
103
+ serverConfig.anonymousTelemetryProxy.data() + serverConfig.anonymousTelemetryProxy.size());
104
+ }
94
105
  if (serverConfig.dataBufferDirExplicitlySet) {
95
106
  Json::Value &optionContainer = findOrCreateOptionContainer(globalOptionsContainer,
96
107
  "PassengerDataBufferDir",
@@ -135,6 +146,15 @@ ConfigManifestGenerator::autoGenerated_generateConfigManifestForServerConfig() {
135
146
  serverConfig.defaultUser.data(),
136
147
  serverConfig.defaultUser.data() + serverConfig.defaultUser.size());
137
148
  }
149
+ if (serverConfig.disableAnonymousTelemetryExplicitlySet) {
150
+ Json::Value &optionContainer = findOrCreateOptionContainer(globalOptionsContainer,
151
+ "PassengerDisableAnonymousTelemetry",
152
+ sizeof("PassengerDisableAnonymousTelemetry") - 1);
153
+ Json::Value &hierarchyMember = addOptionContainerHierarchyMember(optionContainer,
154
+ serverConfig.disableAnonymousTelemetrySourceFile,
155
+ serverConfig.disableAnonymousTelemetrySourceLine);
156
+ hierarchyMember["value"] = serverConfig.disableAnonymousTelemetry == Apache2Module::ENABLED;
157
+ }
138
158
  if (serverConfig.disableSecurityUpdateCheckExplicitlySet) {
139
159
  Json::Value &optionContainer = findOrCreateOptionContainer(globalOptionsContainer,
140
160
  "PassengerDisableSecurityUpdateCheck",
@@ -39,6 +39,11 @@
39
39
 
40
40
  struct AutoGeneratedServerConfig {
41
41
 
42
+ /*
43
+ * Whether to disable Phusion Passenger anonymous telemetry.
44
+ */
45
+ bool disableAnonymousTelemetry;
46
+
42
47
  /*
43
48
  * Whether to disable the Phusion Passenger security update check & notification.
44
49
  */
@@ -114,6 +119,11 @@ struct AutoGeneratedServerConfig {
114
119
  */
115
120
  StaticString adminPanelUsername;
116
121
 
122
+ /*
123
+ * Use specified HTTP/SOCKS proxy for Phusion Passenger anonymous telemetry collection.
124
+ */
125
+ StaticString anonymousTelemetryProxy;
126
+
117
127
  /*
118
128
  * The directory that Phusion Passenger data buffers should be stored into.
119
129
  */
@@ -170,6 +180,7 @@ struct AutoGeneratedServerConfig {
170
180
  std::set<std::string> prestartURLs;
171
181
 
172
182
 
183
+ StaticString disableAnonymousTelemetrySourceFile;
173
184
  StaticString disableSecurityUpdateCheckSourceFile;
174
185
  StaticString showVersionInHeaderSourceFile;
175
186
  StaticString turbocachingSourceFile;
@@ -185,6 +196,7 @@ struct AutoGeneratedServerConfig {
185
196
  StaticString adminPanelPasswordSourceFile;
186
197
  StaticString adminPanelUrlSourceFile;
187
198
  StaticString adminPanelUsernameSourceFile;
199
+ StaticString anonymousTelemetryProxySourceFile;
188
200
  StaticString dataBufferDirSourceFile;
189
201
  StaticString defaultGroupSourceFile;
190
202
  StaticString defaultRubySourceFile;
@@ -197,6 +209,7 @@ struct AutoGeneratedServerConfig {
197
209
  StaticString securityUpdateCheckProxySourceFile;
198
210
  StaticString prestartURLsSourceFile;
199
211
 
212
+ unsigned int disableAnonymousTelemetrySourceLine;
200
213
  unsigned int disableSecurityUpdateCheckSourceLine;
201
214
  unsigned int showVersionInHeaderSourceLine;
202
215
  unsigned int turbocachingSourceLine;
@@ -212,6 +225,7 @@ struct AutoGeneratedServerConfig {
212
225
  unsigned int adminPanelPasswordSourceLine;
213
226
  unsigned int adminPanelUrlSourceLine;
214
227
  unsigned int adminPanelUsernameSourceLine;
228
+ unsigned int anonymousTelemetryProxySourceLine;
215
229
  unsigned int dataBufferDirSourceLine;
216
230
  unsigned int defaultGroupSourceLine;
217
231
  unsigned int defaultRubySourceLine;
@@ -224,6 +238,7 @@ struct AutoGeneratedServerConfig {
224
238
  unsigned int securityUpdateCheckProxySourceLine;
225
239
  unsigned int prestartURLsSourceLine;
226
240
 
241
+ bool disableAnonymousTelemetryExplicitlySet: 1;
227
242
  bool disableSecurityUpdateCheckExplicitlySet: 1;
228
243
  bool showVersionInHeaderExplicitlySet: 1;
229
244
  bool turbocachingExplicitlySet: 1;
@@ -239,6 +254,7 @@ struct AutoGeneratedServerConfig {
239
254
  bool adminPanelPasswordExplicitlySet: 1;
240
255
  bool adminPanelUrlExplicitlySet: 1;
241
256
  bool adminPanelUsernameExplicitlySet: 1;
257
+ bool anonymousTelemetryProxyExplicitlySet: 1;
242
258
  bool dataBufferDirExplicitlySet: 1;
243
259
  bool defaultGroupExplicitlySet: 1;
244
260
  bool defaultRubyExplicitlySet: 1;
@@ -253,6 +269,7 @@ struct AutoGeneratedServerConfig {
253
269
 
254
270
 
255
271
  AutoGeneratedServerConfig() {
272
+ disableAnonymousTelemetry = false;
256
273
  disableSecurityUpdateCheck = false;
257
274
  showVersionInHeader = true;
258
275
  turbocaching = true;
@@ -276,6 +293,9 @@ struct AutoGeneratedServerConfig {
276
293
  /*
277
294
  * adminPanelUsername: default initialized
278
295
  */
296
+ /*
297
+ * anonymousTelemetryProxy: default initialized
298
+ */
279
299
  /*
280
300
  * dataBufferDir: default initialized
281
301
  */
@@ -306,6 +326,7 @@ struct AutoGeneratedServerConfig {
306
326
  * prestartURLs: default initialized
307
327
  */
308
328
 
329
+ disableAnonymousTelemetrySourceLine = 0;
309
330
  disableSecurityUpdateCheckSourceLine = 0;
310
331
  showVersionInHeaderSourceLine = 0;
311
332
  turbocachingSourceLine = 0;
@@ -321,6 +342,7 @@ struct AutoGeneratedServerConfig {
321
342
  adminPanelPasswordSourceLine = 0;
322
343
  adminPanelUrlSourceLine = 0;
323
344
  adminPanelUsernameSourceLine = 0;
345
+ anonymousTelemetryProxySourceLine = 0;
324
346
  dataBufferDirSourceLine = 0;
325
347
  defaultGroupSourceLine = 0;
326
348
  defaultRubySourceLine = 0;
@@ -333,6 +355,7 @@ struct AutoGeneratedServerConfig {
333
355
  securityUpdateCheckProxySourceLine = 0;
334
356
  prestartURLsSourceLine = 0;
335
357
 
358
+ disableAnonymousTelemetryExplicitlySet = false;
336
359
  disableSecurityUpdateCheckExplicitlySet = false;
337
360
  showVersionInHeaderExplicitlySet = false;
338
361
  turbocachingExplicitlySet = false;
@@ -348,6 +371,7 @@ struct AutoGeneratedServerConfig {
348
371
  adminPanelPasswordExplicitlySet = false;
349
372
  adminPanelUrlExplicitlySet = false;
350
373
  adminPanelUsernameExplicitlySet = false;
374
+ anonymousTelemetryProxyExplicitlySet = false;
351
375
  dataBufferDirExplicitlySet = false;
352
376
  defaultGroupExplicitlySet = false;
353
377
  defaultRubyExplicitlySet = false;