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.

Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.editorconfig +5 -0
  3. data/CHANGELOG +13 -0
  4. data/build/apache2.rb +3 -3
  5. data/build/common_library.rb +3 -3
  6. data/build/nginx.rb +4 -4
  7. data/build/packaging.rb +9 -8
  8. data/build/support/cxx_dependency_map.rb +9 -7
  9. data/build/support/general.rb +39 -0
  10. data/build/support/vendor/cxxcodebuilder/CxxCodeBuilder.sublime-project +8 -0
  11. data/build/support/vendor/cxxcodebuilder/Gemfile +4 -0
  12. data/build/support/vendor/cxxcodebuilder/Gemfile.lock +28 -0
  13. data/build/support/vendor/cxxcodebuilder/LICENSE.md +19 -0
  14. data/build/support/vendor/cxxcodebuilder/README.md +98 -0
  15. data/build/support/vendor/cxxcodebuilder/Rakefile +4 -0
  16. data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder.rb +23 -0
  17. data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/builder.rb +574 -0
  18. data/build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/initializer_builder.rb +166 -0
  19. data/build/test_basics.rb +2 -1
  20. data/resources/templates/standalone/server.erb +6 -4
  21. data/src/agent/Core/Controller/ForwardResponse.cpp +5 -5
  22. data/src/agent/Watchdog/WatchdogMain.cpp +0 -10
  23. data/src/apache2_module/ConfigurationCommands.cpp +181 -248
  24. data/src/apache2_module/ConfigurationCommands.cpp.cxxcodebuilder +127 -0
  25. data/src/apache2_module/ConfigurationFields.hpp +135 -51
  26. data/src/apache2_module/ConfigurationFields.hpp.cxxcodebuilder +113 -0
  27. data/src/apache2_module/ConfigurationSetters.cpp +414 -459
  28. data/src/apache2_module/ConfigurationSetters.cpp.cxxcodebuilder +144 -0
  29. data/src/apache2_module/CreateDirConfig.cpp +49 -52
  30. data/src/apache2_module/CreateDirConfig.cpp.cxxcodebuilder +81 -0
  31. data/src/apache2_module/Hooks.cpp +0 -14
  32. data/src/apache2_module/MergeDirConfig.cpp +136 -226
  33. data/src/apache2_module/MergeDirConfig.cpp.cxxcodebuilder +97 -0
  34. data/src/apache2_module/SetHeaders.cpp +92 -143
  35. data/src/apache2_module/SetHeaders.cpp.cxxcodebuilder +106 -0
  36. data/src/cxx_supportlib/Constants.h +86 -146
  37. data/src/cxx_supportlib/Constants.h.cxxcodebuilder +43 -0
  38. data/src/cxx_supportlib/DataStructures/LString.h +40 -23
  39. data/src/cxx_supportlib/MemoryKit/mbuf.cpp +60 -25
  40. data/src/cxx_supportlib/MemoryKit/mbuf.h +50 -25
  41. data/src/cxx_supportlib/ServerKit/CookieUtils.h +36 -3
  42. data/src/cxx_supportlib/ServerKit/HeaderTable.h +2 -8
  43. data/src/cxx_supportlib/ServerKit/HttpServer.h +6 -15
  44. data/src/cxx_supportlib/WatchdogLauncher.cpp +4 -4
  45. data/src/cxx_supportlib/WatchdogLauncher.h +2 -3
  46. data/src/nginx_module/CacheLocationConfig.c +623 -780
  47. data/src/nginx_module/CacheLocationConfig.c.cxxcodebuilder +214 -0
  48. data/src/nginx_module/Configuration.h +1 -1
  49. data/src/nginx_module/ConfigurationCommands.c +404 -535
  50. data/src/nginx_module/ConfigurationCommands.c.cxxcodebuilder +157 -0
  51. data/src/nginx_module/CreateLocationConfig.c +82 -206
  52. data/src/nginx_module/CreateLocationConfig.c.cxxcodebuilder +98 -0
  53. data/src/nginx_module/LocationConfig.h +97 -0
  54. data/src/nginx_module/LocationConfig.h.cxxcodebuilder +131 -0
  55. data/src/nginx_module/MergeLocationConfig.c +157 -278
  56. data/src/nginx_module/MergeLocationConfig.c.cxxcodebuilder +144 -0
  57. data/src/nginx_module/ngx_http_passenger_module.c +4 -10
  58. data/src/ruby_supportlib/phusion_passenger.rb +4 -4
  59. data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +2 -2
  60. data/src/ruby_supportlib/phusion_passenger/packaging.rb +2 -0
  61. data/src/ruby_supportlib/phusion_passenger/platform_info/compiler.rb +6 -0
  62. data/src/ruby_supportlib/phusion_passenger/platform_info/cxx_portability.rb +1 -1
  63. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +27 -8
  64. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller.rb +120 -2
  65. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/lock_file.rb +1 -1
  66. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/spawn.rb +4 -4
  67. data/src/ruby_supportlib/phusion_passenger/vendor/daemon_controller/version.rb +1 -1
  68. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +5 -5
  69. metadata +24 -15
  70. data/src/apache2_module/ConfigurationCommands.cpp.erb +0 -109
  71. data/src/apache2_module/ConfigurationFields.hpp.erb +0 -98
  72. data/src/apache2_module/ConfigurationSetters.cpp.erb +0 -128
  73. data/src/apache2_module/CreateDirConfig.cpp.erb +0 -72
  74. data/src/apache2_module/MergeDirConfig.cpp.erb +0 -82
  75. data/src/apache2_module/SetHeaders.cpp.erb +0 -91
  76. data/src/cxx_supportlib/Constants.h.erb +0 -41
  77. data/src/nginx_module/CacheLocationConfig.c.erb +0 -171
  78. data/src/nginx_module/ConfigurationCommands.c.erb +0 -144
  79. data/src/nginx_module/ConfigurationFields.h +0 -145
  80. data/src/nginx_module/ConfigurationFields.h.erb +0 -112
  81. data/src/nginx_module/CreateLocationConfig.c.erb +0 -78
  82. data/src/nginx_module/MergeLocationConfig.c.erb +0 -118
@@ -0,0 +1,97 @@
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
+ MergeDirConfig.cpp is automatically generated from MergeDirConfig.cpp.cxxcodebuilder,
37
+ using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
38
+ Edits to MergeDirConfig.cpp will be lost.
39
+
40
+ To update MergeDirConfig.cpp:
41
+ rake apache2
42
+
43
+ To force regeneration of MergeDirConfig.cpp:
44
+ rm -f src/apache2_module/MergeDirConfig.cpp
45
+ rake src/apache2_module/MergeDirConfig.cpp
46
+ }
47
+
48
+ separator
49
+
50
+ filter_eligible_options(APACHE2_DIRECTORY_CONFIGURATION_OPTIONS).each do |option|
51
+ if option[:type] == :string
52
+ add_code %Q{
53
+ config->#{struct_field_for(option)} =
54
+ (add->#{struct_field_for(option)} == NULL) ?
55
+ base->#{struct_field_for(option)} :
56
+ add->#{struct_field_for(option)};
57
+ }
58
+ elsif option[:type] == :integer
59
+ add_code %Q{
60
+ config->#{struct_field_for(option)} =
61
+ (add->#{struct_field_for(option)} == UNSET_INT_VALUE) ?
62
+ base->#{struct_field_for(option)} :
63
+ add->#{struct_field_for(option)};
64
+ }
65
+ elsif option[:type] == :flag
66
+ add_code %Q{
67
+ config->#{struct_field_for(option)} =
68
+ (add->#{struct_field_for(option)} == DirConfig::UNSET) ?
69
+ base->#{struct_field_for(option)} :
70
+ add->#{struct_field_for(option)};
71
+ }
72
+ else
73
+ raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}"
74
+ end
75
+ end
76
+ end
77
+
78
+ def filter_eligible_options(options)
79
+ options.reject do |option|
80
+ option[:alias_for] ||
81
+ option.fetch(:field, true).nil? ||
82
+ option[:field].to_s =~ /\./ ||
83
+ !option.fetch(:auto_generate_nginx_merge_code, true)
84
+ end
85
+ end
86
+
87
+ def struct_field_for(option)
88
+ if option.has_key?(:field)
89
+ option[:field]
90
+ else
91
+ result = option[:name].sub(/^Passenger/, '')
92
+ result[0] = result[0..0].downcase
93
+ result
94
+ end
95
+ end
96
+
97
+ main
@@ -1,31 +1,31 @@
1
1
  /*
2
- * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010-2015 Phusion Holding B.V.
2
+ * Phusion Passenger - https://www.phusionpassenger.com/
3
+ * Copyright (c) 2010-2016 Phusion Holding B.V.
4
4
  *
5
- * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
- * trademarks of Phusion Holding B.V.
5
+ * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
+ * trademarks of Phusion Holding B.V.
7
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:
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
- * The above copyright notice and this permission notice shall be included in
16
- * all copies or substantial portions of the Software.
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
- * 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.
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
- * SetHeaders.cpp is automatically generated from SetHeaders.cpp.erb,
28
+ * SetHeaders.cpp is automatically generated from SetHeaders.cpp.cxxcodebuilder,
29
29
  * using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
30
30
  * Edits to SetHeaders.cpp will be lost.
31
31
  *
@@ -37,126 +37,75 @@
37
37
  * rake src/apache2_module/SetHeaders.cpp
38
38
  */
39
39
 
40
-
41
-
42
-
43
-
44
- addHeader(result, StaticString("!~PASSENGER_RUBY",
45
- sizeof("!~PASSENGER_RUBY") - 1), config->ruby ? config->ruby : serverConfig.defaultRuby);
46
-
47
-
48
-
49
- addHeader(result, StaticString("!~PASSENGER_PYTHON",
50
- sizeof("!~PASSENGER_PYTHON") - 1), config->python);
51
-
52
-
53
-
54
- addHeader(result, StaticString("!~PASSENGER_NODEJS",
55
- sizeof("!~PASSENGER_NODEJS") - 1), config->nodejs);
56
-
57
-
58
-
59
- addHeader(result, StaticString("!~PASSENGER_METEOR_APP_SETTINGS",
60
- sizeof("!~PASSENGER_METEOR_APP_SETTINGS") - 1), config->meteorAppSettings);
61
-
62
-
63
-
64
- addHeader(result, StaticString("!~PASSENGER_APP_ENV",
65
- sizeof("!~PASSENGER_APP_ENV") - 1), config->appEnv);
66
-
67
-
68
-
69
- addHeader(r, result, StaticString("!~PASSENGER_MIN_PROCESSES",
70
- sizeof("!~PASSENGER_MIN_PROCESSES") - 1), config->minInstances);
71
-
72
-
73
-
74
- addHeader(r, result, StaticString("!~PASSENGER_MAX_PROCESSES",
75
- sizeof("!~PASSENGER_MAX_PROCESSES") - 1), config->maxInstancesPerApp);
76
-
77
-
78
-
79
- addHeader(result, StaticString("!~PASSENGER_USER",
80
- sizeof("!~PASSENGER_USER") - 1), config->user);
81
-
82
-
83
-
84
- addHeader(result, StaticString("!~PASSENGER_GROUP",
85
- sizeof("!~PASSENGER_GROUP") - 1), config->group);
86
-
87
-
88
-
89
- addHeader(r, result, StaticString("!~PASSENGER_MAX_REQUESTS",
90
- sizeof("!~PASSENGER_MAX_REQUESTS") - 1), config->maxRequests);
91
-
92
-
93
-
94
- addHeader(r, result, StaticString("!~PASSENGER_START_TIMEOUT",
95
- sizeof("!~PASSENGER_START_TIMEOUT") - 1), config->startTimeout);
96
-
97
-
98
-
99
- addHeader(r, result, StaticString("!~PASSENGER_MAX_REQUEST_QUEUE_SIZE",
100
- sizeof("!~PASSENGER_MAX_REQUEST_QUEUE_SIZE") - 1), config->maxRequestQueueSize);
101
-
102
-
103
-
104
- addHeader(r, result, StaticString("!~PASSENGER_MAX_PRELOADER_IDLE_TIME",
105
- sizeof("!~PASSENGER_MAX_PRELOADER_IDLE_TIME") - 1), config->maxPreloaderIdleTime);
106
-
107
-
108
-
109
- addHeader(result, StaticString("!~PASSENGER_LOAD_SHELL_ENVVARS",
110
- sizeof("!~PASSENGER_LOAD_SHELL_ENVVARS") - 1), config->loadShellEnvvars);
111
-
112
-
113
-
114
- addHeader(result, StaticString("!~PASSENGER_STARTUP_FILE",
115
- sizeof("!~PASSENGER_STARTUP_FILE") - 1), config->startupFile);
116
-
117
-
118
-
119
- addHeader(result, StaticString("!~PASSENGER_STICKY_SESSIONS",
120
- sizeof("!~PASSENGER_STICKY_SESSIONS") - 1), config->stickySessions);
121
-
122
-
123
-
124
- addHeader(result, StaticString("!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME",
125
- sizeof("!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME") - 1), config->stickySessionsCookieName);
126
-
127
-
128
-
129
- addHeader(result, StaticString("!~PASSENGER_SPAWN_METHOD",
130
- sizeof("!~PASSENGER_SPAWN_METHOD") - 1), config->spawnMethod);
131
-
132
-
133
-
134
- addHeader(result, StaticString("!~PASSENGER_SHOW_VERSION_IN_HEADER",
135
- sizeof("!~PASSENGER_SHOW_VERSION_IN_HEADER") - 1), config->showVersionInHeader);
136
-
137
-
138
-
139
- addHeader(result, StaticString("!~PASSENGER_FRIENDLY_ERROR_PAGES",
140
- sizeof("!~PASSENGER_FRIENDLY_ERROR_PAGES") - 1), config->friendlyErrorPages);
141
-
142
-
143
-
144
- addHeader(result, StaticString("!~PASSENGER_RESTART_DIR",
145
- sizeof("!~PASSENGER_RESTART_DIR") - 1), config->restartDir);
146
-
147
-
148
-
149
- addHeader(result, StaticString("!~PASSENGER_APP_GROUP_NAME",
150
- sizeof("!~PASSENGER_APP_GROUP_NAME") - 1), config->appGroupName);
151
-
152
-
153
-
154
- addHeader(r, result, StaticString("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS",
155
- sizeof("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS") - 1), config->forceMaxConcurrentRequestsPerProcess);
156
-
157
-
158
-
159
- addHeader(r, result, StaticString("!~PASSENGER_LVE_MIN_UID",
160
- sizeof("!~PASSENGER_LVE_MIN_UID") - 1), config->lveMinUid);
161
-
162
-
40
+ addHeader(result, StaticString("!~PASSENGER_RUBY",
41
+ sizeof("!~PASSENGER_RUBY") - 1),
42
+ config->ruby ? config->ruby : serverConfig.defaultRuby);
43
+ addHeader(result, StaticString("!~PASSENGER_PYTHON",
44
+ sizeof("!~PASSENGER_PYTHON") - 1),
45
+ config->python);
46
+ addHeader(result, StaticString("!~PASSENGER_NODEJS",
47
+ sizeof("!~PASSENGER_NODEJS") - 1),
48
+ config->nodejs);
49
+ addHeader(result, StaticString("!~PASSENGER_METEOR_APP_SETTINGS",
50
+ sizeof("!~PASSENGER_METEOR_APP_SETTINGS") - 1),
51
+ config->meteorAppSettings);
52
+ addHeader(result, StaticString("!~PASSENGER_APP_ENV",
53
+ sizeof("!~PASSENGER_APP_ENV") - 1),
54
+ config->appEnv);
55
+ addHeader(r, result, StaticString("!~PASSENGER_MIN_PROCESSES",
56
+ sizeof("!~PASSENGER_MIN_PROCESSES") - 1),
57
+ config->minInstances);
58
+ addHeader(r, result, StaticString("!~PASSENGER_MAX_PROCESSES",
59
+ sizeof("!~PASSENGER_MAX_PROCESSES") - 1),
60
+ config->maxInstancesPerApp);
61
+ addHeader(result, StaticString("!~PASSENGER_USER",
62
+ sizeof("!~PASSENGER_USER") - 1),
63
+ config->user);
64
+ addHeader(result, StaticString("!~PASSENGER_GROUP",
65
+ sizeof("!~PASSENGER_GROUP") - 1),
66
+ config->group);
67
+ addHeader(r, result, StaticString("!~PASSENGER_MAX_REQUESTS",
68
+ sizeof("!~PASSENGER_MAX_REQUESTS") - 1),
69
+ config->maxRequests);
70
+ addHeader(r, result, StaticString("!~PASSENGER_START_TIMEOUT",
71
+ sizeof("!~PASSENGER_START_TIMEOUT") - 1),
72
+ config->startTimeout);
73
+ addHeader(r, result, StaticString("!~PASSENGER_MAX_REQUEST_QUEUE_SIZE",
74
+ sizeof("!~PASSENGER_MAX_REQUEST_QUEUE_SIZE") - 1),
75
+ config->maxRequestQueueSize);
76
+ addHeader(r, result, StaticString("!~PASSENGER_MAX_PRELOADER_IDLE_TIME",
77
+ sizeof("!~PASSENGER_MAX_PRELOADER_IDLE_TIME") - 1),
78
+ config->maxPreloaderIdleTime);
79
+ addHeader(result, StaticString("!~PASSENGER_LOAD_SHELL_ENVVARS",
80
+ sizeof("!~PASSENGER_LOAD_SHELL_ENVVARS") - 1),
81
+ config->loadShellEnvvars);
82
+ addHeader(result, StaticString("!~PASSENGER_STARTUP_FILE",
83
+ sizeof("!~PASSENGER_STARTUP_FILE") - 1),
84
+ config->startupFile);
85
+ addHeader(result, StaticString("!~PASSENGER_STICKY_SESSIONS",
86
+ sizeof("!~PASSENGER_STICKY_SESSIONS") - 1),
87
+ config->stickySessions);
88
+ addHeader(result, StaticString("!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME",
89
+ sizeof("!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME") - 1),
90
+ config->stickySessionsCookieName);
91
+ addHeader(result, StaticString("!~PASSENGER_SPAWN_METHOD",
92
+ sizeof("!~PASSENGER_SPAWN_METHOD") - 1),
93
+ config->spawnMethod);
94
+ addHeader(result, StaticString("!~PASSENGER_SHOW_VERSION_IN_HEADER",
95
+ sizeof("!~PASSENGER_SHOW_VERSION_IN_HEADER") - 1),
96
+ config->showVersionInHeader);
97
+ addHeader(result, StaticString("!~PASSENGER_FRIENDLY_ERROR_PAGES",
98
+ sizeof("!~PASSENGER_FRIENDLY_ERROR_PAGES") - 1),
99
+ config->friendlyErrorPages);
100
+ addHeader(result, StaticString("!~PASSENGER_RESTART_DIR",
101
+ sizeof("!~PASSENGER_RESTART_DIR") - 1),
102
+ config->restartDir);
103
+ addHeader(result, StaticString("!~PASSENGER_APP_GROUP_NAME",
104
+ sizeof("!~PASSENGER_APP_GROUP_NAME") - 1),
105
+ config->appGroupName);
106
+ addHeader(r, result, StaticString("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS",
107
+ sizeof("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS") - 1),
108
+ config->forceMaxConcurrentRequestsPerProcess);
109
+ addHeader(r, result, StaticString("!~PASSENGER_LVE_MIN_UID",
110
+ sizeof("!~PASSENGER_LVE_MIN_UID") - 1),
111
+ config->lveMinUid);
@@ -0,0 +1,106 @@
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
+ SetHeaders.cpp is automatically generated from SetHeaders.cpp.cxxcodebuilder,
37
+ using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
38
+ Edits to SetHeaders.cpp will be lost.
39
+
40
+ To update SetHeaders.cpp:
41
+ rake apache2
42
+
43
+ To force regeneration of SetHeaders.cpp:
44
+ rm -f src/apache2_module/SetHeaders.cpp
45
+ rake src/apache2_module/SetHeaders.cpp
46
+ }
47
+
48
+ separator
49
+
50
+ filter_eligible_options(APACHE2_DIRECTORY_CONFIGURATION_OPTIONS).each do |option|
51
+ if option[:type] == :string || option[:type] == :flag
52
+ add_code %Q{
53
+ addHeader(result, StaticString(#{header_name_for(option)},
54
+ sizeof(#{header_name_for(option)}) - 1),
55
+ #{header_expression_for(option)});
56
+ }
57
+ elsif option[:type] == :integer
58
+ add_code %Q{
59
+ addHeader(r, result, StaticString(#{header_name_for(option)},
60
+ sizeof(#{header_name_for(option)}) - 1),
61
+ #{header_expression_for(option)});
62
+ }
63
+ else
64
+ raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}"
65
+ end
66
+ end
67
+ end
68
+
69
+ def filter_eligible_options(options)
70
+ return options.reject do |option|
71
+ option[:alias_for] ||
72
+ option.fetch(:field, true).nil? ||
73
+ option[:field].to_s =~ /\./ ||
74
+ (option.has_key?(:header) && !option[:header])
75
+ end
76
+ end
77
+
78
+ def struct_field_for(option)
79
+ if option.has_key?(:field)
80
+ option[:field]
81
+ else
82
+ result = option[:name].sub(/^Passenger/, '')
83
+ result[0] = result[0..0].downcase
84
+ result
85
+ end
86
+ end
87
+
88
+ def header_name_for(option)
89
+ if option[:header]
90
+ "!~#{option[:header]}".inspect
91
+ else
92
+ result = option[:name].sub(/^Passenger/, '')
93
+ result.gsub!(/([A-Z])/, '_\1')
94
+ "!~PASSENGER#{result.upcase}".inspect
95
+ end
96
+ end
97
+
98
+ def header_expression_for(option)
99
+ if option[:header_expression]
100
+ option[:header_expression]
101
+ else
102
+ "config->" + struct_field_for(option)
103
+ end
104
+ end
105
+
106
+ main