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
@@ -0,0 +1,140 @@
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
+ * CacheLocationConfig.c is automatically generated from CacheLocationConfig.c.erb,
28
+ * using definitions from lib/phusion_passenger/nginx/config_options.rb.
29
+ * Edits to MergeLocationConfig.c will be lost.
30
+ *
31
+ * To update CacheLocationConfig.c:
32
+ * rake nginx
33
+ *
34
+ * To force regeneration of CacheLocationConfig.c:
35
+ * rm -f ext/nginx/CacheLocationConfig.c
36
+ * rake ext/nginx/CacheLocationConfig.c
37
+ */
38
+
39
+ <%
40
+ require 'phusion_passenger/nginx/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
+ !option.fetch(:header, true)
48
+ end
49
+ end
50
+
51
+ def struct_field_for(option)
52
+ if option.has_key?(:field)
53
+ return option[:field]
54
+ else
55
+ return option[:name].sub(/^passenger_/, '')
56
+ end
57
+ end
58
+
59
+ def header_name_for(option)
60
+ return option[:header] || option[:name].upcase
61
+ end
62
+ %>
63
+
64
+ size_t len = 0;
65
+ u_char int_buf[32], *end, *buf, *pos;
66
+
67
+ /* Calculate lengths */
68
+ <% for option in filter_eligible_options(LOCATION_CONFIGURATION_OPTIONS) %>
69
+ <% if option[:type] == :string %>
70
+ if (conf-><%= struct_field_for(option) %>.data != NULL) {
71
+ len += <%= header_name_for(option).size + 1 %>;
72
+ len += conf-><%= struct_field_for(option) %>.len + 1;
73
+ }
74
+ <% elsif option[:type] == :integer %>
75
+ if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET) {
76
+ end = ngx_snprintf(int_buf,
77
+ sizeof(int_buf) - 1,
78
+ "%d",
79
+ conf-><%= struct_field_for(option) %>);
80
+ len += <%= header_name_for(option).size + 1 %>;
81
+ len += end - int_buf + 1;
82
+ }
83
+ <% elsif option[:type] == :flag %>
84
+ if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET) {
85
+ len += <%= header_name_for(option).size + 1 %>;
86
+ len += conf-><%= struct_field_for(option) %> ? sizeof("true") : sizeof("false");
87
+ }
88
+ <% else %>
89
+ <% raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}" %>
90
+ <% end %>
91
+ <% end %>
92
+
93
+ /* Create string */
94
+ buf = pos = ngx_pnalloc(cf->pool, len);
95
+
96
+ <% for option in filter_eligible_options(LOCATION_CONFIGURATION_OPTIONS) %>
97
+ <% if option[:type] == :string %>
98
+ if (conf-><%= struct_field_for(option) %>.data != NULL) {
99
+ pos = ngx_copy(pos,
100
+ "<%= header_name_for(option) %>",
101
+ <%= header_name_for(option).size + 1 %>);
102
+ pos = ngx_copy(pos,
103
+ conf-><%= struct_field_for(option) %>.data,
104
+ conf-><%= struct_field_for(option) %>.len);
105
+ *pos = '\0';
106
+ pos++;
107
+ }
108
+ <% elsif option[:type] == :integer %>
109
+ if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET) {
110
+ pos = ngx_copy(pos,
111
+ "<%= header_name_for(option) %>",
112
+ <%= header_name_for(option).size + 1 %>);
113
+ end = ngx_snprintf(int_buf,
114
+ sizeof(int_buf) - 1,
115
+ "%d",
116
+ conf-><%= struct_field_for(option) %>);
117
+ pos = ngx_copy(pos,
118
+ int_buf,
119
+ end - int_buf);
120
+ *pos = '\0';
121
+ pos++;
122
+ }
123
+ <% elsif option[:type] == :flag %>
124
+ if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET) {
125
+ pos = ngx_copy(pos,
126
+ "<%= header_name_for(option) %>",
127
+ <%= header_name_for(option).size + 1 %>);
128
+ if (conf-><%= struct_field_for(option) %>) {
129
+ pos = ngx_copy(pos, "true", sizeof("true"));
130
+ } else {
131
+ pos = ngx_copy(pos, "false", sizeof("false"));
132
+ }
133
+ }
134
+ <% else %>
135
+ <% raise "Unknown option type #{option[:type].inspect} for option #{option[:name]}" %>
136
+ <% end %>
137
+ <% end %>
138
+
139
+ conf->options_cache.data = buf;
140
+ conf->options_cache.len = pos - buf;
@@ -163,18 +163,7 @@ passenger_init_main_conf(ngx_conf_t *cf, void *conf_pointer)
163
163
  return "The user specified by the 'default_user' option does not exist.";
164
164
  }
165
165
 
166
- if (conf->default_group.len == 0) {
167
- group_entry = getgrgid(user_entry->pw_gid);
168
- if (group_entry != NULL) {
169
- conf->default_group.len = strlen(group_entry->gr_name);
170
- conf->default_group.data = ngx_palloc(cf->pool, conf->default_group.len + 1);
171
- memcpy(conf->default_group.data, group_entry->gr_name, conf->default_group.len + 1);
172
- } else {
173
- return "The primary group of the user specified by the 'default_user' "
174
- "option does not exist. Your system's user account database is "
175
- "probably broken, please fix it.";
176
- }
177
- } else {
166
+ if (conf->default_group.len > 0) {
178
167
  if (conf->default_group.len > sizeof(buf) - 1) {
179
168
  return "Value for 'default_group' is too long.";
180
169
  }
@@ -242,41 +231,13 @@ passenger_create_loc_conf(ngx_conf_t *cf)
242
231
  * conf->upstream_config.store_values = NULL;
243
232
  */
244
233
 
245
- conf->enabled = NGX_CONF_UNSET;
246
- conf->friendly_error_pages = NGX_CONF_UNSET;
247
- conf->union_station_support = NGX_CONF_UNSET;
248
- conf->debugger = NGX_CONF_UNSET;
249
- conf->show_version_in_header = NGX_CONF_UNSET;
250
- conf->ruby.data = NULL;
251
- conf->ruby.len = 0;
252
- conf->python.data = NULL;
253
- conf->python.len = 0;
254
- conf->environment.data = NULL;
255
- conf->environment.len = 0;
256
- conf->spawn_method.data = NULL;
257
- conf->spawn_method.len = 0;
258
- conf->union_station_key.data = NULL;
259
- conf->union_station_key.len = 0;
260
- conf->user.data = NULL;
261
- conf->user.len = 0;
262
- conf->group.data = NULL;
263
- conf->group.len = 0;
264
- conf->app_group_name.data = NULL;
265
- conf->app_group_name.len = 0;
266
- conf->app_root.data = NULL;
267
- conf->app_root.len = 0;
268
- conf->app_rights.data = NULL;
269
- conf->app_rights.len = 0;
270
- conf->base_uris = NGX_CONF_UNSET_PTR;
271
- conf->union_station_filters = NGX_CONF_UNSET_PTR;
272
- conf->min_instances = NGX_CONF_UNSET;
273
- conf->max_requests = NGX_CONF_UNSET;
274
- conf->max_preloader_idle_time = NGX_CONF_UNSET;
234
+ #include "CreateLocationConfig.c"
275
235
 
276
236
  /******************************/
277
237
  /******************************/
278
238
 
279
- conf->upstream_config.pass_headers = ngx_array_create(cf->pool, 1, sizeof(ngx_keyval_t));
239
+ conf->upstream_config.pass_headers = NGX_CONF_UNSET_PTR;
240
+ conf->upstream_config.hide_headers = NGX_CONF_UNSET_PTR;
280
241
 
281
242
  conf->upstream_config.store = NGX_CONF_UNSET;
282
243
  conf->upstream_config.store_access = NGX_CONF_UNSET_UINT;
@@ -345,6 +306,12 @@ passenger_create_loc_conf(ngx_conf_t *cf)
345
306
  return conf;
346
307
  }
347
308
 
309
+ static void
310
+ cache_loc_conf_options(ngx_conf_t *cf, passenger_loc_conf_t *conf)
311
+ {
312
+ #include "CacheLocationConfig.c"
313
+ }
314
+
348
315
  char *
349
316
  passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
350
317
  {
@@ -354,35 +321,19 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
354
321
  u_char *p;
355
322
  size_t size;
356
323
  uintptr_t *code;
357
- ngx_str_t *header;
358
- ngx_uint_t i, j;
359
- ngx_array_t hide_headers;
324
+ ngx_uint_t i;
360
325
  ngx_str_t *prev_base_uris, *base_uri;
361
326
  ngx_str_t *prev_union_station_filters, *union_station_filter;
362
327
  ngx_keyval_t *src;
363
- ngx_hash_key_t *hk;
364
328
  ngx_hash_init_t hash;
365
329
  ngx_http_script_compile_t sc;
366
330
  ngx_http_script_copy_code_t *copy;
367
331
 
368
- ngx_conf_merge_value(conf->enabled, prev->enabled, 0);
369
- ngx_conf_merge_value(conf->friendly_error_pages, prev->friendly_error_pages, 1);
370
- ngx_conf_merge_value(conf->union_station_support, prev->union_station_support, 0);
371
- ngx_conf_merge_value(conf->debugger, prev->debugger, 0);
372
- ngx_conf_merge_value(conf->show_version_in_header, prev->show_version_in_header, 1);
373
- ngx_conf_merge_str_value(conf->ruby, prev->ruby, NULL);
374
- ngx_conf_merge_str_value(conf->python, prev->python, NULL);
375
- ngx_conf_merge_str_value(conf->environment, prev->environment, "production");
376
- ngx_conf_merge_str_value(conf->spawn_method, prev->spawn_method, "smart");
377
- ngx_conf_merge_str_value(conf->union_station_key, prev->union_station_key, NULL);
378
- ngx_conf_merge_str_value(conf->user, prev->user, "");
379
- ngx_conf_merge_str_value(conf->group, prev->group, "");
380
- ngx_conf_merge_str_value(conf->app_group_name, prev->app_group_name, NULL);
381
- ngx_conf_merge_str_value(conf->app_root, prev->app_root, NULL);
382
- ngx_conf_merge_str_value(conf->app_rights, prev->app_rights, NULL);
383
- ngx_conf_merge_value(conf->min_instances, prev->min_instances, (ngx_int_t) -1);
384
- ngx_conf_merge_value(conf->max_requests, prev->max_requests, (ngx_int_t) -1);
385
- ngx_conf_merge_value(conf->max_preloader_idle_time, prev->max_preloader_idle_time, (ngx_int_t) -1);
332
+ #include "MergeLocationConfig.c"
333
+ if (prev->options_cache.data == NULL) {
334
+ cache_loc_conf_options(cf, prev);
335
+ }
336
+ cache_loc_conf_options(cf, conf);
386
337
 
387
338
  if (prev->base_uris != NGX_CONF_UNSET_PTR) {
388
339
  if (conf->base_uris == NGX_CONF_UNSET_PTR) {
@@ -645,109 +596,17 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
645
596
  prev->upstream_config.intercept_errors, 0);
646
597
 
647
598
 
648
-
649
- if (conf->upstream_config.hide_headers == NULL
650
- && conf->upstream_config.pass_headers == NULL)
651
- {
652
- conf->upstream_config.hide_headers = prev->upstream_config.hide_headers;
653
- conf->upstream_config.pass_headers = prev->upstream_config.pass_headers;
654
- conf->upstream_config.hide_headers_hash = prev->upstream_config.hide_headers_hash;
655
-
656
- if (conf->upstream_config.hide_headers_hash.buckets) {
657
- goto peers;
658
- }
659
-
660
- } else {
661
- if (conf->upstream_config.hide_headers == NULL) {
662
- conf->upstream_config.hide_headers = prev->upstream_config.hide_headers;
663
- }
664
-
665
- if (conf->upstream_config.pass_headers == NULL) {
666
- conf->upstream_config.pass_headers = prev->upstream_config.pass_headers;
667
- }
668
- }
669
-
670
- if (ngx_array_init(&hide_headers, cf->temp_pool, 4, sizeof(ngx_hash_key_t))
671
- != NGX_OK)
672
- {
673
- return NGX_CONF_ERROR;
674
- }
675
-
676
- for (header = headers_to_hide; header->len; header++) {
677
- hk = ngx_array_push(&hide_headers);
678
- if (hk == NULL) {
679
- return NGX_CONF_ERROR;
680
- }
681
-
682
- hk->key = *header;
683
- hk->key_hash = ngx_hash_key_lc(header->data, header->len);
684
- hk->value = (void *) 1;
685
- }
686
-
687
- if (conf->upstream_config.hide_headers) {
688
-
689
- header = conf->upstream_config.hide_headers->elts;
690
-
691
- for (i = 0; i < conf->upstream_config.hide_headers->nelts; i++) {
692
-
693
- hk = hide_headers.elts;
694
-
695
- for (j = 0; j < hide_headers.nelts; j++) {
696
- if (ngx_strcasecmp(header[i].data, hk[j].key.data) == 0) {
697
- goto exist;
698
- }
699
- }
700
-
701
- hk = ngx_array_push(&hide_headers);
702
- if (hk == NULL) {
703
- return NGX_CONF_ERROR;
704
- }
705
-
706
- hk->key = header[i];
707
- hk->key_hash = ngx_hash_key_lc(header[i].data, header[i].len);
708
- hk->value = (void *) 1;
709
-
710
- exist:
711
-
712
- continue;
713
- }
714
- }
715
-
716
- if (conf->upstream_config.pass_headers) {
717
-
718
- hk = hide_headers.elts;
719
- header = conf->upstream_config.pass_headers->elts;
720
-
721
- for (i = 0; i < conf->upstream_config.pass_headers->nelts; i++) {
722
-
723
- for (j = 0; j < hide_headers.nelts; j++) {
724
-
725
- if (hk[j].key.data == NULL) {
726
- continue;
727
- }
728
-
729
- if (ngx_strcasecmp(header[i].data, hk[j].key.data) == 0) {
730
- hk[j].key.data = NULL;
731
- break;
732
- }
733
- }
734
- }
735
- }
736
-
737
- hash.hash = &conf->upstream_config.hide_headers_hash;
738
- hash.key = ngx_hash_key_lc;
739
599
  hash.max_size = 512;
740
600
  hash.bucket_size = ngx_align(64, ngx_cacheline_size);
741
601
  hash.name = "passenger_hide_headers_hash";
742
- hash.pool = cf->pool;
743
- hash.temp_pool = NULL;
744
602
 
745
- if (ngx_hash_init(&hash, hide_headers.elts, hide_headers.nelts) != NGX_OK) {
603
+ if (ngx_http_upstream_hide_headers_hash(cf, &conf->upstream_config,
604
+ &prev->upstream_config, headers_to_hide, &hash)
605
+ != NGX_OK)
606
+ {
746
607
  return NGX_CONF_ERROR;
747
608
  }
748
609
 
749
- peers:
750
-
751
610
  if (conf->upstream_config.upstream == NULL) {
752
611
  conf->upstream_config.upstream = prev->upstream_config.upstream;
753
612
  }
@@ -1092,6 +951,13 @@ const ngx_command_t passenger_commands[] = {
1092
951
  offsetof(passenger_main_conf_t, temp_dir),
1093
952
  NULL },
1094
953
 
954
+ { ngx_string("passenger_pre_start"),
955
+ NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
956
+ ngx_conf_set_str_array_slot,
957
+ NGX_HTTP_MAIN_CONF_OFFSET,
958
+ offsetof(passenger_main_conf_t, prestart_uris),
959
+ NULL },
960
+
1095
961
  { ngx_string("passenger_abort_on_startup_error"),
1096
962
  NGX_HTTP_MAIN_CONF | NGX_CONF_FLAG,
1097
963
  ngx_conf_set_flag_slot,
@@ -1185,298 +1051,8 @@ const ngx_command_t passenger_commands[] = {
1185
1051
 
1186
1052
  /******** Per-location config ********/
1187
1053
 
1188
- { ngx_string("passenger_enabled"),
1189
- NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
1190
- passenger_enabled,
1191
- NGX_HTTP_LOC_CONF_OFFSET,
1192
- 0,
1193
- NULL },
1194
-
1195
- { ngx_string("passenger_ruby"),
1196
- NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1197
- ngx_conf_set_str_slot,
1198
- NGX_HTTP_LOC_CONF_OFFSET,
1199
- offsetof(passenger_loc_conf_t, ruby),
1200
- NULL },
1201
-
1202
- { ngx_string("passenger_python"),
1203
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1204
- ngx_conf_set_str_slot,
1205
- NGX_HTTP_LOC_CONF_OFFSET,
1206
- offsetof(passenger_loc_conf_t, python),
1207
- NULL },
1208
-
1209
- { ngx_string("passenger_friendly_error_pages"),
1210
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
1211
- ngx_conf_set_flag_slot,
1212
- NGX_HTTP_LOC_CONF_OFFSET,
1213
- offsetof(passenger_loc_conf_t, friendly_error_pages),
1214
- NULL },
1215
-
1216
- { ngx_string("passenger_min_instances"),
1217
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1218
- ngx_conf_set_num_slot,
1219
- NGX_HTTP_LOC_CONF_OFFSET,
1220
- offsetof(passenger_loc_conf_t, min_instances),
1221
- NULL },
1222
-
1223
- { ngx_string("passenger_max_requests"),
1224
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1225
- ngx_conf_set_num_slot,
1226
- NGX_HTTP_LOC_CONF_OFFSET,
1227
- offsetof(passenger_loc_conf_t, max_requests),
1228
- NULL },
1229
-
1230
- { ngx_string("passenger_base_uri"),
1231
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1232
- ngx_conf_set_str_array_slot,
1233
- NGX_HTTP_LOC_CONF_OFFSET,
1234
- offsetof(passenger_loc_conf_t, base_uris),
1235
- NULL },
1236
-
1237
- { ngx_string("passenger_user"),
1238
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1239
- ngx_conf_set_str_slot,
1240
- NGX_HTTP_LOC_CONF_OFFSET,
1241
- offsetof(passenger_loc_conf_t, user),
1242
- NULL },
1243
-
1244
- { ngx_string("passenger_group"),
1245
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1246
- ngx_conf_set_str_slot,
1247
- NGX_HTTP_LOC_CONF_OFFSET,
1248
- offsetof(passenger_loc_conf_t, group),
1249
- NULL },
1250
-
1251
- { ngx_string("passenger_app_group_name"),
1252
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
1253
- ngx_conf_set_str_slot,
1254
- NGX_HTTP_LOC_CONF_OFFSET,
1255
- offsetof(passenger_loc_conf_t, app_group_name),
1256
- NULL },
1257
- { ngx_string("passenger_app_root"),
1258
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
1259
- ngx_conf_set_str_slot,
1260
- NGX_HTTP_LOC_CONF_OFFSET,
1261
- offsetof(passenger_loc_conf_t, app_root),
1262
- NULL },
1263
-
1264
- { ngx_string("passenger_app_rights"),
1265
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
1266
- ngx_conf_set_str_slot,
1267
- NGX_HTTP_LOC_CONF_OFFSET,
1268
- offsetof(passenger_loc_conf_t, app_rights),
1269
- NULL },
1270
-
1271
- { ngx_string("union_station_support"),
1272
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
1273
- ngx_conf_set_flag_slot,
1274
- NGX_HTTP_LOC_CONF_OFFSET,
1275
- offsetof(passenger_loc_conf_t, union_station_support),
1276
- NULL },
1277
-
1278
- { ngx_string("union_station_filter"),
1279
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1280
- union_station_filter,
1281
- NGX_HTTP_LOC_CONF_OFFSET,
1282
- offsetof(passenger_loc_conf_t, union_station_filters),
1283
- NULL },
1284
-
1285
- { ngx_string("passenger_debugger"),
1286
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
1287
- ngx_conf_set_flag_slot,
1288
- NGX_HTTP_LOC_CONF_OFFSET,
1289
- offsetof(passenger_loc_conf_t, debugger),
1290
- NULL },
1291
-
1292
- { ngx_string("passenger_show_version_in_header"),
1293
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
1294
- ngx_conf_set_flag_slot,
1295
- NGX_HTTP_LOC_CONF_OFFSET,
1296
- offsetof(passenger_loc_conf_t, show_version_in_header),
1297
- NULL },
1298
-
1299
- { ngx_string("passenger_pre_start"),
1300
- NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
1301
- ngx_conf_set_str_array_slot,
1302
- NGX_HTTP_MAIN_CONF_OFFSET,
1303
- offsetof(passenger_main_conf_t, prestart_uris),
1304
- NULL },
1305
-
1306
- { ngx_string("passenger_max_preloader_idle_time"),
1307
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1308
- ngx_conf_set_num_slot,
1309
- NGX_HTTP_LOC_CONF_OFFSET,
1310
- offsetof(passenger_loc_conf_t, max_preloader_idle_time),
1311
- NULL },
1312
-
1313
- { ngx_string("passenger_ignore_headers"),
1314
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_1MORE,
1315
- ngx_conf_set_bitmask_slot,
1316
- NGX_HTTP_LOC_CONF_OFFSET,
1317
- offsetof(passenger_loc_conf_t, upstream_config.ignore_headers),
1318
- &ngx_http_upstream_ignore_headers_masks },
1319
-
1320
- { ngx_string("passenger_pass_header"),
1321
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1322
- ngx_conf_set_str_array_slot,
1323
- NGX_HTTP_LOC_CONF_OFFSET,
1324
- offsetof(passenger_loc_conf_t, upstream_config.pass_headers),
1325
- NULL },
1326
-
1327
- { ngx_string("passenger_set_cgi_param"),
1328
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE2,
1329
- set_null_terminated_keyval_slot,
1330
- NGX_HTTP_LOC_CONF_OFFSET,
1331
- offsetof(passenger_loc_conf_t, vars_source),
1332
- NULL },
1333
-
1334
- { ngx_string("passenger_ignore_client_abort"),
1335
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_FLAG,
1336
- ngx_conf_set_flag_slot,
1337
- NGX_HTTP_LOC_CONF_OFFSET,
1338
- offsetof(passenger_loc_conf_t, upstream_config.ignore_client_abort),
1339
- NULL },
1340
-
1341
- { ngx_string("passenger_buffer_response"),
1342
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_FLAG,
1343
- ngx_conf_set_flag_slot,
1344
- NGX_HTTP_LOC_CONF_OFFSET,
1345
- offsetof(passenger_loc_conf_t, upstream_config.buffering),
1346
- NULL },
1347
-
1348
- { ngx_string("passenger_buffer_size"),
1349
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_TAKE1,
1350
- ngx_conf_set_size_slot,
1351
- NGX_HTTP_LOC_CONF_OFFSET,
1352
- offsetof(passenger_loc_conf_t, upstream_config.buffer_size),
1353
- NULL },
1354
-
1355
- { ngx_string("passenger_buffers"),
1356
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_TAKE2,
1357
- ngx_conf_set_bufs_slot,
1358
- NGX_HTTP_LOC_CONF_OFFSET,
1359
- offsetof(passenger_loc_conf_t, upstream_config.bufs),
1360
- NULL },
1361
-
1362
- { ngx_string("passenger_busy_buffers_size"),
1363
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_CONF_TAKE1,
1364
- ngx_conf_set_size_slot,
1365
- NGX_HTTP_LOC_CONF_OFFSET,
1366
- offsetof(passenger_loc_conf_t, upstream_config.busy_buffers_size_conf),
1367
- NULL },
1368
-
1369
- { ngx_string("passenger_spawn_method"),
1370
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1371
- ngx_conf_set_str_slot,
1372
- NGX_HTTP_LOC_CONF_OFFSET,
1373
- offsetof(passenger_loc_conf_t, spawn_method),
1374
- NULL },
1375
-
1376
- { ngx_string("union_station_key"),
1377
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1378
- ngx_conf_set_str_slot,
1379
- NGX_HTTP_LOC_CONF_OFFSET,
1380
- offsetof(passenger_loc_conf_t, union_station_key),
1381
- NULL },
1382
-
1383
- { ngx_string("rails_env"),
1384
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1385
- ngx_conf_set_str_slot,
1386
- NGX_HTTP_LOC_CONF_OFFSET,
1387
- offsetof(passenger_loc_conf_t, environment),
1388
- NULL },
1389
-
1390
- { ngx_string("rack_env"),
1391
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1392
- ngx_conf_set_str_slot,
1393
- NGX_HTTP_LOC_CONF_OFFSET,
1394
- offsetof(passenger_loc_conf_t, environment),
1395
- NULL },
1396
-
1397
- /************************************/
1398
-
1399
- { ngx_string("passenger_max_instances"),
1400
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1401
- passenger_enterprise_only,
1402
- NGX_HTTP_LOC_CONF_OFFSET,
1403
- 0,
1404
- NULL },
1405
-
1406
- { ngx_string("passenger_max_request_time"),
1407
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1408
- passenger_enterprise_only,
1409
- NGX_HTTP_LOC_CONF_OFFSET,
1410
- 0,
1411
- NULL },
1412
-
1413
- { ngx_string("passenger_memory_limit"),
1414
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1415
- passenger_enterprise_only,
1416
- NGX_HTTP_LOC_CONF_OFFSET,
1417
- 0,
1418
- NULL },
1419
-
1420
- { ngx_string("passenger_concurrency_model"),
1421
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1422
- passenger_enterprise_only,
1423
- NGX_HTTP_LOC_CONF_OFFSET,
1424
- 0,
1425
- NULL },
1426
-
1427
- { ngx_string("passenger_thread_count"),
1428
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1429
- passenger_enterprise_only,
1430
- NGX_HTTP_LOC_CONF_OFFSET,
1431
- 0,
1432
- NULL },
1433
-
1434
- { ngx_string("passenger_rolling_restarts"),
1435
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
1436
- passenger_enterprise_only,
1437
- NGX_HTTP_LOC_CONF_OFFSET,
1438
- 0,
1439
- NULL },
1440
-
1441
- { ngx_string("passenger_resist_deployment_errors"),
1442
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
1443
- passenger_enterprise_only,
1444
- NGX_HTTP_LOC_CONF_OFFSET,
1445
- 0,
1446
- NULL },
1447
-
1448
- /************************************/
1449
-
1450
- /******** Backward compatibility options ********/
1451
-
1452
- { ngx_string("rails_spawn_method"),
1453
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1454
- ngx_conf_set_str_slot,
1455
- NGX_HTTP_LOC_CONF_OFFSET,
1456
- offsetof(passenger_loc_conf_t, spawn_method),
1457
- NULL },
1458
-
1459
- { ngx_string("rails_framework_spawner_idle_time"),
1460
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1461
- rails_framework_spawner_idle_time,
1462
- NGX_HTTP_LOC_CONF_OFFSET,
1463
- 0,
1464
- NULL },
1465
-
1466
- { ngx_string("rails_app_spawner_idle_time"),
1467
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
1468
- ngx_conf_set_num_slot,
1469
- NGX_HTTP_LOC_CONF_OFFSET,
1470
- offsetof(passenger_loc_conf_t, max_preloader_idle_time),
1471
- NULL },
1472
-
1473
- { ngx_string("passenger_use_global_queue"),
1474
- NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_FLAG,
1475
- passenger_use_global_queue,
1476
- NGX_HTTP_LOC_CONF_OFFSET,
1477
- 0,
1478
- NULL },
1054
+ #include "ConfigurationCommands.c"
1479
1055
 
1480
- ngx_null_command
1056
+ ngx_null_command
1481
1057
  };
1482
1058