passenger 5.0.28 → 5.0.29
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.
- checksums.yaml +4 -4
- data/.editorconfig +5 -0
- data/CHANGELOG +13 -0
- data/build/apache2.rb +3 -3
- data/build/common_library.rb +3 -3
- data/build/nginx.rb +4 -4
- data/build/packaging.rb +9 -8
- data/build/support/cxx_dependency_map.rb +9 -7
- data/build/support/general.rb +39 -0
- data/build/support/vendor/cxxcodebuilder/CxxCodeBuilder.sublime-project +8 -0
- data/build/support/vendor/cxxcodebuilder/Gemfile +4 -0
- data/build/support/vendor/cxxcodebuilder/Gemfile.lock +28 -0
- data/build/support/vendor/cxxcodebuilder/LICENSE.md +19 -0
- data/build/support/vendor/cxxcodebuilder/README.md +98 -0
- data/build/support/vendor/cxxcodebuilder/Rakefile +4 -0
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder.rb +23 -0
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/builder.rb +574 -0
- data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/initializer_builder.rb +166 -0
- data/build/test_basics.rb +2 -1
- data/resources/templates/standalone/server.erb +6 -4
- data/src/agent/Core/Controller/ForwardResponse.cpp +5 -5
- data/src/agent/Watchdog/WatchdogMain.cpp +0 -10
- data/src/apache2_module/ConfigurationCommands.cpp +181 -248
- data/src/apache2_module/ConfigurationCommands.cpp.cxxcodebuilder +127 -0
- data/src/apache2_module/ConfigurationFields.hpp +135 -51
- data/src/apache2_module/ConfigurationFields.hpp.cxxcodebuilder +113 -0
- data/src/apache2_module/ConfigurationSetters.cpp +414 -459
- data/src/apache2_module/ConfigurationSetters.cpp.cxxcodebuilder +144 -0
- data/src/apache2_module/CreateDirConfig.cpp +49 -52
- data/src/apache2_module/CreateDirConfig.cpp.cxxcodebuilder +81 -0
- data/src/apache2_module/Hooks.cpp +0 -14
- data/src/apache2_module/MergeDirConfig.cpp +136 -226
- data/src/apache2_module/MergeDirConfig.cpp.cxxcodebuilder +97 -0
- data/src/apache2_module/SetHeaders.cpp +92 -143
- data/src/apache2_module/SetHeaders.cpp.cxxcodebuilder +106 -0
- data/src/cxx_supportlib/Constants.h +86 -146
- data/src/cxx_supportlib/Constants.h.cxxcodebuilder +43 -0
- data/src/cxx_supportlib/DataStructures/LString.h +40 -23
- data/src/cxx_supportlib/MemoryKit/mbuf.cpp +60 -25
- data/src/cxx_supportlib/MemoryKit/mbuf.h +50 -25
- data/src/cxx_supportlib/ServerKit/CookieUtils.h +36 -3
- data/src/cxx_supportlib/ServerKit/HeaderTable.h +2 -8
- data/src/cxx_supportlib/ServerKit/HttpServer.h +6 -15
- data/src/cxx_supportlib/WatchdogLauncher.cpp +4 -4
- data/src/cxx_supportlib/WatchdogLauncher.h +2 -3
- data/src/nginx_module/CacheLocationConfig.c +623 -780
- data/src/nginx_module/CacheLocationConfig.c.cxxcodebuilder +214 -0
- data/src/nginx_module/Configuration.h +1 -1
- data/src/nginx_module/ConfigurationCommands.c +404 -535
- data/src/nginx_module/ConfigurationCommands.c.cxxcodebuilder +157 -0
- data/src/nginx_module/CreateLocationConfig.c +82 -206
- data/src/nginx_module/CreateLocationConfig.c.cxxcodebuilder +98 -0
- data/src/nginx_module/LocationConfig.h +97 -0
- data/src/nginx_module/LocationConfig.h.cxxcodebuilder +131 -0
- data/src/nginx_module/MergeLocationConfig.c +157 -278
- data/src/nginx_module/MergeLocationConfig.c.cxxcodebuilder +144 -0
- data/src/nginx_module/ngx_http_passenger_module.c +4 -10
- data/src/ruby_supportlib/phusion_passenger.rb +4 -4
- data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +2 -2
- data/src/ruby_supportlib/phusion_passenger/packaging.rb +2 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +6 -0
- data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +27 -8
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +120 -2
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/spawn.rb +4 -4
- data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/version.rb +1 -1
- data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +5 -5
- metadata +24 -15
- data/src/apache2_module/ConfigurationCommands.cpp.erb +0 -109
- data/src/apache2_module/ConfigurationFields.hpp.erb +0 -98
- data/src/apache2_module/ConfigurationSetters.cpp.erb +0 -128
- data/src/apache2_module/CreateDirConfig.cpp.erb +0 -72
- data/src/apache2_module/MergeDirConfig.cpp.erb +0 -82
- data/src/apache2_module/SetHeaders.cpp.erb +0 -91
- data/src/cxx_supportlib/Constants.h.erb +0 -41
- data/src/nginx_module/CacheLocationConfig.c.erb +0 -171
- data/src/nginx_module/ConfigurationCommands.c.erb +0 -144
- data/src/nginx_module/ConfigurationFields.h +0 -145
- data/src/nginx_module/ConfigurationFields.h.erb +0 -112
- data/src/nginx_module/CreateLocationConfig.c.erb +0 -78
- data/src/nginx_module/MergeLocationConfig.c.erb +0 -118
@@ -1,144 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2010-2015 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
|
-
|
27
|
-
/*
|
28
|
-
* ConfigurationCommands.c is automatically generated from ConfigurationCommands.c.erb,
|
29
|
-
* using definitions from src/ruby_supportlib/phusion_passenger/nginx/config_options.rb.
|
30
|
-
* Edits to ConfigurationCommands.c will be lost.
|
31
|
-
*
|
32
|
-
* To update ConfigurationCommands.c:
|
33
|
-
* rake nginx
|
34
|
-
*
|
35
|
-
* To force regeneration of ConfigurationCommands.c:
|
36
|
-
* rm -f src/nginx_module/ConfigurationCommands.c
|
37
|
-
* rake src/nginx_module/ConfigurationCommands.c
|
38
|
-
*/
|
39
|
-
|
40
|
-
<%
|
41
|
-
require 'phusion_passenger/nginx/config_options'
|
42
|
-
|
43
|
-
def resolve_possible_alias(option)
|
44
|
-
if option[:alias_for]
|
45
|
-
the_alias = LOCATION_CONFIGURATION_OPTIONS.find do |o|
|
46
|
-
o[:name] == option[:alias_for]
|
47
|
-
end.dup
|
48
|
-
the_alias[:aliased_for] = option[:name]
|
49
|
-
return the_alias
|
50
|
-
else
|
51
|
-
return option
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def name_for(option)
|
56
|
-
return (option[:aliased_for] || option[:name]).inspect
|
57
|
-
end
|
58
|
-
|
59
|
-
def context_for(option)
|
60
|
-
context = option.fetch(:context, [:main, :srv, :loc, :lif])
|
61
|
-
return context.map{ |c| "NGX_HTTP_#{c.to_s.upcase}_CONF" }.join(" | ")
|
62
|
-
end
|
63
|
-
|
64
|
-
def take_type_for(option)
|
65
|
-
return option[:take] if option[:take]
|
66
|
-
|
67
|
-
case option[:type]
|
68
|
-
when :string, :integer, :uinteger, :string_array
|
69
|
-
return "NGX_CONF_TAKE1"
|
70
|
-
when :flag
|
71
|
-
return "NGX_CONF_FLAG"
|
72
|
-
when :string_keyval
|
73
|
-
return "NGX_CONF_TAKE2"
|
74
|
-
else
|
75
|
-
raise "Unknown type #{option[:type].inspect} for option #{option[:name]}"
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
def setter_function_for(option)
|
80
|
-
return option[:function] if option[:function]
|
81
|
-
|
82
|
-
case option[:type]
|
83
|
-
when :string
|
84
|
-
return "ngx_conf_set_str_slot"
|
85
|
-
when :integer, :uinteger
|
86
|
-
return "ngx_conf_set_num_slot"
|
87
|
-
when :flag
|
88
|
-
return "ngx_conf_set_flag_slot"
|
89
|
-
when :string_array
|
90
|
-
return "ngx_conf_set_str_array_slot"
|
91
|
-
when :string_keyval
|
92
|
-
return "ngx_conf_set_keyval_slot"
|
93
|
-
when :path
|
94
|
-
return "ngx_conf_set_path_slot"
|
95
|
-
else
|
96
|
-
raise "Unknown type #{option[:type].inspect} for option #{option[:name]}"
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
def struct_for(option)
|
101
|
-
option[:struct] || "NGX_HTTP_LOC_CONF_OFFSET"
|
102
|
-
end
|
103
|
-
|
104
|
-
def struct_type_for(option)
|
105
|
-
case struct_for(option)
|
106
|
-
when "NGX_HTTP_LOC_CONF_OFFSET"
|
107
|
-
return "passenger_loc_conf_t"
|
108
|
-
when "NGX_HTTP_MAIN_CONF_OFFSET"
|
109
|
-
return "passenger_main_conf_t"
|
110
|
-
else
|
111
|
-
raise "Unknown struct #{struct_for(option).inspect}"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def struct_field_for(option)
|
116
|
-
if option.has_key?(:field)
|
117
|
-
if field = option[:field]
|
118
|
-
return "offsetof(#{struct_type_for(option)}, #{field})"
|
119
|
-
else
|
120
|
-
return "0"
|
121
|
-
end
|
122
|
-
else
|
123
|
-
field = option[:name].sub(/^passenger_/, '')
|
124
|
-
return "offsetof(#{struct_type_for(option)}, #{field})"
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
def post_for(option)
|
129
|
-
return option[:post] if option[:post]
|
130
|
-
return "NULL"
|
131
|
-
end
|
132
|
-
%>
|
133
|
-
|
134
|
-
<% for option in LOCATION_CONFIGURATION_OPTIONS %>
|
135
|
-
{
|
136
|
-
<% option = resolve_possible_alias(option) %>
|
137
|
-
ngx_string(<%= name_for(option) %>),
|
138
|
-
<%= context_for(option) %> | <%= take_type_for(option) %>,
|
139
|
-
<%= setter_function_for(option) %>,
|
140
|
-
<%= struct_for(option) %>,
|
141
|
-
<%= struct_field_for(option) %>,
|
142
|
-
<%= post_for(option) %>
|
143
|
-
},
|
144
|
-
<% end %>
|
@@ -1,145 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2010-2015 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
|
-
|
27
|
-
/*
|
28
|
-
* ConfigurationFields.h is automatically generated from ConfigurationFields.h.erb,
|
29
|
-
* using definitions from src/ruby_supportlib/phusion_passenger/nginx/config_options.rb.
|
30
|
-
* Edits to ConfigurationFields.h will be lost.
|
31
|
-
*
|
32
|
-
* To update ConfigurationFields.h:
|
33
|
-
* rake nginx
|
34
|
-
*
|
35
|
-
* To force regeneration of ConfigurationFields.h:
|
36
|
-
* rm -f src/nginx_module/ConfigurationFields.h
|
37
|
-
* rake src/nginx_module/ConfigurationFields.h
|
38
|
-
*/
|
39
|
-
|
40
|
-
typedef struct {
|
41
|
-
ngx_http_upstream_conf_t upstream_config;
|
42
|
-
ngx_array_t *flushes;
|
43
|
-
ngx_array_t *headers_set_len;
|
44
|
-
ngx_array_t *headers_set;
|
45
|
-
ngx_hash_t headers_set_hash;
|
46
|
-
|
47
|
-
/** Raw HTTP header data for this location are cached here. */
|
48
|
-
ngx_str_t options_cache;
|
49
|
-
ngx_str_t env_vars_cache;
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
ngx_int_t abort_websockets_on_process_shutdown;
|
55
|
-
|
56
|
-
ngx_uint_t app_file_descriptor_ulimit;
|
57
|
-
|
58
|
-
ngx_array_t *base_uris;
|
59
|
-
|
60
|
-
ngx_uint_t core_file_descriptor_ulimit;
|
61
|
-
|
62
|
-
ngx_int_t debugger;
|
63
|
-
|
64
|
-
ngx_int_t enabled;
|
65
|
-
|
66
|
-
ngx_array_t *env_vars;
|
67
|
-
|
68
|
-
ngx_int_t force_max_concurrent_requests_per_process;
|
69
|
-
|
70
|
-
ngx_int_t friendly_error_pages;
|
71
|
-
|
72
|
-
ngx_uint_t headers_hash_bucket_size;
|
73
|
-
|
74
|
-
ngx_uint_t headers_hash_max_size;
|
75
|
-
|
76
|
-
ngx_array_t *headers_source;
|
77
|
-
|
78
|
-
ngx_int_t load_shell_envvars;
|
79
|
-
|
80
|
-
ngx_int_t max_instances_per_app;
|
81
|
-
|
82
|
-
ngx_int_t max_preloader_idle_time;
|
83
|
-
|
84
|
-
ngx_int_t max_request_queue_size;
|
85
|
-
|
86
|
-
ngx_int_t max_requests;
|
87
|
-
|
88
|
-
ngx_int_t min_instances;
|
89
|
-
|
90
|
-
ngx_int_t request_queue_overflow_status_code;
|
91
|
-
|
92
|
-
ngx_int_t socket_backlog;
|
93
|
-
|
94
|
-
ngx_int_t start_timeout;
|
95
|
-
|
96
|
-
ngx_int_t sticky_sessions;
|
97
|
-
|
98
|
-
ngx_array_t *union_station_filters;
|
99
|
-
|
100
|
-
ngx_int_t union_station_support;
|
101
|
-
|
102
|
-
ngx_str_t app_group_name;
|
103
|
-
|
104
|
-
ngx_str_t app_rights;
|
105
|
-
|
106
|
-
ngx_str_t app_root;
|
107
|
-
|
108
|
-
ngx_str_t app_type;
|
109
|
-
|
110
|
-
ngx_str_t document_root;
|
111
|
-
|
112
|
-
ngx_str_t environment;
|
113
|
-
|
114
|
-
ngx_str_t group;
|
115
|
-
|
116
|
-
ngx_str_t meteor_app_settings;
|
117
|
-
|
118
|
-
ngx_str_t nodejs;
|
119
|
-
|
120
|
-
ngx_str_t python;
|
121
|
-
|
122
|
-
ngx_str_t restart_dir;
|
123
|
-
|
124
|
-
ngx_str_t ruby;
|
125
|
-
|
126
|
-
ngx_str_t spawn_method;
|
127
|
-
|
128
|
-
ngx_str_t startup_file;
|
129
|
-
|
130
|
-
ngx_str_t sticky_sessions_cookie_name;
|
131
|
-
|
132
|
-
ngx_str_t union_station_key;
|
133
|
-
|
134
|
-
ngx_str_t user;
|
135
|
-
|
136
|
-
ngx_str_t vary_turbocache_by_cookie;
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
#if (NGX_HTTP_CACHE)
|
141
|
-
ngx_http_complex_value_t cache_key;
|
142
|
-
#endif
|
143
|
-
|
144
|
-
/************************************/
|
145
|
-
} passenger_loc_conf_t;
|
@@ -1,112 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2010-2015 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
|
-
|
27
|
-
/*
|
28
|
-
* ConfigurationFields.h is automatically generated from ConfigurationFields.h.erb,
|
29
|
-
* using definitions from src/ruby_supportlib/phusion_passenger/nginx/config_options.rb.
|
30
|
-
* Edits to ConfigurationFields.h will be lost.
|
31
|
-
*
|
32
|
-
* To update ConfigurationFields.h:
|
33
|
-
* rake nginx
|
34
|
-
*
|
35
|
-
* To force regeneration of ConfigurationFields.h:
|
36
|
-
* rm -f src/nginx_module/ConfigurationFields.h
|
37
|
-
* rake src/nginx_module/ConfigurationFields.h
|
38
|
-
*/
|
39
|
-
|
40
|
-
typedef struct {
|
41
|
-
ngx_http_upstream_conf_t upstream_config;
|
42
|
-
ngx_array_t *flushes;
|
43
|
-
ngx_array_t *headers_set_len;
|
44
|
-
ngx_array_t *headers_set;
|
45
|
-
ngx_hash_t headers_set_hash;
|
46
|
-
|
47
|
-
/** Raw HTTP header data for this location are cached here. */
|
48
|
-
ngx_str_t options_cache;
|
49
|
-
ngx_str_t env_vars_cache;
|
50
|
-
|
51
|
-
<%
|
52
|
-
require 'phusion_passenger/nginx/config_options'
|
53
|
-
|
54
|
-
def filter_eligible_options(options)
|
55
|
-
return options.reject do |option|
|
56
|
-
option[:alias_for] ||
|
57
|
-
option.fetch(:field, true).nil? ||
|
58
|
-
option[:field].to_s =~ /\./
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def struct_field_for(option)
|
63
|
-
if option.has_key?(:field)
|
64
|
-
return option[:field].to_s
|
65
|
-
else
|
66
|
-
return option[:name].sub(/^passenger_/, '')
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
# Returns [definition_source, estimated_size_on_x86_64, field_name]
|
71
|
-
def definition_for(option)
|
72
|
-
field = struct_field_for(option)
|
73
|
-
case option[:type]
|
74
|
-
when :string
|
75
|
-
return ["ngx_str_t #{field}", 8 + 4, field]
|
76
|
-
when :integer, :flag
|
77
|
-
return ["ngx_int_t #{field}", 8, field]
|
78
|
-
when :uinteger
|
79
|
-
return ["ngx_uint_t #{field}", 8, field]
|
80
|
-
when :string_array, :string_keyval
|
81
|
-
return ["ngx_array_t *#{field}", 8, field];
|
82
|
-
else
|
83
|
-
raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}"
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
eligible_options = filter_eligible_options(LOCATION_CONFIGURATION_OPTIONS)
|
88
|
-
definitions = eligible_options.map { |o| definition_for(o) }
|
89
|
-
# Sort the definitions by size in order to make the struct smaller.
|
90
|
-
# It's possible to make it even smaller with a smarter algorithm but for now
|
91
|
-
# I don't bother.
|
92
|
-
definitions.sort! do |d1, d2|
|
93
|
-
if d1[1] == d2[1]
|
94
|
-
# After sorting on size, sort alphabetically.
|
95
|
-
d1[2] <=> d2[2]
|
96
|
-
else
|
97
|
-
d1[1] <=> d2[1]
|
98
|
-
end
|
99
|
-
end
|
100
|
-
%>
|
101
|
-
|
102
|
-
<% for definition in definitions %>
|
103
|
-
<%= definition[0] %>;
|
104
|
-
<% end %>
|
105
|
-
|
106
|
-
|
107
|
-
#if (NGX_HTTP_CACHE)
|
108
|
-
ngx_http_complex_value_t cache_key;
|
109
|
-
#endif
|
110
|
-
|
111
|
-
/************************************/
|
112
|
-
} passenger_loc_conf_t;
|
@@ -1,78 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
-
* Copyright (c) 2010-2015 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
|
-
|
27
|
-
/*
|
28
|
-
* CreateLocationConfig.c is automatically generated from CreateLocationConfig.c.erb,
|
29
|
-
* using definitions from src/ruby_supportlib/phusion_passenger/nginx/config_options.rb.
|
30
|
-
* Edits to CreateLocationConfig.c will be lost.
|
31
|
-
*
|
32
|
-
* To update CreateLocationConfig.c:
|
33
|
-
* rake nginx
|
34
|
-
*
|
35
|
-
* To force regeneration of CreateLocationConfig.c:
|
36
|
-
* rm -f src/nginx_module/CreateLocationConfig.c
|
37
|
-
* rake src/nginx_module/CreateLocationConfig.c
|
38
|
-
*/
|
39
|
-
|
40
|
-
void generated_set_conf_part(passenger_loc_conf_t *conf) {
|
41
|
-
<%
|
42
|
-
require 'phusion_passenger/nginx/config_options'
|
43
|
-
|
44
|
-
def filter_eligible_options(options)
|
45
|
-
return options.reject do |option|
|
46
|
-
option[:alias_for] ||
|
47
|
-
option.fetch(:field, true).nil? ||
|
48
|
-
option[:field].to_s =~ /\./ ||
|
49
|
-
option[:auto_generate_nginx_create_code] == false
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
def struct_field_for(option)
|
54
|
-
if option.has_key?(:field)
|
55
|
-
return option[:field]
|
56
|
-
else
|
57
|
-
return option[:name].sub(/^passenger_/, '')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
%>
|
61
|
-
|
62
|
-
<% for option in filter_eligible_options(LOCATION_CONFIGURATION_OPTIONS) %>
|
63
|
-
<% if option[:type] == :string %>
|
64
|
-
conf-><%= struct_field_for(option) %>.data = NULL;
|
65
|
-
conf-><%= struct_field_for(option) %>.len = 0;
|
66
|
-
<% elsif option[:type] == :integer || option[:type] == :flag %>
|
67
|
-
conf-><%= struct_field_for(option) %> = NGX_CONF_UNSET;
|
68
|
-
<% elsif option[:type] == :uinteger %>
|
69
|
-
conf-><%= struct_field_for(option) %> = NGX_CONF_UNSET_UINT;
|
70
|
-
<% elsif option[:type] == :string_array %>
|
71
|
-
conf-><%= struct_field_for(option) %> = NGX_CONF_UNSET_PTR;
|
72
|
-
<% elsif option[:type] == :string_keyval %>
|
73
|
-
conf-><%= struct_field_for(option) %> = NULL;
|
74
|
-
<% else %>
|
75
|
-
<% raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}" %>
|
76
|
-
<% end %>
|
77
|
-
<% end %>
|
78
|
-
}
|