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
@@ -0,0 +1,127 @@
|
|
1
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
|
+
# Copyright (c) 2010-2016 Phusion Holding B.V.
|
3
|
+
#
|
4
|
+
# "Passenger", "Phusion Passenger" and "Union Station" are registered
|
5
|
+
# trademarks of Phusion Holding B.V.
|
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
|
+
# This file uses the cxxcodebuilder API. Learn more at:
|
26
|
+
# https://github.com/phusion/passenger/cxxcodebuilder
|
27
|
+
|
28
|
+
require 'phusion_passenger/apache2/config_options'
|
29
|
+
|
30
|
+
def main
|
31
|
+
comment copyright_header_for(__FILE__)
|
32
|
+
|
33
|
+
separator
|
34
|
+
|
35
|
+
comment %q{
|
36
|
+
ConfigurationCommands.cpp is automatically generated from ConfigurationCommands.cpp.cxxcodebuilder,
|
37
|
+
using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
|
38
|
+
Edits to ConfigurationCommands.cpp will be lost.
|
39
|
+
|
40
|
+
To update ConfigurationCommands.cpp:
|
41
|
+
rake apache2
|
42
|
+
|
43
|
+
To force regeneration of ConfigurationCommands.cpp:
|
44
|
+
rm -f src/apache2_module/ConfigurationCommands.cpp
|
45
|
+
rake src/apache2_module/ConfigurationCommands.cpp
|
46
|
+
}
|
47
|
+
|
48
|
+
separator
|
49
|
+
|
50
|
+
APACHE2_DIRECTORY_CONFIGURATION_OPTIONS.each do |option|
|
51
|
+
option = resolve_possible_alias(option)
|
52
|
+
format =
|
53
|
+
"%s(%s,\n" \
|
54
|
+
"\t(%s) %s,\n" \
|
55
|
+
"\tNULL,\n" \
|
56
|
+
"\t%s,\n" \
|
57
|
+
"\t%s),\n"
|
58
|
+
code = sprintf(format,
|
59
|
+
macro_for(option),
|
60
|
+
name_for(option),
|
61
|
+
function_type_for(option),
|
62
|
+
function_for(option),
|
63
|
+
context_for(option),
|
64
|
+
description_for(option))
|
65
|
+
add_code(code)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def resolve_possible_alias(option)
|
70
|
+
if option[:alias_for]
|
71
|
+
the_alias = APACHE2_DIRECTORY_CONFIGURATION_OPTIONS.find do |o|
|
72
|
+
o[:name] == option[:alias_for]
|
73
|
+
end.dup
|
74
|
+
the_alias[:aliased_for] = option[:name]
|
75
|
+
the_alias
|
76
|
+
else
|
77
|
+
option
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def macro_for(option)
|
82
|
+
case option[:type]
|
83
|
+
when :string, :integer
|
84
|
+
"AP_INIT_TAKE1"
|
85
|
+
when :flag
|
86
|
+
"AP_INIT_FLAG"
|
87
|
+
else
|
88
|
+
raise "Unknown type #{option[:type].inspect} for option #{option[:name].inspect}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def name_for(option)
|
93
|
+
str_val(option[:aliased_for] || option[:name])
|
94
|
+
end
|
95
|
+
|
96
|
+
def function_type_for(option)
|
97
|
+
case option[:type]
|
98
|
+
when :string, :integer
|
99
|
+
"Take1Func"
|
100
|
+
when :flag
|
101
|
+
"FlagFunc"
|
102
|
+
else
|
103
|
+
raise "Unknown type #{option[:type].inspect}"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def function_for(option)
|
108
|
+
if option[:function]
|
109
|
+
option[:function]
|
110
|
+
else
|
111
|
+
function_name = option[:name].gsub(/[A-Z]/) do |letter|
|
112
|
+
"_" + letter[0..0].downcase
|
113
|
+
end
|
114
|
+
"cmd#{function_name}"
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def context_for(option)
|
119
|
+
context = option[:context] || ["OR_OPTIONS", "ACCESS_CONF", "RSRC_CONF"]
|
120
|
+
context.join(" | ")
|
121
|
+
end
|
122
|
+
|
123
|
+
def description_for(option)
|
124
|
+
option[:desc].inspect
|
125
|
+
end
|
126
|
+
|
127
|
+
main
|
@@ -1,31 +1,31 @@
|
|
1
1
|
/*
|
2
|
-
*
|
3
|
-
*
|
2
|
+
* Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
* Copyright (c) 2010-2016 Phusion Holding B.V.
|
4
4
|
*
|
5
|
-
*
|
6
|
-
*
|
5
|
+
* "Passenger", "Phusion Passenger" and "Union Station" are registered
|
6
|
+
* trademarks of Phusion Holding B.V.
|
7
7
|
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
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
14
|
*
|
15
|
-
*
|
16
|
-
*
|
15
|
+
* The above copyright notice and this permission notice shall be included in
|
16
|
+
* all copies or substantial portions of the Software.
|
17
17
|
*
|
18
|
-
*
|
19
|
-
*
|
20
|
-
*
|
21
|
-
*
|
22
|
-
*
|
23
|
-
*
|
24
|
-
*
|
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
25
|
*/
|
26
26
|
|
27
27
|
/*
|
28
|
-
* ConfigurationFields.hpp is automatically generated from ConfigurationFields.hpp.
|
28
|
+
* ConfigurationFields.hpp is automatically generated from ConfigurationFields.hpp.cxxcodebuilder,
|
29
29
|
* using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
|
30
30
|
* Edits to ConfigurationFields.hpp will be lost.
|
31
31
|
*
|
@@ -40,64 +40,148 @@
|
|
40
40
|
struct GeneratedDirConfigPart {
|
41
41
|
enum Threeway { ENABLED, DISABLED, UNSET };
|
42
42
|
|
43
|
-
|
44
|
-
|
43
|
+
/*
|
44
|
+
* Whether to buffer file uploads.
|
45
|
+
*/
|
45
46
|
Threeway bufferUpload;
|
46
|
-
|
47
|
+
|
48
|
+
/*
|
49
|
+
* Enable or disable Phusion Passenger.
|
50
|
+
*/
|
47
51
|
Threeway enabled;
|
48
|
-
|
52
|
+
|
53
|
+
/*
|
54
|
+
* Allow Apache to handle error response.
|
55
|
+
*/
|
49
56
|
Threeway errorOverride;
|
50
|
-
|
57
|
+
|
58
|
+
/*
|
59
|
+
* Whether to display friendly error pages when something goes wrong.
|
60
|
+
*/
|
51
61
|
Threeway friendlyErrorPages;
|
52
|
-
|
62
|
+
|
63
|
+
/*
|
64
|
+
* Enable or disable Passenger's high performance mode.
|
65
|
+
*/
|
53
66
|
Threeway highPerformance;
|
54
|
-
|
67
|
+
|
68
|
+
/*
|
69
|
+
* Whether to load environment variables from the shell before running the application.
|
70
|
+
*/
|
55
71
|
Threeway loadShellEnvvars;
|
56
|
-
|
72
|
+
|
73
|
+
/*
|
74
|
+
* Whether to show the Phusion Passenger version number in the X-Powered-By header.
|
75
|
+
*/
|
57
76
|
Threeway showVersionInHeader;
|
58
|
-
|
77
|
+
|
78
|
+
/*
|
79
|
+
* Whether to enable sticky sessions.
|
80
|
+
*/
|
59
81
|
Threeway stickySessions;
|
60
|
-
|
82
|
+
|
83
|
+
/*
|
84
|
+
* The cookie name to use for sticky sessions.
|
85
|
+
*/
|
61
86
|
Threeway stickySessionsCookieName;
|
62
|
-
|
87
|
+
|
88
|
+
/*
|
89
|
+
* Force Passenger to believe that an application process can handle the given number of concurrent requests per process
|
90
|
+
*/
|
63
91
|
int forceMaxConcurrentRequestsPerProcess;
|
64
|
-
|
92
|
+
|
93
|
+
/*
|
94
|
+
* Minimum user id starting from which entering LVE and CageFS is allowed.
|
95
|
+
*/
|
65
96
|
int lveMinUid;
|
66
|
-
|
97
|
+
|
98
|
+
/*
|
99
|
+
* The maximum number of simultaneously alive application instances a single application may occupy.
|
100
|
+
*/
|
67
101
|
int maxInstancesPerApp;
|
68
|
-
|
102
|
+
|
103
|
+
/*
|
104
|
+
* The maximum number of seconds that a preloader process may be idle before it is shutdown.
|
105
|
+
*/
|
69
106
|
int maxPreloaderIdleTime;
|
70
|
-
|
107
|
+
|
108
|
+
/*
|
109
|
+
* The maximum number of queued requests.
|
110
|
+
*/
|
71
111
|
int maxRequestQueueSize;
|
72
|
-
|
112
|
+
|
113
|
+
/*
|
114
|
+
* The maximum number of requests that an application instance may process.
|
115
|
+
*/
|
73
116
|
int maxRequests;
|
74
|
-
|
117
|
+
|
118
|
+
/*
|
119
|
+
* The minimum number of application instances to keep when cleaning idle instances.
|
120
|
+
*/
|
75
121
|
int minInstances;
|
76
|
-
|
122
|
+
|
123
|
+
/*
|
124
|
+
* A timeout for application startup.
|
125
|
+
*/
|
77
126
|
int startTimeout;
|
78
|
-
|
127
|
+
|
128
|
+
/*
|
129
|
+
* The environment under which applications are run.
|
130
|
+
*/
|
79
131
|
const char *appEnv;
|
80
|
-
|
132
|
+
|
133
|
+
/*
|
134
|
+
* Application process group name.
|
135
|
+
*/
|
81
136
|
const char *appGroupName;
|
82
|
-
|
137
|
+
|
138
|
+
/*
|
139
|
+
* Force specific application type.
|
140
|
+
*/
|
83
141
|
const char *appType;
|
84
|
-
|
142
|
+
|
143
|
+
/*
|
144
|
+
* The group that Ruby applications must run as.
|
145
|
+
*/
|
85
146
|
const char *group;
|
86
|
-
|
147
|
+
|
148
|
+
/*
|
149
|
+
* Settings file for (non-bundled) Meteor apps.
|
150
|
+
*/
|
87
151
|
const char *meteorAppSettings;
|
88
|
-
|
152
|
+
|
153
|
+
/*
|
154
|
+
* The Node.js command to use.
|
155
|
+
*/
|
89
156
|
const char *nodejs;
|
90
|
-
|
157
|
+
|
158
|
+
/*
|
159
|
+
* The Python interpreter to use.
|
160
|
+
*/
|
91
161
|
const char *python;
|
92
|
-
|
162
|
+
|
163
|
+
/*
|
164
|
+
* The directory in which Passenger should look for restart.txt.
|
165
|
+
*/
|
93
166
|
const char *restartDir;
|
94
|
-
|
167
|
+
|
168
|
+
/*
|
169
|
+
* The Ruby interpreter to use.
|
170
|
+
*/
|
95
171
|
const char *ruby;
|
96
|
-
|
172
|
+
|
173
|
+
/*
|
174
|
+
* The spawn method to use.
|
175
|
+
*/
|
97
176
|
const char *spawnMethod;
|
98
|
-
|
177
|
+
|
178
|
+
/*
|
179
|
+
* Force specific startup file.
|
180
|
+
*/
|
99
181
|
const char *startupFile;
|
100
|
-
/** The user that Ruby applications must run as. */
|
101
|
-
const char *user;
|
102
182
|
|
183
|
+
/*
|
184
|
+
* The user that Ruby applications must run as.
|
185
|
+
*/
|
186
|
+
const char *user;
|
103
187
|
};
|
@@ -0,0 +1,113 @@
|
|
1
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
|
+
# Copyright (c) 2010-2016 Phusion Holding B.V.
|
3
|
+
#
|
4
|
+
# "Passenger", "Phusion Passenger" and "Union Station" are registered
|
5
|
+
# trademarks of Phusion Holding B.V.
|
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
|
+
# This file uses the cxxcodebuilder API. Learn more at:
|
26
|
+
# https://github.com/phusion/passenger/cxxcodebuilder
|
27
|
+
|
28
|
+
require 'phusion_passenger/apache2/config_options'
|
29
|
+
|
30
|
+
def main
|
31
|
+
comment copyright_header_for(__FILE__)
|
32
|
+
|
33
|
+
separator
|
34
|
+
|
35
|
+
comment %q{
|
36
|
+
ConfigurationFields.hpp is automatically generated from ConfigurationFields.hpp.cxxcodebuilder,
|
37
|
+
using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
|
38
|
+
Edits to ConfigurationFields.hpp will be lost.
|
39
|
+
|
40
|
+
To update ConfigurationFields.hpp:
|
41
|
+
rake apache2
|
42
|
+
|
43
|
+
To force regeneration of ConfigurationFields.hpp:
|
44
|
+
rm -f src/apache2_module/ConfigurationFields.hpp
|
45
|
+
rake src/apache2_module/ConfigurationFields.hpp
|
46
|
+
}
|
47
|
+
|
48
|
+
separator
|
49
|
+
|
50
|
+
struct 'GeneratedDirConfigPart' do
|
51
|
+
add_code 'enum Threeway { ENABLED, DISABLED, UNSET };'
|
52
|
+
|
53
|
+
definitions.each do |definition|
|
54
|
+
separator
|
55
|
+
comment(definition[3])
|
56
|
+
field(definition[0])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def filter_eligible_options(options)
|
62
|
+
options.reject do |option|
|
63
|
+
option[:alias_for] ||
|
64
|
+
option.fetch(:field, true).nil? ||
|
65
|
+
option[:field].to_s =~ /\./
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def struct_field_for(option)
|
70
|
+
if option.has_key?(:field)
|
71
|
+
option[:field]
|
72
|
+
else
|
73
|
+
result = option[:name].sub(/^Passenger/, '')
|
74
|
+
result[0] = result[0..0].downcase
|
75
|
+
result
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Returns [definition_source, estimated_size_on_x86_64, description]
|
80
|
+
def definition_for(option)
|
81
|
+
field = struct_field_for(option)
|
82
|
+
case option[:type]
|
83
|
+
when :string
|
84
|
+
result = ["const char *#{field}", 8 + 4, field, option[:desc]]
|
85
|
+
when :integer
|
86
|
+
result = ["int #{field}", 4, field, option[:desc]]
|
87
|
+
when :flag
|
88
|
+
result = ["Threeway #{field}", 1, field, option[:desc]]
|
89
|
+
else
|
90
|
+
raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}"
|
91
|
+
end
|
92
|
+
result + [option[:desc]]
|
93
|
+
end
|
94
|
+
|
95
|
+
def definitions
|
96
|
+
@definitions ||= begin
|
97
|
+
eligible_options = filter_eligible_options(APACHE2_DIRECTORY_CONFIGURATION_OPTIONS)
|
98
|
+
definitions = eligible_options.map { |o| definition_for(o) }
|
99
|
+
# Sort the definitions by size in order to make the struct smaller.
|
100
|
+
# It's possible to make it even smaller with a smarter algorithm but for now
|
101
|
+
# I don't bother.
|
102
|
+
definitions.sort! do |d1, d2|
|
103
|
+
if d1[1] == d2[1]
|
104
|
+
# After sorting on size, sort alphabetically.
|
105
|
+
d1[2] <=> d2[2]
|
106
|
+
else
|
107
|
+
d1[1] <=> d2[1]
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
main
|