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
@@ -125,6 +125,8 @@ void mbuf_block_put(struct mbuf_block *mbuf_block);
125
125
  void mbuf_block_ref(struct mbuf_block *mbuf_block);
126
126
  void mbuf_block_unref(struct mbuf_block *mbuf_block);
127
127
 
128
+ void _mbuf_block_assert_refcount_at_least_two(struct mbuf_block *mbuf_block);
129
+
128
130
 
129
131
  /* A subset of an mbuf_block. */
130
132
  class mbuf {
@@ -132,9 +134,12 @@ private:
132
134
  BOOST_COPYABLE_AND_MOVABLE(mbuf)
133
135
 
134
136
  void initialize_with_block(unsigned int start, unsigned int len);
135
- void initialize_with_mbuf(const mbuf &mbuf, unsigned int start, unsigned int len);
137
+ void initialize_with_block_just_created(unsigned int start, unsigned int len);
138
+ void initialize_with_mbuf(const mbuf &other, unsigned int start, unsigned int len);
136
139
 
137
140
  public:
141
+ struct just_created_t { };
142
+
138
143
  struct mbuf_block *mbuf_block; /* container block */
139
144
  char *start; /* start of subset (const) */
140
145
  char *end; /* end of subset (const) */
@@ -157,6 +162,13 @@ public:
157
162
  initialize_with_block(start, len);
158
163
  }
159
164
 
165
+ explicit mbuf(struct mbuf_block *block, unsigned int start, unsigned int len,
166
+ const just_created_t &t)
167
+ : mbuf_block(block)
168
+ {
169
+ initialize_with_block_just_created(start, len);
170
+ }
171
+
160
172
  // Create an mbuf as a dumb wrapper around a memory buffer.
161
173
  explicit mbuf(const char *data, unsigned int len)
162
174
  : mbuf_block(NULL),
@@ -199,39 +211,52 @@ public:
199
211
  }
200
212
 
201
213
  // Copy assignment.
202
- mbuf &operator=(BOOST_COPY_ASSIGN_REF(mbuf) mbuf) {
203
- if (&mbuf != this) {
204
- struct mbuf_block *old_block = mbuf_block;
214
+ mbuf &operator=(BOOST_COPY_ASSIGN_REF(mbuf) other) {
215
+ if (&other != this) {
216
+ #ifndef NDEBUG
217
+ if (mbuf_block != NULL && mbuf_block == other.mbuf_block) {
218
+ _mbuf_block_assert_refcount_at_least_two(mbuf_block);
219
+ }
220
+ #endif
221
+
222
+ if (mbuf_block != NULL) {
223
+ mbuf_block_unref(mbuf_block);
224
+ }
205
225
 
206
- mbuf_block = mbuf.mbuf_block;
207
- start = mbuf.start;
208
- end = mbuf.end;
226
+ mbuf_block = other.mbuf_block;
227
+ start = other.start;
228
+ end = other.end;
209
229
 
210
- if (mbuf.mbuf_block != NULL) {
211
- mbuf_block_ref(mbuf.mbuf_block);
212
- }
213
- if (old_block != NULL) {
214
- mbuf_block_unref(old_block);
230
+ // We reference 'other.mbuf_block' instead of 'this->mbuf_block' as
231
+ // a micro-optimization. This should decrease the number of data
232
+ // dependencies and allow the CPU to reorder the instructions better.
233
+ if (other.mbuf_block != NULL) {
234
+ mbuf_block_ref(other.mbuf_block);
215
235
  }
216
236
  }
217
237
  return *this;
218
238
  }
219
239
 
220
240
  // Move assignment.
221
- mbuf &operator=(BOOST_RV_REF(mbuf) mbuf) {
222
- if (&mbuf != this) {
223
- struct mbuf_block *old_block = mbuf_block;
224
-
225
- mbuf_block = mbuf.mbuf_block;
226
- start = mbuf.start;
227
- end = mbuf.end;
228
- mbuf.mbuf_block = NULL;
229
- mbuf.start = NULL;
230
- mbuf.end = NULL;
231
-
232
- if (old_block != NULL) {
233
- mbuf_block_unref(old_block);
241
+ mbuf &operator=(BOOST_RV_REF(mbuf) other) {
242
+ if (&other != this) {
243
+ #ifndef NDEBUG
244
+ if (mbuf_block != NULL && mbuf_block == other.mbuf_block) {
245
+ _mbuf_block_assert_refcount_at_least_two(mbuf_block);
246
+ }
247
+ #endif
248
+
249
+ if (mbuf_block != NULL) {
250
+ mbuf_block_unref(mbuf_block);
234
251
  }
252
+
253
+ mbuf_block = other.mbuf_block;
254
+ start = other.start;
255
+ end = other.end;
256
+
257
+ other.mbuf_block = NULL;
258
+ other.start = NULL;
259
+ other.end = NULL;
235
260
  }
236
261
  return *this;
237
262
  }
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2014 Phusion Holding B.V.
3
+ * Copyright (c) 2014-2016 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -83,6 +83,14 @@ findCookie(psg_pool_t *pool, const LString *cookieHeaderValue, const LString *na
83
83
  return result;
84
84
  }
85
85
 
86
+ /**
87
+ * Search an LString, starting from the given part and the given index inside that part,
88
+ * for the cookie separator character ('='). Will keep iterating to the next parts
89
+ * until found or until the end of the LString is reached.
90
+ *
91
+ * The part in which the separator character is found is written to `*separatorPart`,
92
+ * and the index inside that part is written to `*separatorIndex`.
93
+ */
86
94
  inline bool
87
95
  findCookieNameValueSeparator(const LString::Part *part, size_t index,
88
96
  const LString::Part **separatorPart, size_t *separatorIndex)
@@ -108,6 +116,15 @@ findCookieNameValueSeparator(const LString::Part *part, size_t index,
108
116
  return result;
109
117
  }
110
118
 
119
+ /**
120
+ * Given an LString and an offset inside that LString containing a cookie separator
121
+ * character (as provided by `separatorPart` and `separatorIndex`), search for the
122
+ * end of that cookie. The end of the cookie is denoted by either the ';' character
123
+ * or by end-of-string. Will keep iterating to the next parts until the end is found.
124
+ *
125
+ * The part in which the end is found is written to `*endPart`,
126
+ * and the index inside that part is written to `*endIndex`.
127
+ */
111
128
  inline bool
112
129
  findCookieEnd(const LString::Part *separatorPart, size_t separatorIndex,
113
130
  const LString::Part **endPart, size_t *endIndex)
@@ -145,6 +162,10 @@ findCookieEnd(const LString::Part *separatorPart, size_t separatorIndex,
145
162
  return result;
146
163
  }
147
164
 
165
+ /**
166
+ * Given an LString containing a cookie name, skip all leading whitespace
167
+ * by modifying the LString in-place.
168
+ */
148
169
  inline void
149
170
  _matchCookieName_skipWhitespace(LString *str) {
150
171
  LString::Part *part = str->start;
@@ -152,7 +173,9 @@ _matchCookieName_skipWhitespace(LString *str) {
152
173
  bool done = false;
153
174
 
154
175
  while (!done) {
155
- while (part->data[pos] == ' ' || part->data[pos] == ';') {
176
+ while (pos < part->size
177
+ && (part->data[pos] == ' ' || part->data[pos] == ';'))
178
+ {
156
179
  pos++;
157
180
  }
158
181
 
@@ -160,10 +183,11 @@ _matchCookieName_skipWhitespace(LString *str) {
160
183
  str->start = part->next;
161
184
  str->size -= part->size;
162
185
  part = part->next;
186
+ pos = 0;
163
187
  if (part == NULL) {
164
188
  assert(str->size == 0);
165
189
  done = true;
166
- str->end = NULL;
190
+ psg_lstr_init(str);
167
191
  }
168
192
  } else {
169
193
  part->data += pos;
@@ -174,6 +198,13 @@ _matchCookieName_skipWhitespace(LString *str) {
174
198
  }
175
199
  }
176
200
 
201
+ /**
202
+ * Checks whether a substring of an LString matches `name`.
203
+ * The substring is assumed to start in part `part` at index `index`.
204
+ * The substring is assumed to end in part `separatorPart` at index
205
+ * `separatorIndex` (which is supposed to contain the cookie name-value
206
+ * separator character '=').
207
+ */
177
208
  inline bool
178
209
  matchCookieName(psg_pool_t *pool, const LString::Part *part, size_t index,
179
210
  const LString::Part *separatorPart, size_t separatorIndex,
@@ -182,6 +213,8 @@ matchCookieName(psg_pool_t *pool, const LString::Part *part, size_t index,
182
213
  LString *str = (LString *) psg_palloc(pool, sizeof(LString));
183
214
  psg_lstr_init(str);
184
215
 
216
+ // Construct the specified substring so that we can use
217
+ // psg_lstr_cmp() to compare that with `name`.
185
218
  if (part == separatorPart) {
186
219
  assert(index < separatorIndex);
187
220
  psg_lstr_append(str, pool,
@@ -290,14 +290,8 @@ public:
290
290
  } else {
291
291
  psg_lstr_append(&cell->header->val, pool, ",", 1);
292
292
  }
293
- LString::Part *part = header->val.start;
294
- header->val.start = NULL;
295
- header->val.size = 0;
296
- while (part != NULL) {
297
- LString::Part *next = part->next;
298
- psg_lstr_append_part(&cell->header->val, part);
299
- part = next;
300
- }
293
+ psg_lstr_move_and_append(&header->val, pool,
294
+ &cell->header->val);
301
295
  psg_lstr_deinit(&header->key);
302
296
  psg_lstr_deinit(&header->origKey);
303
297
  *headerPtr = NULL;
@@ -544,15 +544,6 @@ private:
544
544
 
545
545
  /***** Miscellaneous *****/
546
546
 
547
- char *appendLStringData(char *pos, const char *end, const LString *lstr) {
548
- const LString::Part *part = lstr->start;
549
- while (part != NULL) {
550
- pos = appendData(pos, end, part->data, part->size);
551
- part = part->next;
552
- }
553
- return pos;
554
- }
555
-
556
547
  void writeDefault500Response(Client *client, Request *req) {
557
548
  writeSimpleResponse(client, 500, NULL, DEFAULT_INTERNAL_SERVER_ERROR_RESPONSE);
558
549
  }
@@ -1062,7 +1053,7 @@ public:
1062
1053
  pos = appendData(pos, end, P_STATIC_STRING("Content-Type: text/html; charset=UTF-8\r\n"));
1063
1054
  } else {
1064
1055
  pos = appendData(pos, end, P_STATIC_STRING("Content-Type: "));
1065
- pos = appendLStringData(pos, end, value);
1056
+ pos = appendData(pos, end, value);
1066
1057
  pos = appendData(pos, end, P_STATIC_STRING("\r\n"));
1067
1058
  }
1068
1059
 
@@ -1074,7 +1065,7 @@ public:
1074
1065
  gmtime_r(&the_time, &the_tm);
1075
1066
  pos += strftime(pos, end - pos, "%a, %d %b %Y %H:%M:%S %z", &the_tm);
1076
1067
  } else {
1077
- pos = appendLStringData(pos, end, value);
1068
+ pos = appendData(pos, end, value);
1078
1069
  }
1079
1070
  pos = appendData(pos, end, P_STATIC_STRING("\r\n"));
1080
1071
 
@@ -1087,7 +1078,7 @@ public:
1087
1078
  }
1088
1079
  } else {
1089
1080
  pos = appendData(pos, end, P_STATIC_STRING("Connection: "));
1090
- pos = appendLStringData(pos, end, value);
1081
+ pos = appendData(pos, end, value);
1091
1082
  pos = appendData(pos, end, P_STATIC_STRING("\r\n"));
1092
1083
  if (!psg_lstr_cmp(value, P_STATIC_STRING("Keep-Alive"))
1093
1084
  && !psg_lstr_cmp(value, P_STATIC_STRING("keep-alive")))
@@ -1101,7 +1092,7 @@ public:
1101
1092
  if (value == NULL) {
1102
1093
  pos += snprintf(pos, end - pos, "%u", (unsigned int) body.size());
1103
1094
  } else {
1104
- pos = appendLStringData(pos, end, value);
1095
+ pos = appendData(pos, end, value);
1105
1096
  }
1106
1097
  pos = appendData(pos, end, P_STATIC_STRING("\r\n"));
1107
1098
 
@@ -1113,9 +1104,9 @@ public:
1113
1104
  && !psg_lstr_cmp(&it->header->key, P_STATIC_STRING("connection"))
1114
1105
  && !psg_lstr_cmp(&it->header->key, P_STATIC_STRING("content-length")))
1115
1106
  {
1116
- pos = appendLStringData(pos, end, &it->header->origKey);
1107
+ pos = appendData(pos, end, &it->header->origKey);
1117
1108
  pos = appendData(pos, end, P_STATIC_STRING(": "));
1118
- pos = appendLStringData(pos, end, &it->header->val);
1109
+ pos = appendData(pos, end, &it->header->val);
1119
1110
  pos = appendData(pos, end, P_STATIC_STRING("\r\n"));
1120
1111
  }
1121
1112
  it.next();
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010-2015 Phusion Holding B.V.
3
+ * Copyright (c) 2010-2016 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -41,16 +41,16 @@ psg_variant_map_new() {
41
41
  return (PsgVariantMap *) new Passenger::VariantMap();
42
42
  }
43
43
 
44
- const char *
44
+ char *
45
45
  psg_variant_map_get_optional(PsgVariantMap *m,
46
46
  const char *name)
47
47
  {
48
48
  Passenger::VariantMap *vm = (Passenger::VariantMap *) m;
49
49
  string result = vm->get(name, false, "");
50
50
  if (result.empty()) {
51
- return (const char *) NULL;
51
+ return (char *) NULL;
52
52
  }
53
- return result.c_str();
53
+ return strdup(result.c_str());
54
54
  }
55
55
 
56
56
  void
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010-2015 Phusion Holding B.V.
3
+ * Copyright (c) 2010-2016 Phusion Holding B.V.
4
4
  *
5
5
  * "Passenger", "Phusion Passenger" and "Union Station" are registered
6
6
  * trademarks of Phusion Holding B.V.
@@ -45,8 +45,7 @@ typedef void PsgVariantMap;
45
45
  typedef void (*PsgAfterForkCallback)(void *, void *);
46
46
 
47
47
  PsgVariantMap *psg_variant_map_new();
48
- const char *
49
- psg_variant_map_get_optional(PsgVariantMap *m,
48
+ char *psg_variant_map_get_optional(PsgVariantMap *m,
50
49
  const char *name);
51
50
  void psg_variant_map_set(PsgVariantMap *m,
52
51
  const char *name,
@@ -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
- * CacheLocationConfig.c is automatically generated from CacheLocationConfig.c.erb,
28
+ * CacheLocationConfig.c is automatically generated from CacheLocationConfig.c.cxxcodebuilder,
29
29
  * using definitions from src/ruby_supportlib/phusion_passenger/nginx/config_options.rb.
30
30
  * Edits to CacheLocationConfig.c will be lost.
31
31
  *
@@ -36,765 +36,608 @@
36
36
  * rm -f src/nginx_module/CacheLocationConfig.c
37
37
  * rake src/nginx_module/CacheLocationConfig.c
38
38
  */
39
-
40
-
41
-
42
- /* 0: NGX_ERROR, 1: OK */
43
- int generated_cache_location_part(ngx_conf_t *cf, passenger_loc_conf_t *conf) {
44
- size_t len = 0;
45
- u_char int_buf[32], *end, *buf, *pos;
46
-
47
- /* Calculate lengths */
48
-
49
-
50
- if (conf->socket_backlog != NGX_CONF_UNSET) {
51
- end = ngx_snprintf(int_buf,
52
- sizeof(int_buf) - 1,
53
- "%d",
54
- conf->socket_backlog);
55
- len += sizeof("!~PASSENGER_SOCKET_BACKLOG: ") - 1;
56
- len += end - int_buf;
57
- len += sizeof("\r\n") - 1;
58
- }
59
-
60
-
61
-
62
- if (conf->core_file_descriptor_ulimit != NGX_CONF_UNSET_UINT) {
63
- end = ngx_snprintf(int_buf,
64
- sizeof(int_buf) - 1,
65
- "%ui",
66
- conf->core_file_descriptor_ulimit);
67
- len += sizeof("!~PASSENGER_CORE_FILE_DESCRIPTOR_ULIMIT: ") - 1;
68
- len += end - int_buf;
69
- len += sizeof("\r\n") - 1;
70
- }
71
-
72
-
73
-
74
- if (conf->app_file_descriptor_ulimit != NGX_CONF_UNSET_UINT) {
75
- end = ngx_snprintf(int_buf,
76
- sizeof(int_buf) - 1,
77
- "%ui",
78
- conf->app_file_descriptor_ulimit);
79
- len += sizeof("!~PASSENGER_APP_FILE_DESCRIPTOR_ULIMIT: ") - 1;
80
- len += end - int_buf;
81
- len += sizeof("\r\n") - 1;
82
- }
83
-
84
-
85
-
86
- if (conf->ruby.data != NULL) {
87
- len += sizeof("!~PASSENGER_RUBY: ") - 1;
88
- len += conf->ruby.len;
89
- len += sizeof("\r\n") - 1;
90
- }
91
-
92
-
93
-
94
- if (conf->python.data != NULL) {
95
- len += sizeof("!~PASSENGER_PYTHON: ") - 1;
96
- len += conf->python.len;
97
- len += sizeof("\r\n") - 1;
98
- }
99
-
100
-
101
-
102
- if (conf->nodejs.data != NULL) {
103
- len += sizeof("!~PASSENGER_NODEJS: ") - 1;
104
- len += conf->nodejs.len;
105
- len += sizeof("\r\n") - 1;
106
- }
107
-
108
-
109
-
110
- if (conf->meteor_app_settings.data != NULL) {
111
- len += sizeof("!~PASSENGER_METEOR_APP_SETTINGS: ") - 1;
112
- len += conf->meteor_app_settings.len;
113
- len += sizeof("\r\n") - 1;
114
- }
115
-
116
-
117
-
118
- if (conf->environment.data != NULL) {
119
- len += sizeof("!~PASSENGER_APP_ENV: ") - 1;
120
- len += conf->environment.len;
121
- len += sizeof("\r\n") - 1;
122
- }
123
-
124
-
125
-
126
- if (conf->friendly_error_pages != NGX_CONF_UNSET) {
127
- len += sizeof("!~PASSENGER_FRIENDLY_ERROR_PAGES: ") - 1;
128
- len += conf->friendly_error_pages
129
- ? sizeof("t\r\n") - 1
130
- : sizeof("f\r\n") - 1;
131
- }
132
-
133
-
134
-
135
- if (conf->min_instances != NGX_CONF_UNSET) {
136
- end = ngx_snprintf(int_buf,
137
- sizeof(int_buf) - 1,
138
- "%d",
139
- conf->min_instances);
140
- len += sizeof("!~PASSENGER_MIN_PROCESSES: ") - 1;
141
- len += end - int_buf;
142
- len += sizeof("\r\n") - 1;
143
- }
144
-
145
-
146
-
147
- if (conf->max_instances_per_app != NGX_CONF_UNSET) {
148
- end = ngx_snprintf(int_buf,
149
- sizeof(int_buf) - 1,
150
- "%d",
151
- conf->max_instances_per_app);
152
- len += sizeof("!~PASSENGER_MAX_PROCESSES: ") - 1;
153
- len += end - int_buf;
154
- len += sizeof("\r\n") - 1;
155
- }
156
-
157
-
158
-
159
- if (conf->max_requests != NGX_CONF_UNSET) {
160
- end = ngx_snprintf(int_buf,
161
- sizeof(int_buf) - 1,
162
- "%d",
163
- conf->max_requests);
164
- len += sizeof("!~PASSENGER_MAX_REQUESTS: ") - 1;
165
- len += end - int_buf;
166
- len += sizeof("\r\n") - 1;
167
- }
168
-
169
-
170
-
171
- if (conf->start_timeout != NGX_CONF_UNSET) {
172
- end = ngx_snprintf(int_buf,
173
- sizeof(int_buf) - 1,
174
- "%d",
175
- conf->start_timeout);
176
- len += sizeof("!~PASSENGER_START_TIMEOUT: ") - 1;
177
- len += end - int_buf;
178
- len += sizeof("\r\n") - 1;
179
- }
180
-
181
-
182
-
183
- if (conf->user.data != NULL) {
184
- len += sizeof("!~PASSENGER_USER: ") - 1;
185
- len += conf->user.len;
186
- len += sizeof("\r\n") - 1;
187
- }
188
-
189
-
190
-
191
- if (conf->group.data != NULL) {
192
- len += sizeof("!~PASSENGER_GROUP: ") - 1;
193
- len += conf->group.len;
194
- len += sizeof("\r\n") - 1;
195
- }
196
-
197
-
198
-
199
- if (conf->app_group_name.data != NULL) {
200
- len += sizeof("!~PASSENGER_APP_GROUP_NAME: ") - 1;
201
- len += conf->app_group_name.len;
202
- len += sizeof("\r\n") - 1;
203
- }
204
-
205
-
206
-
207
- if (conf->app_root.data != NULL) {
208
- len += sizeof("!~PASSENGER_APP_ROOT: ") - 1;
209
- len += conf->app_root.len;
210
- len += sizeof("\r\n") - 1;
211
- }
212
-
213
-
214
-
215
- if (conf->app_rights.data != NULL) {
216
- len += sizeof("!~PASSENGER_APP_RIGHTS: ") - 1;
217
- len += conf->app_rights.len;
218
- len += sizeof("\r\n") - 1;
219
- }
220
-
221
-
222
-
223
- if (conf->union_station_support != NGX_CONF_UNSET) {
224
- len += sizeof("!~UNION_STATION_SUPPORT: ") - 1;
225
- len += conf->union_station_support
226
- ? sizeof("t\r\n") - 1
227
- : sizeof("f\r\n") - 1;
228
- }
229
-
230
-
231
-
232
- if (conf->debugger != NGX_CONF_UNSET) {
233
- len += sizeof("!~PASSENGER_DEBUGGER: ") - 1;
234
- len += conf->debugger
235
- ? sizeof("t\r\n") - 1
236
- : sizeof("f\r\n") - 1;
237
- }
238
-
239
-
240
-
241
- if (conf->max_preloader_idle_time != NGX_CONF_UNSET) {
242
- end = ngx_snprintf(int_buf,
243
- sizeof(int_buf) - 1,
244
- "%d",
245
- conf->max_preloader_idle_time);
246
- len += sizeof("!~PASSENGER_MAX_PRELOADER_IDLE_TIME: ") - 1;
247
- len += end - int_buf;
248
- len += sizeof("\r\n") - 1;
249
- }
250
-
251
-
252
-
253
- if (conf->spawn_method.data != NULL) {
254
- len += sizeof("!~PASSENGER_SPAWN_METHOD: ") - 1;
255
- len += conf->spawn_method.len;
256
- len += sizeof("\r\n") - 1;
257
- }
258
-
259
-
260
-
261
- if (conf->load_shell_envvars != NGX_CONF_UNSET) {
262
- len += sizeof("!~PASSENGER_LOAD_SHELL_ENVVARS: ") - 1;
263
- len += conf->load_shell_envvars
264
- ? sizeof("t\r\n") - 1
265
- : sizeof("f\r\n") - 1;
266
- }
267
-
268
-
269
-
270
- if (conf->union_station_key.data != NULL) {
271
- len += sizeof("!~UNION_STATION_KEY: ") - 1;
272
- len += conf->union_station_key.len;
273
- len += sizeof("\r\n") - 1;
274
- }
275
-
276
-
277
-
278
- if (conf->max_request_queue_size != NGX_CONF_UNSET) {
279
- end = ngx_snprintf(int_buf,
280
- sizeof(int_buf) - 1,
281
- "%d",
282
- conf->max_request_queue_size);
283
- len += sizeof("!~PASSENGER_MAX_REQUEST_QUEUE_SIZE: ") - 1;
284
- len += end - int_buf;
285
- len += sizeof("\r\n") - 1;
286
- }
287
-
288
-
289
-
290
- if (conf->request_queue_overflow_status_code != NGX_CONF_UNSET) {
291
- end = ngx_snprintf(int_buf,
292
- sizeof(int_buf) - 1,
293
- "%d",
294
- conf->request_queue_overflow_status_code);
295
- len += sizeof("!~PASSENGER_REQUEST_QUEUE_OVERFLOW_STATUS_CODE: ") - 1;
296
- len += end - int_buf;
297
- len += sizeof("\r\n") - 1;
298
- }
299
-
300
-
301
-
302
- if (conf->restart_dir.data != NULL) {
303
- len += sizeof("!~PASSENGER_RESTART_DIR: ") - 1;
304
- len += conf->restart_dir.len;
305
- len += sizeof("\r\n") - 1;
306
- }
307
-
308
-
309
-
310
- if (conf->startup_file.data != NULL) {
311
- len += sizeof("!~PASSENGER_STARTUP_FILE: ") - 1;
312
- len += conf->startup_file.len;
313
- len += sizeof("\r\n") - 1;
314
- }
315
-
316
-
317
-
318
- if (conf->sticky_sessions != NGX_CONF_UNSET) {
319
- len += sizeof("!~PASSENGER_STICKY_SESSIONS: ") - 1;
320
- len += conf->sticky_sessions
321
- ? sizeof("t\r\n") - 1
322
- : sizeof("f\r\n") - 1;
323
- }
324
-
325
-
326
-
327
- if (conf->sticky_sessions_cookie_name.data != NULL) {
328
- len += sizeof("!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME: ") - 1;
329
- len += conf->sticky_sessions_cookie_name.len;
330
- len += sizeof("\r\n") - 1;
331
- }
332
-
333
-
334
-
335
- if (conf->vary_turbocache_by_cookie.data != NULL) {
336
- len += sizeof("!~PASSENGER_VARY_TURBOCACHE_BY_COOKIE: ") - 1;
337
- len += conf->vary_turbocache_by_cookie.len;
338
- len += sizeof("\r\n") - 1;
339
- }
340
-
341
-
342
-
343
- if (conf->abort_websockets_on_process_shutdown != NGX_CONF_UNSET) {
344
- len += sizeof("!~PASSENGER_ABORT_WEBSOCKETS_ON_PROCESS_SHUTDOWN: ") - 1;
345
- len += conf->abort_websockets_on_process_shutdown
346
- ? sizeof("t\r\n") - 1
347
- : sizeof("f\r\n") - 1;
348
- }
349
-
350
-
351
-
352
- if (conf->force_max_concurrent_requests_per_process != NGX_CONF_UNSET) {
353
- end = ngx_snprintf(int_buf,
354
- sizeof(int_buf) - 1,
355
- "%d",
356
- conf->force_max_concurrent_requests_per_process);
357
- len += sizeof("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS: ") - 1;
358
- len += end - int_buf;
359
- len += sizeof("\r\n") - 1;
360
- }
361
-
362
-
363
-
364
- /* Create string */
365
- buf = pos = ngx_pnalloc(cf->pool, len);
366
- if (buf == NULL) {
367
- return 0;
39
+ /*
40
+ * 0: NGX_ERROR, 1: OK
41
+ */
42
+ int
43
+ generated_cache_location_part(ngx_conf_t *cf, passenger_loc_conf_t *conf) {
44
+ size_t len = 0;
45
+ u_char int_buf[32], *end, *buf, *pos;
46
+
47
+ /*
48
+ * Calculate lengths
49
+ */
50
+
51
+ if (conf->socket_backlog != NGX_CONF_UNSET) {
52
+ end = ngx_snprintf(int_buf,
53
+ sizeof(int_buf) - 1,
54
+ "%d",
55
+ conf->socket_backlog);
56
+ len += sizeof("!~PASSENGER_SOCKET_BACKLOG: ") - 1;
57
+ len += end - int_buf;
58
+ len += sizeof("\r\n") - 1;
59
+ }
60
+
61
+ if (conf->core_file_descriptor_ulimit != NGX_CONF_UNSET_UINT) {
62
+ end = ngx_snprintf(int_buf,
63
+ sizeof(int_buf) - 1,
64
+ "%ui",
65
+ conf->core_file_descriptor_ulimit);
66
+ len += sizeof("!~PASSENGER_CORE_FILE_DESCRIPTOR_ULIMIT: ") - 1;
67
+ len += end - int_buf;
68
+ len += sizeof("\r\n") - 1;
69
+ }
70
+
71
+ if (conf->app_file_descriptor_ulimit != NGX_CONF_UNSET_UINT) {
72
+ end = ngx_snprintf(int_buf,
73
+ sizeof(int_buf) - 1,
74
+ "%ui",
75
+ conf->app_file_descriptor_ulimit);
76
+ len += sizeof("!~PASSENGER_APP_FILE_DESCRIPTOR_ULIMIT: ") - 1;
77
+ len += end - int_buf;
78
+ len += sizeof("\r\n") - 1;
79
+ }
80
+
81
+ if (conf->ruby.data != NULL) {
82
+ len += sizeof("!~PASSENGER_RUBY: ") - 1;
83
+ len += conf->ruby.len;
84
+ len += sizeof("\r\n") - 1;
85
+ }
86
+
87
+ if (conf->python.data != NULL) {
88
+ len += sizeof("!~PASSENGER_PYTHON: ") - 1;
89
+ len += conf->python.len;
90
+ len += sizeof("\r\n") - 1;
91
+ }
92
+
93
+ if (conf->nodejs.data != NULL) {
94
+ len += sizeof("!~PASSENGER_NODEJS: ") - 1;
95
+ len += conf->nodejs.len;
96
+ len += sizeof("\r\n") - 1;
97
+ }
98
+
99
+ if (conf->meteor_app_settings.data != NULL) {
100
+ len += sizeof("!~PASSENGER_METEOR_APP_SETTINGS: ") - 1;
101
+ len += conf->meteor_app_settings.len;
102
+ len += sizeof("\r\n") - 1;
103
+ }
104
+
105
+ if (conf->environment.data != NULL) {
106
+ len += sizeof("!~PASSENGER_APP_ENV: ") - 1;
107
+ len += conf->environment.len;
108
+ len += sizeof("\r\n") - 1;
109
+ }
110
+
111
+ if (conf->friendly_error_pages != NGX_CONF_UNSET) {
112
+ len += sizeof("!~PASSENGER_FRIENDLY_ERROR_PAGES: ") - 1;
113
+ len += conf->friendly_error_pages
114
+ ? sizeof("t\r\n") - 1
115
+ : sizeof("f\r\n") - 1;
116
+ }
117
+
118
+ if (conf->min_instances != NGX_CONF_UNSET) {
119
+ end = ngx_snprintf(int_buf,
120
+ sizeof(int_buf) - 1,
121
+ "%d",
122
+ conf->min_instances);
123
+ len += sizeof("!~PASSENGER_MIN_PROCESSES: ") - 1;
124
+ len += end - int_buf;
125
+ len += sizeof("\r\n") - 1;
126
+ }
127
+
128
+ if (conf->max_instances_per_app != NGX_CONF_UNSET) {
129
+ end = ngx_snprintf(int_buf,
130
+ sizeof(int_buf) - 1,
131
+ "%d",
132
+ conf->max_instances_per_app);
133
+ len += sizeof("!~PASSENGER_MAX_PROCESSES: ") - 1;
134
+ len += end - int_buf;
135
+ len += sizeof("\r\n") - 1;
136
+ }
137
+
138
+ if (conf->max_requests != NGX_CONF_UNSET) {
139
+ end = ngx_snprintf(int_buf,
140
+ sizeof(int_buf) - 1,
141
+ "%d",
142
+ conf->max_requests);
143
+ len += sizeof("!~PASSENGER_MAX_REQUESTS: ") - 1;
144
+ len += end - int_buf;
145
+ len += sizeof("\r\n") - 1;
146
+ }
147
+
148
+ if (conf->start_timeout != NGX_CONF_UNSET) {
149
+ end = ngx_snprintf(int_buf,
150
+ sizeof(int_buf) - 1,
151
+ "%d",
152
+ conf->start_timeout);
153
+ len += sizeof("!~PASSENGER_START_TIMEOUT: ") - 1;
154
+ len += end - int_buf;
155
+ len += sizeof("\r\n") - 1;
156
+ }
157
+
158
+ if (conf->user.data != NULL) {
159
+ len += sizeof("!~PASSENGER_USER: ") - 1;
160
+ len += conf->user.len;
161
+ len += sizeof("\r\n") - 1;
162
+ }
163
+
164
+ if (conf->group.data != NULL) {
165
+ len += sizeof("!~PASSENGER_GROUP: ") - 1;
166
+ len += conf->group.len;
167
+ len += sizeof("\r\n") - 1;
168
+ }
169
+
170
+ if (conf->app_group_name.data != NULL) {
171
+ len += sizeof("!~PASSENGER_APP_GROUP_NAME: ") - 1;
172
+ len += conf->app_group_name.len;
173
+ len += sizeof("\r\n") - 1;
174
+ }
175
+
176
+ if (conf->app_root.data != NULL) {
177
+ len += sizeof("!~PASSENGER_APP_ROOT: ") - 1;
178
+ len += conf->app_root.len;
179
+ len += sizeof("\r\n") - 1;
180
+ }
181
+
182
+ if (conf->app_rights.data != NULL) {
183
+ len += sizeof("!~PASSENGER_APP_RIGHTS: ") - 1;
184
+ len += conf->app_rights.len;
185
+ len += sizeof("\r\n") - 1;
186
+ }
187
+
188
+ if (conf->union_station_support != NGX_CONF_UNSET) {
189
+ len += sizeof("!~UNION_STATION_SUPPORT: ") - 1;
190
+ len += conf->union_station_support
191
+ ? sizeof("t\r\n") - 1
192
+ : sizeof("f\r\n") - 1;
193
+ }
194
+
195
+ if (conf->debugger != NGX_CONF_UNSET) {
196
+ len += sizeof("!~PASSENGER_DEBUGGER: ") - 1;
197
+ len += conf->debugger
198
+ ? sizeof("t\r\n") - 1
199
+ : sizeof("f\r\n") - 1;
200
+ }
201
+
202
+ if (conf->max_preloader_idle_time != NGX_CONF_UNSET) {
203
+ end = ngx_snprintf(int_buf,
204
+ sizeof(int_buf) - 1,
205
+ "%d",
206
+ conf->max_preloader_idle_time);
207
+ len += sizeof("!~PASSENGER_MAX_PRELOADER_IDLE_TIME: ") - 1;
208
+ len += end - int_buf;
209
+ len += sizeof("\r\n") - 1;
210
+ }
211
+
212
+ if (conf->spawn_method.data != NULL) {
213
+ len += sizeof("!~PASSENGER_SPAWN_METHOD: ") - 1;
214
+ len += conf->spawn_method.len;
215
+ len += sizeof("\r\n") - 1;
216
+ }
217
+
218
+ if (conf->load_shell_envvars != NGX_CONF_UNSET) {
219
+ len += sizeof("!~PASSENGER_LOAD_SHELL_ENVVARS: ") - 1;
220
+ len += conf->load_shell_envvars
221
+ ? sizeof("t\r\n") - 1
222
+ : sizeof("f\r\n") - 1;
223
+ }
224
+
225
+ if (conf->union_station_key.data != NULL) {
226
+ len += sizeof("!~UNION_STATION_KEY: ") - 1;
227
+ len += conf->union_station_key.len;
228
+ len += sizeof("\r\n") - 1;
229
+ }
230
+
231
+ if (conf->max_request_queue_size != NGX_CONF_UNSET) {
232
+ end = ngx_snprintf(int_buf,
233
+ sizeof(int_buf) - 1,
234
+ "%d",
235
+ conf->max_request_queue_size);
236
+ len += sizeof("!~PASSENGER_MAX_REQUEST_QUEUE_SIZE: ") - 1;
237
+ len += end - int_buf;
238
+ len += sizeof("\r\n") - 1;
239
+ }
240
+
241
+ if (conf->request_queue_overflow_status_code != NGX_CONF_UNSET) {
242
+ end = ngx_snprintf(int_buf,
243
+ sizeof(int_buf) - 1,
244
+ "%d",
245
+ conf->request_queue_overflow_status_code);
246
+ len += sizeof("!~PASSENGER_REQUEST_QUEUE_OVERFLOW_STATUS_CODE: ") - 1;
247
+ len += end - int_buf;
248
+ len += sizeof("\r\n") - 1;
249
+ }
250
+
251
+ if (conf->restart_dir.data != NULL) {
252
+ len += sizeof("!~PASSENGER_RESTART_DIR: ") - 1;
253
+ len += conf->restart_dir.len;
254
+ len += sizeof("\r\n") - 1;
255
+ }
256
+
257
+ if (conf->startup_file.data != NULL) {
258
+ len += sizeof("!~PASSENGER_STARTUP_FILE: ") - 1;
259
+ len += conf->startup_file.len;
260
+ len += sizeof("\r\n") - 1;
261
+ }
262
+
263
+ if (conf->sticky_sessions != NGX_CONF_UNSET) {
264
+ len += sizeof("!~PASSENGER_STICKY_SESSIONS: ") - 1;
265
+ len += conf->sticky_sessions
266
+ ? sizeof("t\r\n") - 1
267
+ : sizeof("f\r\n") - 1;
268
+ }
269
+
270
+ if (conf->sticky_sessions_cookie_name.data != NULL) {
271
+ len += sizeof("!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME: ") - 1;
272
+ len += conf->sticky_sessions_cookie_name.len;
273
+ len += sizeof("\r\n") - 1;
274
+ }
275
+
276
+ if (conf->vary_turbocache_by_cookie.data != NULL) {
277
+ len += sizeof("!~PASSENGER_VARY_TURBOCACHE_BY_COOKIE: ") - 1;
278
+ len += conf->vary_turbocache_by_cookie.len;
279
+ len += sizeof("\r\n") - 1;
280
+ }
281
+
282
+ if (conf->abort_websockets_on_process_shutdown != NGX_CONF_UNSET) {
283
+ len += sizeof("!~PASSENGER_ABORT_WEBSOCKETS_ON_PROCESS_SHUTDOWN: ") - 1;
284
+ len += conf->abort_websockets_on_process_shutdown
285
+ ? sizeof("t\r\n") - 1
286
+ : sizeof("f\r\n") - 1;
287
+ }
288
+
289
+ if (conf->force_max_concurrent_requests_per_process != NGX_CONF_UNSET) {
290
+ end = ngx_snprintf(int_buf,
291
+ sizeof(int_buf) - 1,
292
+ "%d",
293
+ conf->force_max_concurrent_requests_per_process);
294
+ len += sizeof("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS: ") - 1;
295
+ len += end - int_buf;
296
+ len += sizeof("\r\n") - 1;
297
+ }
298
+
299
+
300
+ /* Create string */
301
+ buf = pos = ngx_pnalloc(cf->pool, len);
302
+ if (buf == NULL) {
303
+ return 0;
304
+ }
305
+
306
+ if (conf->socket_backlog != NGX_CONF_UNSET) {
307
+ pos = ngx_copy(pos,
308
+ "!~PASSENGER_SOCKET_BACKLOG: ",
309
+ sizeof("!~PASSENGER_SOCKET_BACKLOG: ") - 1);
310
+ end = ngx_snprintf(int_buf,
311
+ sizeof(int_buf) - 1,
312
+ "%d",
313
+ conf->socket_backlog);
314
+ pos = ngx_copy(pos, int_buf, end - int_buf);
315
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
316
+ }
317
+ if (conf->core_file_descriptor_ulimit != NGX_CONF_UNSET_UINT) {
318
+ pos = ngx_copy(pos,
319
+ "!~PASSENGER_CORE_FILE_DESCRIPTOR_ULIMIT: ",
320
+ sizeof("!~PASSENGER_CORE_FILE_DESCRIPTOR_ULIMIT: ") - 1);
321
+ end = ngx_snprintf(int_buf,
322
+ sizeof(int_buf) - 1,
323
+ "%ui",
324
+ conf->core_file_descriptor_ulimit);
325
+ pos = ngx_copy(pos, int_buf, end - int_buf);
326
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
327
+ }
328
+ if (conf->app_file_descriptor_ulimit != NGX_CONF_UNSET_UINT) {
329
+ pos = ngx_copy(pos,
330
+ "!~PASSENGER_APP_FILE_DESCRIPTOR_ULIMIT: ",
331
+ sizeof("!~PASSENGER_APP_FILE_DESCRIPTOR_ULIMIT: ") - 1);
332
+ end = ngx_snprintf(int_buf,
333
+ sizeof(int_buf) - 1,
334
+ "%ui",
335
+ conf->app_file_descriptor_ulimit);
336
+ pos = ngx_copy(pos, int_buf, end - int_buf);
337
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
338
+ }
339
+ if (conf->ruby.data != NULL) {
340
+ pos = ngx_copy(pos,
341
+ "!~PASSENGER_RUBY: ",
342
+ sizeof("!~PASSENGER_RUBY: ") - 1);
343
+ pos = ngx_copy(pos,
344
+ conf->ruby.data,
345
+ conf->ruby.len);
346
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
347
+ }
348
+ if (conf->python.data != NULL) {
349
+ pos = ngx_copy(pos,
350
+ "!~PASSENGER_PYTHON: ",
351
+ sizeof("!~PASSENGER_PYTHON: ") - 1);
352
+ pos = ngx_copy(pos,
353
+ conf->python.data,
354
+ conf->python.len);
355
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
356
+ }
357
+ if (conf->nodejs.data != NULL) {
358
+ pos = ngx_copy(pos,
359
+ "!~PASSENGER_NODEJS: ",
360
+ sizeof("!~PASSENGER_NODEJS: ") - 1);
361
+ pos = ngx_copy(pos,
362
+ conf->nodejs.data,
363
+ conf->nodejs.len);
364
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
365
+ }
366
+ if (conf->meteor_app_settings.data != NULL) {
367
+ pos = ngx_copy(pos,
368
+ "!~PASSENGER_METEOR_APP_SETTINGS: ",
369
+ sizeof("!~PASSENGER_METEOR_APP_SETTINGS: ") - 1);
370
+ pos = ngx_copy(pos,
371
+ conf->meteor_app_settings.data,
372
+ conf->meteor_app_settings.len);
373
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
374
+ }
375
+ if (conf->environment.data != NULL) {
376
+ pos = ngx_copy(pos,
377
+ "!~PASSENGER_APP_ENV: ",
378
+ sizeof("!~PASSENGER_APP_ENV: ") - 1);
379
+ pos = ngx_copy(pos,
380
+ conf->environment.data,
381
+ conf->environment.len);
382
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
383
+ }
384
+ if (conf->friendly_error_pages != NGX_CONF_UNSET) {
385
+ pos = ngx_copy(pos,
386
+ "!~PASSENGER_FRIENDLY_ERROR_PAGES: ",
387
+ sizeof("!~PASSENGER_FRIENDLY_ERROR_PAGES: ") - 1);
388
+ if (conf->friendly_error_pages) {
389
+ pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
390
+ } else {
391
+ pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
392
+ }
393
+ }
394
+
395
+ if (conf->min_instances != NGX_CONF_UNSET) {
396
+ pos = ngx_copy(pos,
397
+ "!~PASSENGER_MIN_PROCESSES: ",
398
+ sizeof("!~PASSENGER_MIN_PROCESSES: ") - 1);
399
+ end = ngx_snprintf(int_buf,
400
+ sizeof(int_buf) - 1,
401
+ "%d",
402
+ conf->min_instances);
403
+ pos = ngx_copy(pos, int_buf, end - int_buf);
404
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
405
+ }
406
+ if (conf->max_instances_per_app != NGX_CONF_UNSET) {
407
+ pos = ngx_copy(pos,
408
+ "!~PASSENGER_MAX_PROCESSES: ",
409
+ sizeof("!~PASSENGER_MAX_PROCESSES: ") - 1);
410
+ end = ngx_snprintf(int_buf,
411
+ sizeof(int_buf) - 1,
412
+ "%d",
413
+ conf->max_instances_per_app);
414
+ pos = ngx_copy(pos, int_buf, end - int_buf);
415
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
416
+ }
417
+ if (conf->max_requests != NGX_CONF_UNSET) {
418
+ pos = ngx_copy(pos,
419
+ "!~PASSENGER_MAX_REQUESTS: ",
420
+ sizeof("!~PASSENGER_MAX_REQUESTS: ") - 1);
421
+ end = ngx_snprintf(int_buf,
422
+ sizeof(int_buf) - 1,
423
+ "%d",
424
+ conf->max_requests);
425
+ pos = ngx_copy(pos, int_buf, end - int_buf);
426
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
427
+ }
428
+ if (conf->start_timeout != NGX_CONF_UNSET) {
429
+ pos = ngx_copy(pos,
430
+ "!~PASSENGER_START_TIMEOUT: ",
431
+ sizeof("!~PASSENGER_START_TIMEOUT: ") - 1);
432
+ end = ngx_snprintf(int_buf,
433
+ sizeof(int_buf) - 1,
434
+ "%d",
435
+ conf->start_timeout);
436
+ pos = ngx_copy(pos, int_buf, end - int_buf);
437
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
438
+ }
439
+ if (conf->user.data != NULL) {
440
+ pos = ngx_copy(pos,
441
+ "!~PASSENGER_USER: ",
442
+ sizeof("!~PASSENGER_USER: ") - 1);
443
+ pos = ngx_copy(pos,
444
+ conf->user.data,
445
+ conf->user.len);
446
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
447
+ }
448
+ if (conf->group.data != NULL) {
449
+ pos = ngx_copy(pos,
450
+ "!~PASSENGER_GROUP: ",
451
+ sizeof("!~PASSENGER_GROUP: ") - 1);
452
+ pos = ngx_copy(pos,
453
+ conf->group.data,
454
+ conf->group.len);
455
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
456
+ }
457
+ if (conf->app_group_name.data != NULL) {
458
+ pos = ngx_copy(pos,
459
+ "!~PASSENGER_APP_GROUP_NAME: ",
460
+ sizeof("!~PASSENGER_APP_GROUP_NAME: ") - 1);
461
+ pos = ngx_copy(pos,
462
+ conf->app_group_name.data,
463
+ conf->app_group_name.len);
464
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
465
+ }
466
+ if (conf->app_root.data != NULL) {
467
+ pos = ngx_copy(pos,
468
+ "!~PASSENGER_APP_ROOT: ",
469
+ sizeof("!~PASSENGER_APP_ROOT: ") - 1);
470
+ pos = ngx_copy(pos,
471
+ conf->app_root.data,
472
+ conf->app_root.len);
473
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
474
+ }
475
+ if (conf->app_rights.data != NULL) {
476
+ pos = ngx_copy(pos,
477
+ "!~PASSENGER_APP_RIGHTS: ",
478
+ sizeof("!~PASSENGER_APP_RIGHTS: ") - 1);
479
+ pos = ngx_copy(pos,
480
+ conf->app_rights.data,
481
+ conf->app_rights.len);
482
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
483
+ }
484
+ if (conf->union_station_support != NGX_CONF_UNSET) {
485
+ pos = ngx_copy(pos,
486
+ "!~UNION_STATION_SUPPORT: ",
487
+ sizeof("!~UNION_STATION_SUPPORT: ") - 1);
488
+ if (conf->union_station_support) {
489
+ pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
490
+ } else {
491
+ pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
492
+ }
493
+ }
494
+
495
+ if (conf->debugger != NGX_CONF_UNSET) {
496
+ pos = ngx_copy(pos,
497
+ "!~PASSENGER_DEBUGGER: ",
498
+ sizeof("!~PASSENGER_DEBUGGER: ") - 1);
499
+ if (conf->debugger) {
500
+ pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
501
+ } else {
502
+ pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
503
+ }
504
+ }
505
+
506
+ if (conf->max_preloader_idle_time != NGX_CONF_UNSET) {
507
+ pos = ngx_copy(pos,
508
+ "!~PASSENGER_MAX_PRELOADER_IDLE_TIME: ",
509
+ sizeof("!~PASSENGER_MAX_PRELOADER_IDLE_TIME: ") - 1);
510
+ end = ngx_snprintf(int_buf,
511
+ sizeof(int_buf) - 1,
512
+ "%d",
513
+ conf->max_preloader_idle_time);
514
+ pos = ngx_copy(pos, int_buf, end - int_buf);
515
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
516
+ }
517
+ if (conf->spawn_method.data != NULL) {
518
+ pos = ngx_copy(pos,
519
+ "!~PASSENGER_SPAWN_METHOD: ",
520
+ sizeof("!~PASSENGER_SPAWN_METHOD: ") - 1);
521
+ pos = ngx_copy(pos,
522
+ conf->spawn_method.data,
523
+ conf->spawn_method.len);
524
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
525
+ }
526
+ if (conf->load_shell_envvars != NGX_CONF_UNSET) {
527
+ pos = ngx_copy(pos,
528
+ "!~PASSENGER_LOAD_SHELL_ENVVARS: ",
529
+ sizeof("!~PASSENGER_LOAD_SHELL_ENVVARS: ") - 1);
530
+ if (conf->load_shell_envvars) {
531
+ pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
532
+ } else {
533
+ pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
534
+ }
535
+ }
536
+
537
+ if (conf->union_station_key.data != NULL) {
538
+ pos = ngx_copy(pos,
539
+ "!~UNION_STATION_KEY: ",
540
+ sizeof("!~UNION_STATION_KEY: ") - 1);
541
+ pos = ngx_copy(pos,
542
+ conf->union_station_key.data,
543
+ conf->union_station_key.len);
544
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
545
+ }
546
+ if (conf->max_request_queue_size != NGX_CONF_UNSET) {
547
+ pos = ngx_copy(pos,
548
+ "!~PASSENGER_MAX_REQUEST_QUEUE_SIZE: ",
549
+ sizeof("!~PASSENGER_MAX_REQUEST_QUEUE_SIZE: ") - 1);
550
+ end = ngx_snprintf(int_buf,
551
+ sizeof(int_buf) - 1,
552
+ "%d",
553
+ conf->max_request_queue_size);
554
+ pos = ngx_copy(pos, int_buf, end - int_buf);
555
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
556
+ }
557
+ if (conf->request_queue_overflow_status_code != NGX_CONF_UNSET) {
558
+ pos = ngx_copy(pos,
559
+ "!~PASSENGER_REQUEST_QUEUE_OVERFLOW_STATUS_CODE: ",
560
+ sizeof("!~PASSENGER_REQUEST_QUEUE_OVERFLOW_STATUS_CODE: ") - 1);
561
+ end = ngx_snprintf(int_buf,
562
+ sizeof(int_buf) - 1,
563
+ "%d",
564
+ conf->request_queue_overflow_status_code);
565
+ pos = ngx_copy(pos, int_buf, end - int_buf);
566
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
567
+ }
568
+ if (conf->restart_dir.data != NULL) {
569
+ pos = ngx_copy(pos,
570
+ "!~PASSENGER_RESTART_DIR: ",
571
+ sizeof("!~PASSENGER_RESTART_DIR: ") - 1);
572
+ pos = ngx_copy(pos,
573
+ conf->restart_dir.data,
574
+ conf->restart_dir.len);
575
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
576
+ }
577
+ if (conf->startup_file.data != NULL) {
578
+ pos = ngx_copy(pos,
579
+ "!~PASSENGER_STARTUP_FILE: ",
580
+ sizeof("!~PASSENGER_STARTUP_FILE: ") - 1);
581
+ pos = ngx_copy(pos,
582
+ conf->startup_file.data,
583
+ conf->startup_file.len);
584
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
585
+ }
586
+ if (conf->sticky_sessions != NGX_CONF_UNSET) {
587
+ pos = ngx_copy(pos,
588
+ "!~PASSENGER_STICKY_SESSIONS: ",
589
+ sizeof("!~PASSENGER_STICKY_SESSIONS: ") - 1);
590
+ if (conf->sticky_sessions) {
591
+ pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
592
+ } else {
593
+ pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
594
+ }
595
+ }
596
+
597
+ if (conf->sticky_sessions_cookie_name.data != NULL) {
598
+ pos = ngx_copy(pos,
599
+ "!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME: ",
600
+ sizeof("!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME: ") - 1);
601
+ pos = ngx_copy(pos,
602
+ conf->sticky_sessions_cookie_name.data,
603
+ conf->sticky_sessions_cookie_name.len);
604
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
605
+ }
606
+ if (conf->vary_turbocache_by_cookie.data != NULL) {
607
+ pos = ngx_copy(pos,
608
+ "!~PASSENGER_VARY_TURBOCACHE_BY_COOKIE: ",
609
+ sizeof("!~PASSENGER_VARY_TURBOCACHE_BY_COOKIE: ") - 1);
610
+ pos = ngx_copy(pos,
611
+ conf->vary_turbocache_by_cookie.data,
612
+ conf->vary_turbocache_by_cookie.len);
613
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
614
+ }
615
+ if (conf->abort_websockets_on_process_shutdown != NGX_CONF_UNSET) {
616
+ pos = ngx_copy(pos,
617
+ "!~PASSENGER_ABORT_WEBSOCKETS_ON_PROCESS_SHUTDOWN: ",
618
+ sizeof("!~PASSENGER_ABORT_WEBSOCKETS_ON_PROCESS_SHUTDOWN: ") - 1);
619
+ if (conf->abort_websockets_on_process_shutdown) {
620
+ pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
621
+ } else {
622
+ pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
623
+ }
624
+ }
625
+
626
+ if (conf->force_max_concurrent_requests_per_process != NGX_CONF_UNSET) {
627
+ pos = ngx_copy(pos,
628
+ "!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS: ",
629
+ sizeof("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS: ") - 1);
630
+ end = ngx_snprintf(int_buf,
631
+ sizeof(int_buf) - 1,
632
+ "%d",
633
+ conf->force_max_concurrent_requests_per_process);
634
+ pos = ngx_copy(pos, int_buf, end - int_buf);
635
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
636
+ }
637
+
638
+ conf->options_cache.data = buf;
639
+ conf->options_cache.len = pos - buf;
640
+
641
+ return 1;
368
642
  }
369
643
 
370
-
371
-
372
- if (conf->socket_backlog != NGX_CONF_UNSET) {
373
- pos = ngx_copy(pos,
374
- "!~PASSENGER_SOCKET_BACKLOG: ",
375
- sizeof("!~PASSENGER_SOCKET_BACKLOG: ") - 1);
376
- end = ngx_snprintf(int_buf,
377
- sizeof(int_buf) - 1,
378
- "%d",
379
- conf->socket_backlog);
380
- pos = ngx_copy(pos, int_buf, end - int_buf);
381
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
382
- }
383
-
384
-
385
-
386
- if (conf->core_file_descriptor_ulimit != NGX_CONF_UNSET_UINT) {
387
- pos = ngx_copy(pos,
388
- "!~PASSENGER_CORE_FILE_DESCRIPTOR_ULIMIT: ",
389
- sizeof("!~PASSENGER_CORE_FILE_DESCRIPTOR_ULIMIT: ") - 1);
390
- end = ngx_snprintf(int_buf,
391
- sizeof(int_buf) - 1,
392
- "%ui",
393
- conf->core_file_descriptor_ulimit);
394
- pos = ngx_copy(pos, int_buf, end - int_buf);
395
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
396
- }
397
-
398
-
399
-
400
- if (conf->app_file_descriptor_ulimit != NGX_CONF_UNSET_UINT) {
401
- pos = ngx_copy(pos,
402
- "!~PASSENGER_APP_FILE_DESCRIPTOR_ULIMIT: ",
403
- sizeof("!~PASSENGER_APP_FILE_DESCRIPTOR_ULIMIT: ") - 1);
404
- end = ngx_snprintf(int_buf,
405
- sizeof(int_buf) - 1,
406
- "%ui",
407
- conf->app_file_descriptor_ulimit);
408
- pos = ngx_copy(pos, int_buf, end - int_buf);
409
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
410
- }
411
-
412
-
413
-
414
- if (conf->ruby.data != NULL) {
415
- pos = ngx_copy(pos,
416
- "!~PASSENGER_RUBY: ",
417
- sizeof("!~PASSENGER_RUBY: ") - 1);
418
- pos = ngx_copy(pos,
419
- conf->ruby.data,
420
- conf->ruby.len);
421
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
422
- }
423
-
424
-
425
-
426
- if (conf->python.data != NULL) {
427
- pos = ngx_copy(pos,
428
- "!~PASSENGER_PYTHON: ",
429
- sizeof("!~PASSENGER_PYTHON: ") - 1);
430
- pos = ngx_copy(pos,
431
- conf->python.data,
432
- conf->python.len);
433
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
434
- }
435
-
436
-
437
-
438
- if (conf->nodejs.data != NULL) {
439
- pos = ngx_copy(pos,
440
- "!~PASSENGER_NODEJS: ",
441
- sizeof("!~PASSENGER_NODEJS: ") - 1);
442
- pos = ngx_copy(pos,
443
- conf->nodejs.data,
444
- conf->nodejs.len);
445
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
446
- }
447
-
448
-
449
-
450
- if (conf->meteor_app_settings.data != NULL) {
451
- pos = ngx_copy(pos,
452
- "!~PASSENGER_METEOR_APP_SETTINGS: ",
453
- sizeof("!~PASSENGER_METEOR_APP_SETTINGS: ") - 1);
454
- pos = ngx_copy(pos,
455
- conf->meteor_app_settings.data,
456
- conf->meteor_app_settings.len);
457
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
458
- }
459
-
460
-
461
-
462
- if (conf->environment.data != NULL) {
463
- pos = ngx_copy(pos,
464
- "!~PASSENGER_APP_ENV: ",
465
- sizeof("!~PASSENGER_APP_ENV: ") - 1);
466
- pos = ngx_copy(pos,
467
- conf->environment.data,
468
- conf->environment.len);
469
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
470
- }
471
-
472
-
473
-
474
- if (conf->friendly_error_pages != NGX_CONF_UNSET) {
475
- pos = ngx_copy(pos,
476
- "!~PASSENGER_FRIENDLY_ERROR_PAGES: ",
477
- sizeof("!~PASSENGER_FRIENDLY_ERROR_PAGES: ") - 1);
478
- if (conf->friendly_error_pages) {
479
- pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
480
- } else {
481
- pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
482
- }
483
- }
484
-
485
-
486
-
487
- if (conf->min_instances != NGX_CONF_UNSET) {
488
- pos = ngx_copy(pos,
489
- "!~PASSENGER_MIN_PROCESSES: ",
490
- sizeof("!~PASSENGER_MIN_PROCESSES: ") - 1);
491
- end = ngx_snprintf(int_buf,
492
- sizeof(int_buf) - 1,
493
- "%d",
494
- conf->min_instances);
495
- pos = ngx_copy(pos, int_buf, end - int_buf);
496
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
497
- }
498
-
499
-
500
-
501
- if (conf->max_instances_per_app != NGX_CONF_UNSET) {
502
- pos = ngx_copy(pos,
503
- "!~PASSENGER_MAX_PROCESSES: ",
504
- sizeof("!~PASSENGER_MAX_PROCESSES: ") - 1);
505
- end = ngx_snprintf(int_buf,
506
- sizeof(int_buf) - 1,
507
- "%d",
508
- conf->max_instances_per_app);
509
- pos = ngx_copy(pos, int_buf, end - int_buf);
510
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
511
- }
512
-
513
-
514
-
515
- if (conf->max_requests != NGX_CONF_UNSET) {
516
- pos = ngx_copy(pos,
517
- "!~PASSENGER_MAX_REQUESTS: ",
518
- sizeof("!~PASSENGER_MAX_REQUESTS: ") - 1);
519
- end = ngx_snprintf(int_buf,
520
- sizeof(int_buf) - 1,
521
- "%d",
522
- conf->max_requests);
523
- pos = ngx_copy(pos, int_buf, end - int_buf);
524
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
525
- }
526
-
527
-
528
-
529
- if (conf->start_timeout != NGX_CONF_UNSET) {
530
- pos = ngx_copy(pos,
531
- "!~PASSENGER_START_TIMEOUT: ",
532
- sizeof("!~PASSENGER_START_TIMEOUT: ") - 1);
533
- end = ngx_snprintf(int_buf,
534
- sizeof(int_buf) - 1,
535
- "%d",
536
- conf->start_timeout);
537
- pos = ngx_copy(pos, int_buf, end - int_buf);
538
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
539
- }
540
-
541
-
542
-
543
- if (conf->user.data != NULL) {
544
- pos = ngx_copy(pos,
545
- "!~PASSENGER_USER: ",
546
- sizeof("!~PASSENGER_USER: ") - 1);
547
- pos = ngx_copy(pos,
548
- conf->user.data,
549
- conf->user.len);
550
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
551
- }
552
-
553
-
554
-
555
- if (conf->group.data != NULL) {
556
- pos = ngx_copy(pos,
557
- "!~PASSENGER_GROUP: ",
558
- sizeof("!~PASSENGER_GROUP: ") - 1);
559
- pos = ngx_copy(pos,
560
- conf->group.data,
561
- conf->group.len);
562
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
563
- }
564
-
565
-
566
-
567
- if (conf->app_group_name.data != NULL) {
568
- pos = ngx_copy(pos,
569
- "!~PASSENGER_APP_GROUP_NAME: ",
570
- sizeof("!~PASSENGER_APP_GROUP_NAME: ") - 1);
571
- pos = ngx_copy(pos,
572
- conf->app_group_name.data,
573
- conf->app_group_name.len);
574
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
575
- }
576
-
577
-
578
-
579
- if (conf->app_root.data != NULL) {
580
- pos = ngx_copy(pos,
581
- "!~PASSENGER_APP_ROOT: ",
582
- sizeof("!~PASSENGER_APP_ROOT: ") - 1);
583
- pos = ngx_copy(pos,
584
- conf->app_root.data,
585
- conf->app_root.len);
586
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
587
- }
588
-
589
-
590
-
591
- if (conf->app_rights.data != NULL) {
592
- pos = ngx_copy(pos,
593
- "!~PASSENGER_APP_RIGHTS: ",
594
- sizeof("!~PASSENGER_APP_RIGHTS: ") - 1);
595
- pos = ngx_copy(pos,
596
- conf->app_rights.data,
597
- conf->app_rights.len);
598
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
599
- }
600
-
601
-
602
-
603
- if (conf->union_station_support != NGX_CONF_UNSET) {
604
- pos = ngx_copy(pos,
605
- "!~UNION_STATION_SUPPORT: ",
606
- sizeof("!~UNION_STATION_SUPPORT: ") - 1);
607
- if (conf->union_station_support) {
608
- pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
609
- } else {
610
- pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
611
- }
612
- }
613
-
614
-
615
-
616
- if (conf->debugger != NGX_CONF_UNSET) {
617
- pos = ngx_copy(pos,
618
- "!~PASSENGER_DEBUGGER: ",
619
- sizeof("!~PASSENGER_DEBUGGER: ") - 1);
620
- if (conf->debugger) {
621
- pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
622
- } else {
623
- pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
624
- }
625
- }
626
-
627
-
628
-
629
- if (conf->max_preloader_idle_time != NGX_CONF_UNSET) {
630
- pos = ngx_copy(pos,
631
- "!~PASSENGER_MAX_PRELOADER_IDLE_TIME: ",
632
- sizeof("!~PASSENGER_MAX_PRELOADER_IDLE_TIME: ") - 1);
633
- end = ngx_snprintf(int_buf,
634
- sizeof(int_buf) - 1,
635
- "%d",
636
- conf->max_preloader_idle_time);
637
- pos = ngx_copy(pos, int_buf, end - int_buf);
638
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
639
- }
640
-
641
-
642
-
643
- if (conf->spawn_method.data != NULL) {
644
- pos = ngx_copy(pos,
645
- "!~PASSENGER_SPAWN_METHOD: ",
646
- sizeof("!~PASSENGER_SPAWN_METHOD: ") - 1);
647
- pos = ngx_copy(pos,
648
- conf->spawn_method.data,
649
- conf->spawn_method.len);
650
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
651
- }
652
-
653
-
654
-
655
- if (conf->load_shell_envvars != NGX_CONF_UNSET) {
656
- pos = ngx_copy(pos,
657
- "!~PASSENGER_LOAD_SHELL_ENVVARS: ",
658
- sizeof("!~PASSENGER_LOAD_SHELL_ENVVARS: ") - 1);
659
- if (conf->load_shell_envvars) {
660
- pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
661
- } else {
662
- pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
663
- }
664
- }
665
-
666
-
667
-
668
- if (conf->union_station_key.data != NULL) {
669
- pos = ngx_copy(pos,
670
- "!~UNION_STATION_KEY: ",
671
- sizeof("!~UNION_STATION_KEY: ") - 1);
672
- pos = ngx_copy(pos,
673
- conf->union_station_key.data,
674
- conf->union_station_key.len);
675
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
676
- }
677
-
678
-
679
-
680
- if (conf->max_request_queue_size != NGX_CONF_UNSET) {
681
- pos = ngx_copy(pos,
682
- "!~PASSENGER_MAX_REQUEST_QUEUE_SIZE: ",
683
- sizeof("!~PASSENGER_MAX_REQUEST_QUEUE_SIZE: ") - 1);
684
- end = ngx_snprintf(int_buf,
685
- sizeof(int_buf) - 1,
686
- "%d",
687
- conf->max_request_queue_size);
688
- pos = ngx_copy(pos, int_buf, end - int_buf);
689
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
690
- }
691
-
692
-
693
-
694
- if (conf->request_queue_overflow_status_code != NGX_CONF_UNSET) {
695
- pos = ngx_copy(pos,
696
- "!~PASSENGER_REQUEST_QUEUE_OVERFLOW_STATUS_CODE: ",
697
- sizeof("!~PASSENGER_REQUEST_QUEUE_OVERFLOW_STATUS_CODE: ") - 1);
698
- end = ngx_snprintf(int_buf,
699
- sizeof(int_buf) - 1,
700
- "%d",
701
- conf->request_queue_overflow_status_code);
702
- pos = ngx_copy(pos, int_buf, end - int_buf);
703
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
704
- }
705
-
706
-
707
-
708
- if (conf->restart_dir.data != NULL) {
709
- pos = ngx_copy(pos,
710
- "!~PASSENGER_RESTART_DIR: ",
711
- sizeof("!~PASSENGER_RESTART_DIR: ") - 1);
712
- pos = ngx_copy(pos,
713
- conf->restart_dir.data,
714
- conf->restart_dir.len);
715
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
716
- }
717
-
718
-
719
-
720
- if (conf->startup_file.data != NULL) {
721
- pos = ngx_copy(pos,
722
- "!~PASSENGER_STARTUP_FILE: ",
723
- sizeof("!~PASSENGER_STARTUP_FILE: ") - 1);
724
- pos = ngx_copy(pos,
725
- conf->startup_file.data,
726
- conf->startup_file.len);
727
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
728
- }
729
-
730
-
731
-
732
- if (conf->sticky_sessions != NGX_CONF_UNSET) {
733
- pos = ngx_copy(pos,
734
- "!~PASSENGER_STICKY_SESSIONS: ",
735
- sizeof("!~PASSENGER_STICKY_SESSIONS: ") - 1);
736
- if (conf->sticky_sessions) {
737
- pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
738
- } else {
739
- pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
740
- }
741
- }
742
-
743
-
744
-
745
- if (conf->sticky_sessions_cookie_name.data != NULL) {
746
- pos = ngx_copy(pos,
747
- "!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME: ",
748
- sizeof("!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME: ") - 1);
749
- pos = ngx_copy(pos,
750
- conf->sticky_sessions_cookie_name.data,
751
- conf->sticky_sessions_cookie_name.len);
752
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
753
- }
754
-
755
-
756
-
757
- if (conf->vary_turbocache_by_cookie.data != NULL) {
758
- pos = ngx_copy(pos,
759
- "!~PASSENGER_VARY_TURBOCACHE_BY_COOKIE: ",
760
- sizeof("!~PASSENGER_VARY_TURBOCACHE_BY_COOKIE: ") - 1);
761
- pos = ngx_copy(pos,
762
- conf->vary_turbocache_by_cookie.data,
763
- conf->vary_turbocache_by_cookie.len);
764
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
765
- }
766
-
767
-
768
-
769
- if (conf->abort_websockets_on_process_shutdown != NGX_CONF_UNSET) {
770
- pos = ngx_copy(pos,
771
- "!~PASSENGER_ABORT_WEBSOCKETS_ON_PROCESS_SHUTDOWN: ",
772
- sizeof("!~PASSENGER_ABORT_WEBSOCKETS_ON_PROCESS_SHUTDOWN: ") - 1);
773
- if (conf->abort_websockets_on_process_shutdown) {
774
- pos = ngx_copy(pos, "t\r\n", sizeof("t\r\n") - 1);
775
- } else {
776
- pos = ngx_copy(pos, "f\r\n", sizeof("f\r\n") - 1);
777
- }
778
- }
779
-
780
-
781
-
782
- if (conf->force_max_concurrent_requests_per_process != NGX_CONF_UNSET) {
783
- pos = ngx_copy(pos,
784
- "!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS: ",
785
- sizeof("!~PASSENGER_FORCE_MAX_CONCURRENT_REQUESTS_PER_PROCESS: ") - 1);
786
- end = ngx_snprintf(int_buf,
787
- sizeof(int_buf) - 1,
788
- "%d",
789
- conf->force_max_concurrent_requests_per_process);
790
- pos = ngx_copy(pos, int_buf, end - int_buf);
791
- pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
792
- }
793
-
794
-
795
-
796
- conf->options_cache.data = buf;
797
- conf->options_cache.len = pos - buf;
798
-
799
- return 1;
800
- }