passenger 4.0.14 → 4.0.16
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.
- data.tar.gz.asc +7 -7
- data/NEWS +69 -0
- data/bin/passenger-install-apache2-module +7 -1
- data/bin/passenger-install-nginx-module +18 -1
- data/build/apache2.rb +25 -1
- data/build/basics.rb +7 -4
- data/build/debian.rb +72 -25
- data/build/nginx.rb +24 -0
- data/build/packaging.rb +45 -3
- data/debian.template/{control → control.template} +17 -8
- data/debian.template/ruby-passenger.install.template +1 -0
- data/debian.template/rules.template +9 -3
- data/dev/run_travis.sh +14 -0
- data/doc/Users guide Apache.idmap.txt +64 -48
- data/doc/Users guide Apache.txt +127 -93
- data/doc/Users guide Nginx.idmap.txt +46 -28
- data/doc/Users guide Nginx.txt +100 -12
- data/doc/images/{conservative_spawning.png → direct_spawning.png} +0 -0
- data/doc/images/{conservative_spawning.svg → direct_spawning.svg} +0 -0
- data/doc/users_guide_snippets/installation.txt +107 -66
- data/doc/users_guide_snippets/passenger_spawn_method.txt +1 -1
- data/doc/users_guide_snippets/rvm_helper_tool.txt +0 -12
- data/doc/users_guide_snippets/tips.txt +70 -3
- data/doc/users_guide_snippets/under_the_hood/page_caching_support.txt +2 -0
- data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +114 -0
- data/ext/apache2/Configuration.cpp +53 -101
- data/ext/apache2/Configuration.hpp +19 -41
- data/ext/apache2/ConfigurationCommands.cpp +95 -0
- data/ext/apache2/ConfigurationCommands.cpp.erb +91 -0
- data/ext/apache2/ConfigurationFields.hpp +59 -0
- data/ext/apache2/ConfigurationFields.hpp.erb +89 -0
- data/ext/apache2/ConfigurationSetters.cpp +223 -0
- data/ext/apache2/ConfigurationSetters.cpp.erb +126 -0
- data/ext/apache2/CreateDirConfig.cpp +50 -0
- data/ext/apache2/CreateDirConfig.cpp.erb +71 -0
- data/ext/apache2/Hooks.cpp +6 -0
- data/ext/apache2/MergeDirConfig.cpp +103 -0
- data/ext/apache2/MergeDirConfig.cpp.erb +81 -0
- data/ext/common/ApplicationPool2/AppTypes.cpp +2 -0
- data/ext/common/ApplicationPool2/AppTypes.h +2 -0
- data/ext/common/ApplicationPool2/Common.h +1 -1
- data/ext/common/ApplicationPool2/Group.h +56 -7
- data/ext/common/ApplicationPool2/Implementation.cpp +133 -31
- data/ext/common/ApplicationPool2/Options.h +23 -2
- data/ext/common/ApplicationPool2/Pool.h +8 -1
- data/ext/common/ApplicationPool2/Process.h +9 -0
- data/ext/common/ApplicationPool2/Session.h +1 -0
- data/ext/common/ApplicationPool2/Spawner.h +21 -19
- data/ext/common/ApplicationPool2/SuperGroup.h +1 -1
- data/ext/common/Constants.h +21 -17
- data/ext/common/Constants.h.erb +1 -1
- data/ext/common/Exceptions.h +19 -0
- data/ext/common/ServerInstanceDir.h +8 -4
- data/ext/common/Utils.cpp +33 -1
- data/ext/common/Utils.h +14 -0
- data/ext/common/Utils/StrIntUtils.cpp +16 -0
- data/ext/common/Utils/StrIntUtils.h +5 -0
- data/ext/common/agents/HelperAgent/Main.cpp +5 -5
- data/ext/common/agents/HelperAgent/RequestHandler.h +94 -45
- data/ext/common/agents/LoggingAgent/Main.cpp +10 -26
- data/ext/common/agents/Watchdog/Main.cpp +4 -15
- data/ext/nginx/CacheLocationConfig.c +501 -0
- data/ext/nginx/CacheLocationConfig.c.erb +140 -0
- data/ext/nginx/Configuration.c +29 -453
- data/ext/nginx/Configuration.h +3 -21
- data/ext/nginx/ConfigurationCommands.c +501 -0
- data/ext/nginx/ConfigurationCommands.c.erb +136 -0
- data/ext/nginx/ConfigurationFields.h +89 -0
- data/ext/nginx/ConfigurationFields.h.erb +85 -0
- data/ext/nginx/ContentHandler.c +3 -166
- data/ext/nginx/CreateLocationConfig.c +146 -0
- data/ext/nginx/CreateLocationConfig.c.erb +70 -0
- data/ext/nginx/MergeLocationConfig.c +166 -0
- data/ext/nginx/MergeLocationConfig.c.erb +72 -0
- data/ext/nginx/config +4 -0
- data/ext/oxt/detail/tracable_exception_disabled.hpp +21 -1
- data/ext/oxt/detail/tracable_exception_enabled.hpp +4 -1
- data/ext/oxt/implementation.cpp +7 -1
- data/ext/oxt/macros.hpp +9 -7
- data/helper-scripts/backtrace-sanitizer.rb +23 -0
- data/helper-scripts/classic-rails-loader.rb +23 -0
- data/helper-scripts/classic-rails-preloader.rb +23 -0
- data/helper-scripts/download_binaries/extconf.rb +10 -5
- data/helper-scripts/meteor-loader.rb +127 -0
- data/helper-scripts/node-loader.js +1 -1
- data/helper-scripts/rack-preloader.rb +23 -0
- data/helper-scripts/system-memory-stats.py +22 -0
- data/helper-scripts/touch-dir.sh +48 -0
- data/lib/phusion_passenger.rb +1 -1
- data/lib/phusion_passenger/apache2/config_options.rb +104 -0
- data/lib/phusion_passenger/constants.rb +8 -0
- data/lib/phusion_passenger/native_support.rb +9 -1
- data/lib/phusion_passenger/nginx/config_options.rb +328 -0
- data/lib/phusion_passenger/packaging.rb +2 -2
- data/lib/phusion_passenger/platform_info/apache.rb +8 -0
- data/lib/phusion_passenger/platform_info/compiler.rb +2 -2
- data/lib/phusion_passenger/rails3_extensions/init.rb +19 -4
- data/lib/phusion_passenger/ruby_core_enhancements.rb +4 -1
- data/lib/phusion_passenger/standalone/app_finder.rb +3 -2
- data/lib/phusion_passenger/standalone/command.rb +1 -0
- data/lib/phusion_passenger/standalone/runtime_installer.rb +1 -6
- data/lib/phusion_passenger/standalone/runtime_locator.rb +9 -2
- data/lib/phusion_passenger/standalone/start_command.rb +45 -9
- data/lib/phusion_passenger/utils.rb +4 -1
- data/resources/templates/{nginx → installer_common}/run_installer_as_root.txt.erb +3 -1
- data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +6 -0
- data/resources/templates/standalone/config.erb +8 -8
- data/test/cxx/ApplicationPool2/PoolTest.cpp +120 -3
- data/test/cxx/RequestHandlerTest.cpp +66 -3
- data/test/integration_tests/native_packaging_spec.rb +41 -0
- data/test/integration_tests/nginx_tests.rb +1 -0
- data/test/integration_tests/standalone_tests.rb +4 -0
- data/test/ruby/shared/rails/analytics_logging_extensions_sharedspec.rb +22 -0
- data/test/stub/rails3.0/config/initializers/passenger.rb +2 -1
- data/test/stub/rails3.1/config/initializers/passenger.rb +2 -1
- data/test/stub/rails3.2/config/initializers/passenger.rb +2 -1
- data/test/stub/rails4.0/config/initializers/passenger.rb +5 -1
- data/test/stub/wsgi/passenger_wsgi.py +5 -0
- metadata +32 -7
- metadata.gz.asc +7 -7
- data/resources/templates/apache2/run_installer_as_root.txt.erb +0 -8
@@ -0,0 +1,136 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
* Copyright (c) 2010-2013 Phusion
|
4
|
+
*
|
5
|
+
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
|
+
*
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
13
|
+
*
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
15
|
+
* all copies or substantial portions of the Software.
|
16
|
+
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
* THE SOFTWARE.
|
24
|
+
*/
|
25
|
+
|
26
|
+
/*
|
27
|
+
* ConfigurationCommands.c is automatically generated from ConfigurationCommands.c.erb,
|
28
|
+
* using definitions from lib/phusion_passenger/nginx/config_options.rb.
|
29
|
+
* Edits to ConfigurationCommands.c will be lost.
|
30
|
+
*
|
31
|
+
* To update ConfigurationCommands.c:
|
32
|
+
* rake nginx
|
33
|
+
*
|
34
|
+
* To force regeneration of ConfigurationCommands.c:
|
35
|
+
* rm -f ext/nginx/ConfigurationCommands.c
|
36
|
+
* rake ext/nginx/ConfigurationCommands.c
|
37
|
+
*/
|
38
|
+
|
39
|
+
<%
|
40
|
+
require 'phusion_passenger/nginx/config_options'
|
41
|
+
|
42
|
+
def resolve_possible_alias(option)
|
43
|
+
if option[:alias_for]
|
44
|
+
the_alias = LOCATION_CONFIGURATION_OPTIONS.find do |o|
|
45
|
+
o[:name] == option[:alias_for]
|
46
|
+
end.dup
|
47
|
+
the_alias[:aliased_for] = option[:name]
|
48
|
+
return the_alias
|
49
|
+
else
|
50
|
+
return option
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def name_for(option)
|
55
|
+
return (option[:aliased_for] || option[:name]).inspect
|
56
|
+
end
|
57
|
+
|
58
|
+
def context_for(option)
|
59
|
+
context = option.fetch(:context, [:main, :srv, :loc, :lif])
|
60
|
+
return context.map{ |c| "NGX_HTTP_#{c.upcase}_CONF" }.join(" | ")
|
61
|
+
end
|
62
|
+
|
63
|
+
def take_type_for(option)
|
64
|
+
return option[:take] if option[:take]
|
65
|
+
|
66
|
+
case option[:type]
|
67
|
+
when :string, :integer, :string_array
|
68
|
+
return "NGX_CONF_TAKE1"
|
69
|
+
when :flag
|
70
|
+
return "NGX_CONF_FLAG"
|
71
|
+
when :string_keyval
|
72
|
+
return "NGX_CONF_TAKE2"
|
73
|
+
else
|
74
|
+
raise "Unknown type #{option[:type].inspect} for option #{option[:name]}"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def setter_function_for(option)
|
79
|
+
return option[:function] if option[:function]
|
80
|
+
|
81
|
+
case option[:type]
|
82
|
+
when :string
|
83
|
+
return "ngx_conf_set_str_slot"
|
84
|
+
when :integer
|
85
|
+
return "ngx_conf_set_num_slot"
|
86
|
+
when :flag
|
87
|
+
return "ngx_conf_set_flag_slot"
|
88
|
+
when :string_array
|
89
|
+
return "ngx_conf_set_str_array_slot"
|
90
|
+
when :string_keyval
|
91
|
+
return "set_null_terminated_keyval_slot"
|
92
|
+
else
|
93
|
+
raise "Unknown type #{option[:type].inspect} for option #{option[:name]}"
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def struct_for(option)
|
98
|
+
option[:struct] || "NGX_HTTP_LOC_CONF_OFFSET"
|
99
|
+
end
|
100
|
+
|
101
|
+
def struct_type_for(option)
|
102
|
+
case struct_for(option)
|
103
|
+
when "NGX_HTTP_LOC_CONF_OFFSET"
|
104
|
+
return "passenger_loc_conf_t"
|
105
|
+
when "NGX_HTTP_MAIN_CONF_OFFSET"
|
106
|
+
return "passenger_main_conf_t"
|
107
|
+
else
|
108
|
+
raise "Unknown struct #{struct_for(option).inspect}"
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def struct_field_for(option)
|
113
|
+
if option.has_key?(:field)
|
114
|
+
if field = option[:field]
|
115
|
+
return "offsetof(#{struct_type_for(option)}, #{field})"
|
116
|
+
else
|
117
|
+
return "0"
|
118
|
+
end
|
119
|
+
else
|
120
|
+
field = option[:name].sub(/^passenger_/, '')
|
121
|
+
return "offsetof(#{struct_type_for(option)}, #{field})"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
%>
|
125
|
+
|
126
|
+
<% for option in LOCATION_CONFIGURATION_OPTIONS %>
|
127
|
+
{
|
128
|
+
<% option = resolve_possible_alias(option) %>
|
129
|
+
ngx_string(<%= name_for(option) %>),
|
130
|
+
<%= context_for(option) %> | <%= take_type_for(option) %>,
|
131
|
+
<%= setter_function_for(option) %>,
|
132
|
+
<%= struct_for(option) %>,
|
133
|
+
<%= struct_field_for(option) %>,
|
134
|
+
NULL
|
135
|
+
},
|
136
|
+
<% end %>
|
@@ -0,0 +1,89 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
* Copyright (c) 2010-2013 Phusion
|
4
|
+
*
|
5
|
+
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
|
+
*
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
13
|
+
*
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
15
|
+
* all copies or substantial portions of the Software.
|
16
|
+
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
* THE SOFTWARE.
|
24
|
+
*/
|
25
|
+
|
26
|
+
/*
|
27
|
+
* ConfigurationFields.h is automatically generated from ConfigurationFields.h.erb,
|
28
|
+
* using definitions from lib/phusion_passenger/nginx/config_options.rb.
|
29
|
+
* Edits to ConfigurationFields.h will be lost.
|
30
|
+
*
|
31
|
+
* To update ConfigurationFields.h:
|
32
|
+
* rake nginx
|
33
|
+
*
|
34
|
+
* To force regeneration of ConfigurationFields.h:
|
35
|
+
* rm -f ext/nginx/ConfigurationFields.h
|
36
|
+
* rake ext/nginx/ConfigurationFields.h
|
37
|
+
*/
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
ngx_int_t enabled;
|
43
|
+
|
44
|
+
ngx_int_t max_request_queue_size;
|
45
|
+
|
46
|
+
ngx_array_t *vars_source;
|
47
|
+
|
48
|
+
ngx_int_t max_preloader_idle_time;
|
49
|
+
|
50
|
+
ngx_int_t friendly_error_pages;
|
51
|
+
|
52
|
+
ngx_int_t min_instances;
|
53
|
+
|
54
|
+
ngx_int_t max_requests;
|
55
|
+
|
56
|
+
ngx_int_t start_timeout;
|
57
|
+
|
58
|
+
ngx_array_t *base_uris;
|
59
|
+
|
60
|
+
ngx_int_t show_version_in_header;
|
61
|
+
|
62
|
+
ngx_int_t debugger;
|
63
|
+
|
64
|
+
ngx_array_t *union_station_filters;
|
65
|
+
|
66
|
+
ngx_int_t union_station_support;
|
67
|
+
|
68
|
+
ngx_int_t request_queue_overflow_status_code;
|
69
|
+
|
70
|
+
ngx_str_t app_rights;
|
71
|
+
|
72
|
+
ngx_str_t app_group_name;
|
73
|
+
|
74
|
+
ngx_str_t group;
|
75
|
+
|
76
|
+
ngx_str_t user;
|
77
|
+
|
78
|
+
ngx_str_t environment;
|
79
|
+
|
80
|
+
ngx_str_t python;
|
81
|
+
|
82
|
+
ngx_str_t spawn_method;
|
83
|
+
|
84
|
+
ngx_str_t union_station_key;
|
85
|
+
|
86
|
+
ngx_str_t ruby;
|
87
|
+
|
88
|
+
ngx_str_t app_root;
|
89
|
+
|
@@ -0,0 +1,85 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
* Copyright (c) 2010-2013 Phusion
|
4
|
+
*
|
5
|
+
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
|
+
*
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
13
|
+
*
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
15
|
+
* all copies or substantial portions of the Software.
|
16
|
+
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
* THE SOFTWARE.
|
24
|
+
*/
|
25
|
+
|
26
|
+
/*
|
27
|
+
* ConfigurationFields.h is automatically generated from ConfigurationFields.h.erb,
|
28
|
+
* using definitions from lib/phusion_passenger/nginx/config_options.rb.
|
29
|
+
* Edits to ConfigurationFields.h will be lost.
|
30
|
+
*
|
31
|
+
* To update ConfigurationFields.h:
|
32
|
+
* rake nginx
|
33
|
+
*
|
34
|
+
* To force regeneration of ConfigurationFields.h:
|
35
|
+
* rm -f ext/nginx/ConfigurationFields.h
|
36
|
+
* rake ext/nginx/ConfigurationFields.h
|
37
|
+
*/
|
38
|
+
|
39
|
+
<%
|
40
|
+
require 'phusion_passenger/nginx/config_options'
|
41
|
+
|
42
|
+
def filter_eligible_options(options)
|
43
|
+
return options.reject do |option|
|
44
|
+
option[:alias_for] ||
|
45
|
+
option.fetch(:field, true).nil? ||
|
46
|
+
option[:field].to_s =~ /\./
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def struct_field_for(option)
|
51
|
+
if option.has_key?(:field)
|
52
|
+
return option[:field]
|
53
|
+
else
|
54
|
+
return option[:name].sub(/^passenger_/, '')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Returns [definition_source, estimated_size_on_x86_64]
|
59
|
+
def definition_for(option)
|
60
|
+
field = struct_field_for(option)
|
61
|
+
case option[:type]
|
62
|
+
when :string
|
63
|
+
return ["ngx_str_t #{field}", 8 + 4]
|
64
|
+
when :integer, :flag
|
65
|
+
return ["ngx_int_t #{field}", 8]
|
66
|
+
when :string_array, :string_keyval
|
67
|
+
return ["ngx_array_t *#{field}", 8];
|
68
|
+
else
|
69
|
+
raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
eligible_options = filter_eligible_options(LOCATION_CONFIGURATION_OPTIONS)
|
74
|
+
definitions = eligible_options.map { |o| definition_for(o) }
|
75
|
+
# Sort the definitions by size in order to make the struct smaller.
|
76
|
+
# It's possible to make it even smaller with a smarter algorithm but for now
|
77
|
+
# I don't bother.
|
78
|
+
definitions.sort! do |d1, d2|
|
79
|
+
d1[1] <=> d2[1]
|
80
|
+
end
|
81
|
+
%>
|
82
|
+
|
83
|
+
<% for definition in definitions %>
|
84
|
+
<%= definition[0] %>;
|
85
|
+
<% end %>
|
data/ext/nginx/ContentHandler.c
CHANGED
@@ -275,63 +275,6 @@ fix_peer_address(ngx_http_request_t *r) {
|
|
275
275
|
}
|
276
276
|
|
277
277
|
|
278
|
-
/* Convenience macros for building the SCGI header in create_request(). */
|
279
|
-
|
280
|
-
#define ANALYZE_BOOLEAN_CONFIG_LENGTH(name, container, config_field) \
|
281
|
-
do { \
|
282
|
-
if (container->config_field) { \
|
283
|
-
len += sizeof(name) + sizeof("true"); \
|
284
|
-
} else { \
|
285
|
-
len += sizeof(name) + sizeof("false"); \
|
286
|
-
} \
|
287
|
-
} while (0)
|
288
|
-
|
289
|
-
#define SERIALIZE_BOOLEAN_CONFIG_DATA(name, container, config_field) \
|
290
|
-
do { \
|
291
|
-
b->last = ngx_copy(b->last, name, sizeof(name)); \
|
292
|
-
if (container->config_field) { \
|
293
|
-
b->last = ngx_copy(b->last, "true", sizeof("true")); \
|
294
|
-
} else { \
|
295
|
-
b->last = ngx_copy(b->last, "false", sizeof("false")); \
|
296
|
-
} \
|
297
|
-
} while (0)
|
298
|
-
|
299
|
-
#define PREPARE_INT_CONFIG_DATA(name, container, config_field) \
|
300
|
-
do { \
|
301
|
-
end = ngx_snprintf(config_field ## _string, \
|
302
|
-
sizeof(config_field ## _string) - 1, \
|
303
|
-
"%d", \
|
304
|
-
container->config_field); \
|
305
|
-
*end = '\0'; \
|
306
|
-
len += sizeof(name) + (end - config_field ## _string) + 1; \
|
307
|
-
} while (0)
|
308
|
-
|
309
|
-
#define SERIALIZE_INT_CONFIG_DATA(name, container, config_field) \
|
310
|
-
do { \
|
311
|
-
b->last = ngx_copy(b->last, name, sizeof(name)); \
|
312
|
-
b->last = ngx_copy(b->last, config_field ## _string, \
|
313
|
-
ngx_strlen(config_field ## _string) + 1); \
|
314
|
-
} while (0)
|
315
|
-
|
316
|
-
#define ANALYZE_STR_CONFIG_LENGTH(name, container, config_field) \
|
317
|
-
do { \
|
318
|
-
if (container->config_field.data != NULL) { \
|
319
|
-
len += sizeof(name) + (container->config_field.len) + 1; \
|
320
|
-
} \
|
321
|
-
} while (0)
|
322
|
-
|
323
|
-
#define SERIALIZE_STR_CONFIG_DATA(name, container, config_field) \
|
324
|
-
do { \
|
325
|
-
if (container->config_field.data != NULL) { \
|
326
|
-
b->last = ngx_copy(b->last, name, sizeof(name)); \
|
327
|
-
b->last = ngx_copy(b->last, container->config_field.data, \
|
328
|
-
container->config_field.len); \
|
329
|
-
*b->last = '\0'; \
|
330
|
-
b->last++; \
|
331
|
-
} \
|
332
|
-
} while (0)
|
333
|
-
|
334
|
-
|
335
278
|
#if (NGX_HTTP_CACHE)
|
336
279
|
|
337
280
|
static ngx_int_t
|
@@ -370,10 +313,6 @@ create_request(ngx_http_request_t *r)
|
|
370
313
|
int server_name_len;
|
371
314
|
ngx_str_t escaped_uri;
|
372
315
|
ngx_str_t *union_station_filters = NULL;
|
373
|
-
u_char min_instances_string[12];
|
374
|
-
u_char max_requests_string[12];
|
375
|
-
u_char max_preloader_idle_time_string[12];
|
376
|
-
u_char *end;
|
377
316
|
void *tmp;
|
378
317
|
ngx_uint_t i, n;
|
379
318
|
ngx_buf_t *b;
|
@@ -471,55 +410,10 @@ create_request(ngx_http_request_t *r)
|
|
471
410
|
#endif
|
472
411
|
|
473
412
|
/* Lengths of Passenger application pool options. */
|
474
|
-
|
475
|
-
|
476
|
-
ANALYZE_BOOLEAN_CONFIG_LENGTH("UNION_STATION_SUPPORT",
|
477
|
-
slcf, union_station_support);
|
478
|
-
ANALYZE_BOOLEAN_CONFIG_LENGTH("PASSENGER_DEBUGGER",
|
479
|
-
slcf, debugger);
|
480
|
-
ANALYZE_BOOLEAN_CONFIG_LENGTH("PASSENGER_SHOW_VERSION_IN_HEADER",
|
481
|
-
slcf, show_version_in_header);
|
482
|
-
if (slcf->ruby.data != NULL) {
|
483
|
-
ANALYZE_STR_CONFIG_LENGTH("PASSENGER_RUBY", slcf, ruby);
|
484
|
-
} else {
|
485
|
-
len += sizeof("PASSENGER_RUBY") + passenger_main_conf.default_ruby.len + 1;
|
486
|
-
}
|
487
|
-
ANALYZE_STR_CONFIG_LENGTH("PASSENGER_PYTHON", slcf, python);
|
488
|
-
len += sizeof("PASSENGER_ENV") + slcf->environment.len + 1;
|
489
|
-
len += sizeof("PASSENGER_SPAWN_METHOD") + slcf->spawn_method.len + 1;
|
413
|
+
len += slcf->options_cache.len;
|
414
|
+
|
490
415
|
len += sizeof("PASSENGER_APP_TYPE") + app_type_string_len;
|
491
|
-
ANALYZE_STR_CONFIG_LENGTH("PASSENGER_APP_GROUP_NAME", slcf, app_group_name);
|
492
|
-
ANALYZE_STR_CONFIG_LENGTH("PASSENGER_APP_ROOT", slcf, app_root);
|
493
|
-
ANALYZE_STR_CONFIG_LENGTH("PASSENGER_APP_RIGHTS", slcf, app_rights);
|
494
|
-
ANALYZE_STR_CONFIG_LENGTH("PASSENGER_USER", slcf, user);
|
495
|
-
ANALYZE_STR_CONFIG_LENGTH("PASSENGER_GROUP", slcf, group);
|
496
|
-
ANALYZE_STR_CONFIG_LENGTH("UNION_STATION_KEY", slcf, union_station_key);
|
497
|
-
|
498
|
-
end = ngx_snprintf(min_instances_string,
|
499
|
-
sizeof(min_instances_string) - 1,
|
500
|
-
"%d",
|
501
|
-
(slcf->min_instances == (ngx_int_t) -1) ? 1 : slcf->min_instances);
|
502
|
-
*end = '\0';
|
503
|
-
len += sizeof("PASSENGER_MIN_INSTANCES") +
|
504
|
-
ngx_strlen(min_instances_string) + 1;
|
505
416
|
|
506
|
-
end = ngx_snprintf(max_requests_string,
|
507
|
-
sizeof(max_requests_string) - 1,
|
508
|
-
"%d",
|
509
|
-
(slcf->max_requests == (ngx_int_t) -1) ? 0 : slcf->max_requests);
|
510
|
-
*end = '\0';
|
511
|
-
len += sizeof("PASSENGER_MAX_REQUESTS") +
|
512
|
-
ngx_strlen(max_requests_string) + 1;
|
513
|
-
|
514
|
-
end = ngx_snprintf(max_preloader_idle_time_string,
|
515
|
-
sizeof(max_preloader_idle_time_string) - 1,
|
516
|
-
"%d",
|
517
|
-
(slcf->max_preloader_idle_time == (ngx_int_t) -1) ?
|
518
|
-
-1 : slcf->max_preloader_idle_time);
|
519
|
-
*end = '\0';
|
520
|
-
len += sizeof("PASSENGER_MAX_PRELOADER_IDLE_TIME") +
|
521
|
-
ngx_strlen(max_preloader_idle_time_string) + 1;
|
522
|
-
|
523
417
|
if (slcf->union_station_filters != NGX_CONF_UNSET_PTR && slcf->union_station_filters->nelts > 0) {
|
524
418
|
len += sizeof("UNION_STATION_FILTERS");
|
525
419
|
|
@@ -690,69 +584,12 @@ create_request(ngx_http_request_t *r)
|
|
690
584
|
|
691
585
|
|
692
586
|
/* Build Passenger application pool option headers. */
|
693
|
-
|
694
|
-
slcf, friendly_error_pages);
|
695
|
-
SERIALIZE_BOOLEAN_CONFIG_DATA("UNION_STATION_SUPPORT",
|
696
|
-
slcf, union_station_support);
|
697
|
-
SERIALIZE_BOOLEAN_CONFIG_DATA("PASSENGER_DEBUGGER",
|
698
|
-
slcf, debugger);
|
699
|
-
SERIALIZE_BOOLEAN_CONFIG_DATA("PASSENGER_SHOW_VERSION_IN_HEADER",
|
700
|
-
slcf, show_version_in_header);
|
701
|
-
|
702
|
-
if (slcf->ruby.data != NULL) {
|
703
|
-
SERIALIZE_STR_CONFIG_DATA("PASSENGER_RUBY",
|
704
|
-
slcf, ruby);
|
705
|
-
} else {
|
706
|
-
b->last = ngx_copy(b->last, "PASSENGER_RUBY",
|
707
|
-
sizeof("PASSENGER_RUBY"));
|
708
|
-
b->last = ngx_copy(b->last, passenger_main_conf.default_ruby.data,
|
709
|
-
passenger_main_conf.default_ruby.len + 1);
|
710
|
-
}
|
711
|
-
SERIALIZE_STR_CONFIG_DATA("PASSENGER_PYTHON",
|
712
|
-
slcf, python);
|
713
|
-
|
714
|
-
b->last = ngx_copy(b->last, "PASSENGER_ENV",
|
715
|
-
sizeof("PASSENGER_ENV"));
|
716
|
-
b->last = ngx_copy(b->last, slcf->environment.data,
|
717
|
-
slcf->environment.len + 1);
|
718
|
-
|
719
|
-
b->last = ngx_copy(b->last, "PASSENGER_SPAWN_METHOD",
|
720
|
-
sizeof("PASSENGER_SPAWN_METHOD"));
|
721
|
-
b->last = ngx_copy(b->last, slcf->spawn_method.data,
|
722
|
-
slcf->spawn_method.len + 1);
|
723
|
-
|
724
|
-
SERIALIZE_STR_CONFIG_DATA("PASSENGER_APP_GROUP_NAME",
|
725
|
-
slcf, app_group_name);
|
726
|
-
SERIALIZE_STR_CONFIG_DATA("PASSENGER_APP_ROOT",
|
727
|
-
slcf, app_root);
|
728
|
-
SERIALIZE_STR_CONFIG_DATA("PASSENGER_APP_RIGHTS",
|
729
|
-
slcf, app_rights);
|
730
|
-
SERIALIZE_STR_CONFIG_DATA("PASSENGER_USER",
|
731
|
-
slcf, user);
|
732
|
-
SERIALIZE_STR_CONFIG_DATA("PASSENGER_GROUP",
|
733
|
-
slcf, group);
|
734
|
-
SERIALIZE_STR_CONFIG_DATA("UNION_STATION_KEY",
|
735
|
-
slcf, union_station_key);
|
587
|
+
b->last = ngx_copy(b->last, slcf->options_cache.data, slcf->options_cache.len);
|
736
588
|
|
737
589
|
b->last = ngx_copy(b->last, "PASSENGER_APP_TYPE",
|
738
590
|
sizeof("PASSENGER_APP_TYPE"));
|
739
591
|
b->last = ngx_copy(b->last, app_type_string, app_type_string_len);
|
740
592
|
|
741
|
-
b->last = ngx_copy(b->last, "PASSENGER_MIN_INSTANCES",
|
742
|
-
sizeof("PASSENGER_MIN_INSTANCES"));
|
743
|
-
b->last = ngx_copy(b->last, min_instances_string,
|
744
|
-
ngx_strlen(min_instances_string) + 1);
|
745
|
-
|
746
|
-
b->last = ngx_copy(b->last, "PASSENGER_MAX_REQUESTS",
|
747
|
-
sizeof("PASSENGER_MAX_REQUESTS"));
|
748
|
-
b->last = ngx_copy(b->last, max_requests_string,
|
749
|
-
ngx_strlen(max_requests_string) + 1);
|
750
|
-
|
751
|
-
b->last = ngx_copy(b->last, "PASSENGER_MAX_PRELOADER_IDLE_TIME",
|
752
|
-
sizeof("PASSENGER_MAX_PRELOADER_IDLE_TIME"));
|
753
|
-
b->last = ngx_copy(b->last, max_preloader_idle_time_string,
|
754
|
-
ngx_strlen(max_preloader_idle_time_string) + 1);
|
755
|
-
|
756
593
|
if (slcf->union_station_filters != NGX_CONF_UNSET_PTR && slcf->union_station_filters->nelts > 0) {
|
757
594
|
b->last = ngx_copy(b->last, "UNION_STATION_FILTERS",
|
758
595
|
sizeof("UNION_STATION_FILTERS"));
|