passenger 6.0.22 → 6.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +34 -1
- data/Rakefile +9 -2
- data/bin/passenger-install-nginx-module +1 -0
- data/build/test_basics.rb +30 -11
- data/passenger.gemspec +4 -2
- data/resources/templates/standalone/server.erb +1 -0
- data/src/agent/Core/ApplicationPool/Group/StateInspection.cpp +1 -1
- data/src/agent/Core/ApplicationPool/Pool/StateInspection.cpp +0 -3
- data/src/agent/Core/Config.h +2 -1
- data/src/agent/Core/Controller/CheckoutSession.cpp +24 -1
- data/src/agent/Core/Controller/Config.h +5 -1
- data/src/agent/Core/Controller.h +1 -0
- data/src/agent/Core/OptionParser.h +3 -0
- data/src/agent/Core/SpawningKit/ErrorRenderer.h +5 -0
- data/src/agent/Watchdog/Config.h +2 -1
- data/src/apache2_module/ConfigGeneral/AutoGeneratedDefinitions.cpp +5 -0
- data/src/apache2_module/ConfigGeneral/AutoGeneratedSetterFuncs.cpp +15 -0
- data/src/apache2_module/DirConfig/AutoGeneratedCreateFunction.cpp +5 -0
- data/src/apache2_module/DirConfig/AutoGeneratedHeaderSerialization.cpp +3 -0
- data/src/apache2_module/DirConfig/AutoGeneratedManifestGeneration.cpp +13 -0
- data/src/apache2_module/DirConfig/AutoGeneratedMergeFunction.cpp +7 -0
- data/src/apache2_module/DirConfig/AutoGeneratedStruct.h +13 -0
- data/src/cxx_supportlib/Constants.h +1 -1
- data/src/cxx_supportlib/DataStructures/LString.h +4 -0
- data/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +8 -0
- data/src/nginx_module/ConfigGeneral/AutoGeneratedSetterFuncs.c +12 -0
- data/src/nginx_module/Configuration.c +7 -2
- data/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +6 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedHeaderSerialization.c +15 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +14 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedMergeFunction.c +3 -0
- data/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +4 -0
- data/src/ruby_native_extension/passenger_native_support.c +1 -0
- data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +5 -0
- data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +5 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/depcheck_specs/gems.rb +10 -0
- data/src/ruby_supportlib/phusion_passenger/rack/handler.rb +73 -0
- data/src/ruby_supportlib/phusion_passenger/rack_handler.rb +30 -56
- data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +5 -0
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +1 -0
- data/src/ruby_supportlib/phusion_passenger/utils/json.rb +2 -197
- data/src/ruby_supportlib/phusion_passenger/utils/strscan.rb +67 -0
- data/src/ruby_supportlib/phusion_passenger.rb +5 -5
- metadata +20 -4
@@ -86,6 +86,12 @@ passenger_serialize_autogenerated_loc_conf_to_headers(ngx_conf_t *cf, passenger_
|
|
86
86
|
: sizeof("f\r\n") - 1;
|
87
87
|
}
|
88
88
|
|
89
|
+
if (conf->autogenerated.custom_error_page.data != NULL) {
|
90
|
+
len += sizeof("!~PASSENGER_CUSTOM_ERROR_PAGE: ") - 1;
|
91
|
+
len += conf->autogenerated.custom_error_page.len;
|
92
|
+
len += sizeof("\r\n") - 1;
|
93
|
+
}
|
94
|
+
|
89
95
|
if (conf->autogenerated.min_instances != NGX_CONF_UNSET_UINT) {
|
90
96
|
end = ngx_snprintf(int_buf,
|
91
97
|
sizeof(int_buf) - 1,
|
@@ -342,6 +348,15 @@ passenger_serialize_autogenerated_loc_conf_to_headers(ngx_conf_t *cf, passenger_
|
|
342
348
|
}
|
343
349
|
}
|
344
350
|
|
351
|
+
if (conf->autogenerated.custom_error_page.data != NULL) {
|
352
|
+
pos = ngx_copy(pos,
|
353
|
+
"!~PASSENGER_CUSTOM_ERROR_PAGE: ",
|
354
|
+
sizeof("!~PASSENGER_CUSTOM_ERROR_PAGE: ") - 1);
|
355
|
+
pos = ngx_copy(pos,
|
356
|
+
conf->autogenerated.custom_error_page.data,
|
357
|
+
conf->autogenerated.custom_error_page.len);
|
358
|
+
pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
|
359
|
+
}
|
345
360
|
if (conf->autogenerated.min_instances != NGX_CONF_UNSET_UINT) {
|
346
361
|
pos = ngx_copy(pos,
|
347
362
|
"!~PASSENGER_MIN_PROCESSES: ",
|
@@ -129,6 +129,20 @@ generate_config_manifest_for_autogenerated_loc_conf(manifest_gen_ctx_t *ctx, pas
|
|
129
129
|
psg_json_value_set_bool(hierarchy_member, "value",
|
130
130
|
plcf->autogenerated.friendly_error_pages);
|
131
131
|
}
|
132
|
+
if (plcf->autogenerated.custom_error_page_explicitly_set) {
|
133
|
+
find_or_create_manifest_app_and_loc_options_containers(ctx,
|
134
|
+
plcf, cscf, clcf, &app_options_container, &loc_options_container);
|
135
|
+
option_container = find_or_create_manifest_option_container(ctx,
|
136
|
+
app_options_container,
|
137
|
+
"passenger_custom_error_page",
|
138
|
+
sizeof("passenger_custom_error_page") - 1);
|
139
|
+
hierarchy_member = add_manifest_option_container_hierarchy_member(option_container,
|
140
|
+
&plcf->autogenerated.custom_error_page_source_file,
|
141
|
+
plcf->autogenerated.custom_error_page_source_line);
|
142
|
+
psg_json_value_set_str(hierarchy_member, "value",
|
143
|
+
(const char *) plcf->autogenerated.custom_error_page.data,
|
144
|
+
plcf->autogenerated.custom_error_page.len);
|
145
|
+
}
|
132
146
|
if (plcf->autogenerated.min_instances_explicitly_set) {
|
133
147
|
find_or_create_manifest_app_and_loc_options_containers(ctx,
|
134
148
|
plcf, cscf, clcf, &app_options_container, &loc_options_container);
|
@@ -61,6 +61,9 @@ passenger_merge_autogenerated_loc_conf(passenger_autogenerated_loc_conf_t *conf,
|
|
61
61
|
ngx_conf_merge_value(conf->friendly_error_pages,
|
62
62
|
prev->friendly_error_pages,
|
63
63
|
NGX_CONF_UNSET);
|
64
|
+
ngx_conf_merge_str_value(conf->custom_error_page,
|
65
|
+
prev->custom_error_page,
|
66
|
+
NULL);
|
64
67
|
ngx_conf_merge_uint_value(conf->min_instances,
|
65
68
|
prev->min_instances,
|
66
69
|
1);
|
@@ -67,6 +67,7 @@ typedef struct {
|
|
67
67
|
ngx_str_t app_root;
|
68
68
|
ngx_str_t app_start_command;
|
69
69
|
ngx_str_t app_type;
|
70
|
+
ngx_str_t custom_error_page;
|
70
71
|
ngx_str_t direct_instance_request_address;
|
71
72
|
ngx_str_t document_root;
|
72
73
|
ngx_str_t environment;
|
@@ -92,6 +93,7 @@ typedef struct {
|
|
92
93
|
ngx_str_t app_type_source_file;
|
93
94
|
ngx_str_t base_uris_source_file;
|
94
95
|
ngx_str_t buffer_upload_source_file;
|
96
|
+
ngx_str_t custom_error_page_source_file;
|
95
97
|
ngx_str_t debugger_source_file;
|
96
98
|
ngx_str_t direct_instance_request_address_source_file;
|
97
99
|
ngx_str_t document_root_source_file;
|
@@ -147,6 +149,7 @@ typedef struct {
|
|
147
149
|
ngx_uint_t app_type_source_line;
|
148
150
|
ngx_uint_t base_uris_source_line;
|
149
151
|
ngx_uint_t buffer_upload_source_line;
|
152
|
+
ngx_uint_t custom_error_page_source_line;
|
150
153
|
ngx_uint_t debugger_source_line;
|
151
154
|
ngx_uint_t direct_instance_request_address_source_line;
|
152
155
|
ngx_uint_t document_root_source_line;
|
@@ -202,6 +205,7 @@ typedef struct {
|
|
202
205
|
ngx_int_t app_type_explicitly_set;
|
203
206
|
ngx_int_t base_uris_explicitly_set;
|
204
207
|
ngx_int_t buffer_upload_explicitly_set;
|
208
|
+
ngx_int_t custom_error_page_explicitly_set;
|
205
209
|
ngx_int_t debugger_explicitly_set;
|
206
210
|
ngx_int_t direct_instance_request_address_explicitly_set;
|
207
211
|
ngx_int_t document_root_explicitly_set;
|
@@ -993,6 +993,7 @@ Init_passenger_native_support() {
|
|
993
993
|
fs_watcher_wait_for_change, 0);
|
994
994
|
rb_define_method(cFileSystemWatcher, "close",
|
995
995
|
fs_watcher_close, 0);
|
996
|
+
rb_undef_alloc_func(cFileSystemWatcher);
|
996
997
|
#endif
|
997
998
|
|
998
999
|
/* The maximum length of a Unix socket path, including terminating null. */
|
@@ -462,6 +462,11 @@ APACHE2_CONFIGURATION_OPTIONS = [
|
|
462
462
|
:dynamic_default => 'On if PassengerAppEnv is development, off otherwise',
|
463
463
|
:desc => 'Whether to display friendly error pages when something goes wrong.'
|
464
464
|
},
|
465
|
+
{
|
466
|
+
:name => 'PassengerCustomErrorPage',
|
467
|
+
:type => :string,
|
468
|
+
:desc => 'Path to html file to use for Passenger generated error pages.'
|
469
|
+
},
|
465
470
|
{
|
466
471
|
:name => 'PassengerRestartDir',
|
467
472
|
:type => :string,
|
@@ -403,6 +403,11 @@ NGINX_CONFIGURATION_OPTIONS = [
|
|
403
403
|
:type => :flag,
|
404
404
|
:dynamic_default => 'On if passenger_app_env is development, off otherwise'
|
405
405
|
},
|
406
|
+
{
|
407
|
+
:name => 'passenger_custom_error_page',
|
408
|
+
:scope => :application,
|
409
|
+
:type => :string
|
410
|
+
},
|
406
411
|
{
|
407
412
|
:name => 'passenger_min_instances',
|
408
413
|
:scope => :application,
|
@@ -13,3 +13,13 @@ define 'rack' do
|
|
13
13
|
end
|
14
14
|
gem_install 'rack'
|
15
15
|
end
|
16
|
+
|
17
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
|
18
|
+
define 'rackup' do
|
19
|
+
name 'rackup'
|
20
|
+
define_checker do
|
21
|
+
check_for_ruby_library('rackup')
|
22
|
+
end
|
23
|
+
gem_install 'rackup'
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
4
|
+
# Copyright (c) 2024 Phusion Holding B.V.
|
5
|
+
#
|
6
|
+
# "Passenger", "Phusion Passenger" and "Union Station" are registered
|
7
|
+
# trademarks of Phusion Holding B.V.
|
8
|
+
#
|
9
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
10
|
+
# of this software and associated documentation files (the "Software"), to deal
|
11
|
+
# in the Software without restriction, including without limitation the rights
|
12
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
# copies of the Software, and to permit persons to whom the Software is
|
14
|
+
# furnished to do so, subject to the following conditions:
|
15
|
+
#
|
16
|
+
# The above copyright notice and this permission notice shall be included in
|
17
|
+
# all copies or substantial portions of the Software.
|
18
|
+
#
|
19
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
20
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
21
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
22
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
23
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
24
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
25
|
+
# THE SOFTWARE.
|
26
|
+
|
27
|
+
module PhusionPassenger
|
28
|
+
module Rack
|
29
|
+
module Handler
|
30
|
+
def run(app, options = {})
|
31
|
+
result = system(ruby_executable, '-S', find_passenger_standalone,
|
32
|
+
'start', *build_args(options))
|
33
|
+
if !result
|
34
|
+
raise "Error starting Passenger"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def environment
|
39
|
+
ENV['RAILS_ENV'] || 'development'
|
40
|
+
end
|
41
|
+
|
42
|
+
def to_s
|
43
|
+
'Passenger application server'
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
def build_args(options)
|
48
|
+
args = ['-e', environment]
|
49
|
+
args << '-p' << options[:Port].to_s if options[:Port]
|
50
|
+
args << '-a' << options[:Host].to_s if options[:Host]
|
51
|
+
args << '-R' << options[:config].to_s if options[:config]
|
52
|
+
args
|
53
|
+
end
|
54
|
+
|
55
|
+
def rb_config
|
56
|
+
if defined?(::RbConfig)
|
57
|
+
::RbConfig::CONFIG
|
58
|
+
else
|
59
|
+
::Config::CONFIG
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def ruby_executable
|
64
|
+
@ruby_executable ||= rb_config['bindir'] + '/' +
|
65
|
+
rb_config['RUBY_INSTALL_NAME'] + rb_config['EXEEXT']
|
66
|
+
end
|
67
|
+
|
68
|
+
def find_passenger_standalone
|
69
|
+
::File.join(::PhusionPassenger.bin_dir, 'passenger')
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
4
|
# Copyright (c) 2016-2017 Phusion Holding B.V.
|
3
5
|
#
|
@@ -30,73 +32,45 @@ begin
|
|
30
32
|
rescue LoadError
|
31
33
|
end
|
32
34
|
require 'phusion_passenger'
|
35
|
+
require_relative 'rack/handler'
|
33
36
|
## Magic comment: end bootstrap ##
|
34
37
|
|
35
38
|
PhusionPassenger.locate_directories
|
36
39
|
|
37
40
|
require 'rbconfig'
|
41
|
+
require 'rackup' if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
|
38
42
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
if !result
|
47
|
-
raise "Error starting Passenger"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def environment
|
52
|
-
ENV['RAILS_ENV'] || 'development'
|
53
|
-
end
|
54
|
-
|
55
|
-
def to_s
|
56
|
-
'Passenger application server'
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
def build_args(options)
|
61
|
-
args = ['-e', environment]
|
62
|
-
if options[:Port]
|
63
|
-
args << '-p'
|
64
|
-
args << options[:Port].to_s
|
65
|
-
end
|
66
|
-
if options[:Host]
|
67
|
-
args << '-a'
|
68
|
-
args << options[:Host].to_s
|
69
|
-
end
|
70
|
-
if options[:config]
|
71
|
-
args << '-R'
|
72
|
-
args << options[:config].to_s
|
73
|
-
end
|
74
|
-
args
|
75
|
-
end
|
76
|
-
|
77
|
-
def rb_config
|
78
|
-
if defined?(::RbConfig)
|
79
|
-
::RbConfig::CONFIG
|
80
|
-
else
|
81
|
-
::Config::CONFIG
|
82
|
-
end
|
43
|
+
# Rackup was removed in Rack 3, it is now a separate gem
|
44
|
+
if Object.const_defined? :Rackup
|
45
|
+
module Rackup
|
46
|
+
module Handler
|
47
|
+
module PhusionPassenger
|
48
|
+
class << self
|
49
|
+
include ::PhusionPassenger::Rack::Handler
|
83
50
|
end
|
51
|
+
end
|
84
52
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
end
|
53
|
+
def self.default(options = {})
|
54
|
+
::Rackup::Handler::PhusionPassenger
|
55
|
+
end
|
89
56
|
|
90
|
-
|
91
|
-
|
57
|
+
register :passenger, PhusionPassenger
|
58
|
+
end
|
59
|
+
end
|
60
|
+
elsif Object.const_defined?(:Rack) && Rack.release < '3'
|
61
|
+
module Rack
|
62
|
+
module Handler
|
63
|
+
module PhusionPassenger
|
64
|
+
class << self
|
65
|
+
include ::PhusionPassenger::Rack::Handler
|
92
66
|
end
|
93
67
|
end
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
def self.default(options = {})
|
99
|
-
Rack::Handler::PhusionPassenger
|
68
|
+
def self.default(options = {})
|
69
|
+
::Rack::Handler::PhusionPassenger
|
70
|
+
end
|
100
71
|
end
|
101
72
|
end
|
73
|
+
::Rack::Handler.register(:passenger, ::Rack::Handler::PhusionPassenger)
|
74
|
+
else
|
75
|
+
raise 'Rack 3 must be used with the Rackup gem'
|
102
76
|
end
|
@@ -281,6 +281,11 @@ module PhusionPassenger
|
|
281
281
|
:type => :boolean,
|
282
282
|
:desc => 'Turn on friendly error pages'
|
283
283
|
},
|
284
|
+
{
|
285
|
+
:name => :custom_error_page,
|
286
|
+
:type => :path,
|
287
|
+
:desc => 'Path to html file to use for Passenger generated error pages'
|
288
|
+
},
|
284
289
|
{
|
285
290
|
:type => :boolean,
|
286
291
|
:cli => '--no-friendly-error-pages',
|
@@ -144,6 +144,7 @@ module PhusionPassenger
|
|
144
144
|
add_param(command, :app_start_command, "--app-start-command")
|
145
145
|
add_param(command, :spawn_method, "--spawn-method")
|
146
146
|
add_param(command, :restart_dir, "--restart-dir")
|
147
|
+
add_param(command, :custom_error_page, "--custom-error-page")
|
147
148
|
if @options.has_key?(:friendly_error_pages)
|
148
149
|
if @options[:friendly_error_pages]
|
149
150
|
command << " --force-friendly-error-pages"
|
@@ -25,7 +25,7 @@
|
|
25
25
|
# gem being available, for example in 'passenger start' before the RuntimeInstaller
|
26
26
|
# has run.
|
27
27
|
|
28
|
-
|
28
|
+
PhusionPassenger.require_passenger_lib 'utils/strscan'
|
29
29
|
require 'forwardable'
|
30
30
|
|
31
31
|
module PhusionPassenger
|
@@ -56,11 +56,10 @@ class JSON
|
|
56
56
|
private :s, :scan, :matched
|
57
57
|
|
58
58
|
def initialize data
|
59
|
-
@scanner = StringScanner.new data.to_s
|
59
|
+
@scanner = PhusionPassenger::Utils::StringScanner.new data.to_s
|
60
60
|
end
|
61
61
|
|
62
62
|
def parse
|
63
|
-
space
|
64
63
|
object
|
65
64
|
end
|
66
65
|
|
@@ -197,199 +196,5 @@ class JSON
|
|
197
196
|
extend Generator
|
198
197
|
end
|
199
198
|
|
200
|
-
if __FILE__ == $0
|
201
|
-
if !$stdin.tty?
|
202
|
-
data = JSON.parse $stdin.read
|
203
|
-
require 'pp'
|
204
|
-
pp data
|
205
|
-
else
|
206
|
-
require 'test/unit'
|
207
|
-
require 'date'
|
208
|
-
class ParserTest < Test::Unit::TestCase
|
209
|
-
PARSED = JSON.parse DATA.read
|
210
|
-
def parsed() PARSED end
|
211
|
-
def parse_string(str) JSON.parse(%(["#{str}"]).gsub('\\\\', '\\')).first end
|
212
|
-
def test_string
|
213
|
-
assert_equal "Pagination library for \"Rails 3\", Sinatra, Merb, DataMapper, and more",
|
214
|
-
parsed['head']['repository']['description']
|
215
|
-
end
|
216
|
-
def test_string_specials
|
217
|
-
assert_equal "\r\n\t\f\b", parse_string('\r\n\t\f\b')
|
218
|
-
assert_equal "aA", parse_string('\u0061\u0041')
|
219
|
-
assert_equal "\e", parse_string('\u001B')
|
220
|
-
assert_equal "xyz", parse_string('\x\y\z')
|
221
|
-
assert_equal '"\\/', parse_string('\"\\\\\\/')
|
222
|
-
assert_equal 'no #{interpolation}', parse_string('no #{interpolation}')
|
223
|
-
end
|
224
|
-
def test_hash
|
225
|
-
assert_equal %w[label ref repository sha user], parsed['head'].keys.sort
|
226
|
-
end
|
227
|
-
def test_number
|
228
|
-
assert_equal 124.3e2, parsed['head']['repository']['size']
|
229
|
-
end
|
230
|
-
def test_bool
|
231
|
-
assert_equal true, parsed['head']['repository']['fork']
|
232
|
-
assert_equal false, parsed['head']['repository']['private']
|
233
|
-
end
|
234
|
-
def test_nil
|
235
|
-
assert_nil parsed['head']['user']['company']
|
236
|
-
end
|
237
|
-
def test_array
|
238
|
-
assert_equal ["4438f", {"a" => "b"}], parsed['head']['sha']
|
239
|
-
end
|
240
|
-
def test_invalid
|
241
|
-
assert_raises(RuntimeError) { JSON.parse %({) }
|
242
|
-
assert_raises(RuntimeError) { JSON.parse %({ "foo": }) }
|
243
|
-
assert_raises(RuntimeError) { JSON.parse %([ "foo": "bar" ]) }
|
244
|
-
assert_raises(RuntimeError) { JSON.parse %([ ~"foo" ]) }
|
245
|
-
assert_raises(RuntimeError) { JSON.parse %([ "foo ]) }
|
246
|
-
assert_raises(RuntimeError) { JSON.parse %([ "foo\\" ]) }
|
247
|
-
assert_raises(RuntimeError) { JSON.parse %([ "foo\\uabGd" ]) }
|
248
|
-
end
|
249
|
-
def test_single_line_comments
|
250
|
-
source = %Q{
|
251
|
-
// comment before document
|
252
|
-
{
|
253
|
-
// comment
|
254
|
-
"foo": "1",
|
255
|
-
"bar": "2",
|
256
|
-
// another comment
|
257
|
-
"baz": "3",
|
258
|
-
"array": [
|
259
|
-
// comment inside array
|
260
|
-
1, 2, 3
|
261
|
-
// comment at end of array
|
262
|
-
]
|
263
|
-
// comment at end of hash
|
264
|
-
}
|
265
|
-
// comment after document
|
266
|
-
}
|
267
|
-
doc = { "foo" => "1", "bar" => "2", "baz" => "3", "array" => [1, 2, 3] }
|
268
|
-
assert_equal(doc, JSON.parse(source))
|
269
|
-
end
|
270
|
-
def test_multi_line_comments
|
271
|
-
source = %Q{
|
272
|
-
/* comment before
|
273
|
-
* document */
|
274
|
-
{
|
275
|
-
/* comment */
|
276
|
-
"foo": "1",
|
277
|
-
"bar": "2",
|
278
|
-
/* another
|
279
|
-
comment
|
280
|
-
*/
|
281
|
-
"baz": "3",
|
282
|
-
"array": [
|
283
|
-
/* comment inside array */
|
284
|
-
1, 2, 3,
|
285
|
-
4, /* comment inside an array */ 5,
|
286
|
-
/*
|
287
|
-
// "nested" comments
|
288
|
-
{ "faux json": "inside comment" }
|
289
|
-
*/
|
290
|
-
6, 7
|
291
|
-
/**
|
292
|
-
* comment at end of array
|
293
|
-
*/
|
294
|
-
]
|
295
|
-
/**************************
|
296
|
-
comment at end of hash
|
297
|
-
**************************/
|
298
|
-
}
|
299
|
-
/* comment after
|
300
|
-
document */
|
301
|
-
}
|
302
|
-
doc = { "foo" => "1", "bar" => "2", "baz" => "3", "array" => [1, 2, 3, 4, 5, 6, 7] }
|
303
|
-
assert_equal(doc, JSON.parse(source))
|
304
|
-
end
|
305
|
-
end
|
306
|
-
|
307
|
-
class GeneratorTest < Test::Unit::TestCase
|
308
|
-
def generate(obj) JSON.generate(obj) end
|
309
|
-
def test_array
|
310
|
-
assert_equal %([1, 2, 3]), generate([1, 2, 3])
|
311
|
-
end
|
312
|
-
def test_bool
|
313
|
-
assert_equal %([true, false]), generate([true, false])
|
314
|
-
end
|
315
|
-
def test_null
|
316
|
-
assert_equal %([null]), generate([nil])
|
317
|
-
end
|
318
|
-
def test_string
|
319
|
-
assert_equal %(["abc\\n123"]), generate(["abc\n123"])
|
320
|
-
end
|
321
|
-
def test_string_unicode
|
322
|
-
assert_equal %(["ć\\"č\\nž\\tš\\\\đ"]), generate(["ć\"č\nž\tš\\đ"])
|
323
|
-
end
|
324
|
-
def test_time
|
325
|
-
time = Time.utc(2012, 04, 19, 1, 2, 3)
|
326
|
-
assert_equal %(["2012-04-19 01:02:03 UTC"]), generate([time])
|
327
|
-
end
|
328
|
-
def test_date
|
329
|
-
time = Date.new(2012, 04, 19)
|
330
|
-
assert_equal %(["2012-04-19"]), generate([time])
|
331
|
-
end
|
332
|
-
def test_symbol
|
333
|
-
assert_equal %(["abc"]), generate([:abc])
|
334
|
-
end
|
335
|
-
def test_hash
|
336
|
-
json = generate(:abc => 123, 123 => 'abc')
|
337
|
-
assert_match /^\{/, json
|
338
|
-
assert_match /\}$/, json
|
339
|
-
assert_equal [%("123": "abc"), %("abc": 123)], json[1...-1].split(', ').sort
|
340
|
-
end
|
341
|
-
def test_nested_structure
|
342
|
-
json = generate(:hash => {1=>2}, :array => [1,2])
|
343
|
-
assert json.include?(%("hash": {"1": 2}))
|
344
|
-
assert json.include?(%("array": [1, 2]))
|
345
|
-
end
|
346
|
-
def test_invalid_json
|
347
|
-
assert_raises(ArgumentError) { generate("abc") }
|
348
|
-
end
|
349
|
-
def test_invalid_object
|
350
|
-
err = assert_raises(ArgumentError) { generate("a" => Object.new) }
|
351
|
-
assert_equal "can't serialize Object", err.message
|
352
|
-
end
|
353
|
-
end
|
354
|
-
end
|
355
|
-
end
|
356
|
-
|
357
199
|
end # module Utils
|
358
200
|
end # module PhusionPassenger
|
359
|
-
|
360
|
-
__END__
|
361
|
-
{
|
362
|
-
"head": {
|
363
|
-
"ref": "master",
|
364
|
-
"repository": {
|
365
|
-
"forks": 0,
|
366
|
-
"integrate_branch": "rails3",
|
367
|
-
"watchers": 1,
|
368
|
-
"language": "Ruby",
|
369
|
-
"description": "Pagination library for \"Rails 3\", Sinatra, Merb, DataMapper, and more",
|
370
|
-
"has_downloads": true,
|
371
|
-
"fork": true,
|
372
|
-
"created_at": "2011/10/24 03:20:48 -0700",
|
373
|
-
"homepage": "http://github.com/mislav/will_paginate/wikis",
|
374
|
-
"size": 124.3e2,
|
375
|
-
"private": false,
|
376
|
-
"has_wiki": true,
|
377
|
-
"name": "will_paginate",
|
378
|
-
"owner": "dbackeus",
|
379
|
-
"url": "https://github.com/dbackeus/will_paginate",
|
380
|
-
"has_issues": false,
|
381
|
-
"open_issues": 0,
|
382
|
-
"pushed_at": "2011/10/25 05:44:05 -0700"
|
383
|
-
},
|
384
|
-
"label": "dbackeus:master",
|
385
|
-
"sha": ["4438f", { "a" : "b" }],
|
386
|
-
"user": {
|
387
|
-
"name": "David Backeus",
|
388
|
-
"company": null,
|
389
|
-
"gravatar_id": "ebe96524f5db9e92188f0542dc9d1d1a",
|
390
|
-
"location": "Stockholm (Sweden)",
|
391
|
-
"type": "User",
|
392
|
-
"login": "dbackeus"
|
393
|
-
}
|
394
|
-
}
|
395
|
-
}
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
# Copyright (c) 2024 Phusion Holding B.V.
|
4
|
+
#
|
5
|
+
# "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
|
+
# trademarks of Phusion Holding B.V.
|
7
|
+
#
|
8
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
# of this software and associated documentation files (the "Software"), to deal
|
10
|
+
# in the Software without restriction, including without limitation the rights
|
11
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
# copies of the Software, and to permit persons to whom the Software is
|
13
|
+
# furnished to do so, subject to the following conditions:
|
14
|
+
#
|
15
|
+
# The above copyright notice and this permission notice shall be included in
|
16
|
+
# all copies or substantial portions of the Software.
|
17
|
+
#
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
|
+
# THE SOFTWARE.
|
25
|
+
|
26
|
+
module PhusionPassenger
|
27
|
+
module Utils
|
28
|
+
|
29
|
+
# A minimal pure-Ruby StringScanner implementation so that
|
30
|
+
# PhusionPassenger::Utils::JSON doesn't have to depend on the 'strscan' gem.
|
31
|
+
class StringScanner
|
32
|
+
attr_reader :pos, :matched
|
33
|
+
|
34
|
+
def initialize(data)
|
35
|
+
@data = data
|
36
|
+
@pos = 0
|
37
|
+
@matched = nil
|
38
|
+
end
|
39
|
+
|
40
|
+
def getch
|
41
|
+
@matched =
|
42
|
+
if @pos < @data.size
|
43
|
+
@pos += 1
|
44
|
+
@data[@pos - 1]
|
45
|
+
else
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def scan(pattern)
|
51
|
+
md = @data[@pos .. -1].match(/\A#{pattern}/)
|
52
|
+
@matched =
|
53
|
+
if md
|
54
|
+
@pos += md[0].size
|
55
|
+
@matched = md[0]
|
56
|
+
else
|
57
|
+
nil
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def reset
|
62
|
+
@pos = 0
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
end # module Utils
|
67
|
+
end # module PhusionPassenger
|
@@ -31,16 +31,16 @@ module PhusionPassenger
|
|
31
31
|
|
32
32
|
PACKAGE_NAME = 'passenger'
|
33
33
|
# Run 'rake src/cxx_supportlib/Constants.h configkit_schemas_inline_comments' after changing this number.
|
34
|
-
VERSION_STRING = '6.0.
|
34
|
+
VERSION_STRING = '6.0.23'
|
35
35
|
|
36
36
|
# Tip: find the SHA-256 with ./dev/nginx_version_sha256 <VERSION>
|
37
|
-
PREFERRED_NGINX_VERSION = '1.26.
|
38
|
-
NGINX_SHA256_CHECKSUM = '
|
37
|
+
PREFERRED_NGINX_VERSION = '1.26.1'
|
38
|
+
NGINX_SHA256_CHECKSUM = 'f9187468ff2eb159260bfd53867c25ff8e334726237acf227b9e870e53d3e36b'
|
39
39
|
|
40
40
|
# Packaging may be locked to an older version due to the specific module configuration being
|
41
41
|
# incompatible with the version we prefer (latest stable).
|
42
|
-
PACKAGING_PREFERRED_NGINX_VERSION = '1.26.
|
43
|
-
PACKAGING_NGINX_SHA256_CHECKSUM = '
|
42
|
+
PACKAGING_PREFERRED_NGINX_VERSION = '1.26.1'
|
43
|
+
PACKAGING_NGINX_SHA256_CHECKSUM = 'f9187468ff2eb159260bfd53867c25ff8e334726237acf227b9e870e53d3e36b'
|
44
44
|
|
45
45
|
# sha256sum of the .tar.gz
|
46
46
|
PREFERRED_PCRE_VERSION = '10.39'
|