~ubuntu-branches/ubuntu/wily/ruby-passenger/wily-proposed

« back to all changes in this revision

Viewing changes to ext/nginx/CacheLocationConfig.c

  • Committer: Package Import Robot
  • Author(s): Felix Geyer
  • Date: 2013-11-23 23:50:02 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20131123235002-8fdhsq7afj15o2z2
Tags: 4.0.25-1
* New upstream release.
* Refresh fix_install_path.patch.
* Build for Ruby 2.0 instead of 1.8. (Closes: #725591)
* Add fix_ftbfs_fortify_source.patch.
* Install passenger template files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 CacheLocationConfig.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
 
 
41
size_t len = 0;
 
42
u_char int_buf[32], *end, *buf, *pos;
 
43
 
 
44
/* Calculate lengths */
 
45
 
 
46
        
 
47
                if (conf->ruby.data != NULL) {
 
48
                        len += 15;
 
49
                        len += conf->ruby.len + 1;
 
50
                }
 
51
        
 
52
 
 
53
        
 
54
                if (conf->python.data != NULL) {
 
55
                        len += 17;
 
56
                        len += conf->python.len + 1;
 
57
                }
 
58
        
 
59
 
 
60
        
 
61
                if (conf->nodejs.data != NULL) {
 
62
                        len += 17;
 
63
                        len += conf->nodejs.len + 1;
 
64
                }
 
65
        
 
66
 
 
67
        
 
68
                if (conf->environment.data != NULL) {
 
69
                        len += 14;
 
70
                        len += conf->environment.len + 1;
 
71
                }
 
72
        
 
73
 
 
74
        
 
75
                if (conf->friendly_error_pages != NGX_CONF_UNSET) {
 
76
                        len += 31;
 
77
                        len += conf->friendly_error_pages ? sizeof("true") : sizeof("false");
 
78
                }
 
79
        
 
80
 
 
81
        
 
82
                if (conf->min_instances != NGX_CONF_UNSET) {
 
83
                        end = ngx_snprintf(int_buf,
 
84
                                sizeof(int_buf) - 1,
 
85
                                "%d",
 
86
                                conf->min_instances);
 
87
                        len += 24;
 
88
                        len += end - int_buf + 1;
 
89
                }
 
90
        
 
91
 
 
92
        
 
93
                if (conf->max_requests != NGX_CONF_UNSET) {
 
94
                        end = ngx_snprintf(int_buf,
 
95
                                sizeof(int_buf) - 1,
 
96
                                "%d",
 
97
                                conf->max_requests);
 
98
                        len += 23;
 
99
                        len += end - int_buf + 1;
 
100
                }
 
101
        
 
102
 
 
103
        
 
104
                if (conf->start_timeout != NGX_CONF_UNSET) {
 
105
                        end = ngx_snprintf(int_buf,
 
106
                                sizeof(int_buf) - 1,
 
107
                                "%d",
 
108
                                conf->start_timeout);
 
109
                        len += 24;
 
110
                        len += end - int_buf + 1;
 
111
                }
 
112
        
 
113
 
 
114
        
 
115
                if (conf->user.data != NULL) {
 
116
                        len += 15;
 
117
                        len += conf->user.len + 1;
 
118
                }
 
119
        
 
120
 
 
121
        
 
122
                if (conf->group.data != NULL) {
 
123
                        len += 16;
 
124
                        len += conf->group.len + 1;
 
125
                }
 
126
        
 
127
 
 
128
        
 
129
                if (conf->app_group_name.data != NULL) {
 
130
                        len += 25;
 
131
                        len += conf->app_group_name.len + 1;
 
132
                }
 
133
        
 
134
 
 
135
        
 
136
                if (conf->app_root.data != NULL) {
 
137
                        len += 19;
 
138
                        len += conf->app_root.len + 1;
 
139
                }
 
140
        
 
141
 
 
142
        
 
143
                if (conf->app_rights.data != NULL) {
 
144
                        len += 21;
 
145
                        len += conf->app_rights.len + 1;
 
146
                }
 
147
        
 
148
 
 
149
        
 
150
                if (conf->union_station_support != NGX_CONF_UNSET) {
 
151
                        len += 22;
 
152
                        len += conf->union_station_support ? sizeof("true") : sizeof("false");
 
153
                }
 
154
        
 
155
 
 
156
        
 
157
                if (conf->debugger != NGX_CONF_UNSET) {
 
158
                        len += 19;
 
159
                        len += conf->debugger ? sizeof("true") : sizeof("false");
 
160
                }
 
161
        
 
162
 
 
163
        
 
164
                if (conf->show_version_in_header != NGX_CONF_UNSET) {
 
165
                        len += 33;
 
166
                        len += conf->show_version_in_header ? sizeof("true") : sizeof("false");
 
167
                }
 
168
        
 
169
 
 
170
        
 
171
                if (conf->max_preloader_idle_time != NGX_CONF_UNSET) {
 
172
                        end = ngx_snprintf(int_buf,
 
173
                                sizeof(int_buf) - 1,
 
174
                                "%d",
 
175
                                conf->max_preloader_idle_time);
 
176
                        len += 34;
 
177
                        len += end - int_buf + 1;
 
178
                }
 
179
        
 
180
 
 
181
        
 
182
                if (conf->spawn_method.data != NULL) {
 
183
                        len += 23;
 
184
                        len += conf->spawn_method.len + 1;
 
185
                }
 
186
        
 
187
 
 
188
        
 
189
                if (conf->load_shell_envvars != NGX_CONF_UNSET) {
 
190
                        len += 29;
 
191
                        len += conf->load_shell_envvars ? sizeof("true") : sizeof("false");
 
192
                }
 
193
        
 
194
 
 
195
        
 
196
                if (conf->union_station_key.data != NULL) {
 
197
                        len += 18;
 
198
                        len += conf->union_station_key.len + 1;
 
199
                }
 
200
        
 
201
 
 
202
        
 
203
                if (conf->max_request_queue_size != NGX_CONF_UNSET) {
 
204
                        end = ngx_snprintf(int_buf,
 
205
                                sizeof(int_buf) - 1,
 
206
                                "%d",
 
207
                                conf->max_request_queue_size);
 
208
                        len += 33;
 
209
                        len += end - int_buf + 1;
 
210
                }
 
211
        
 
212
 
 
213
        
 
214
                if (conf->request_queue_overflow_status_code != NGX_CONF_UNSET) {
 
215
                        end = ngx_snprintf(int_buf,
 
216
                                sizeof(int_buf) - 1,
 
217
                                "%d",
 
218
                                conf->request_queue_overflow_status_code);
 
219
                        len += 45;
 
220
                        len += end - int_buf + 1;
 
221
                }
 
222
        
 
223
 
 
224
        
 
225
                if (conf->restart_dir.data != NULL) {
 
226
                        len += 22;
 
227
                        len += conf->restart_dir.len + 1;
 
228
                }
 
229
        
 
230
 
 
231
        
 
232
                if (conf->startup_file.data != NULL) {
 
233
                        len += 23;
 
234
                        len += conf->startup_file.len + 1;
 
235
                }
 
236
        
 
237
 
 
238
 
 
239
/* Create string */
 
240
buf = pos = ngx_pnalloc(cf->pool, len);
 
241
 
 
242
 
 
243
        
 
244
                if (conf->ruby.data != NULL) {
 
245
                        pos = ngx_copy(pos,
 
246
                                "PASSENGER_RUBY",
 
247
                                15);
 
248
                        pos = ngx_copy(pos,
 
249
                                conf->ruby.data,
 
250
                                conf->ruby.len);
 
251
                        *pos = '\0';
 
252
                        pos++;
 
253
                }
 
254
        
 
255
 
 
256
        
 
257
                if (conf->python.data != NULL) {
 
258
                        pos = ngx_copy(pos,
 
259
                                "PASSENGER_PYTHON",
 
260
                                17);
 
261
                        pos = ngx_copy(pos,
 
262
                                conf->python.data,
 
263
                                conf->python.len);
 
264
                        *pos = '\0';
 
265
                        pos++;
 
266
                }
 
267
        
 
268
 
 
269
        
 
270
                if (conf->nodejs.data != NULL) {
 
271
                        pos = ngx_copy(pos,
 
272
                                "PASSENGER_NODEJS",
 
273
                                17);
 
274
                        pos = ngx_copy(pos,
 
275
                                conf->nodejs.data,
 
276
                                conf->nodejs.len);
 
277
                        *pos = '\0';
 
278
                        pos++;
 
279
                }
 
280
        
 
281
 
 
282
        
 
283
                if (conf->environment.data != NULL) {
 
284
                        pos = ngx_copy(pos,
 
285
                                "PASSENGER_ENV",
 
286
                                14);
 
287
                        pos = ngx_copy(pos,
 
288
                                conf->environment.data,
 
289
                                conf->environment.len);
 
290
                        *pos = '\0';
 
291
                        pos++;
 
292
                }
 
293
        
 
294
 
 
295
        
 
296
                if (conf->friendly_error_pages != NGX_CONF_UNSET) {
 
297
                        pos = ngx_copy(pos,
 
298
                                "PASSENGER_FRIENDLY_ERROR_PAGES",
 
299
                                31);
 
300
                        if (conf->friendly_error_pages) {
 
301
                                pos = ngx_copy(pos, "true", sizeof("true"));
 
302
                        } else {
 
303
                                pos = ngx_copy(pos, "false", sizeof("false"));
 
304
                        }
 
305
                }
 
306
        
 
307
 
 
308
        
 
309
                if (conf->min_instances != NGX_CONF_UNSET) {
 
310
                        pos = ngx_copy(pos,
 
311
                                "PASSENGER_MIN_INSTANCES",
 
312
                                24);
 
313
                        end = ngx_snprintf(int_buf,
 
314
                                sizeof(int_buf) - 1,
 
315
                                "%d",
 
316
                                conf->min_instances);
 
317
                        pos = ngx_copy(pos,
 
318
                                int_buf,
 
319
                                end - int_buf);
 
320
                        *pos = '\0';
 
321
                        pos++;
 
322
                }
 
323
        
 
324
 
 
325
        
 
326
                if (conf->max_requests != NGX_CONF_UNSET) {
 
327
                        pos = ngx_copy(pos,
 
328
                                "PASSENGER_MAX_REQUESTS",
 
329
                                23);
 
330
                        end = ngx_snprintf(int_buf,
 
331
                                sizeof(int_buf) - 1,
 
332
                                "%d",
 
333
                                conf->max_requests);
 
334
                        pos = ngx_copy(pos,
 
335
                                int_buf,
 
336
                                end - int_buf);
 
337
                        *pos = '\0';
 
338
                        pos++;
 
339
                }
 
340
        
 
341
 
 
342
        
 
343
                if (conf->start_timeout != NGX_CONF_UNSET) {
 
344
                        pos = ngx_copy(pos,
 
345
                                "PASSENGER_START_TIMEOUT",
 
346
                                24);
 
347
                        end = ngx_snprintf(int_buf,
 
348
                                sizeof(int_buf) - 1,
 
349
                                "%d",
 
350
                                conf->start_timeout);
 
351
                        pos = ngx_copy(pos,
 
352
                                int_buf,
 
353
                                end - int_buf);
 
354
                        *pos = '\0';
 
355
                        pos++;
 
356
                }
 
357
        
 
358
 
 
359
        
 
360
                if (conf->user.data != NULL) {
 
361
                        pos = ngx_copy(pos,
 
362
                                "PASSENGER_USER",
 
363
                                15);
 
364
                        pos = ngx_copy(pos,
 
365
                                conf->user.data,
 
366
                                conf->user.len);
 
367
                        *pos = '\0';
 
368
                        pos++;
 
369
                }
 
370
        
 
371
 
 
372
        
 
373
                if (conf->group.data != NULL) {
 
374
                        pos = ngx_copy(pos,
 
375
                                "PASSENGER_GROUP",
 
376
                                16);
 
377
                        pos = ngx_copy(pos,
 
378
                                conf->group.data,
 
379
                                conf->group.len);
 
380
                        *pos = '\0';
 
381
                        pos++;
 
382
                }
 
383
        
 
384
 
 
385
        
 
386
                if (conf->app_group_name.data != NULL) {
 
387
                        pos = ngx_copy(pos,
 
388
                                "PASSENGER_APP_GROUP_NAME",
 
389
                                25);
 
390
                        pos = ngx_copy(pos,
 
391
                                conf->app_group_name.data,
 
392
                                conf->app_group_name.len);
 
393
                        *pos = '\0';
 
394
                        pos++;
 
395
                }
 
396
        
 
397
 
 
398
        
 
399
                if (conf->app_root.data != NULL) {
 
400
                        pos = ngx_copy(pos,
 
401
                                "PASSENGER_APP_ROOT",
 
402
                                19);
 
403
                        pos = ngx_copy(pos,
 
404
                                conf->app_root.data,
 
405
                                conf->app_root.len);
 
406
                        *pos = '\0';
 
407
                        pos++;
 
408
                }
 
409
        
 
410
 
 
411
        
 
412
                if (conf->app_rights.data != NULL) {
 
413
                        pos = ngx_copy(pos,
 
414
                                "PASSENGER_APP_RIGHTS",
 
415
                                21);
 
416
                        pos = ngx_copy(pos,
 
417
                                conf->app_rights.data,
 
418
                                conf->app_rights.len);
 
419
                        *pos = '\0';
 
420
                        pos++;
 
421
                }
 
422
        
 
423
 
 
424
        
 
425
                if (conf->union_station_support != NGX_CONF_UNSET) {
 
426
                        pos = ngx_copy(pos,
 
427
                                "UNION_STATION_SUPPORT",
 
428
                                22);
 
429
                        if (conf->union_station_support) {
 
430
                                pos = ngx_copy(pos, "true", sizeof("true"));
 
431
                        } else {
 
432
                                pos = ngx_copy(pos, "false", sizeof("false"));
 
433
                        }
 
434
                }
 
435
        
 
436
 
 
437
        
 
438
                if (conf->debugger != NGX_CONF_UNSET) {
 
439
                        pos = ngx_copy(pos,
 
440
                                "PASSENGER_DEBUGGER",
 
441
                                19);
 
442
                        if (conf->debugger) {
 
443
                                pos = ngx_copy(pos, "true", sizeof("true"));
 
444
                        } else {
 
445
                                pos = ngx_copy(pos, "false", sizeof("false"));
 
446
                        }
 
447
                }
 
448
        
 
449
 
 
450
        
 
451
                if (conf->show_version_in_header != NGX_CONF_UNSET) {
 
452
                        pos = ngx_copy(pos,
 
453
                                "PASSENGER_SHOW_VERSION_IN_HEADER",
 
454
                                33);
 
455
                        if (conf->show_version_in_header) {
 
456
                                pos = ngx_copy(pos, "true", sizeof("true"));
 
457
                        } else {
 
458
                                pos = ngx_copy(pos, "false", sizeof("false"));
 
459
                        }
 
460
                }
 
461
        
 
462
 
 
463
        
 
464
                if (conf->max_preloader_idle_time != NGX_CONF_UNSET) {
 
465
                        pos = ngx_copy(pos,
 
466
                                "PASSENGER_MAX_PRELOADER_IDLE_TIME",
 
467
                                34);
 
468
                        end = ngx_snprintf(int_buf,
 
469
                                sizeof(int_buf) - 1,
 
470
                                "%d",
 
471
                                conf->max_preloader_idle_time);
 
472
                        pos = ngx_copy(pos,
 
473
                                int_buf,
 
474
                                end - int_buf);
 
475
                        *pos = '\0';
 
476
                        pos++;
 
477
                }
 
478
        
 
479
 
 
480
        
 
481
                if (conf->spawn_method.data != NULL) {
 
482
                        pos = ngx_copy(pos,
 
483
                                "PASSENGER_SPAWN_METHOD",
 
484
                                23);
 
485
                        pos = ngx_copy(pos,
 
486
                                conf->spawn_method.data,
 
487
                                conf->spawn_method.len);
 
488
                        *pos = '\0';
 
489
                        pos++;
 
490
                }
 
491
        
 
492
 
 
493
        
 
494
                if (conf->load_shell_envvars != NGX_CONF_UNSET) {
 
495
                        pos = ngx_copy(pos,
 
496
                                "PASSENGER_LOAD_SHELL_ENVVARS",
 
497
                                29);
 
498
                        if (conf->load_shell_envvars) {
 
499
                                pos = ngx_copy(pos, "true", sizeof("true"));
 
500
                        } else {
 
501
                                pos = ngx_copy(pos, "false", sizeof("false"));
 
502
                        }
 
503
                }
 
504
        
 
505
 
 
506
        
 
507
                if (conf->union_station_key.data != NULL) {
 
508
                        pos = ngx_copy(pos,
 
509
                                "UNION_STATION_KEY",
 
510
                                18);
 
511
                        pos = ngx_copy(pos,
 
512
                                conf->union_station_key.data,
 
513
                                conf->union_station_key.len);
 
514
                        *pos = '\0';
 
515
                        pos++;
 
516
                }
 
517
        
 
518
 
 
519
        
 
520
                if (conf->max_request_queue_size != NGX_CONF_UNSET) {
 
521
                        pos = ngx_copy(pos,
 
522
                                "PASSENGER_MAX_REQUEST_QUEUE_SIZE",
 
523
                                33);
 
524
                        end = ngx_snprintf(int_buf,
 
525
                                sizeof(int_buf) - 1,
 
526
                                "%d",
 
527
                                conf->max_request_queue_size);
 
528
                        pos = ngx_copy(pos,
 
529
                                int_buf,
 
530
                                end - int_buf);
 
531
                        *pos = '\0';
 
532
                        pos++;
 
533
                }
 
534
        
 
535
 
 
536
        
 
537
                if (conf->request_queue_overflow_status_code != NGX_CONF_UNSET) {
 
538
                        pos = ngx_copy(pos,
 
539
                                "PASSENGER_REQUEST_QUEUE_OVERFLOW_STATUS_CODE",
 
540
                                45);
 
541
                        end = ngx_snprintf(int_buf,
 
542
                                sizeof(int_buf) - 1,
 
543
                                "%d",
 
544
                                conf->request_queue_overflow_status_code);
 
545
                        pos = ngx_copy(pos,
 
546
                                int_buf,
 
547
                                end - int_buf);
 
548
                        *pos = '\0';
 
549
                        pos++;
 
550
                }
 
551
        
 
552
 
 
553
        
 
554
                if (conf->restart_dir.data != NULL) {
 
555
                        pos = ngx_copy(pos,
 
556
                                "PASSENGER_RESTART_DIR",
 
557
                                22);
 
558
                        pos = ngx_copy(pos,
 
559
                                conf->restart_dir.data,
 
560
                                conf->restart_dir.len);
 
561
                        *pos = '\0';
 
562
                        pos++;
 
563
                }
 
564
        
 
565
 
 
566
        
 
567
                if (conf->startup_file.data != NULL) {
 
568
                        pos = ngx_copy(pos,
 
569
                                "PASSENGER_STARTUP_FILE",
 
570
                                23);
 
571
                        pos = ngx_copy(pos,
 
572
                                conf->startup_file.data,
 
573
                                conf->startup_file.len);
 
574
                        *pos = '\0';
 
575
                        pos++;
 
576
                }
 
577
        
 
578
 
 
579
 
 
580
conf->options_cache.data = buf;
 
581
conf->options_cache.len = pos - buf;