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,72 +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
- * CreateDirConfig.cpp is automatically generated from CreateDirConfig.cpp.erb,
29
- * using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
30
- * Edits to CreateDirConfig.cpp will be lost.
31
- *
32
- * To update CreateDirConfig.cpp:
33
- * rake apache2
34
- *
35
- * To force regeneration of CreateDirConfig.cpp:
36
- * rm -f src/apache2_module/CreateDirConfig.cpp
37
- * rake src/apache2_module/CreateDirConfig.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
- end
49
- end
50
-
51
- def struct_field_for(option)
52
- if option.has_key?(:field)
53
- return option[:field]
54
- else
55
- result = option[:name].sub(/^Passenger/, '')
56
- result[0] = result[0..0].downcase
57
- return result
58
- end
59
- end
60
- %>
61
-
62
- <% for option in filter_eligible_options(APACHE2_DIRECTORY_CONFIGURATION_OPTIONS) -%>
63
- <% if option[:type] == :string -%>
64
- config-><%= struct_field_for(option) %> = NULL;
65
- <% elsif option[:type] == :integer -%>
66
- config-><%= struct_field_for(option) %> = UNSET_INT_VALUE;
67
- <% elsif option[:type] == :flag -%>
68
- config-><%= struct_field_for(option) %> = DirConfig::UNSET;
69
- <% else
70
- raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}"
71
- end -%>
72
- <% end %>
@@ -1,82 +0,0 @@
1
- /*
2
- * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010-2013 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
- * MergeDirConfig.cpp is automatically generated from MergeDirConfig.cpp.erb,
29
- * using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
30
- * Edits to MergeDirConfig.cpp will be lost.
31
- *
32
- * To update MergeDirConfig.cpp:
33
- * rake apache2
34
- *
35
- * To force regeneration of MergeDirConfig.cpp:
36
- * rm -f src/apache2_module/MergeDirConfig.cpp
37
- * rake src/apache2_module/MergeDirConfig.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.fetch(:auto_generate_nginx_merge_code, true)
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
-
63
- <% for option in filter_eligible_options(APACHE2_DIRECTORY_CONFIGURATION_OPTIONS) %>
64
- <% if option[:type] == :string %>
65
- config-><%= struct_field_for(option) %> =
66
- (add-><%= struct_field_for(option) %> == NULL) ?
67
- base-><%= struct_field_for(option) %> :
68
- add-><%= struct_field_for(option) %>;
69
- <% elsif option[:type] == :integer %>
70
- config-><%= struct_field_for(option) %> =
71
- (add-><%= struct_field_for(option) %> == UNSET_INT_VALUE) ?
72
- base-><%= struct_field_for(option) %> :
73
- add-><%= struct_field_for(option) %>;
74
- <% elsif option[:type] == :flag %>
75
- config-><%= struct_field_for(option) %> =
76
- (add-><%= struct_field_for(option) %> == DirConfig::UNSET) ?
77
- base-><%= struct_field_for(option) %> :
78
- add-><%= struct_field_for(option) %>;
79
- <% else
80
- raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}"
81
- end %>
82
- <% end %>
@@ -1,91 +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
- * SetHeaders.cpp is automatically generated from SetHeaders.cpp.erb,
29
- * using definitions from src/ruby_supportlib/phusion_passenger/apache2/config_options.rb.
30
- * Edits to SetHeaders.cpp will be lost.
31
- *
32
- * To update SetHeaders.cpp:
33
- * rake apache2
34
- *
35
- * To force regeneration of SetHeaders.cpp:
36
- * rm -f src/apache2_module/SetHeaders.cpp
37
- * rake src/apache2_module/SetHeaders.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.has_key?(:header) && !option[:header])
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 header_name_for(option)
63
- if option[:header]
64
- return "!~#{option[:header]}".inspect
65
- else
66
- result = option[:name].sub(/^Passenger/, '')
67
- result.gsub!(/([A-Z])/, '_\1')
68
- return "!~PASSENGER#{result.upcase}".inspect
69
- end
70
- end
71
-
72
- def header_expression_for(option)
73
- if option[:header_expression]
74
- return option[:header_expression]
75
- else
76
- return "config->" + struct_field_for(option)
77
- end
78
- end
79
- %>
80
-
81
- <% for option in filter_eligible_options(APACHE2_DIRECTORY_CONFIGURATION_OPTIONS) %>
82
- <% if option[:type] == :string || option[:type] == :flag %>
83
- addHeader(result, StaticString(<%= header_name_for(option) %>,
84
- sizeof(<%= header_name_for(option) %>) - 1), <%= header_expression_for(option) %>);
85
- <% elsif option[:type] == :integer %>
86
- addHeader(r, result, StaticString(<%= header_name_for(option) %>,
87
- sizeof(<%= header_name_for(option) %>) - 1), <%= header_expression_for(option) %>);
88
- <% else %>
89
- <% raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}" %>
90
- <% end %>
91
- <% end %>
@@ -1,41 +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
- #ifndef _PASSENGER_CONSTANTS_H_
27
- #define _PASSENGER_CONSTANTS_H_
28
-
29
- /* Constants.h is automatically generated from Constants.h.erb by the build system.
30
- * Most constants are derived from src/ruby_supportlib/phusion_passenger/constants.rb.
31
- *
32
- * To force regenerating this file:
33
- * rm -f src/cxx_supportlib/Constants.h
34
- * rake src/cxx_supportlib/Constants.h
35
- */
36
-
37
- <% for constant_name in PhusionPassenger::SharedConstants.constants.sort %>
38
- #define <%= constant_name %> <%=PhusionPassenger::SharedConstants.const_get(constant_name).inspect %>
39
- <% end %>
40
-
41
- #endif /* _PASSENGER_CONSTANTS_H */
@@ -1,171 +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
- * CacheLocationConfig.c is automatically generated from CacheLocationConfig.c.erb,
29
- * using definitions from src/ruby_supportlib/phusion_passenger/nginx/config_options.rb.
30
- * Edits to CacheLocationConfig.c will be lost.
31
- *
32
- * To update CacheLocationConfig.c:
33
- * rake nginx
34
- *
35
- * To force regeneration of CacheLocationConfig.c:
36
- * rm -f src/nginx_module/CacheLocationConfig.c
37
- * rake src/nginx_module/CacheLocationConfig.c
38
- */
39
-
40
- <%
41
- require 'phusion_passenger/nginx/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.fetch(:header, true)
49
- end
50
- end
51
-
52
- def struct_field_for(option)
53
- if option.has_key?(:field)
54
- return option[:field]
55
- else
56
- return option[:name].sub(/^passenger_/, '')
57
- end
58
- end
59
-
60
- def header_name_for(option)
61
- return option[:header] || option[:name].upcase
62
- end
63
- %>
64
-
65
- /* 0: NGX_ERROR, 1: OK */
66
- int generated_cache_location_part(ngx_conf_t *cf, passenger_loc_conf_t *conf) {
67
- size_t len = 0;
68
- u_char int_buf[32], *end, *buf, *pos;
69
-
70
- /* Calculate lengths */
71
- <% for option in filter_eligible_options(LOCATION_CONFIGURATION_OPTIONS) %>
72
- <% if option[:type] == :string %>
73
- if (conf-><%= struct_field_for(option) %>.data != NULL) {
74
- len += sizeof("!~<%= header_name_for(option) %>: ") - 1;
75
- len += conf-><%= struct_field_for(option) %>.len;
76
- len += sizeof("\r\n") - 1;
77
- }
78
- <% elsif option[:type] == :integer %>
79
- if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET) {
80
- end = ngx_snprintf(int_buf,
81
- sizeof(int_buf) - 1,
82
- "%d",
83
- conf-><%= struct_field_for(option) %>);
84
- len += sizeof("!~<%= header_name_for(option) %>: ") - 1;
85
- len += end - int_buf;
86
- len += sizeof("\r\n") - 1;
87
- }
88
- <% elsif option[:type] == :uinteger %>
89
- if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET_UINT) {
90
- end = ngx_snprintf(int_buf,
91
- sizeof(int_buf) - 1,
92
- "%ui",
93
- conf-><%= struct_field_for(option) %>);
94
- len += sizeof("!~<%= header_name_for(option) %>: ") - 1;
95
- len += end - int_buf;
96
- len += sizeof("\r\n") - 1;
97
- }
98
- <% elsif option[:type] == :flag %>
99
- if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET) {
100
- len += sizeof("!~<%= header_name_for(option) %>: ") - 1;
101
- len += conf-><%= struct_field_for(option) %>
102
- ? sizeof("t\r\n") - 1
103
- : sizeof("f\r\n") - 1;
104
- }
105
- <% else %>
106
- <% raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}" %>
107
- <% end %>
108
- <% end %>
109
-
110
- /* Create string */
111
- buf = pos = ngx_pnalloc(cf->pool, len);
112
- if (buf == NULL) {
113
- return 0;
114
- }
115
-
116
- <% for option in filter_eligible_options(LOCATION_CONFIGURATION_OPTIONS) %>
117
- <% if option[:type] == :string %>
118
- if (conf-><%= struct_field_for(option) %>.data != NULL) {
119
- pos = ngx_copy(pos,
120
- "!~<%= header_name_for(option) %>: ",
121
- sizeof("!~<%= header_name_for(option) %>: ") - 1);
122
- pos = ngx_copy(pos,
123
- conf-><%= struct_field_for(option) %>.data,
124
- conf-><%= struct_field_for(option) %>.len);
125
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
126
- }
127
- <% elsif option[:type] == :integer %>
128
- if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET) {
129
- pos = ngx_copy(pos,
130
- "!~<%= header_name_for(option) %>: ",
131
- sizeof("!~<%= header_name_for(option) %>: ") - 1);
132
- end = ngx_snprintf(int_buf,
133
- sizeof(int_buf) - 1,
134
- "%d",
135
- conf-><%= struct_field_for(option) %>);
136
- pos = ngx_copy(pos, int_buf, end - int_buf);
137
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
138
- }
139
- <% elsif option[:type] == :uinteger %>
140
- if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET_UINT) {
141
- pos = ngx_copy(pos,
142
- "!~<%= header_name_for(option) %>: ",
143
- sizeof("!~<%= header_name_for(option) %>: ") - 1);
144
- end = ngx_snprintf(int_buf,
145
- sizeof(int_buf) - 1,
146
- "%ui",
147
- conf-><%= struct_field_for(option) %>);
148
- pos = ngx_copy(pos, int_buf, end - int_buf);
149
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
150
- }
151
- <% elsif option[:type] == :flag %>
152
- if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET) {
153
- pos = ngx_copy(pos,
154
- "!~<%= header_name_for(option) %>: ",
155
- sizeof("!~<%= header_name_for(option) %>: ") - 1);
156
- if (conf-><%= struct_field_for(option) %>) {
157
- pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
158
- } else {
159
- pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
160
- }
161
- }
162
- <% else %>
163
- <% raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}" %>
164
- <% end %>
165
- <% end %>
166
-
167
- conf->options_cache.data = buf;
168
- conf->options_cache.len = pos - buf;
169
-
170
- return 1;
171
- }