passenger 5.0.0.beta2 → 5.0.0.beta3

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 (73) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/CHANGELOG +30 -0
  5. data/CONTRIBUTORS +2 -0
  6. data/Gemfile.lock +1 -1
  7. data/bin/passenger-status +13 -15
  8. data/build/cxx_tests.rb +14 -1
  9. data/build/preprocessor.rb +4 -2
  10. data/debian.template/control.template +2 -2
  11. data/doc/Security of user switching support.txt +2 -2
  12. data/doc/Users guide Apache.idmap.txt +6 -4
  13. data/doc/Users guide Apache.txt +20 -1
  14. data/doc/Users guide Nginx.idmap.txt +5 -3
  15. data/doc/Users guide Nginx.txt +22 -2
  16. data/ext/apache2/Configuration.cpp +6 -0
  17. data/ext/apache2/Configuration.hpp +4 -1
  18. data/ext/apache2/Hooks.cpp +1 -0
  19. data/ext/common/Constants.h +4 -2
  20. data/ext/common/Constants.h.erb +1 -1
  21. data/ext/common/DataStructures/LString.h +10 -0
  22. data/ext/common/ServerKit/Channel.h +1 -1
  23. data/ext/common/ServerKit/Context.h +2 -21
  24. data/ext/common/ServerKit/CookieUtils.h +246 -0
  25. data/ext/common/ServerKit/FdSourceChannel.h +10 -0
  26. data/ext/common/ServerKit/FileBufferedChannel.h +173 -17
  27. data/ext/common/ServerKit/FileBufferedFdSinkChannel.h +33 -1
  28. data/ext/common/ServerKit/HeaderTable.h +3 -1
  29. data/ext/common/ServerKit/HttpServer.h +36 -8
  30. data/ext/common/ServerKit/Server.h +1 -0
  31. data/ext/common/Utils.cpp +2 -1
  32. data/ext/common/Utils/DateParsing.h +15 -2
  33. data/ext/common/Utils/JsonUtils.h +39 -1
  34. data/ext/common/agents/HelperAgent/Main.cpp +4 -2
  35. data/ext/common/agents/HelperAgent/OptionParser.h +14 -2
  36. data/ext/common/agents/HelperAgent/RequestHandler.h +22 -8
  37. data/ext/common/agents/HelperAgent/RequestHandler/ForwardResponse.cpp +92 -11
  38. data/ext/common/agents/HelperAgent/RequestHandler/Hooks.cpp +3 -1
  39. data/ext/common/agents/HelperAgent/RequestHandler/InitRequest.cpp +9 -5
  40. data/ext/common/agents/HelperAgent/RequestHandler/Request.h +1 -0
  41. data/ext/common/agents/HelperAgent/RequestHandler/SendRequest.cpp +27 -13
  42. data/ext/common/agents/HelperAgent/ResponseCache.h +91 -34
  43. data/ext/common/agents/LoggingAgent/AdminServer.h +21 -1
  44. data/ext/nginx/CacheLocationConfig.c +20 -0
  45. data/ext/nginx/Configuration.c +130 -24
  46. data/ext/nginx/Configuration.h +2 -1
  47. data/ext/nginx/ConfigurationCommands.c +10 -0
  48. data/ext/nginx/ConfigurationFields.h +2 -0
  49. data/ext/nginx/ContentHandler.c +1 -6
  50. data/ext/nginx/CreateLocationConfig.c +5 -0
  51. data/ext/nginx/MergeLocationConfig.c +6 -0
  52. data/ext/nginx/StaticContentHandler.c +3 -9
  53. data/ext/nginx/ngx_http_passenger_module.c +2 -1
  54. data/ext/ruby/extconf.rb +5 -4
  55. data/lib/phusion_passenger.rb +2 -2
  56. data/lib/phusion_passenger/constants.rb +2 -1
  57. data/lib/phusion_passenger/nginx/config_options.rb +5 -1
  58. data/lib/phusion_passenger/rack/thread_handler_extension.rb +3 -1
  59. data/lib/phusion_passenger/ruby_core_enhancements.rb +3 -4
  60. data/lib/phusion_passenger/standalone/start_command.rb +5 -1
  61. data/lib/phusion_passenger/standalone/start_command/builtin_engine.rb +10 -3
  62. data/resources/templates/standalone/config.erb +2 -1
  63. data/test/cxx/DateParsingTest.cpp +75 -0
  64. data/test/cxx/ResponseCacheTest.cpp +322 -0
  65. data/test/cxx/ServerKit/CookieUtilsTest.cpp +274 -0
  66. data/test/cxx/ServerKit/HttpServerTest.cpp +77 -0
  67. data/test/stub/rails3.0/Gemfile.lock +2 -2
  68. data/test/stub/rails3.1/Gemfile.lock +2 -2
  69. data/test/stub/rails3.2/Gemfile.lock +2 -2
  70. data/test/stub/rails4.0/Gemfile.lock +2 -2
  71. data/test/stub/rails4.1/Gemfile.lock +2 -2
  72. metadata +6 -2
  73. metadata.gz.asc +7 -7
@@ -250,6 +250,24 @@ private:
250
250
  }
251
251
  }
252
252
 
253
+ void processStatusTxt(Client *client, Request *req) {
254
+ if (req->method != HTTP_GET) {
255
+ respondWith405(client, req);
256
+ } else if (authorize(client, req, READONLY)) {
257
+ HeaderTable headers;
258
+ headers.insert(req->pool, "content-type", "text/plain");
259
+
260
+ stringstream stream;
261
+ loggingServer->dump(stream);
262
+ writeSimpleResponse(client, 200, &headers, stream.str());
263
+ if (!req->ended()) {
264
+ endRequest(&client, &req);
265
+ }
266
+ } else {
267
+ respondWith401(client, req);
268
+ }
269
+ }
270
+
253
271
  void respondWith401(Client *client, Request *req) {
254
272
  HeaderTable headers;
255
273
  headers.insert(req->pool, "cache-control", "no-cache, no-store, must-revalidate");
@@ -301,7 +319,9 @@ protected:
301
319
  } else if (path == P_STATIC_STRING("/config.json")) {
302
320
  processConfig(client, req);
303
321
  } else if (path == P_STATIC_STRING("/reopen_logs.json")) {
304
- processReopenLogs(client, req);
322
+ processReopenLogs(client, req);
323
+ } else if (path == P_STATIC_STRING("/status.txt")) {
324
+ processStatusTxt(client, req);
305
325
  } else {
306
326
  respondWith404(client, req);
307
327
  }
@@ -284,6 +284,14 @@ u_char int_buf[32], *end, *buf, *pos;
284
284
  }
285
285
 
286
286
 
287
+
288
+ if (conf->vary_turbocache_by_cookie.data != NULL) {
289
+ len += sizeof("!~PASSENGER_VARY_TURBOCACHE_BY_COOKIE: ") - 1;
290
+ len += conf->vary_turbocache_by_cookie.len;
291
+ len += sizeof("\r\n") - 1;
292
+ }
293
+
294
+
287
295
 
288
296
  /* Create string */
289
297
  buf = pos = ngx_pnalloc(cf->pool, len);
@@ -623,6 +631,18 @@ if (buf == NULL) {
623
631
  }
624
632
 
625
633
 
634
+
635
+ if (conf->vary_turbocache_by_cookie.data != NULL) {
636
+ pos = ngx_copy(pos,
637
+ "!~PASSENGER_VARY_TURBOCACHE_BY_COOKIE: ",
638
+ sizeof("!~PASSENGER_VARY_TURBOCACHE_BY_COOKIE: ") - 1);
639
+ pos = ngx_copy(pos,
640
+ conf->vary_turbocache_by_cookie.data,
641
+ conf->vary_turbocache_by_cookie.len);
642
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
643
+ }
644
+
645
+
626
646
 
627
647
  conf->options_cache.data = buf;
628
648
  conf->options_cache.len = pos - buf;
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Copyright (C) Igor Sysoev
3
3
  * Copyright (C) 2007 Manlio Perillo (manlio.perillo@gmail.com)
4
- * Copyright (C) 2010-2014 Phusion
4
+ * Copyright (C) 2010-2015 Phusion
5
5
  *
6
6
  * Redistribution and use in source and binary forms, with or without
7
7
  * modification, are permitted provided that the following conditions
@@ -93,6 +93,7 @@ passenger_create_main_conf(ngx_conf_t *cf)
93
93
  conf->abort_on_startup_error = NGX_CONF_UNSET;
94
94
  conf->max_pool_size = NGX_CONF_UNSET_UINT;
95
95
  conf->pool_idle_time = NGX_CONF_UNSET_UINT;
96
+ conf->response_buffer_high_watermark = NGX_CONF_UNSET_UINT;
96
97
  conf->stat_throttle_rate = NGX_CONF_UNSET_UINT;
97
98
  conf->user_switching = NGX_CONF_UNSET;
98
99
  conf->show_version_in_header = NGX_CONF_UNSET;
@@ -165,6 +166,10 @@ passenger_init_main_conf(ngx_conf_t *cf, void *conf_pointer)
165
166
  conf->pool_idle_time = DEFAULT_POOL_IDLE_TIME;
166
167
  }
167
168
 
169
+ if (conf->response_buffer_high_watermark == NGX_CONF_UNSET_UINT) {
170
+ conf->response_buffer_high_watermark = DEFAULT_RESPONSE_BUFFER_HIGH_WATERMARK;
171
+ }
172
+
168
173
  if (conf->stat_throttle_rate == NGX_CONF_UNSET_UINT) {
169
174
  conf->stat_throttle_rate = DEFAULT_STAT_THROTTLE_RATE;
170
175
  }
@@ -272,17 +277,29 @@ passenger_create_loc_conf(ngx_conf_t *cf)
272
277
 
273
278
  conf->upstream_config.store = NGX_CONF_UNSET;
274
279
  conf->upstream_config.store_access = NGX_CONF_UNSET_UINT;
280
+ #if NGINX_VERSION_NUM >= 1007005
281
+ conf->upstream_config.next_upstream_tries = NGX_CONF_UNSET_UINT;
282
+ #endif
275
283
  conf->upstream_config.buffering = NGX_CONF_UNSET;
276
284
  conf->upstream_config.ignore_client_abort = NGX_CONF_UNSET;
285
+ #if NGINX_VERSION_NUM >= 1007007
286
+ conf->upstream_config.force_ranges = NGX_CONF_UNSET;
287
+ #endif
277
288
 
278
289
  conf->upstream_config.local = NGX_CONF_UNSET_PTR;
279
290
 
280
291
  conf->upstream_config.connect_timeout = NGX_CONF_UNSET_MSEC;
281
292
  conf->upstream_config.send_timeout = NGX_CONF_UNSET_MSEC;
282
293
  conf->upstream_config.read_timeout = NGX_CONF_UNSET_MSEC;
294
+ #if NGINX_VERSION_NUM >= 1007005
295
+ conf->upstream_config.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
296
+ #endif
283
297
 
284
298
  conf->upstream_config.send_lowat = NGX_CONF_UNSET_SIZE;
285
299
  conf->upstream_config.buffer_size = NGX_CONF_UNSET_SIZE;
300
+ #if NGINX_VERSION_NUM >= 1007007
301
+ conf->upstream_config.limit_rate = NGX_CONF_UNSET_SIZE;
302
+ #endif
286
303
 
287
304
  conf->upstream_config.busy_buffers_size_conf = NGX_CONF_UNSET_SIZE;
288
305
  conf->upstream_config.max_temp_file_size_conf = NGX_CONF_UNSET_SIZE;
@@ -292,14 +309,22 @@ passenger_create_loc_conf(ngx_conf_t *cf)
292
309
  conf->upstream_config.pass_request_body = NGX_CONF_UNSET;
293
310
 
294
311
  #if (NGX_HTTP_CACHE)
295
- conf->upstream_config.cache = NGX_CONF_UNSET_PTR;
312
+ #if NGINX_VERSION_NUM >= 1007009
313
+ conf->upstream_config.cache = NGX_CONF_UNSET;
314
+ #else
315
+ conf->upstream_config.cache = NGX_CONF_UNSET_PTR;
316
+ #endif
296
317
  conf->upstream_config.cache_min_uses = NGX_CONF_UNSET_UINT;
297
318
  conf->upstream_config.cache_bypass = NGX_CONF_UNSET_PTR;
298
319
  conf->upstream_config.no_cache = NGX_CONF_UNSET_PTR;
299
320
  conf->upstream_config.cache_valid = NGX_CONF_UNSET_PTR;
300
- #if NGINX_VERSION_NUM >= 1002000
301
- conf->upstream_config.cache_lock = NGX_CONF_UNSET;
302
- conf->upstream_config.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
321
+ conf->upstream_config.cache_lock = NGX_CONF_UNSET;
322
+ conf->upstream_config.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
323
+ #if NGINX_VERSION_NUM >= 1007008
324
+ conf->upstream_config.cache_lock_age = NGX_CONF_UNSET_MSEC;
325
+ #endif
326
+ #if NGINX_VERSION_NUM >= 1006000
327
+ conf->upstream_config.cache_revalidate = NGX_CONF_UNSET;
303
328
  #endif
304
329
  #endif
305
330
 
@@ -308,9 +333,7 @@ passenger_create_loc_conf(ngx_conf_t *cf)
308
333
  conf->upstream_config.cyclic_temp_file = 0;
309
334
  conf->upstream_config.change_buffering = 1;
310
335
 
311
- #if NGINX_VERSION_NUM >= 1000010
312
336
  ngx_str_set(&conf->upstream_config.module, "passenger");
313
- #endif
314
337
 
315
338
  conf->options_cache.data = NULL;
316
339
  conf->options_cache.len = 0;
@@ -410,25 +433,54 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
410
433
  /******************************/
411
434
  /******************************/
412
435
 
413
- if (conf->upstream_config.store != 0) {
414
- ngx_conf_merge_value(conf->upstream_config.store,
415
- prev->upstream_config.store, 0);
436
+ #if (NGX_HTTP_CACHE) && NGINX_VERSION_NUM >= 1007009
437
+ if (conf->upstream_config.store > 0) {
438
+ conf->upstream_config.cache = 0;
439
+ }
440
+ if (conf->upstream_config.cache > 0) {
441
+ conf->upstream_config.store = 0;
442
+ }
443
+ #endif
444
+
445
+ #if NGINX_VERSION_NUM >= 1007009
446
+ if (conf->upstream_config.store == NGX_CONF_UNSET) {
447
+ ngx_conf_merge_value(conf->upstream_config.store,
448
+ prev->upstream_config.store, 0);
416
449
 
417
- if (conf->upstream_config.store_lengths == NULL) {
418
450
  conf->upstream_config.store_lengths = prev->upstream_config.store_lengths;
419
451
  conf->upstream_config.store_values = prev->upstream_config.store_values;
420
452
  }
421
- }
453
+ #else
454
+ if (conf->upstream_config.store != 0) {
455
+ ngx_conf_merge_value(conf->upstream_config.store,
456
+ prev->upstream_config.store, 0);
457
+
458
+ if (conf->upstream_config.store_lengths == NULL) {
459
+ conf->upstream_config.store_lengths = prev->upstream_config.store_lengths;
460
+ conf->upstream_config.store_values = prev->upstream_config.store_values;
461
+ }
462
+ }
463
+ #endif
422
464
 
423
465
  ngx_conf_merge_uint_value(conf->upstream_config.store_access,
424
466
  prev->upstream_config.store_access, 0600);
425
467
 
468
+ #if NGINX_VERSION_NUM >= 1007005
469
+ ngx_conf_merge_uint_value(conf->upstream_config.next_upstream_tries,
470
+ prev->upstream_config.next_upstream_tries, 0);
471
+ #endif
472
+
426
473
  ngx_conf_merge_value(conf->upstream_config.buffering,
427
474
  prev->upstream_config.buffering, 0);
428
475
 
429
476
  ngx_conf_merge_value(conf->upstream_config.ignore_client_abort,
430
477
  prev->upstream_config.ignore_client_abort, 0);
431
478
 
479
+ #if NGINX_VERSION_NUM >= 1007007
480
+ ngx_conf_merge_value(conf->upstream_config.force_ranges,
481
+ prev->upstream_config.force_ranges, 0);
482
+ #endif
483
+
432
484
  ngx_conf_merge_ptr_value(conf->upstream_config.local,
433
485
  prev->upstream_config.local, NULL);
434
486
 
@@ -441,6 +493,11 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
441
493
  ngx_conf_merge_msec_value(conf->upstream_config.read_timeout,
442
494
  prev->upstream_config.read_timeout, 12000000);
443
495
 
496
+ #if NGINX_VERSION_NUM >= 1007005
497
+ ngx_conf_merge_msec_value(conf->upstream_config.next_upstream_timeout,
498
+ prev->upstream_config.next_upstream_timeout, 0);
499
+ #endif
500
+
444
501
  ngx_conf_merge_size_value(conf->upstream_config.send_lowat,
445
502
  prev->upstream_config.send_lowat, 0);
446
503
 
@@ -448,6 +505,11 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
448
505
  prev->upstream_config.buffer_size,
449
506
  16 * 1024);
450
507
 
508
+ #if NGINX_VERSION_NUM >= 1007007
509
+ ngx_conf_merge_size_value(conf->upstream_config.limit_rate,
510
+ prev->upstream_config.limit_rate, 0);
511
+ #endif
512
+
451
513
 
452
514
  ngx_conf_merge_bufs_value(conf->upstream_config.bufs, prev->upstream_config.bufs,
453
515
  8, 16 * 1024);
@@ -562,20 +624,42 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
562
624
 
563
625
  #if (NGX_HTTP_CACHE)
564
626
 
565
- ngx_conf_merge_ptr_value(conf->upstream_config.cache,
566
- prev->upstream_config.cache, NULL);
627
+ #if NGINX_VERSION_NUM >= 1007009
628
+ if (conf->upstream_config.cache == NGX_CONF_UNSET) {
629
+ ngx_conf_merge_value(conf->upstream_config.cache,
630
+ prev->upstream_config.cache, 0);
567
631
 
568
- if (conf->upstream_config.cache && conf->upstream_config.cache->data == NULL) {
569
- ngx_shm_zone_t *shm_zone;
632
+ conf->upstream_config.cache_zone = prev->upstream_config.cache_zone;
633
+ conf->upstream_config.cache_value = prev->upstream_config.cache_value;
634
+ }
570
635
 
571
- shm_zone = conf->upstream_config.cache;
636
+ if (conf->upstream_config.cache_zone && conf->upstream_config.cache_zone->data == NULL) {
637
+ ngx_shm_zone_t *shm_zone;
572
638
 
573
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
574
- "\"scgi_cache\" zone \"%V\" is unknown",
575
- &shm_zone->shm.name);
639
+ shm_zone = conf->upstream_config.cache_zone;
576
640
 
577
- return NGX_CONF_ERROR;
578
- }
641
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
642
+ "\"scgi_cache\" zone \"%V\" is unknown",
643
+ &shm_zone->shm.name);
644
+
645
+ return NGX_CONF_ERROR;
646
+ }
647
+ #else
648
+ ngx_conf_merge_ptr_value(conf->upstream_config.cache,
649
+ prev->upstream_config.cache, NULL);
650
+
651
+ if (conf->upstream_config.cache && conf->upstream_config.cache->data == NULL) {
652
+ ngx_shm_zone_t *shm_zone;
653
+
654
+ shm_zone = conf->upstream_config.cache;
655
+
656
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
657
+ "\"scgi_cache\" zone \"%V\" is unknown",
658
+ &shm_zone->shm.name);
659
+
660
+ return NGX_CONF_ERROR;
661
+ }
662
+ #endif
579
663
 
580
664
  ngx_conf_merge_uint_value(conf->upstream_config.cache_min_uses,
581
665
  prev->upstream_config.cache_min_uses, 1);
@@ -613,12 +697,23 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
613
697
  conf->cache_key = prev->cache_key;
614
698
  }
615
699
 
616
- #if NGINX_VERSION_NUM >= 1002000
617
700
  ngx_conf_merge_value(conf->upstream_config.cache_lock,
618
701
  prev->upstream_config.cache_lock, 0);
619
702
 
620
703
  ngx_conf_merge_msec_value(conf->upstream_config.cache_lock_timeout,
621
704
  prev->upstream_config.cache_lock_timeout, 5000);
705
+
706
+ ngx_conf_merge_value(conf->upstream_config.cache_revalidate,
707
+ prev->upstream_config.cache_revalidate, 0);
708
+
709
+ #if NGINX_VERSION_NUM >= 1007008
710
+ ngx_conf_merge_msec_value(conf->upstream_config.cache_lock_age,
711
+ prev->upstream_config.cache_lock_age, 5000);
712
+ #endif
713
+
714
+ #if NGINX_VERSION_NUM >= 1006000
715
+ ngx_conf_merge_value(conf->upstream_config.cache_revalidate,
716
+ prev->upstream_config.cache_revalidate, 0);
622
717
  #endif
623
718
 
624
719
  #endif
@@ -690,7 +785,11 @@ merge_headers(ngx_conf_t *cf, passenger_loc_conf_t *conf, passenger_loc_conf_t *
690
785
 
691
786
  if (conf->headers_set_hash.buckets
692
787
  #if (NGX_HTTP_CACHE)
693
- && ((conf->upstream_config.cache == NULL) == (prev->upstream_config.cache == NULL))
788
+ #if NGINX_VERSION_NUM >= 1007009
789
+ && ((conf->upstream_config.cache == NGX_CONF_UNSET) == (prev->upstream_config.cache == NGX_CONF_UNSET))
790
+ #else
791
+ && ((conf->upstream_config.cache == NGX_CONF_UNSET_PTR) == (prev->upstream_config.cache == NGX_CONF_UNSET_PTR))
792
+ #endif
694
793
  #endif
695
794
  )
696
795
  {
@@ -1212,6 +1311,13 @@ const ngx_command_t passenger_commands[] = {
1212
1311
  offsetof(passenger_main_conf_t, pool_idle_time),
1213
1312
  NULL },
1214
1313
 
1314
+ { ngx_string("passenger_response_buffer_high_watermark"),
1315
+ NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
1316
+ ngx_conf_set_num_slot,
1317
+ NGX_HTTP_MAIN_CONF_OFFSET,
1318
+ offsetof(passenger_main_conf_t, response_buffer_high_watermark),
1319
+ NULL },
1320
+
1215
1321
  { ngx_string("passenger_stat_throttle_rate"),
1216
1322
  NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
1217
1323
  ngx_conf_set_num_slot,
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * Copyright (C) Igor Sysoev
3
3
  * Copyright (C) 2007 Manlio Perillo (manlio.perillo@gmail.com)
4
- * Copyright (C) 2010-2014 Phusion
4
+ * Copyright (C) 2010-2015 Phusion
5
5
  *
6
6
  * Redistribution and use in source and binary forms, with or without
7
7
  * modification, are permitted provided that the following conditions
@@ -62,6 +62,7 @@ typedef struct {
62
62
  ngx_flag_t abort_on_startup_error;
63
63
  ngx_uint_t max_pool_size;
64
64
  ngx_uint_t pool_idle_time;
65
+ ngx_uint_t response_buffer_high_watermark;
65
66
  ngx_uint_t stat_throttle_rate;
66
67
  ngx_flag_t turbocaching;
67
68
  ngx_flag_t show_version_in_header;
@@ -469,6 +469,16 @@
469
469
  NULL
470
470
  },
471
471
 
472
+ {
473
+
474
+ ngx_string("passenger_vary_turbocache_by_cookie"),
475
+ NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
476
+ ngx_conf_set_str_slot,
477
+ NGX_HTTP_LOC_CONF_OFFSET,
478
+ offsetof(passenger_loc_conf_t, vary_turbocache_by_cookie),
479
+ NULL
480
+ },
481
+
472
482
  {
473
483
 
474
484
  ngx_string("passenger_fly_with"),
@@ -109,3 +109,5 @@
109
109
 
110
110
  ngx_str_t user;
111
111
 
112
+ ngx_str_t vary_turbocache_by_cookie;
113
+
@@ -1233,7 +1233,7 @@ process_header(ngx_http_request_t *r)
1233
1233
  ngx_str_set(&u->headers_in.status_line, "200 OK");
1234
1234
  }
1235
1235
 
1236
- if (u->state) {
1236
+ if (u->state && u->state->status == 0) {
1237
1237
  u->state->status = u->headers_in.status_n;
1238
1238
  }
1239
1239
 
@@ -1299,11 +1299,6 @@ passenger_content_handler(ngx_http_request_t *r)
1299
1299
 
1300
1300
  if (passenger_main_conf.root_dir.len == 0) {
1301
1301
  return NGX_DECLINED;
1302
- } else if (r->subrequest_in_memory) {
1303
- ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
1304
- "ngx_http_passenger_module does not support "
1305
- "subrequest in memory");
1306
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
1307
1302
  }
1308
1303
 
1309
1304
  slcf = ngx_http_get_module_loc_conf(r, ngx_http_passenger_module);
@@ -191,3 +191,8 @@
191
191
  conf->sticky_sessions_cookie_name.len = 0;
192
192
 
193
193
 
194
+
195
+ conf->vary_turbocache_by_cookie.data = NULL;
196
+ conf->vary_turbocache_by_cookie.len = 0;
197
+
198
+
@@ -249,3 +249,9 @@
249
249
  NULL);
250
250
 
251
251
 
252
+
253
+ ngx_conf_merge_str_value(conf->vary_turbocache_by_cookie,
254
+ prev->vary_turbocache_by_cookie,
255
+ NULL);
256
+
257
+
@@ -75,9 +75,7 @@ passenger_static_content_handler(ngx_http_request_t *r, ngx_str_t *filename)
75
75
  clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
76
76
 
77
77
  ngx_memzero(&of, sizeof(ngx_open_file_info_t));
78
- #if NGX_VERSION_NUM >= 8000
79
- of.read_ahead = clcf->read_ahead;
80
- #endif
78
+ of.read_ahead = clcf->read_ahead;
81
79
  of.directio = clcf->directio;
82
80
  of.valid = clcf->open_file_cache_valid;
83
81
  of.min_uses = clcf->open_file_cache_min_uses;
@@ -121,9 +119,7 @@ passenger_static_content_handler(ngx_http_request_t *r, ngx_str_t *filename)
121
119
  return rc;
122
120
  }
123
121
 
124
- #if NGINX_VERSION_NUM >= 7000
125
- r->root_tested = !r->error_page;
126
- #endif
122
+ r->root_tested = !r->error_page;
127
123
 
128
124
  ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd);
129
125
 
@@ -238,9 +234,7 @@ passenger_static_content_handler(ngx_http_request_t *r, ngx_str_t *filename)
238
234
  b->file->fd = of.fd;
239
235
  b->file->name = *filename;
240
236
  b->file->log = log;
241
- #if NGINX_VERSION_NUM >= 7000
242
- b->file->directio = of.is_directio;
243
- #endif
237
+ b->file->directio = of.is_directio;
244
238
 
245
239
  out.buf = b;
246
240
  out.next = NULL;