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.

Files changed (121) hide show
  1. data.tar.gz.asc +7 -7
  2. data/NEWS +69 -0
  3. data/bin/passenger-install-apache2-module +7 -1
  4. data/bin/passenger-install-nginx-module +18 -1
  5. data/build/apache2.rb +25 -1
  6. data/build/basics.rb +7 -4
  7. data/build/debian.rb +72 -25
  8. data/build/nginx.rb +24 -0
  9. data/build/packaging.rb +45 -3
  10. data/debian.template/{control → control.template} +17 -8
  11. data/debian.template/ruby-passenger.install.template +1 -0
  12. data/debian.template/rules.template +9 -3
  13. data/dev/run_travis.sh +14 -0
  14. data/doc/Users guide Apache.idmap.txt +64 -48
  15. data/doc/Users guide Apache.txt +127 -93
  16. data/doc/Users guide Nginx.idmap.txt +46 -28
  17. data/doc/Users guide Nginx.txt +100 -12
  18. data/doc/images/{conservative_spawning.png → direct_spawning.png} +0 -0
  19. data/doc/images/{conservative_spawning.svg → direct_spawning.svg} +0 -0
  20. data/doc/users_guide_snippets/installation.txt +107 -66
  21. data/doc/users_guide_snippets/passenger_spawn_method.txt +1 -1
  22. data/doc/users_guide_snippets/rvm_helper_tool.txt +0 -12
  23. data/doc/users_guide_snippets/tips.txt +70 -3
  24. data/doc/users_guide_snippets/under_the_hood/page_caching_support.txt +2 -0
  25. data/doc/users_guide_snippets/under_the_hood/relationship_with_ruby.txt +114 -0
  26. data/ext/apache2/Configuration.cpp +53 -101
  27. data/ext/apache2/Configuration.hpp +19 -41
  28. data/ext/apache2/ConfigurationCommands.cpp +95 -0
  29. data/ext/apache2/ConfigurationCommands.cpp.erb +91 -0
  30. data/ext/apache2/ConfigurationFields.hpp +59 -0
  31. data/ext/apache2/ConfigurationFields.hpp.erb +89 -0
  32. data/ext/apache2/ConfigurationSetters.cpp +223 -0
  33. data/ext/apache2/ConfigurationSetters.cpp.erb +126 -0
  34. data/ext/apache2/CreateDirConfig.cpp +50 -0
  35. data/ext/apache2/CreateDirConfig.cpp.erb +71 -0
  36. data/ext/apache2/Hooks.cpp +6 -0
  37. data/ext/apache2/MergeDirConfig.cpp +103 -0
  38. data/ext/apache2/MergeDirConfig.cpp.erb +81 -0
  39. data/ext/common/ApplicationPool2/AppTypes.cpp +2 -0
  40. data/ext/common/ApplicationPool2/AppTypes.h +2 -0
  41. data/ext/common/ApplicationPool2/Common.h +1 -1
  42. data/ext/common/ApplicationPool2/Group.h +56 -7
  43. data/ext/common/ApplicationPool2/Implementation.cpp +133 -31
  44. data/ext/common/ApplicationPool2/Options.h +23 -2
  45. data/ext/common/ApplicationPool2/Pool.h +8 -1
  46. data/ext/common/ApplicationPool2/Process.h +9 -0
  47. data/ext/common/ApplicationPool2/Session.h +1 -0
  48. data/ext/common/ApplicationPool2/Spawner.h +21 -19
  49. data/ext/common/ApplicationPool2/SuperGroup.h +1 -1
  50. data/ext/common/Constants.h +21 -17
  51. data/ext/common/Constants.h.erb +1 -1
  52. data/ext/common/Exceptions.h +19 -0
  53. data/ext/common/ServerInstanceDir.h +8 -4
  54. data/ext/common/Utils.cpp +33 -1
  55. data/ext/common/Utils.h +14 -0
  56. data/ext/common/Utils/StrIntUtils.cpp +16 -0
  57. data/ext/common/Utils/StrIntUtils.h +5 -0
  58. data/ext/common/agents/HelperAgent/Main.cpp +5 -5
  59. data/ext/common/agents/HelperAgent/RequestHandler.h +94 -45
  60. data/ext/common/agents/LoggingAgent/Main.cpp +10 -26
  61. data/ext/common/agents/Watchdog/Main.cpp +4 -15
  62. data/ext/nginx/CacheLocationConfig.c +501 -0
  63. data/ext/nginx/CacheLocationConfig.c.erb +140 -0
  64. data/ext/nginx/Configuration.c +29 -453
  65. data/ext/nginx/Configuration.h +3 -21
  66. data/ext/nginx/ConfigurationCommands.c +501 -0
  67. data/ext/nginx/ConfigurationCommands.c.erb +136 -0
  68. data/ext/nginx/ConfigurationFields.h +89 -0
  69. data/ext/nginx/ConfigurationFields.h.erb +85 -0
  70. data/ext/nginx/ContentHandler.c +3 -166
  71. data/ext/nginx/CreateLocationConfig.c +146 -0
  72. data/ext/nginx/CreateLocationConfig.c.erb +70 -0
  73. data/ext/nginx/MergeLocationConfig.c +166 -0
  74. data/ext/nginx/MergeLocationConfig.c.erb +72 -0
  75. data/ext/nginx/config +4 -0
  76. data/ext/oxt/detail/tracable_exception_disabled.hpp +21 -1
  77. data/ext/oxt/detail/tracable_exception_enabled.hpp +4 -1
  78. data/ext/oxt/implementation.cpp +7 -1
  79. data/ext/oxt/macros.hpp +9 -7
  80. data/helper-scripts/backtrace-sanitizer.rb +23 -0
  81. data/helper-scripts/classic-rails-loader.rb +23 -0
  82. data/helper-scripts/classic-rails-preloader.rb +23 -0
  83. data/helper-scripts/download_binaries/extconf.rb +10 -5
  84. data/helper-scripts/meteor-loader.rb +127 -0
  85. data/helper-scripts/node-loader.js +1 -1
  86. data/helper-scripts/rack-preloader.rb +23 -0
  87. data/helper-scripts/system-memory-stats.py +22 -0
  88. data/helper-scripts/touch-dir.sh +48 -0
  89. data/lib/phusion_passenger.rb +1 -1
  90. data/lib/phusion_passenger/apache2/config_options.rb +104 -0
  91. data/lib/phusion_passenger/constants.rb +8 -0
  92. data/lib/phusion_passenger/native_support.rb +9 -1
  93. data/lib/phusion_passenger/nginx/config_options.rb +328 -0
  94. data/lib/phusion_passenger/packaging.rb +2 -2
  95. data/lib/phusion_passenger/platform_info/apache.rb +8 -0
  96. data/lib/phusion_passenger/platform_info/compiler.rb +2 -2
  97. data/lib/phusion_passenger/rails3_extensions/init.rb +19 -4
  98. data/lib/phusion_passenger/ruby_core_enhancements.rb +4 -1
  99. data/lib/phusion_passenger/standalone/app_finder.rb +3 -2
  100. data/lib/phusion_passenger/standalone/command.rb +1 -0
  101. data/lib/phusion_passenger/standalone/runtime_installer.rb +1 -6
  102. data/lib/phusion_passenger/standalone/runtime_locator.rb +9 -2
  103. data/lib/phusion_passenger/standalone/start_command.rb +45 -9
  104. data/lib/phusion_passenger/utils.rb +4 -1
  105. data/resources/templates/{nginx → installer_common}/run_installer_as_root.txt.erb +3 -1
  106. data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +6 -0
  107. data/resources/templates/standalone/config.erb +8 -8
  108. data/test/cxx/ApplicationPool2/PoolTest.cpp +120 -3
  109. data/test/cxx/RequestHandlerTest.cpp +66 -3
  110. data/test/integration_tests/native_packaging_spec.rb +41 -0
  111. data/test/integration_tests/nginx_tests.rb +1 -0
  112. data/test/integration_tests/standalone_tests.rb +4 -0
  113. data/test/ruby/shared/rails/analytics_logging_extensions_sharedspec.rb +22 -0
  114. data/test/stub/rails3.0/config/initializers/passenger.rb +2 -1
  115. data/test/stub/rails3.1/config/initializers/passenger.rb +2 -1
  116. data/test/stub/rails3.2/config/initializers/passenger.rb +2 -1
  117. data/test/stub/rails4.0/config/initializers/passenger.rb +5 -1
  118. data/test/stub/wsgi/passenger_wsgi.py +5 -0
  119. metadata +32 -7
  120. metadata.gz.asc +7 -7
  121. data/resources/templates/apache2/run_installer_as_root.txt.erb +0 -8
@@ -53,6 +53,8 @@ namespace Passenger {
53
53
 
54
54
  using namespace std;
55
55
 
56
+ #define UNSET_INT_VALUE INT_MIN
57
+
56
58
 
57
59
  /**
58
60
  * Per-directory configuration information.
@@ -64,13 +66,10 @@ struct DirConfig {
64
66
  enum Threeway { ENABLED, DISABLED, UNSET };
65
67
  enum SpawnMethod { SM_UNSET, SM_SMART, SM_DIRECT };
66
68
 
67
- Threeway enabled;
68
-
69
+ #include "ConfigurationFields.hpp"
70
+
69
71
  std::set<std::string> baseURIs;
70
72
 
71
- /** The Ruby interpreter to use. */
72
- const char *ruby;
73
-
74
73
  /** The Python interpreter to use. */
75
74
  const char *python;
76
75
 
@@ -90,11 +89,6 @@ struct DirConfig {
90
89
  /** The spawn method to use. */
91
90
  SpawnMethod spawnMethod;
92
91
 
93
- /** See PoolOptions for more info. */
94
- const char *user;
95
- /** See PoolOptions for more info. */
96
- const char *group;
97
-
98
92
  /**
99
93
  * The idle timeout, in seconds, of preloader processes.
100
94
  * May also be 0 (which indicates that the application spawner should
@@ -102,37 +96,13 @@ struct DirConfig {
102
96
  * and the default value should be used).
103
97
  */
104
98
  long maxPreloaderIdleTime;
105
-
106
- /**
107
- * The maximum number of requests that the spawned application may process
108
- * before exiting. A value of 0 means unlimited.
109
- */
110
- unsigned long maxRequests;
111
-
112
- /** Indicates whether the maxRequests option was explicitly specified
113
- * in the directory configuration. */
114
- bool maxRequestsSpecified;
115
-
116
- /**
117
- * The minimum number of processes for a group that should be kept in
118
- * the pool when cleaning idle processes. Defaults to 0.
119
- */
120
- unsigned long minInstances;
121
-
122
- /**
123
- * Indicates whether the minInstances option was explicitly specified
124
- * in the directory configuration. */
125
- bool minInstancesSpecified;
126
-
99
+
127
100
  /** Whether symlinks in the document root path should be resolved.
128
101
  * The implication of this is documented in the users guide, section
129
102
  * "How Phusion Passenger detects whether a virtual host is a web application".
130
103
  */
131
104
  Threeway resolveSymlinksInDocRoot;
132
105
 
133
- /** Whether high performance mode should be turned on. */
134
- Threeway highPerformance;
135
-
136
106
  /**
137
107
  * Whether encoded slashes in URLs should be supported. This however conflicts
138
108
  * with mod_rewrite support because of a bug/limitation in Apache, so it's one
@@ -231,19 +201,27 @@ struct DirConfig {
231
201
  }
232
202
  }
233
203
 
204
+ unsigned long getMinInstances() const {
205
+ if (minInstances != UNSET_INT_VALUE) {
206
+ return minInstances;
207
+ } else {
208
+ return 1;
209
+ }
210
+ }
211
+
234
212
  unsigned long getMaxRequests() const {
235
- if (maxRequestsSpecified) {
213
+ if (maxRequests != UNSET_INT_VALUE) {
236
214
  return maxRequests;
237
215
  } else {
238
216
  return 0;
239
217
  }
240
218
  }
241
-
242
- unsigned long getMinInstances() const {
243
- if (minInstancesSpecified) {
244
- return minInstances;
219
+
220
+ unsigned long getStartTimeout() const {
221
+ if (startTimeout != UNSET_INT_VALUE) {
222
+ return startTimeout;
245
223
  } else {
246
- return 1;
224
+ return DEFAULT_START_TIMEOUT / 1000;
247
225
  }
248
226
  }
249
227
 
@@ -0,0 +1,95 @@
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.cpp is automatically generated from ConfigurationCommands.cpp.erb,
28
+ * using definitions from lib/phusion_passenger/apache2/config_options.rb.
29
+ * Edits to ConfigurationCommands.cpp will be lost.
30
+ *
31
+ * To update ConfigurationCommands.cpp:
32
+ * rake apache2
33
+ *
34
+ * To force regeneration of ConfigurationCommands.c:
35
+ * rm -f ext/apache2/ConfigurationCommands.cpp
36
+ * rake ext/apache2/ConfigurationCommands.cpp
37
+ */
38
+
39
+
40
+
41
+
42
+ AP_INIT_TAKE1("PassengerRuby",
43
+ (Take1Func) cmd_passenger_ruby,
44
+ NULL,
45
+ OR_OPTIONS | ACCESS_CONF | RSRC_CONF,
46
+ "The Ruby interpreter to use."),
47
+
48
+ AP_INIT_TAKE1("PassengerMinInstances",
49
+ (Take1Func) cmd_passenger_min_instances,
50
+ NULL,
51
+ OR_LIMIT | ACCESS_CONF | RSRC_CONF,
52
+ "The minimum number of application instances to keep when cleaning idle instances."),
53
+
54
+ AP_INIT_TAKE1("PassengerUser",
55
+ (Take1Func) cmd_passenger_user,
56
+ NULL,
57
+ ACCESS_CONF | RSRC_CONF,
58
+ "The user that Ruby applications must run as."),
59
+
60
+ AP_INIT_TAKE1("PassengerGroup",
61
+ (Take1Func) cmd_passenger_group,
62
+ NULL,
63
+ ACCESS_CONF | RSRC_CONF,
64
+ "The group that Ruby applications must run as."),
65
+
66
+ AP_INIT_TAKE1("PassengerMaxRequests",
67
+ (Take1Func) cmd_passenger_max_requests,
68
+ NULL,
69
+ OR_LIMIT | ACCESS_CONF | RSRC_CONF,
70
+ "The maximum number of requests that an application instance may process."),
71
+
72
+ AP_INIT_TAKE1("PassengerStartTimeout",
73
+ (Take1Func) cmd_passenger_start_timeout,
74
+ NULL,
75
+ OR_LIMIT | ACCESS_CONF | RSRC_CONF,
76
+ "A timeout for application startup."),
77
+
78
+ AP_INIT_FLAG("PassengerHighPerformance",
79
+ (FlagFunc) cmd_passenger_high_performance,
80
+ NULL,
81
+ OR_ALL,
82
+ "Enable or disable Passenger's high performance mode."),
83
+
84
+ AP_INIT_FLAG("PassengerEnabled",
85
+ (FlagFunc) cmd_passenger_enabled,
86
+ NULL,
87
+ OR_ALL,
88
+ "Enable or disable Phusion Passenger."),
89
+
90
+ AP_INIT_TAKE1("PassengerMaxRequestQueueSize",
91
+ (Take1Func) cmd_passenger_max_request_queue_size,
92
+ NULL,
93
+ OR_ALL,
94
+ "The maximum number of queued requests."),
95
+
@@ -0,0 +1,91 @@
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.cpp is automatically generated from ConfigurationCommands.cpp.erb,
28
+ * using definitions from lib/phusion_passenger/apache2/config_options.rb.
29
+ * Edits to ConfigurationCommands.cpp will be lost.
30
+ *
31
+ * To update ConfigurationCommands.cpp:
32
+ * rake apache2
33
+ *
34
+ * To force regeneration of ConfigurationCommands.c:
35
+ * rm -f ext/apache2/ConfigurationCommands.cpp
36
+ * rake ext/apache2/ConfigurationCommands.cpp
37
+ */
38
+
39
+ <%
40
+ require 'phusion_passenger/apache2/config_options'
41
+
42
+ def macro_for(option)
43
+ case option[:type]
44
+ when :string, :integer
45
+ return "AP_INIT_TAKE1"
46
+ when :flag
47
+ return "AP_INIT_FLAG"
48
+ else
49
+ raise "Unknown type #{option[:type].inspect} for option #{option[:name].inspect}"
50
+ end
51
+ end
52
+
53
+ def name_for(option)
54
+ return (option[:aliased_for] || option[:name]).inspect
55
+ end
56
+
57
+ def function_type_for(option)
58
+ case option[:type]
59
+ when :string, :integer
60
+ return "Take1Func"
61
+ when :flag
62
+ return "FlagFunc"
63
+ else
64
+ raise "Unknown type #{option[:type].inspect}"
65
+ end
66
+ end
67
+
68
+ def function_for(option)
69
+ function_name = option[:name].gsub(/[A-Z]/) do |letter|
70
+ "_" + letter[0..0].downcase
71
+ end
72
+ return "cmd#{function_name}"
73
+ end
74
+
75
+ def context_for(option)
76
+ context = option[:context] || ["OR_OPTIONS", "ACCESS_CONF", "RSRC_CONF"]
77
+ return context.join(" | ")
78
+ end
79
+
80
+ def description_for(option)
81
+ return option[:desc].inspect
82
+ end
83
+ %>
84
+
85
+ <% for option in APACHE2_DIRECTORY_CONFIGURATION_OPTIONS %>
86
+ <%= macro_for(option) %>(<%= name_for(option) %>,
87
+ (<%= function_type_for(option) %>) <%= function_for(option) %>,
88
+ NULL,
89
+ <%= context_for(option) %>,
90
+ <%= description_for(option) %>),
91
+ <% end %>
@@ -0,0 +1,59 @@
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.hpp is automatically generated from ConfigurationFields.hpp.erb,
28
+ * using definitions from lib/phusion_passenger/apache2/config_options.rb.
29
+ * Edits to ConfigurationFields.hpp will be lost.
30
+ *
31
+ * To update ConfigurationFields.hpp:
32
+ * rake apache2
33
+ *
34
+ * To force regeneration of ConfigurationFields.hpp:
35
+ * rm -f ext/apache2/ConfigurationFields.hpp
36
+ * rake ext/apache2/ConfigurationFields.hpp
37
+ */
38
+
39
+
40
+
41
+ /** Enable or disable Phusion Passenger. */
42
+ Threeway enabled;
43
+ /** Enable or disable Passenger's high performance mode. */
44
+ Threeway highPerformance;
45
+ /** The maximum number of queued requests. */
46
+ int maxRequestQueueSize;
47
+ /** The minimum number of application instances to keep when cleaning idle instances. */
48
+ int minInstances;
49
+ /** A timeout for application startup. */
50
+ int startTimeout;
51
+ /** The maximum number of requests that an application instance may process. */
52
+ int maxRequests;
53
+ /** The group that Ruby applications must run as. */
54
+ const char *group;
55
+ /** The user that Ruby applications must run as. */
56
+ const char *user;
57
+ /** The Ruby interpreter to use. */
58
+ const char *ruby;
59
+
@@ -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.hpp is automatically generated from ConfigurationFields.hpp.erb,
28
+ * using definitions from lib/phusion_passenger/apache2/config_options.rb.
29
+ * Edits to ConfigurationFields.hpp will be lost.
30
+ *
31
+ * To update ConfigurationFields.hpp:
32
+ * rake apache2
33
+ *
34
+ * To force regeneration of ConfigurationFields.hpp:
35
+ * rm -f ext/apache2/ConfigurationFields.hpp
36
+ * rake ext/apache2/ConfigurationFields.hpp
37
+ */
38
+
39
+ <%
40
+ require 'phusion_passenger/apache2/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
+ result = option[:name].sub(/^Passenger/, '')
55
+ result[0] = result[0..0].downcase
56
+ return result
57
+ end
58
+ end
59
+
60
+ # Returns [definition_source, estimated_size_on_x86_64, description]
61
+ def definition_for(option)
62
+ field = struct_field_for(option)
63
+ case option[:type]
64
+ when :string
65
+ result = ["const char *#{field}", 8 + 4]
66
+ when :integer
67
+ result = ["int #{field}", 4]
68
+ when :flag
69
+ result = ["Threeway #{field}", 1]
70
+ else
71
+ raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}"
72
+ end
73
+ return result + [option[:desc]]
74
+ end
75
+
76
+ eligible_options = filter_eligible_options(APACHE2_DIRECTORY_CONFIGURATION_OPTIONS)
77
+ definitions = eligible_options.map { |o| definition_for(o) }
78
+ # Sort the definitions by size in order to make the struct smaller.
79
+ # It's possible to make it even smaller with a smarter algorithm but for now
80
+ # I don't bother.
81
+ definitions.sort! do |d1, d2|
82
+ d1[1] <=> d2[1]
83
+ end
84
+ %>
85
+
86
+ <% for definition in definitions -%>
87
+ /** <%= definition[2] %> */
88
+ <%= definition[0] %>;
89
+ <% end %>
@@ -0,0 +1,223 @@
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
+ * ConfigurationSetters.cpp is automatically generated from ConfigurationSetters.cpp.erb,
28
+ * using definitions from lib/phusion_passenger/apache2/config_options.rb.
29
+ * Edits to ConfigurationSetters.cpp will be lost.
30
+ *
31
+ * To update ConfigurationSetters.cpp:
32
+ * rake apache2
33
+ *
34
+ * To force regeneration of ConfigurationSetters.cpp:
35
+ * rm -f ext/apache2/ConfigurationSetters.cpp
36
+ * rake ext/apache2/ConfigurationSetters.cpp
37
+ */
38
+
39
+
40
+
41
+
42
+ static const char *
43
+ cmd_passenger_ruby(cmd_parms *cmd, void *pcfg, const char *arg) {
44
+ DirConfig *config = (DirConfig *) pcfg;
45
+ config->ruby = arg;
46
+ return NULL;
47
+ }
48
+
49
+
50
+ static const char *
51
+ cmd_passenger_min_instances(cmd_parms *cmd, void *pcfg, const char *arg) {
52
+ DirConfig *config = (DirConfig *) pcfg;
53
+ char *end;
54
+ long result;
55
+
56
+ result = strtol(arg, &end, 10);
57
+ if (*end != '\0') {
58
+ string message = "Invalid number specified for ";
59
+ message.append(cmd->directive->directive);
60
+ message.append(".");
61
+
62
+ char *messageStr = (char *) apr_palloc(cmd->temp_pool,
63
+ message.size() + 1);
64
+ memcpy(messageStr, message.c_str(), message.size() + 1);
65
+ return messageStr;
66
+
67
+ } else if (result < 0) {
68
+ string message = "Value for ";
69
+ message.append(cmd->directive->directive);
70
+ message.append(" must be greater than or equal to 0.");
71
+
72
+ char *messageStr = (char *) apr_palloc(cmd->temp_pool,
73
+ message.size() + 1);
74
+ memcpy(messageStr, message.c_str(), message.size() + 1);
75
+ return messageStr;
76
+
77
+ } else {
78
+ config->minInstances = (int) result;
79
+ return NULL;
80
+ }
81
+ }
82
+
83
+
84
+ static const char *
85
+ cmd_passenger_user(cmd_parms *cmd, void *pcfg, const char *arg) {
86
+ DirConfig *config = (DirConfig *) pcfg;
87
+ config->user = arg;
88
+ return NULL;
89
+ }
90
+
91
+
92
+ static const char *
93
+ cmd_passenger_group(cmd_parms *cmd, void *pcfg, const char *arg) {
94
+ DirConfig *config = (DirConfig *) pcfg;
95
+ config->group = arg;
96
+ return NULL;
97
+ }
98
+
99
+
100
+ static const char *
101
+ cmd_passenger_max_requests(cmd_parms *cmd, void *pcfg, const char *arg) {
102
+ DirConfig *config = (DirConfig *) pcfg;
103
+ char *end;
104
+ long result;
105
+
106
+ result = strtol(arg, &end, 10);
107
+ if (*end != '\0') {
108
+ string message = "Invalid number specified for ";
109
+ message.append(cmd->directive->directive);
110
+ message.append(".");
111
+
112
+ char *messageStr = (char *) apr_palloc(cmd->temp_pool,
113
+ message.size() + 1);
114
+ memcpy(messageStr, message.c_str(), message.size() + 1);
115
+ return messageStr;
116
+
117
+ } else if (result < 0) {
118
+ string message = "Value for ";
119
+ message.append(cmd->directive->directive);
120
+ message.append(" must be greater than or equal to 0.");
121
+
122
+ char *messageStr = (char *) apr_palloc(cmd->temp_pool,
123
+ message.size() + 1);
124
+ memcpy(messageStr, message.c_str(), message.size() + 1);
125
+ return messageStr;
126
+
127
+ } else {
128
+ config->maxRequests = (int) result;
129
+ return NULL;
130
+ }
131
+ }
132
+
133
+
134
+ static const char *
135
+ cmd_passenger_start_timeout(cmd_parms *cmd, void *pcfg, const char *arg) {
136
+ DirConfig *config = (DirConfig *) pcfg;
137
+ char *end;
138
+ long result;
139
+
140
+ result = strtol(arg, &end, 10);
141
+ if (*end != '\0') {
142
+ string message = "Invalid number specified for ";
143
+ message.append(cmd->directive->directive);
144
+ message.append(".");
145
+
146
+ char *messageStr = (char *) apr_palloc(cmd->temp_pool,
147
+ message.size() + 1);
148
+ memcpy(messageStr, message.c_str(), message.size() + 1);
149
+ return messageStr;
150
+
151
+ } else if (result < 1) {
152
+ string message = "Value for ";
153
+ message.append(cmd->directive->directive);
154
+ message.append(" must be greater than or equal to 1.");
155
+
156
+ char *messageStr = (char *) apr_palloc(cmd->temp_pool,
157
+ message.size() + 1);
158
+ memcpy(messageStr, message.c_str(), message.size() + 1);
159
+ return messageStr;
160
+
161
+ } else {
162
+ config->startTimeout = (int) result;
163
+ return NULL;
164
+ }
165
+ }
166
+
167
+
168
+ static const char *
169
+ cmd_passenger_high_performance(cmd_parms *cmd, void *pcfg, const char *arg) {
170
+ DirConfig *config = (DirConfig *) pcfg;
171
+ config->highPerformance =
172
+ arg ?
173
+ DirConfig::ENABLED :
174
+ DirConfig::DISABLED;
175
+ return NULL;
176
+ }
177
+
178
+
179
+ static const char *
180
+ cmd_passenger_enabled(cmd_parms *cmd, void *pcfg, const char *arg) {
181
+ DirConfig *config = (DirConfig *) pcfg;
182
+ config->enabled =
183
+ arg ?
184
+ DirConfig::ENABLED :
185
+ DirConfig::DISABLED;
186
+ return NULL;
187
+ }
188
+
189
+
190
+ static const char *
191
+ cmd_passenger_max_request_queue_size(cmd_parms *cmd, void *pcfg, const char *arg) {
192
+ DirConfig *config = (DirConfig *) pcfg;
193
+ char *end;
194
+ long result;
195
+
196
+ result = strtol(arg, &end, 10);
197
+ if (*end != '\0') {
198
+ string message = "Invalid number specified for ";
199
+ message.append(cmd->directive->directive);
200
+ message.append(".");
201
+
202
+ char *messageStr = (char *) apr_palloc(cmd->temp_pool,
203
+ message.size() + 1);
204
+ memcpy(messageStr, message.c_str(), message.size() + 1);
205
+ return messageStr;
206
+
207
+ } else if (result < 0) {
208
+ string message = "Value for ";
209
+ message.append(cmd->directive->directive);
210
+ message.append(" must be greater than or equal to 0.");
211
+
212
+ char *messageStr = (char *) apr_palloc(cmd->temp_pool,
213
+ message.size() + 1);
214
+ memcpy(messageStr, message.c_str(), message.size() + 1);
215
+ return messageStr;
216
+
217
+ } else {
218
+ config->maxRequestQueueSize = (int) result;
219
+ return NULL;
220
+ }
221
+ }
222
+
223
+