passenger 5.1.1 → 5.1.2

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 (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +13 -0
  3. data/CONTRIBUTING.md +4 -8
  4. data/CONTRIBUTORS +1 -0
  5. data/INSTALL.md +1 -1
  6. data/README.md +2 -2
  7. data/build/misc.rb +1 -0
  8. data/build/packaging.rb +3 -3
  9. data/dev/ci/run_travis.sh +81 -20
  10. data/src/agent/Core/CoreMain.cpp +1 -1
  11. data/src/agent/Core/SecurityUpdateChecker.h +120 -3
  12. data/src/cxx_supportlib/Constants.h +2 -2
  13. data/src/cxx_supportlib/Crypto.cpp +14 -22
  14. data/src/cxx_supportlib/Crypto.h +1 -1
  15. data/src/cxx_supportlib/Utils/DateParsing.h +1 -1
  16. data/src/helper-scripts/node-loader.js +60 -59
  17. data/src/nodejs_supportlib/phusion_passenger/line_reader.js +9 -9
  18. data/src/nodejs_supportlib/phusion_passenger/log_express.js +3 -3
  19. data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +8 -9
  20. data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +10 -10
  21. data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +20 -18
  22. data/src/ruby_supportlib/phusion_passenger.rb +1 -1
  23. data/src/ruby_supportlib/phusion_passenger/admin_tools/memory_stats.rb +1 -1
  24. data/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb +27 -7
  25. data/src/ruby_supportlib/phusion_passenger/config/nginx_engine_compiler.rb +15 -3
  26. data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -1
  27. data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +1 -1
  28. data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/libs.rb +4 -1
  29. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +16 -10
  30. metadata +2 -2
@@ -25,7 +25,6 @@
25
25
 
26
26
  var log;
27
27
  var net = require('net');
28
- var os = require('os');
29
28
  var nbo = require('vendor-copy/network-byte-order');
30
29
  var codify = require('vendor-copy/codify');
31
30
 
@@ -102,15 +101,15 @@ exports.init = function(logger, routerAddress, routerUser, routerPass, gatewayKe
102
101
  changeState(0, "Init approved");
103
102
 
104
103
  beginConnection();
105
- }
104
+ };
106
105
 
107
106
  exports.finit = function() {
108
107
  resetState("finit()");
109
- }
108
+ };
110
109
 
111
110
  exports.isEnabled = function() {
112
111
  return routerState >= 0;
113
- }
112
+ };
114
113
 
115
114
  function beginConnection() {
116
115
  changeState(1);
@@ -162,7 +161,7 @@ function LogTransaction(cat) {
162
161
  }
163
162
 
164
163
  function findLastPendingTxnForId(txnId) {
165
- for (i = pendingTxnBuf.length - 1; i >= 0; i--) {
164
+ for (var i = pendingTxnBuf.length - 1; i >= 0; i--) {
166
165
  if (pendingTxnBuf[i].txnId == txnId) {
167
166
  return pendingTxnBuf[i];
168
167
  }
@@ -180,7 +179,7 @@ exports.deferIfPendingTxns = function(txnId, deferThis, deferFn, deferArgs) {
180
179
  txn.deferFn = deferFn;
181
180
  txn.deferArgs = deferArgs;
182
181
  }
183
- }
182
+ };
184
183
 
185
184
  // Example categories are "requests", "exceptions". The lineArray is a specific format parsed by Union STation.
186
185
  // txnIfContinue is an optional txnId and attaches the log to an existing transaction with the specified txnId.
@@ -204,7 +203,7 @@ exports.logToUstTransaction = function(category, lineArray, txnIfContinue) {
204
203
  }
205
204
 
206
205
  pushPendingData();
207
- }
206
+ };
208
207
 
209
208
  function verifyOk(rcvString, topic) {
210
209
  if ("status" != rcvString[0] || "ok" != rcvString[1]) {
@@ -249,7 +248,7 @@ function pushPendingData() {
249
248
  case 2:
250
249
  // txn is open, log the data & close
251
250
  log.debug("log & close transaction(" + pendingTxnBuf[0].txnId + ")");
252
- txn = pendingTxnBuf.shift();
251
+ var txn = pendingTxnBuf.shift();
253
252
 
254
253
  if (txn.deferFn) {
255
254
  var moveToTxn = findLastPendingTxnForId(txn.txnId);
@@ -264,7 +263,7 @@ function pushPendingData() {
264
263
  }
265
264
  }
266
265
 
267
- for (i = 0; i < txn.logBuf.length; i++) {
266
+ for (var i = 0; i < txn.logBuf.length; i++) {
268
267
  writeLenArray(routerConn, "log\0" + txn.txnId + "\0" + codify.toCode(txn.timestamp) + "\0");
269
268
  writeLenString(routerConn, txn.logBuf[i]);
270
269
  }
@@ -309,17 +308,20 @@ function readLenArray(newData) {
309
308
  readBuf += newData;
310
309
  log.silly("read: total len = " + readBuf.length);
311
310
  log.silly(new Buffer(readBuf).toString("hex"));
311
+
312
312
  if (readBuf.length < 2) {
313
- log.silly("need more header data..");
313
+ log.silly("need more header data..");
314
314
  return null; // expecting at least length bytes
315
315
  }
316
- payloadLen = nbo.ntohs(new Buffer(readBuf), 0);
316
+
317
+ var payloadLen = nbo.ntohs(new Buffer(readBuf), 0);
317
318
  log.silly("read: payloadLen = " + payloadLen);
319
+
318
320
  if (readBuf.length < 2 + payloadLen) {
319
- log.silly("need more payload data..");
321
+ log.silly("need more payload data..");
320
322
  return null; // not fully read yet
321
323
  }
322
- resultStr = readBuf.substring(2, payloadLen + 2);
324
+ var resultStr = readBuf.substring(2, payloadLen + 2);
323
325
  readBuf = readBuf.substring(payloadLen + 2); // keep any bytes read beyond length for next read
324
326
 
325
327
  return resultStr.split("\0");
@@ -328,7 +330,7 @@ function readLenArray(newData) {
328
330
  function onData(data) {
329
331
  log.silly("onData [" + data + "] (len = " + data.length + ")");
330
332
 
331
- rcvString = readLenArray(data);
333
+ var rcvString = readLenArray(data);
332
334
  if (!rcvString) {
333
335
  return;
334
336
  }
@@ -365,8 +367,8 @@ function onData(data) {
365
367
 
366
368
  case 5:
367
369
  log.warn("unexpected data receive state (5)");
368
- pushPendingData();
369
- break;
370
+ pushPendingData();
371
+ break;
370
372
 
371
373
  case 6:
372
374
  resetWatchdog();
@@ -421,14 +423,14 @@ function changeState(newRouterState, optReason) {
421
423
  }
422
424
 
423
425
  function writeLenString(c, str) {
424
- len = new Buffer(4);
426
+ var len = new Buffer(4);
425
427
  nbo.htonl(len, 0, str.length);
426
428
  c.write(len);
427
429
  c.write(str);
428
430
  }
429
431
 
430
432
  function writeLenArray(c, str) {
431
- len = new Buffer(2);
433
+ var len = new Buffer(2);
432
434
  nbo.htons(len, 0, str.length);
433
435
  c.write(len);
434
436
  c.write(str);
@@ -31,7 +31,7 @@ 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.1'
34
+ VERSION_STRING = '5.1.2'
35
35
 
36
36
  PREFERRED_NGINX_VERSION = '1.10.2'
37
37
  NGINX_SHA256_CHECKSUM = '1045ac4987a396e2fa5d0011daf8987b612dd2f05181b67507da68cbe7d765c2'
@@ -90,7 +90,7 @@ module PhusionPassenger
90
90
  # Phusion Passenger is not running.
91
91
  def passenger_processes
92
92
  @passenger_processes ||= list_processes(:match =>
93
- /((^| )Passenger|(^| )Rails:|(^| )Rack:|wsgi-loader.py|(.*)PassengerAgent)/)
93
+ /((^| )Passenger|(^| )Rails:|(^| )Rack:|wsgi-loader.py|(.*)PassengerAgent|rack-loader.rb)/)
94
94
  end
95
95
 
96
96
  # Returns the sum of the memory usages of all given processes.
@@ -1,5 +1,5 @@
1
1
  # Phusion Passenger - https://www.phusionpassenger.com/
2
- # Copyright (c) 2014-2015 Phusion Holding B.V.
2
+ # Copyright (c) 2014-2017 Phusion Holding B.V.
3
3
  #
4
4
  # "Passenger", "Phusion Passenger" and "Union Station" are registered
5
5
  # trademarks of Phusion Holding B.V.
@@ -100,6 +100,11 @@ module PhusionPassenger
100
100
  "Nginx version with --nginx-version") do |val|
101
101
  options[:nginx_tarball] = val
102
102
  end
103
+ opts.on("--engine ENGINE", String, "Engine to use. " +
104
+ "Default: Nginx") do |val|
105
+ options[:engine] = val.downcase
106
+ options[:compile] = false unless options[:engine] == "nginx"
107
+ end
103
108
  opts.on("--brief", "Report progress in a brief style") do
104
109
  options[:brief] = true
105
110
  options[:install_agent_args] << "--brief"
@@ -182,12 +187,14 @@ module PhusionPassenger
182
187
  end
183
188
  result
184
189
  end
185
- if !@options[:nginx_version]
186
- if @options[:nginx_tarball]
187
- abort "#{@colors.red}Error: if you specify --nginx-tarball, " +
188
- "you must also specify --nginx-version.#{@colors.reset}"
189
- else
190
- @options[:nginx_version] = PREFERRED_NGINX_VERSION
190
+ if @options[:engine] == "nginx"
191
+ if !@options[:nginx_version]
192
+ if @options[:nginx_tarball]
193
+ abort "#{@colors.red}Error: if you specify --nginx-tarball, " +
194
+ "you must also specify --nginx-version.#{@colors.reset}"
195
+ else
196
+ @options[:nginx_version] = PREFERRED_NGINX_VERSION
197
+ end
191
198
  end
192
199
  end
193
200
  end
@@ -221,6 +228,7 @@ module PhusionPassenger
221
228
  end
222
229
 
223
230
  def download_nginx_engine
231
+ return true if @options[:engine] != "nginx"
224
232
  if @options[:nginx_version] != PREFERRED_NGINX_VERSION
225
233
  return false
226
234
  end
@@ -242,6 +250,10 @@ module PhusionPassenger
242
250
  end
243
251
 
244
252
  def compile_nginx_engine(tmpdir)
253
+ if @options[:engine] != "nginx"
254
+ puts "Not compiling Nginx engine, because builtin engine selected."
255
+ return
256
+ end
245
257
  puts
246
258
  puts "---------------------------------------"
247
259
  puts
@@ -251,6 +263,14 @@ module PhusionPassenger
251
263
  args = @options[:compile_args].dup
252
264
  args << "--working-dir"
253
265
  args << tmpdir
266
+ if @options[:nginx_version]
267
+ args << "--nginx-version"
268
+ args << @options[:nginx_version]
269
+ end
270
+ if @options[:nginx_tarball]
271
+ args << "--nginx-tarball"
272
+ args << @options[:nginx_tarball]
273
+ end
254
274
  CompileNginxEngineCommand.new(args).run
255
275
  else
256
276
  abort "No precompiled Nginx engine could be downloaded. Refusing to compile because --no-compile is given."
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  #
3
3
  # Phusion Passenger - https://www.phusionpassenger.com/
4
- # Copyright (c) 2010-2015 Phusion Holding B.V.
4
+ # Copyright (c) 2010-2017 Phusion Holding B.V.
5
5
  #
6
6
  # "Passenger", "Phusion Passenger" and "Union Station" are registered
7
7
  # trademarks of Phusion Holding B.V.
@@ -242,12 +242,24 @@ module PhusionPassenger
242
242
  abort
243
243
  end
244
244
  end
245
- nginx_sources_name = "nginx-#{@nginx_version}"
246
245
 
247
246
  puts "Extracting tarball..."
248
247
  e_working_dir = Shellwords.escape(@working_dir)
249
248
  e_tarball = Shellwords.escape(tarball)
250
- system("cd #{e_working_dir} && tar xzf #{e_tarball}")
249
+ result = system("cd #{e_working_dir} && tar xzf #{e_tarball}")
250
+ if !result
251
+ puts
252
+ if @nginx_tarball
253
+ new_screen
254
+ puts "You specified --nginx-tarball, but the file could not be extracted. " +
255
+ "Please check the path and format (tar.gz), and ensure Passenger can write to " +
256
+ PlatformInfo.tmpexedir + "."
257
+ puts
258
+ else
259
+ show_possible_solutions_for_download_and_extraction_problems
260
+ end
261
+ abort
262
+ end
251
263
  end
252
264
 
253
265
  def show_possible_solutions_for_download_and_extraction_problems
@@ -106,7 +106,7 @@ module PhusionPassenger
106
106
  SHORT_PROGRAM_NAME = "Passenger"
107
107
  SERVER_TOKEN_NAME = "Phusion_Passenger"
108
108
  FLYING_PASSENGER_NAME = "Flying Passenger"
109
- SUPPORT_URL = "https://www.phusionpassenger.com/documentation_and_support"
109
+ SUPPORT_URL = "https://www.phusionpassenger.com/support"
110
110
  ENTERPRISE_URL = "https://www.phusionpassenger.com/enterprise"
111
111
  GLOBAL_NAMESPACE_DIRNAME = PhusionPassenger::GLOBAL_NAMESPACE_DIRNAME_
112
112
  # Subdirectory under $HOME to use for storing stuff.
@@ -239,7 +239,7 @@ module PhusionPassenger
239
239
  elsif @results.size > 1
240
240
  log "<yellow>WARNING: You have multiple Apache installations on your system!</yellow>"
241
241
  log "You are strongly recommended to read this section of the documentation:"
242
- log "<b>https://www.phusionpassenger.com/install/apache/multiple_apache_installs.html</b>"
242
+ log "<b>https://www.phusionpassenger.com/library/install/apache/multiple_apache_installs.html</b>"
243
243
  end
244
244
  end
245
245
 
@@ -49,7 +49,10 @@ define 'libcurl-dev' do
49
49
  source = %Q{
50
50
  #include <curl/curl.h>
51
51
  int main() {
52
- curl_global_init(CURL_GLOBAL_ALL);
52
+ CURLcode result = curl_global_init(CURL_GLOBAL_ALL);
53
+ if (result == CURLE_PEER_FAILED_VERIFICATION) { // fails to compile if too old
54
+ return 1;
55
+ }
53
56
  return 0;
54
57
  }
55
58
  }
@@ -1,5 +1,5 @@
1
1
  # Phusion Passenger - https://www.phusionpassenger.com/
2
- # Copyright (c) 2010-2016 Phusion Holding B.V.
2
+ # Copyright (c) 2010-2017 Phusion Holding B.V.
3
3
  #
4
4
  # "Passenger", "Phusion Passenger" and "Union Station" are registered
5
5
  # trademarks of Phusion Holding B.V.
@@ -177,6 +177,9 @@ module PhusionPassenger
177
177
  if @options[:ssl] && !@options[:ssl_certificate_key]
178
178
  abort "You specified --ssl. Please specify --ssl-certificate-key as well."
179
179
  end
180
+ if @options[:nginx_tarball] && !@options_without_defaults[:nginx_version]
181
+ abort "You specified --nginx-tarball. Please also specify which Nginx version the tarball contains using --nginx-version."
182
+ end
180
183
  if @options[:engine] != "builtin" && @options[:engine] != "nginx"
181
184
  abort "You've specified an invalid value for --engine. The only values allowed are: builtin, nginx."
182
185
  end
@@ -218,10 +221,10 @@ module PhusionPassenger
218
221
  else
219
222
  nginx_name = "nginx-#{@options[:nginx_version]}"
220
223
  @nginx_binary = PhusionPassenger.find_support_binary(nginx_name)
221
- if !@agent_exe || !@nginx_binary
224
+ if !@agent_exe || (@options[:engine] == "nginx" && !@nginx_binary)
222
225
  install_runtime
223
226
  @agent_exe = PhusionPassenger.find_support_binary(AGENT_EXE)
224
- @nginx_binary = PhusionPassenger.find_support_binary(nginx_name)
227
+ @nginx_binary = PhusionPassenger.find_support_binary(nginx_name) if @options[:engine] == "nginx"
225
228
  end
226
229
  end
227
230
  end
@@ -240,6 +243,7 @@ module PhusionPassenger
240
243
  # (as opposed to responding quickly with an error), then the system
241
244
  # quickly switches to a mirror.
242
245
  "--connect-timeout", "0",
246
+ "--engine", @options[:engine],
243
247
  "--idle-timeout", "0"
244
248
  ]
245
249
  if @options[:auto]
@@ -249,13 +253,15 @@ module PhusionPassenger
249
253
  args << "--url-root"
250
254
  args << @options[:binaries_url_root]
251
255
  end
252
- if @options[:nginx_version]
253
- args << "--nginx-version"
254
- args << @options[:nginx_version]
255
- end
256
- if @options[:nginx_tarball]
257
- args << "--nginx-tarball"
258
- args << @options[:nginx_tarball]
256
+ if @options[:engine] == "nginx"
257
+ if @options[:nginx_version]
258
+ args << "--nginx-version"
259
+ args << @options[:nginx_version]
260
+ end
261
+ if @options[:nginx_tarball]
262
+ args << "--nginx-tarball"
263
+ args << @options[:nginx_tarball]
264
+ end
259
265
  end
260
266
  if @options[:dont_compile_runtime]
261
267
  args << "--no-compile"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phusion - http://www.phusion.nl/
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-22 00:00:00.000000000 Z
11
+ date: 2017-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake