passenger 4.0.19 → 4.0.20

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 (65) hide show
  1. checksums.yaml +15 -0
  2. checksums.yaml.gz.asc +12 -0
  3. data.tar.gz.asc +7 -7
  4. data/NEWS +22 -0
  5. data/bin/passenger-install-apache2-module +2 -2
  6. data/bin/passenger-install-nginx-module +2 -2
  7. data/build/agents.rb +6 -0
  8. data/build/apache2.rb +1 -0
  9. data/build/basics.rb +2 -2
  10. data/build/cplusplus_support.rb +6 -1
  11. data/build/cxx_tests.rb +1 -0
  12. data/build/nginx.rb +1 -0
  13. data/build/packaging.rb +1 -1
  14. data/dev/copy_boost_headers.rb +1 -0
  15. data/doc/Users guide Apache.idmap.txt +56 -54
  16. data/doc/Users guide Apache.txt +22 -3
  17. data/doc/Users guide Nginx.idmap.txt +52 -50
  18. data/doc/Users guide Nginx.txt +22 -3
  19. data/ext/apache2/Configuration.hpp +4 -0
  20. data/ext/apache2/ConfigurationCommands.cpp +6 -0
  21. data/ext/apache2/ConfigurationFields.hpp +6 -4
  22. data/ext/apache2/ConfigurationSetters.cpp +11 -0
  23. data/ext/apache2/CreateDirConfig.cpp +1 -0
  24. data/ext/apache2/Hooks.cpp +2 -0
  25. data/ext/apache2/MergeDirConfig.cpp +7 -0
  26. data/ext/boost/type_traits/detail/common_type_imp.hpp +333 -0
  27. data/ext/boost/type_traits/detail/has_binary_operator.hpp +229 -0
  28. data/ext/boost/type_traits/detail/has_postfix_operator.hpp +202 -0
  29. data/ext/boost/type_traits/detail/has_prefix_operator.hpp +210 -0
  30. data/ext/boost/type_traits/detail/is_function_ptr_tester.hpp +654 -0
  31. data/ext/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp +2759 -0
  32. data/ext/boost/type_traits/detail/wrap.hpp +18 -0
  33. data/ext/common/Constants.h +1 -1
  34. data/ext/common/Utils/StrIntUtils.cpp +1 -1
  35. data/ext/common/agents/HelperAgent/Main.cpp +18 -1
  36. data/ext/common/agents/HelperAgent/RequestHandler.h +3 -0
  37. data/ext/common/agents/SpawnPreparer.cpp +25 -0
  38. data/ext/common/agents/TempDirToucher.c +357 -0
  39. data/ext/common/agents/Watchdog/Main.cpp +38 -0
  40. data/ext/nginx/CacheLocationConfig.c +21 -1
  41. data/ext/nginx/CacheLocationConfig.c.erb +1 -1
  42. data/ext/nginx/ConfigurationCommands.c +10 -0
  43. data/ext/nginx/ConfigurationFields.h +18 -16
  44. data/ext/nginx/ConfigurationFields.h.erb +11 -6
  45. data/ext/nginx/CreateLocationConfig.c +4 -0
  46. data/ext/nginx/MergeLocationConfig.c +6 -0
  47. data/helper-scripts/node-loader.js +6 -2
  48. data/lib/phusion_passenger.rb +1 -1
  49. data/lib/phusion_passenger/{rails3_extensions → active_support3_extensions}/init.rb +10 -8
  50. data/lib/phusion_passenger/apache2/config_options.rb +5 -0
  51. data/lib/phusion_passenger/loader_shared_helpers.rb +61 -7
  52. data/lib/phusion_passenger/nginx/config_options.rb +4 -0
  53. data/lib/phusion_passenger/platform_info/apache.rb +6 -1
  54. data/lib/phusion_passenger/platform_info/compiler.rb +29 -2
  55. data/lib/phusion_passenger/platform_info/depcheck_specs/compiler_toolchain.rb +4 -4
  56. data/lib/phusion_passenger/platform_info/ruby.rb +7 -3
  57. data/lib/phusion_passenger/public_api.rb +4 -4
  58. data/lib/phusion_passenger/standalone/command.rb +10 -0
  59. data/lib/phusion_passenger/standalone/runtime_installer.rb +2 -2
  60. data/lib/phusion_passenger/standalone/start_command.rb +14 -8
  61. data/lib/phusion_passenger/utils/unseekable_socket.rb +52 -0
  62. data/resources/templates/standalone/config.erb +11 -0
  63. metadata +14 -15
  64. metadata.gz.asc +7 -7
  65. data/helper-scripts/touch-dir.sh +0 -48
@@ -229,6 +229,10 @@ LOCATION_CONFIGURATION_OPTIONS = [
229
229
  :name => 'passenger_spawn_method',
230
230
  :type => :string
231
231
  },
232
+ {
233
+ :name => 'passenger_load_shell_envvars',
234
+ :type => :flag
235
+ },
232
236
  {
233
237
  :name => 'union_station_key',
234
238
  :type => :string
@@ -399,7 +399,12 @@ module PlatformInfo
399
399
  # The C compiler flags that are necessary to compile an Apache module.
400
400
  # Also includes APR and APU compiler flags if with_apr_flags is true.
401
401
  def self.apache2_module_cflags(with_apr_flags = true)
402
- flags = ["-fPIC"]
402
+ flags = [""]
403
+ if cc_is_sun_studio?
404
+ flags << "-KPIC"
405
+ else
406
+ flags << "-fPIC"
407
+ end
403
408
  if with_apr_flags
404
409
  flags << apr_flags
405
410
  flags << apu_flags
@@ -22,6 +22,7 @@
22
22
  # THE SOFTWARE.
23
23
 
24
24
  require 'phusion_passenger/platform_info'
25
+ require 'phusion_passenger/platform_info/operating_system'
25
26
 
26
27
  module PhusionPassenger
27
28
 
@@ -106,11 +107,32 @@ private
106
107
 
107
108
  public
108
109
  def self.cc
109
- return string_env('CC', 'gcc')
110
+ return string_env('CC', default_cc)
110
111
  end
111
112
 
112
113
  def self.cxx
113
- return string_env('CXX', 'g++')
114
+ return string_env('CXX', default_cxx)
115
+ end
116
+
117
+ def self.default_cc
118
+ # OS X Mavericks (10.9) switched from GCC to Clang as the default compiler,
119
+ # i.e. as an alias for 'cc'. Since the Nginx by default uses 'cc' as the compiler,
120
+ # we'll have to do that too. Otherwise we'll get C++ linker errors because Nginx
121
+ # is compiled with Clang while Phusion Passenger is compiled with GCC.
122
+ # https://code.google.com/p/phusion-passenger/issues/detail?id=950
123
+ if PlatformInfo.os_name == "macosx"
124
+ return 'cc'
125
+ else
126
+ return 'gcc'
127
+ end
128
+ end
129
+
130
+ def self.default_cxx
131
+ if PlatformInfo.os_name == "macosx"
132
+ return 'c++'
133
+ else
134
+ return 'g++'
135
+ end
114
136
  end
115
137
 
116
138
  def self.cc_is_clang?
@@ -123,6 +145,11 @@ public
123
145
  end
124
146
  memoize :cxx_is_clang?
125
147
 
148
+ def self.cc_is_sun_studio?
149
+ `#{cc} -V 2>&1` =~ /Sun C/ || `#{cc} -flags 2>&1` =~ /Sun C/
150
+ end
151
+ memoize :cc_is_sun_studio?
152
+
126
153
 
127
154
  # Looks for the given C or C++ header. This works by invoking the compiler and
128
155
  # searching in the compiler's header search path. Returns its full filename,
@@ -1,5 +1,5 @@
1
- define 'gcc' do
2
- name "GNU C compiler"
1
+ define 'cc' do
2
+ name "C compiler"
3
3
  website "http://gcc.gnu.org/"
4
4
  define_checker do
5
5
  require 'phusion_passenger/platform_info/compiler'
@@ -23,8 +23,8 @@ define 'gcc' do
23
23
  end
24
24
  end
25
25
 
26
- define 'g++' do
27
- name "GNU C++ compiler"
26
+ define 'c++' do
27
+ name "C++ compiler"
28
28
  website "http://gcc.gnu.org/"
29
29
  define_checker do
30
30
  require 'phusion_passenger/platform_info/compiler'
@@ -255,19 +255,23 @@ module PlatformInfo
255
255
  matching_path = $LOAD_PATH.find_all do |item|
256
256
  item.include?("rvm/gems/")
257
257
  end
258
- if matching_path
258
+ if matching_path && !matching_path.empty?
259
259
  subpath = matching_path.to_s.gsub(/^.*rvm\/gems\//, '')
260
260
  result = subpath.split('/').first
261
261
  return result if result
262
262
  end
263
-
263
+
264
264
  # On Ruby 1.9, $LOAD_PATH does not contain any gem paths until
265
265
  # at least one gem has been required so the above can fail.
266
266
  # We're out of options now, we can't detect the gem set.
267
267
  # Raise an exception so that the user knows what's going on
268
268
  # instead of having things fail in obscure ways later.
269
269
  STDERR.puts "Unable to autodetect the currently active RVM gem " +
270
- "set name. Please contact this program's author for support."
270
+ "set name. This could happen if you ran this program using 'sudo' " +
271
+ "instead of 'rvmsudo'. When using RVM, you're always supposed to " +
272
+ "use 'rvmsudo' instead of 'sudo!'.\n\n" +
273
+ "Please try rerunning this program using 'rvmsudo'. If that " +
274
+ "doesn't help, please contact this program's author for support."
271
275
  exit 1
272
276
  end
273
277
  return nil
@@ -42,10 +42,10 @@ class << self
42
42
  end
43
43
 
44
44
  def install_framework_extensions!(*args)
45
- require 'rails/version' if defined?(::Rails) && !defined?(::Rails::VERSION)
46
- if defined?(::Rails) && ::Rails::VERSION::MAJOR >= 3
47
- require 'phusion_passenger/rails3_extensions/init'
48
- Rails3Extensions.init!(PhusionPassenger::App.options, *args)
45
+ require 'active_support/version' if defined?(::ActiveSupport) && !defined?(::ActiveSupport::VERSION)
46
+ if defined?(::ActiveSupport) && ::ActiveSupport::VERSION::MAJOR >= 3
47
+ require 'phusion_passenger/active_support3_extensions/init'
48
+ ActiveSupport3Extensions.init!(PhusionPassenger::App.options, *args)
49
49
  end
50
50
  end
51
51
 
@@ -222,6 +222,16 @@ private
222
222
  puts output if debugging?
223
223
  end
224
224
  end
225
+
226
+ def serialize_strset(*items)
227
+ if "".respond_to?(:force_encoding)
228
+ items = items.map { |x| x.force_encoding('binary') }
229
+ null = "\0".force_encoding('binary')
230
+ else
231
+ null = "\0"
232
+ end
233
+ return [items.join(null)].pack('m*').gsub("\n", "").strip
234
+ end
225
235
 
226
236
  def determine_nginx_start_command
227
237
  if @options[:nginx_bin]
@@ -99,8 +99,8 @@ protected
99
99
  'depcheck_specs/utilities'
100
100
  ]
101
101
  ids = [
102
- 'gcc',
103
- 'g++',
102
+ 'cc',
103
+ 'c++',
104
104
  'gmake',
105
105
  'ruby-openssl',
106
106
  'rubygems',
@@ -106,16 +106,12 @@ class StartCommand < Command
106
106
  ensure
107
107
  begin_shutdown
108
108
  begin
109
- stop_touching_temp_dir_in_background if should_wait_until_nginx_has_exited?
110
109
  stop_threads
111
110
  ensure
112
111
  finalize_shutdown
113
112
  end
114
113
  end
115
114
  ensure
116
- if @temp_dir
117
- FileUtils.remove_entry_secure(@temp_dir) rescue nil
118
- end
119
115
  @plugin.call_hook(:cleanup)
120
116
  end
121
117
 
@@ -402,6 +398,10 @@ private
402
398
  return !@options[:daemonize]
403
399
  end
404
400
 
401
+ def should_cleanup_temp_dir?
402
+ return @temp_dir && !@options[:daemonize]
403
+ end
404
+
405
405
  # Returns the URL that Nginx will be listening on.
406
406
  def listen_url
407
407
  if @options[:socket_file]
@@ -570,10 +570,16 @@ private
570
570
  end
571
571
 
572
572
  def touch_temp_dir_in_background
573
- require 'shellwords'
574
- script = Shellwords.escape("#{PhusionPassenger.helper_scripts_dir}/touch-dir.sh")
575
- dir = Shellwords.escape(@temp_dir)
576
- @toucher = IO.popen("sh #{script} #{dir}", "r")
573
+ result = system("#{@runtime_locator.find_agents_dir}/TempDirToucher",
574
+ @temp_dir,
575
+ "--cleanup",
576
+ "--daemonize",
577
+ "--pid-file", "#{@temp_dir}/temp_dir_toucher.pid",
578
+ "--log-file", @options[:log_file])
579
+ if !result
580
+ error "Cannot start #{@runtime_locator.find_agents_dir}/TempDirToucher"
581
+ exit 1
582
+ end
577
583
  end
578
584
 
579
585
  def begin_shutdown
@@ -115,6 +115,12 @@ class UnseekableSocket
115
115
  rescue => e
116
116
  raise annotate(e)
117
117
  end
118
+
119
+ def write_nonblock(string)
120
+ @socket.write_nonblock(string)
121
+ rescue => e
122
+ raise annotate(e)
123
+ end
118
124
 
119
125
  def writev(components)
120
126
  @socket.writev(components)
@@ -134,6 +140,24 @@ class UnseekableSocket
134
140
  raise annotate(e)
135
141
  end if IO.method_defined?(:writev3)
136
142
 
143
+ def send(*args)
144
+ @socket.send(*args)
145
+ rescue => e
146
+ raise annotate(e)
147
+ end
148
+
149
+ def sendmsg(*args)
150
+ @socket.sendmsg(*args)
151
+ rescue => e
152
+ raise annotate(e)
153
+ end
154
+
155
+ def sendmsg_nonblock(*args)
156
+ @socket.sendmsg_nonblock(*args)
157
+ rescue => e
158
+ raise annotate(e)
159
+ end
160
+
137
161
  def puts(*args)
138
162
  @socket.puts(*args)
139
163
  rescue => e
@@ -165,6 +189,13 @@ class UnseekableSocket
165
189
  rescue => e
166
190
  raise annotate(e)
167
191
  end
192
+
193
+ def read_nonblock(*args)
194
+ raise EOFError, "end of file reached" if @simulate_eof
195
+ @socket.read_nonblock(*args)
196
+ rescue => e
197
+ raise annotate(e)
198
+ end
168
199
 
169
200
  def readpartial(*args)
170
201
  raise EOFError, "end of file reached" if @simulate_eof
@@ -179,6 +210,27 @@ class UnseekableSocket
179
210
  rescue => e
180
211
  raise annotate(e)
181
212
  end
213
+
214
+ def recv(*args)
215
+ raise EOFError, "end of file reached" if @simulate_eof
216
+ @socket.recv(*args)
217
+ rescue => e
218
+ raise annotate(e)
219
+ end
220
+
221
+ def recvfrom(*args)
222
+ raise EOFError, "end of file reached" if @simulate_eof
223
+ @socket.recvfrom(*args)
224
+ rescue => e
225
+ raise annotate(e)
226
+ end
227
+
228
+ def recvfrom_nonblock(*args)
229
+ raise EOFError, "end of file reached" if @simulate_eof
230
+ @socket.recvfrom_nonblock(*args)
231
+ rescue => e
232
+ raise annotate(e)
233
+ end
182
234
 
183
235
  def each(&block)
184
236
  return if @simulate_eof
@@ -11,6 +11,16 @@ daemon on;
11
11
  error_log '<%= @options[:log_file] %>' <% if debugging? %>info<% end %>;
12
12
  pid '<%= @options[:pid_file] %>';
13
13
 
14
+ <% if Process.euid == 0 %>
15
+ <% if @options[:user] %>
16
+ <%# Run workers as the given user. The master process will always run as root and will be able to bind to any port. %>
17
+ user <%= @options[:user] %> <%= default_group_for(@options[:user]) %>;
18
+ <% else %>
19
+ <%# Prevent running Nginx workers as nobody. %>
20
+ user <%= current_user %> <%= default_group_for(current_user) %>;
21
+ <% end %>
22
+ <% end %>
23
+
14
24
  events {
15
25
  worker_connections 1024;
16
26
  }
@@ -21,6 +31,7 @@ http {
21
31
  passenger_ruby <%= PlatformInfo.ruby_command %>;
22
32
  passenger_root '<%= location_config_filename %>';
23
33
  passenger_abort_on_startup_error on;
34
+ passenger_ctl cleanup_pidfiles <%= serialize_strset("#{@temp_dir}/temp_dir_toucher.pid") %>;
24
35
  passenger_user_switching off;
25
36
  passenger_max_pool_size <%= @options[:max_pool_size] %>;
26
37
  passenger_min_instances <%= @options[:min_instances] %>;
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.19
5
- prerelease:
4
+ version: 4.0.20
6
5
  platform: ruby
7
6
  authors:
8
7
  - Phusion - http://www.phusion.nl/
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-24 00:00:00.000000000 Z
11
+ date: 2013-10-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ! '>='
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: daemon_controller
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rack
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ! '>='
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ! '>='
60
53
  - !ruby/object:Gem::Version
@@ -105,6 +98,7 @@ files:
105
98
  - build/test_basics.rb
106
99
  - lib/phusion_passenger.rb
107
100
  - lib/phusion_passenger/abstract_installer.rb
101
+ - lib/phusion_passenger/active_support3_extensions/init.rb
108
102
  - lib/phusion_passenger/admin_tools/memory_stats.rb
109
103
  - lib/phusion_passenger/admin_tools/server_instance.rb
110
104
  - lib/phusion_passenger/admin_tools.rb
@@ -145,7 +139,6 @@ files:
145
139
  - lib/phusion_passenger/public_api.rb
146
140
  - lib/phusion_passenger/rack/out_of_band_gc.rb
147
141
  - lib/phusion_passenger/rack/thread_handler_extension.rb
148
- - lib/phusion_passenger/rails3_extensions/init.rb
149
142
  - lib/phusion_passenger/request_handler/thread_handler.rb
150
143
  - lib/phusion_passenger/request_handler.rb
151
144
  - lib/phusion_passenger/ruby_core_enhancements.rb
@@ -317,7 +310,6 @@ files:
317
310
  - helper-scripts/rack-loader.rb
318
311
  - helper-scripts/rack-preloader.rb
319
312
  - helper-scripts/system-memory-stats.py
320
- - helper-scripts/touch-dir.sh
321
313
  - helper-scripts/wsgi-loader.py
322
314
  - helper-scripts/wsgi-preloader.py
323
315
  - ext/common/agents/Base.cpp
@@ -348,6 +340,7 @@ files:
348
340
  - ext/common/Utils/SystemTime.cpp
349
341
  - ext/common/Utils.cpp
350
342
  - ext/common/agents/EnvPrinter.c
343
+ - ext/common/agents/TempDirToucher.c
351
344
  - ext/common/Utils/Blowfish.c
352
345
  - ext/common/Utils/fib.c
353
346
  - ext/common/Account.h
@@ -2110,19 +2103,26 @@ files:
2110
2103
  - ext/boost/type_traits/decay.hpp
2111
2104
  - ext/boost/type_traits/detail/bool_trait_def.hpp
2112
2105
  - ext/boost/type_traits/detail/bool_trait_undef.hpp
2106
+ - ext/boost/type_traits/detail/common_type_imp.hpp
2113
2107
  - ext/boost/type_traits/detail/cv_traits_impl.hpp
2114
2108
  - ext/boost/type_traits/detail/false_result.hpp
2109
+ - ext/boost/type_traits/detail/has_binary_operator.hpp
2110
+ - ext/boost/type_traits/detail/has_postfix_operator.hpp
2111
+ - ext/boost/type_traits/detail/has_prefix_operator.hpp
2115
2112
  - ext/boost/type_traits/detail/ice_and.hpp
2116
2113
  - ext/boost/type_traits/detail/ice_eq.hpp
2117
2114
  - ext/boost/type_traits/detail/ice_not.hpp
2118
2115
  - ext/boost/type_traits/detail/ice_or.hpp
2119
2116
  - ext/boost/type_traits/detail/is_function_ptr_helper.hpp
2117
+ - ext/boost/type_traits/detail/is_function_ptr_tester.hpp
2120
2118
  - ext/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp
2119
+ - ext/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp
2121
2120
  - ext/boost/type_traits/detail/size_t_trait_def.hpp
2122
2121
  - ext/boost/type_traits/detail/size_t_trait_undef.hpp
2123
2122
  - ext/boost/type_traits/detail/template_arity_spec.hpp
2124
2123
  - ext/boost/type_traits/detail/type_trait_def.hpp
2125
2124
  - ext/boost/type_traits/detail/type_trait_undef.hpp
2125
+ - ext/boost/type_traits/detail/wrap.hpp
2126
2126
  - ext/boost/type_traits/detail/yes_no_type.hpp
2127
2127
  - ext/boost/type_traits/function_traits.hpp
2128
2128
  - ext/boost/type_traits/has_nothrow_assign.hpp
@@ -2900,27 +2900,26 @@ files:
2900
2900
  - test/stub/wsgi/tmp/.gitignore
2901
2901
  homepage: https://www.phusionpassenger.com/
2902
2902
  licenses: []
2903
+ metadata: {}
2903
2904
  post_install_message:
2904
2905
  rdoc_options: []
2905
2906
  require_paths:
2906
2907
  - lib
2907
2908
  required_ruby_version: !ruby/object:Gem::Requirement
2908
- none: false
2909
2909
  requirements:
2910
2910
  - - ! '>='
2911
2911
  - !ruby/object:Gem::Version
2912
2912
  version: '0'
2913
2913
  required_rubygems_version: !ruby/object:Gem::Requirement
2914
- none: false
2915
2914
  requirements:
2916
2915
  - - ! '>='
2917
2916
  - !ruby/object:Gem::Version
2918
2917
  version: '0'
2919
2918
  requirements: []
2920
2919
  rubyforge_project: passenger
2921
- rubygems_version: 1.8.25
2920
+ rubygems_version: 2.1.5
2922
2921
  signing_key:
2923
- specification_version: 3
2922
+ specification_version: 4
2924
2923
  summary: A fast and robust web server and application server for Ruby, Python and
2925
2924
  Node.js
2926
2925
  test_files: []