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
@@ -1,5 +1,5 @@
1
1
  # daemon_controller, library for robust daemon management
2
- # Copyright (c) 2010-2015 Phusion
2
+ # Copyright (c) 2010-2015 Phusion Holding B.V.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -1,16 +1,16 @@
1
1
  # daemon_controller, library for robust daemon management
2
- # Copyright (c) 2010 Phusion
3
- #
2
+ # Copyright (c) 2010 Phusion Holding B.V.
3
+ #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
6
6
  # in the Software without restriction, including without limitation the rights
7
7
  # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
8
  # copies of the Software, and to permit persons to whom the Software is
9
9
  # furnished to do so, subject to the following conditions:
10
- #
10
+ #
11
11
  # The above copyright notice and this permission notice shall be included in
12
12
  # all copies or substantial portions of the Software.
13
- #
13
+ #
14
14
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
15
  # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
16
  # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -1,5 +1,5 @@
1
1
  # daemon_controller, library for robust daemon management
2
- # Copyright (c) 2010-2015 Phusion
2
+ # Copyright (c) 2010-2015 Phusion Holding B.V.
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy
5
5
  # of this software and associated documentation files (the "Software"), to deal
@@ -120,7 +120,7 @@ module UnionStationHooks
120
120
  #
121
121
  # This method should be used for logging exceptions outside the
122
122
  # request-response cycle, e.g. exceptions in threads. If you want to
123
- # log a request that occurred during a request, use
123
+ # log an exception that occurred during a request, use
124
124
  # {RequestReporter#log_exception} instead. That method will also log
125
125
  # any related request-specific information, while this method does not.
126
126
  #
@@ -149,11 +149,11 @@ module UnionStationHooks
149
149
  #
150
150
  # This TimePoint samples monotonic time (with a fallback to wall clock
151
151
  # time) as well as CPU time, time spent in userspace and kernel space,
152
- # time spent context switching, etc. The exact information contained
152
+ # time spent context switching, etc. The exact information contained
153
153
  # in the object is operating system specific, hence the object is opaque.
154
154
  #
155
155
  # You should use it for the various API methods that require timing
156
- # information. Those methods also accept standard Ruby `Time` objects,
156
+ # information. Those methods also accept standard Ruby `Time` objects,
157
157
  # but we strongly recommended against doing this, because wall clock
158
158
  # time can jump forwards and backwards, which may create issues.
159
159
  #
@@ -171,8 +171,8 @@ module UnionStationHooks
171
171
  TimePoint.new(monotime_usec, pt.utime, pt.stime)
172
172
  end
173
173
 
174
- # Returns a best-estimate delta (usec) between the wallclock and
175
- # the monotonic clock (updated every request), such that:
174
+ # Returns a best-estimate delta (usec) between the wallclock and
175
+ # the monotonic clock (updated every request), such that:
176
176
  # time_monotic_usec = time_wallclock_usec - delta
177
177
  def get_delta_monotonic
178
178
  @mono_mutex.synchronize { @delta_monotonic }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: passenger
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.28
4
+ version: 5.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phusion - http://www.phusion.nl/
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-28 00:00:00.000000000 Z
11
+ date: 2016-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -84,6 +84,15 @@ files:
84
84
  - build/support/cplusplus.rb
85
85
  - build/support/cxx_dependency_map.rb
86
86
  - build/support/general.rb
87
+ - build/support/vendor/cxxcodebuilder/CxxCodeBuilder.sublime-project
88
+ - build/support/vendor/cxxcodebuilder/Gemfile
89
+ - build/support/vendor/cxxcodebuilder/Gemfile.lock
90
+ - build/support/vendor/cxxcodebuilder/LICENSE.md
91
+ - build/support/vendor/cxxcodebuilder/README.md
92
+ - build/support/vendor/cxxcodebuilder/Rakefile
93
+ - build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder.rb
94
+ - build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/builder.rb
95
+ - build/support/vendor/cxxcodebuilder/lib/cxxcodebuilder/initializer_builder.rb
87
96
  - build/test_basics.rb
88
97
  - configure
89
98
  - dev/ci/inituidgid
@@ -373,21 +382,21 @@ files:
373
382
  - src/apache2_module/Configuration.h
374
383
  - src/apache2_module/Configuration.hpp
375
384
  - src/apache2_module/ConfigurationCommands.cpp
376
- - src/apache2_module/ConfigurationCommands.cpp.erb
385
+ - src/apache2_module/ConfigurationCommands.cpp.cxxcodebuilder
377
386
  - src/apache2_module/ConfigurationFields.hpp
378
- - src/apache2_module/ConfigurationFields.hpp.erb
387
+ - src/apache2_module/ConfigurationFields.hpp.cxxcodebuilder
379
388
  - src/apache2_module/ConfigurationSetters.cpp
380
- - src/apache2_module/ConfigurationSetters.cpp.erb
389
+ - src/apache2_module/ConfigurationSetters.cpp.cxxcodebuilder
381
390
  - src/apache2_module/CreateDirConfig.cpp
382
- - src/apache2_module/CreateDirConfig.cpp.erb
391
+ - src/apache2_module/CreateDirConfig.cpp.cxxcodebuilder
383
392
  - src/apache2_module/DirectoryMapper.h
384
393
  - src/apache2_module/Hooks.cpp
385
394
  - src/apache2_module/Hooks.h
386
395
  - src/apache2_module/MergeDirConfig.cpp
387
- - src/apache2_module/MergeDirConfig.cpp.erb
396
+ - src/apache2_module/MergeDirConfig.cpp.cxxcodebuilder
388
397
  - src/apache2_module/README.md
389
398
  - src/apache2_module/SetHeaders.cpp
390
- - src/apache2_module/SetHeaders.cpp.erb
399
+ - src/apache2_module/SetHeaders.cpp.cxxcodebuilder
391
400
  - src/apache2_module/mod_passenger.c
392
401
  - src/cxx_supportlib/Algorithms/MovingAverage.h
393
402
  - src/cxx_supportlib/AppTypes.cpp
@@ -395,7 +404,7 @@ files:
395
404
  - src/cxx_supportlib/BackgroundEventLoop.cpp
396
405
  - src/cxx_supportlib/BackgroundEventLoop.h
397
406
  - src/cxx_supportlib/Constants.h
398
- - src/cxx_supportlib/Constants.h.erb
407
+ - src/cxx_supportlib/Constants.h.cxxcodebuilder
399
408
  - src/cxx_supportlib/DataStructures/HashedStaticString.h
400
409
  - src/cxx_supportlib/DataStructures/LString.cpp
401
410
  - src/cxx_supportlib/DataStructures/LString.h
@@ -3425,19 +3434,19 @@ files:
3425
3434
  - src/helper-scripts/rack-preloader.rb
3426
3435
  - src/helper-scripts/wsgi-loader.py
3427
3436
  - src/nginx_module/CacheLocationConfig.c
3428
- - src/nginx_module/CacheLocationConfig.c.erb
3437
+ - src/nginx_module/CacheLocationConfig.c.cxxcodebuilder
3429
3438
  - src/nginx_module/Configuration.c
3430
3439
  - src/nginx_module/Configuration.h
3431
3440
  - src/nginx_module/ConfigurationCommands.c
3432
- - src/nginx_module/ConfigurationCommands.c.erb
3433
- - src/nginx_module/ConfigurationFields.h
3434
- - src/nginx_module/ConfigurationFields.h.erb
3441
+ - src/nginx_module/ConfigurationCommands.c.cxxcodebuilder
3435
3442
  - src/nginx_module/ContentHandler.c
3436
3443
  - src/nginx_module/ContentHandler.h
3437
3444
  - src/nginx_module/CreateLocationConfig.c
3438
- - src/nginx_module/CreateLocationConfig.c.erb
3445
+ - src/nginx_module/CreateLocationConfig.c.cxxcodebuilder
3446
+ - src/nginx_module/LocationConfig.h
3447
+ - src/nginx_module/LocationConfig.h.cxxcodebuilder
3439
3448
  - src/nginx_module/MergeLocationConfig.c
3440
- - src/nginx_module/MergeLocationConfig.c.erb
3449
+ - src/nginx_module/MergeLocationConfig.c.cxxcodebuilder
3441
3450
  - src/nginx_module/README.md
3442
3451
  - src/nginx_module/StaticContentHandler.c
3443
3452
  - src/nginx_module/StaticContentHandler.h
@@ -1,109 +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.cpp is automatically generated from ConfigurationCommands.cpp.erb,
29
- * using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
30
- * Edits to ConfigurationCommands.cpp will be lost.
31
- *
32
- * To update ConfigurationCommands.cpp:
33
- * rake apache2
34
- *
35
- * To force regeneration of ConfigurationCommands.c:
36
- * rm -f src/apache2_module/ConfigurationCommands.cpp
37
- * rake src/apache2_module/ConfigurationCommands.cpp
38
- */
39
-
40
- <%
41
- require 'phusion_passenger/apache2/config_options'
42
-
43
- def resolve_possible_alias(option)
44
- if option[:alias_for]
45
- the_alias = APACHE2_DIRECTORY_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 macro_for(option)
56
- case option[:type]
57
- when :string, :integer
58
- return "AP_INIT_TAKE1"
59
- when :flag
60
- return "AP_INIT_FLAG"
61
- else
62
- raise "Unknown type #{option[:type].inspect} for option #{option[:name].inspect}"
63
- end
64
- end
65
-
66
- def name_for(option)
67
- return (option[:aliased_for] || option[:name]).inspect
68
- end
69
-
70
- def function_type_for(option)
71
- case option[:type]
72
- when :string, :integer
73
- return "Take1Func"
74
- when :flag
75
- return "FlagFunc"
76
- else
77
- raise "Unknown type #{option[:type].inspect}"
78
- end
79
- end
80
-
81
- def function_for(option)
82
- if option[:function]
83
- return option[:function]
84
- else
85
- function_name = option[:name].gsub(/[A-Z]/) do |letter|
86
- "_" + letter[0..0].downcase
87
- end
88
- return "cmd#{function_name}"
89
- end
90
- end
91
-
92
- def context_for(option)
93
- context = option[:context] || ["OR_OPTIONS", "ACCESS_CONF", "RSRC_CONF"]
94
- return context.join(" | ")
95
- end
96
-
97
- def description_for(option)
98
- return option[:desc].inspect
99
- end
100
- %>
101
-
102
- <% for option in APACHE2_DIRECTORY_CONFIGURATION_OPTIONS %>
103
- <% option = resolve_possible_alias(option) %>
104
- <%= macro_for(option) %>(<%= name_for(option) %>,
105
- (<%= function_type_for(option) %>) <%= function_for(option) %>,
106
- NULL,
107
- <%= context_for(option) %>,
108
- <%= description_for(option) %>),
109
- <% end %>
@@ -1,98 +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.hpp is automatically generated from ConfigurationFields.hpp.erb,
29
- * using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
30
- * Edits to ConfigurationFields.hpp will be lost.
31
- *
32
- * To update ConfigurationFields.hpp:
33
- * rake apache2
34
- *
35
- * To force regeneration of ConfigurationFields.hpp:
36
- * rm -f src/apache2_module/ConfigurationFields.hpp
37
- * rake src/apache2_module/ConfigurationFields.hpp
38
- */
39
-
40
- struct GeneratedDirConfigPart {
41
- enum Threeway { ENABLED, DISABLED, UNSET };
42
- <%
43
- require 'phusion_passenger/apache2/config_options'
44
-
45
- def filter_eligible_options(options)
46
- return options.reject do |option|
47
- option[:alias_for] ||
48
- option.fetch(:field, true).nil? ||
49
- option[:field].to_s =~ /\./
50
- end
51
- end
52
-
53
- def struct_field_for(option)
54
- if option.has_key?(:field)
55
- return option[:field]
56
- else
57
- result = option[:name].sub(/^Passenger/, '')
58
- result[0] = result[0..0].downcase
59
- return result
60
- end
61
- end
62
-
63
- # Returns [definition_source, estimated_size_on_x86_64, description]
64
- def definition_for(option)
65
- field = struct_field_for(option)
66
- case option[:type]
67
- when :string
68
- result = ["const char *#{field}", 8 + 4, field, option[:desc]]
69
- when :integer
70
- result = ["int #{field}", 4, field, option[:desc]]
71
- when :flag
72
- result = ["Threeway #{field}", 1, field, option[:desc]]
73
- else
74
- raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}"
75
- end
76
- return result + [option[:desc]]
77
- end
78
-
79
- eligible_options = filter_eligible_options(APACHE2_DIRECTORY_CONFIGURATION_OPTIONS)
80
- definitions = eligible_options.map { |o| definition_for(o) }
81
- # Sort the definitions by size in order to make the struct smaller.
82
- # It's possible to make it even smaller with a smarter algorithm but for now
83
- # I don't bother.
84
- definitions.sort! do |d1, d2|
85
- if d1[1] == d2[1]
86
- # After sorting on size, sort alphabetically.
87
- d1[2] <=> d2[2]
88
- else
89
- d1[1] <=> d2[1]
90
- end
91
- end
92
- %>
93
-
94
- <% for definition in definitions -%>
95
- /** <%= definition[3] %> */
96
- <%= definition[0] %>;
97
- <% end %>
98
- };
@@ -1,128 +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
- * ConfigurationSetters.cpp is automatically generated from ConfigurationSetters.cpp.erb,
29
- * using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
30
- * Edits to ConfigurationSetters.cpp will be lost.
31
- *
32
- * To update ConfigurationSetters.cpp:
33
- * rake apache2
34
- *
35
- * To force regeneration of ConfigurationSetters.cpp:
36
- * rm -f src/apache2_module/ConfigurationSetters.cpp
37
- * rake src/apache2_module/ConfigurationSetters.cpp
38
- */
39
-
40
- <%
41
- require 'phusion_passenger/apache2/config_options'
42
-
43
- def filter_eligible_options(options)
44
- return options.reject do |option|
45
- option[:alias_for] ||
46
- option.fetch(:field, true).nil? ||
47
- option[:field].to_s =~ /\./ ||
48
- option[:function]
49
- end
50
- end
51
-
52
- def struct_field_for(option)
53
- if option.has_key?(:field)
54
- return option[:field]
55
- else
56
- result = option[:name].sub(/^Passenger/, '')
57
- result[0] = result[0..0].downcase
58
- return result
59
- end
60
- end
61
-
62
- def min_value_for(option)
63
- return option[:min_value] || 0
64
- end
65
-
66
- def function_for(option)
67
- function_name = option[:name].gsub(/[A-Z]/) do |letter|
68
- "_" + letter[0..0].downcase
69
- end
70
- return "cmd#{function_name}"
71
- end
72
- %>
73
-
74
- <% for option in filter_eligible_options(APACHE2_DIRECTORY_CONFIGURATION_OPTIONS) -%>
75
- <% if option[:type] == :string %>
76
- static const char *
77
- <%= function_for(option) %>(cmd_parms *cmd, void *pcfg, const char *arg) {
78
- DirConfig *config = (DirConfig *) pcfg;
79
- config-><%= struct_field_for(option) %> = arg;
80
- return NULL;
81
- }
82
- <% elsif option[:type] == :integer %>
83
- static const char *
84
- <%= function_for(option) %>(cmd_parms *cmd, void *pcfg, const char *arg) {
85
- DirConfig *config = (DirConfig *) pcfg;
86
- char *end;
87
- long result;
88
-
89
- result = strtol(arg, &end, 10);
90
- if (*end != '\0') {
91
- string message = "Invalid number specified for ";
92
- message.append(cmd->directive->directive);
93
- message.append(".");
94
-
95
- char *messageStr = (char *) apr_palloc(cmd->temp_pool,
96
- message.size() + 1);
97
- memcpy(messageStr, message.c_str(), message.size() + 1);
98
- return messageStr;
99
- <% if option[:min_value] %>
100
- } else if (result < <%= option[:min_value] %>) {
101
- string message = "Value for ";
102
- message.append(cmd->directive->directive);
103
- message.append(" must be greater than or equal to <%= option[:min_value] %>.");
104
-
105
- char *messageStr = (char *) apr_palloc(cmd->temp_pool,
106
- message.size() + 1);
107
- memcpy(messageStr, message.c_str(), message.size() + 1);
108
- return messageStr;
109
- <% end %>
110
- } else {
111
- config-><%= struct_field_for(option) %> = (int) result;
112
- return NULL;
113
- }
114
- }
115
- <% elsif option[:type] == :flag %>
116
- static const char *
117
- <%= function_for(option) %>(cmd_parms *cmd, void *pcfg, const char *arg) {
118
- DirConfig *config = (DirConfig *) pcfg;
119
- config-><%= struct_field_for(option) %> =
120
- arg ?
121
- DirConfig::ENABLED :
122
- DirConfig::DISABLED;
123
- return NULL;
124
- }
125
- <% else
126
- raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}"
127
- end %>
128
- <% end %>