passenger 5.0.25 → 5.0.26

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 (128) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +20 -0
  3. data/CONTRIBUTORS +1 -0
  4. data/build/cxx_dependency_map.rb +7338 -7104
  5. data/build/cxx_tests.rb +3 -3
  6. data/build/misc.rb +1 -0
  7. data/dev/index_cxx_dependencies.rb +3 -2
  8. data/resources/templates/standalone/config.erb +1 -1
  9. data/resources/templates/standalone/http.erb +1 -0
  10. data/resources/templates/standalone/server.erb +1 -0
  11. data/src/agent/Core/ApplicationPool/AbstractSession.h +83 -0
  12. data/src/agent/Core/ApplicationPool/Common.h +6 -4
  13. data/src/agent/Core/ApplicationPool/Options.h +4 -1
  14. data/src/agent/Core/ApplicationPool/Pool.h +2 -2
  15. data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +3 -6
  16. data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +3 -3
  17. data/src/agent/Core/ApplicationPool/Session.h +15 -27
  18. data/src/agent/Core/ApplicationPool/TestSession.h +188 -0
  19. data/src/agent/Core/Controller.h +15 -6
  20. data/src/agent/Core/Controller/CheckoutSession.cpp +13 -5
  21. data/src/agent/Core/Controller/ForwardResponse.cpp +20 -2
  22. data/src/agent/Core/Controller/Hooks.cpp +15 -2
  23. data/src/agent/Core/Controller/InitRequest.cpp +5 -1
  24. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +1 -0
  25. data/src/agent/Core/Controller/Request.h +11 -4
  26. data/src/agent/Core/Controller/SendRequest.cpp +34 -13
  27. data/src/agent/Core/Controller/StateInspectionAndConfiguration.cpp +2 -2
  28. data/src/agent/Core/CoreMain.cpp +27 -1
  29. data/src/agent/Core/OptionParser.h +11 -1
  30. data/src/agent/Core/SpawningKit/DirectSpawner.h +1 -0
  31. data/src/agent/Core/SpawningKit/SmartSpawner.h +1 -0
  32. data/src/agent/Core/SpawningKit/Spawner.h +21 -1
  33. data/src/agent/SpawnPreparer/SpawnPreparerMain.cpp +1 -1
  34. data/src/agent/UstRouter/OptionParser.h +7 -1
  35. data/src/agent/UstRouter/UstRouterMain.cpp +27 -1
  36. data/src/cxx_supportlib/Algorithms/MovingAverage.h +223 -0
  37. data/src/cxx_supportlib/Constants.h +2 -2
  38. data/src/cxx_supportlib/DataStructures/StringKeyTable.h +96 -40
  39. data/src/cxx_supportlib/ResourceLocator.h +33 -14
  40. data/src/cxx_supportlib/ServerKit/Channel.h +198 -69
  41. data/src/cxx_supportlib/ServerKit/Errors.h +6 -1
  42. data/src/cxx_supportlib/ServerKit/HttpRequest.h +20 -1
  43. data/src/cxx_supportlib/ServerKit/HttpServer.h +124 -32
  44. data/src/cxx_supportlib/ServerKit/Server.h +65 -1
  45. data/src/cxx_supportlib/Utils/IOUtils.cpp +12 -22
  46. data/src/cxx_supportlib/Utils/JsonUtils.h +87 -1
  47. data/src/cxx_supportlib/Utils/StrIntUtils.cpp +16 -1
  48. data/src/cxx_supportlib/Utils/StrIntUtils.h +31 -1
  49. data/src/cxx_supportlib/Utils/VariantMap.h +6 -1
  50. data/src/cxx_supportlib/WatchdogLauncher.h +17 -9
  51. data/src/cxx_supportlib/vendor-copy/libuv/AUTHORS +43 -0
  52. data/src/cxx_supportlib/vendor-copy/libuv/ChangeLog +350 -1
  53. data/src/cxx_supportlib/vendor-copy/libuv/Makefile.am +9 -1
  54. data/src/cxx_supportlib/vendor-copy/libuv/README.md +48 -0
  55. data/src/cxx_supportlib/vendor-copy/libuv/checksparse.sh +1 -0
  56. data/src/cxx_supportlib/vendor-copy/libuv/common.gypi +5 -5
  57. data/src/cxx_supportlib/vendor-copy/libuv/configure.ac +2 -1
  58. data/src/cxx_supportlib/vendor-copy/libuv/gyp_uv.py +0 -3
  59. data/src/cxx_supportlib/vendor-copy/libuv/include/uv-version.h +5 -1
  60. data/src/cxx_supportlib/vendor-copy/libuv/include/uv.h +30 -3
  61. data/src/cxx_supportlib/vendor-copy/libuv/src/fs-poll.c +3 -3
  62. data/src/cxx_supportlib/vendor-copy/libuv/src/inet.c +0 -4
  63. data/src/cxx_supportlib/vendor-copy/libuv/src/queue.h +17 -1
  64. data/src/cxx_supportlib/vendor-copy/libuv/src/threadpool.c +10 -10
  65. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/aix.c +84 -166
  66. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/android-ifaddrs.c +11 -11
  67. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/async.c +7 -1
  68. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/atomic-ops.h +17 -0
  69. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/core.c +140 -21
  70. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/darwin.c +15 -11
  71. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/dl.c +4 -7
  72. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/freebsd.c +52 -37
  73. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fs.c +181 -60
  74. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/fsevents.c +39 -34
  75. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/getaddrinfo.c +4 -4
  76. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/internal.h +3 -1
  77. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/kqueue.c +12 -4
  78. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-core.c +38 -15
  79. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-inotify.c +36 -8
  80. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.c +4 -4
  81. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/linux-syscalls.h +2 -2
  82. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop-watcher.c +6 -1
  83. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/loop.c +28 -8
  84. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/netbsd.c +18 -16
  85. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/openbsd.c +18 -16
  86. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pipe.c +3 -3
  87. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/process.c +18 -6
  88. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/proctitle.c +2 -2
  89. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/pthread-fixes.c +1 -0
  90. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/signal.c +2 -0
  91. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/stream.c +47 -30
  92. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/sunos.c +13 -11
  93. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tcp.c +43 -8
  94. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/thread.c +21 -15
  95. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/tty.c +16 -2
  96. data/src/cxx_supportlib/vendor-copy/libuv/src/unix/udp.c +54 -14
  97. data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.c +104 -21
  98. data/src/cxx_supportlib/vendor-copy/libuv/src/uv-common.h +14 -1
  99. data/src/cxx_supportlib/vendor-copy/libuv/src/version.c +1 -5
  100. data/src/cxx_supportlib/vendor-copy/libuv/uv.gyp +22 -1
  101. data/src/nginx_module/CacheLocationConfig.c +52 -0
  102. data/src/nginx_module/CacheLocationConfig.c.erb +13 -1
  103. data/src/nginx_module/Configuration.c +1 -0
  104. data/src/nginx_module/Configuration.h +1 -0
  105. data/src/nginx_module/ConfigurationCommands.c +20 -0
  106. data/src/nginx_module/ConfigurationFields.h +4 -0
  107. data/src/nginx_module/CreateLocationConfig.c +8 -0
  108. data/src/nginx_module/MergeLocationConfig.c +12 -0
  109. data/src/nginx_module/config +31 -13
  110. data/src/nginx_module/ngx_http_passenger_module.c +4 -0
  111. data/src/ruby_supportlib/phusion_passenger.rb +1 -1
  112. data/src/ruby_supportlib/phusion_passenger/constants.rb +1 -1
  113. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +11 -1
  114. data/src/ruby_supportlib/phusion_passenger/platform_info/apache.rb +6 -1
  115. data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +32 -31
  116. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +13 -2
  117. data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +1 -0
  118. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +6 -1
  119. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +6 -0
  120. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +29 -19
  121. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +2 -2
  122. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +2 -3
  123. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +2 -1
  124. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/spec_helper.rb +2 -0
  125. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/time_point.rb +3 -17
  126. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +7 -10
  127. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +11 -9
  128. metadata +5 -2
@@ -21,10 +21,6 @@
21
21
 
22
22
  #include "uv.h"
23
23
 
24
- #define UV_VERSION ((UV_VERSION_MAJOR << 16) | \
25
- (UV_VERSION_MINOR << 8) | \
26
- (UV_VERSION_PATCH))
27
-
28
24
  #define UV_STRINGIFY(v) UV_STRINGIFY_HELPER(v)
29
25
  #define UV_STRINGIFY_HELPER(v) #v
30
26
 
@@ -40,7 +36,7 @@
40
36
 
41
37
 
42
38
  unsigned int uv_version(void) {
43
- return UV_VERSION;
39
+ return UV_VERSION_HEX;
44
40
  }
45
41
 
46
42
 
@@ -104,12 +104,20 @@
104
104
  'src/win/winsock.c',
105
105
  'src/win/winsock.h',
106
106
  ],
107
+ 'conditions': [
108
+ ['MSVS_VERSION < "2015"', {
109
+ 'sources': [
110
+ 'src/win/snprintf.c'
111
+ ]
112
+ }]
113
+ ],
107
114
  'link_settings': {
108
115
  'libraries': [
109
116
  '-ladvapi32',
110
117
  '-liphlpapi',
111
118
  '-lpsapi',
112
119
  '-lshell32',
120
+ '-luserenv',
113
121
  '-lws2_32'
114
122
  ],
115
123
  },
@@ -304,6 +312,7 @@
304
312
  'test/test-getnameinfo.c',
305
313
  'test/test-getsockname.c',
306
314
  'test/test-handle-fileno.c',
315
+ 'test/test-homedir.c',
307
316
  'test/test-hrtime.c',
308
317
  'test/test-idle.c',
309
318
  'test/test-ip6-addr.c',
@@ -324,7 +333,10 @@
324
333
  'test/test-ping-pong.c',
325
334
  'test/test-pipe-bind-error.c',
326
335
  'test/test-pipe-connect-error.c',
336
+ 'test/test-pipe-connect-multiple.c',
337
+ 'test/test-pipe-connect-prepare.c',
327
338
  'test/test-pipe-getsockname.c',
339
+ 'test/test-pipe-pending-instances.c',
328
340
  'test/test-pipe-sendmsg.c',
329
341
  'test/test-pipe-server-close.c',
330
342
  'test/test-pipe-close-stdout-read-stdin.c',
@@ -335,6 +347,7 @@
335
347
  'test/test-poll-close-doesnt-corrupt-stack.c',
336
348
  'test/test-poll-closesocket.c',
337
349
  'test/test-process-title.c',
350
+ 'test/test-queue-foreach-delete.c',
338
351
  'test/test-ref.c',
339
352
  'test/test-run-nowait.c',
340
353
  'test/test-run-once.c',
@@ -353,6 +366,7 @@
353
366
  'test/test-tcp-close.c',
354
367
  'test/test-tcp-close-accept.c',
355
368
  'test/test-tcp-close-while-connecting.c',
369
+ 'test/test-tcp-create-socket-early.c',
356
370
  'test/test-tcp-connect-error-after-write.c',
357
371
  'test/test-tcp-shutdown-after-write.c',
358
372
  'test/test-tcp-flags.c',
@@ -381,6 +395,7 @@
381
395
  'test/test-timer.c',
382
396
  'test/test-tty.c',
383
397
  'test/test-udp-bind.c',
398
+ 'test/test-udp-create-socket-early.c',
384
399
  'test/test-udp-dgram-too-big.c',
385
400
  'test/test-udp-ipv6.c',
386
401
  'test/test-udp-open.c',
@@ -424,6 +439,9 @@
424
439
  '_XOPEN_SOURCE=500',
425
440
  ],
426
441
  }],
442
+ ['uv_library=="shared_library"', {
443
+ 'defines': [ 'USING_UV_SHARED=1' ]
444
+ }],
427
445
  ],
428
446
  'msvs-settings': {
429
447
  'VCLinkerTool': {
@@ -475,7 +493,10 @@
475
493
  'test/runner-unix.c',
476
494
  'test/runner-unix.h',
477
495
  ]
478
- }]
496
+ }],
497
+ ['uv_library=="shared_library"', {
498
+ 'defines': [ 'USING_UV_SHARED=1' ]
499
+ }],
479
500
  ],
480
501
  'msvs-settings': {
481
502
  'VCLinkerTool': {
@@ -59,6 +59,30 @@ int generated_cache_location_part(ngx_conf_t *cf, passenger_loc_conf_t *conf) {
59
59
 
60
60
 
61
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
+
62
86
  if (conf->ruby.data != NULL) {
63
87
  len += sizeof("!~PASSENGER_RUBY: ") - 1;
64
88
  len += conf->ruby.len;
@@ -359,6 +383,34 @@ if (buf == NULL) {
359
383
 
360
384
 
361
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
+
362
414
  if (conf->ruby.data != NULL) {
363
415
  pos = ngx_copy(pos,
364
416
  "!~PASSENGER_RUBY: ",
@@ -85,7 +85,7 @@ int generated_cache_location_part(ngx_conf_t *cf, passenger_loc_conf_t *conf) {
85
85
  len += end - int_buf;
86
86
  len += sizeof("\r\n") - 1;
87
87
  }
88
- <% elsif option[:type] == :integer %>
88
+ <% elsif option[:type] == :uinteger %>
89
89
  if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET_UINT) {
90
90
  end = ngx_snprintf(int_buf,
91
91
  sizeof(int_buf) - 1,
@@ -136,6 +136,18 @@ if (buf == NULL) {
136
136
  pos = ngx_copy(pos, int_buf, end - int_buf);
137
137
  pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
138
138
  }
139
+ <% elsif option[:type] == :uinteger %>
140
+ if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET_UINT) {
141
+ pos = ngx_copy(pos,
142
+ "!~<%= header_name_for(option) %>: ",
143
+ sizeof("!~<%= header_name_for(option) %>: ") - 1);
144
+ end = ngx_snprintf(int_buf,
145
+ sizeof(int_buf) - 1,
146
+ "%ui",
147
+ conf-><%= struct_field_for(option) %>);
148
+ pos = ngx_copy(pos, int_buf, end - int_buf);
149
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
150
+ }
139
151
  <% elsif option[:type] == :flag %>
140
152
  if (conf-><%= struct_field_for(option) %> != NGX_CONF_UNSET) {
141
153
  pos = ngx_copy(pos,
@@ -117,6 +117,7 @@ passenger_create_main_conf(ngx_conf_t *cf)
117
117
  conf->pool_idle_time = NGX_CONF_UNSET_UINT;
118
118
  conf->response_buffer_high_watermark = NGX_CONF_UNSET_UINT;
119
119
  conf->stat_throttle_rate = NGX_CONF_UNSET_UINT;
120
+ conf->core_file_descriptor_ulimit = NGX_CONF_UNSET_UINT;
120
121
  conf->user_switching = NGX_CONF_UNSET;
121
122
  conf->show_version_in_header = NGX_CONF_UNSET;
122
123
  conf->turbocaching = NGX_CONF_UNSET;
@@ -48,6 +48,7 @@ typedef struct {
48
48
  ngx_uint_t pool_idle_time;
49
49
  ngx_uint_t response_buffer_high_watermark;
50
50
  ngx_uint_t stat_throttle_rate;
51
+ ngx_uint_t core_file_descriptor_ulimit;
51
52
  ngx_flag_t turbocaching;
52
53
  ngx_flag_t show_version_in_header;
53
54
  ngx_flag_t user_switching;
@@ -50,6 +50,26 @@
50
50
  NULL
51
51
  },
52
52
 
53
+ {
54
+
55
+ ngx_string("passenger_core_file_descriptor_ulimit"),
56
+ NGX_HTTP_MAIN_CONF | NGX_CONF_TAKE1,
57
+ ngx_conf_set_num_slot,
58
+ NGX_HTTP_MAIN_CONF_OFFSET,
59
+ offsetof(passenger_main_conf_t, core_file_descriptor_ulimit),
60
+ NULL
61
+ },
62
+
63
+ {
64
+
65
+ ngx_string("passenger_app_file_descriptor_ulimit"),
66
+ NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
67
+ ngx_conf_set_num_slot,
68
+ NGX_HTTP_LOC_CONF_OFFSET,
69
+ offsetof(passenger_loc_conf_t, app_file_descriptor_ulimit),
70
+ NULL
71
+ },
72
+
53
73
  {
54
74
 
55
75
  ngx_string("passenger_enabled"),
@@ -53,8 +53,12 @@
53
53
 
54
54
  ngx_int_t abort_websockets_on_process_shutdown;
55
55
 
56
+ ngx_uint_t app_file_descriptor_ulimit;
57
+
56
58
  ngx_array_t *base_uris;
57
59
 
60
+ ngx_uint_t core_file_descriptor_ulimit;
61
+
58
62
  ngx_int_t debugger;
59
63
 
60
64
  ngx_int_t enabled;
@@ -46,6 +46,14 @@ void generated_set_conf_part(passenger_loc_conf_t *conf) {
46
46
 
47
47
 
48
48
 
49
+ conf->core_file_descriptor_ulimit = NGX_CONF_UNSET_UINT;
50
+
51
+
52
+
53
+ conf->app_file_descriptor_ulimit = NGX_CONF_UNSET_UINT;
54
+
55
+
56
+
49
57
  conf->enabled = NGX_CONF_UNSET;
50
58
 
51
59
 
@@ -49,6 +49,18 @@ int generated_merge_part(passenger_loc_conf_t *conf, passenger_loc_conf_t *prev,
49
49
 
50
50
 
51
51
 
52
+ ngx_conf_merge_uint_value(conf->core_file_descriptor_ulimit,
53
+ prev->core_file_descriptor_ulimit,
54
+ NGX_CONF_UNSET_UINT);
55
+
56
+
57
+
58
+ ngx_conf_merge_uint_value(conf->app_file_descriptor_ulimit,
59
+ prev->app_file_descriptor_ulimit,
60
+ NGX_CONF_UNSET_UINT);
61
+
62
+
63
+
52
64
  ngx_conf_merge_value(conf->enabled,
53
65
  prev->enabled,
54
66
  NGX_CONF_UNSET);
@@ -41,15 +41,8 @@ if test "x$PASSENGER_LIBS" = "x"; then
41
41
  PASSENGER_LIBS=`$PASSENGER_CONFIG --nginx-libs`
42
42
  fi
43
43
 
44
- ngx_addon_name=ngx_http_passenger_module
45
- HTTP_MODULES="$HTTP_MODULES ngx_http_passenger_module"
46
- NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
47
- ${ngx_addon_dir}/ngx_http_passenger_module.c \
48
- ${ngx_addon_dir}/Configuration.c \
49
- ${ngx_addon_dir}/ContentHandler.c \
50
- ${ngx_addon_dir}/StaticContentHandler.c"
51
- NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
52
- ${ngx_addon_dir}/Configuration.h \
44
+ PASSENGER_MODULE_INCS="$PASSENGER_INCLUDEDIR"
45
+ PASSENGER_MODULE_DEPS="${ngx_addon_dir}/Configuration.h \
53
46
  ${ngx_addon_dir}/ConfigurationCommands.c \
54
47
  ${ngx_addon_dir}/CreateLocationConfig.c \
55
48
  ${ngx_addon_dir}/MergeLocationConfig.c \
@@ -60,8 +53,12 @@ NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
60
53
  ${PASSENGER_INCLUDEDIR}/cxx_supportlib/Constants.h \
61
54
  ${PASSENGER_INCLUDEDIR}/cxx_supportlib/WatchdogLauncher.h \
62
55
  ${PASSENGER_INCLUDEDIR}/cxx_supportlib/AppTypes.h"
63
- CORE_INCS="$CORE_INCS $PASSENGER_INCLUDEDIR"
64
- CORE_LIBS="$CORE_LIBS $PASSENGER_LIBS -lstdc++ -lpthread"
56
+ PASSENGER_MODULE_SRCS="${ngx_addon_dir}/ngx_http_passenger_module.c \
57
+ ${ngx_addon_dir}/Configuration.c \
58
+ ${ngx_addon_dir}/ContentHandler.c \
59
+ ${ngx_addon_dir}/StaticContentHandler.c"
60
+ PASSENGER_MODULE_LIBS="$PASSENGER_LIBS -lstdc++ -lpthread"
61
+
65
62
 
66
63
  ngx_feature="Math library"
67
64
  ngx_feature_name=
@@ -72,7 +69,7 @@ ngx_feature_libs="-lm"
72
69
  ngx_feature_test="pow(1, 2)"
73
70
  . auto/feature
74
71
  if [ $ngx_found = yes ]; then
75
- CORE_LIBS="$CORE_LIBS -lm"
72
+ PASSENGER_MODULE_LIBS="$PASSENGER_MODULE_LIBS -lm"
76
73
  fi
77
74
 
78
75
  ngx_feature="POSIX realtime library"
@@ -84,9 +81,10 @@ ngx_feature_libs="-lrt"
84
81
  ngx_feature_test=
85
82
  . auto/feature
86
83
  if [ $ngx_found = yes ]; then
87
- CORE_LIBS="$CORE_LIBS -lrt"
84
+ PASSENGER_MODULE_LIBS="$PASSENGER_MODULE_LIBS -lrt"
88
85
  fi
89
86
 
87
+
90
88
  nginx_version=`grep 'NGINX_VERSION ' src/core/nginx.h | awk '{ print $3 }' | sed 's/"//g' | head -n1`
91
89
 
92
90
  nginx_major_version=`echo "$nginx_version" | cut -d . -f 1`
@@ -100,3 +98,23 @@ have=PASSENGER_NGINX_MINOR_VERSION value="$nginx_minor_version"
100
98
  nginx_micro_version=`echo "$nginx_version" | cut -d . -f 3`
101
99
  have=PASSENGER_NGINX_MICRO_VERSION value="$nginx_micro_version"
102
100
  . auto/define
101
+
102
+
103
+ ngx_addon_name=ngx_http_passenger_module
104
+
105
+ if test -n "$ngx_module_link"; then
106
+ ngx_module_type=HTTP
107
+ ngx_module_name=ngx_http_passenger_module
108
+ ngx_module_incs="$PASSENGER_MODULE_INCS"
109
+ ngx_module_deps="$PASSENGER_MODULE_DEPS"
110
+ ngx_module_srcs="$PASSENGER_MODULE_SRCS"
111
+ ngx_module_libs="$PASSENGER_MODULE_LIBS"
112
+
113
+ . auto/module
114
+ else
115
+ HTTP_MODULES="$HTTP_MODULES ngx_http_passenger_module"
116
+ NGX_ADDON_SRCS="$NGX_ADDON_SRCS $PASSENGER_MODULE_SRCS"
117
+ NGX_ADDON_DEPS="$NGX_ADDON_DEPS $PASSENGER_MODULE_DEPS"
118
+ CORE_INCS="$CORE_INCS $PASSENGER_MODULE_INCS"
119
+ CORE_LIBS="$CORE_LIBS $PASSENGER_MODULE_LIBS"
120
+ fi
@@ -286,6 +286,10 @@ start_watchdog(ngx_cycle_t *cycle) {
286
286
  psg_variant_map_set_ngx_str(params, "union_station_proxy_address", &passenger_main_conf.union_station_proxy_address);
287
287
  psg_variant_map_set_strset (params, "prestart_urls", (const char **) prestart_uris_ary, passenger_main_conf.prestart_uris->nelts);
288
288
 
289
+ if (passenger_main_conf.core_file_descriptor_ulimit != NGX_CONF_UNSET_UINT) {
290
+ psg_variant_map_set_int(params, "core_file_descriptor_ulimit", passenger_main_conf.core_file_descriptor_ulimit);
291
+ }
292
+
289
293
  if (passenger_main_conf.log_file.len > 0) {
290
294
  psg_variant_map_set_ngx_str(params, "log_file", &passenger_main_conf.log_file);
291
295
  } else if (cycle->new_log.file == NULL) {
@@ -31,7 +31,7 @@ module PhusionPassenger
31
31
 
32
32
  PACKAGE_NAME = 'passenger'
33
33
  # Run 'rake src/cxx_supportlib/Constants.h' after changing this number.
34
- VERSION_STRING = '5.0.25'
34
+ VERSION_STRING = '5.0.26'
35
35
 
36
36
  PREFERRED_NGINX_VERSION = '1.8.1'
37
37
  NGINX_SHA256_CHECKSUM = '8f4b3c630966c044ec72715754334d1fdf741caa1d5795fb4646c27d09f797b7'
@@ -44,7 +44,7 @@ module PhusionPassenger
44
44
  # Default config values
45
45
  DEFAULT_LOG_LEVEL = 3
46
46
  DEFAULT_INTEGRATION_MODE = "standalone"
47
- DEFAULT_SOCKET_BACKLOG = 1024
47
+ DEFAULT_SOCKET_BACKLOG = 2048
48
48
  DEFAULT_RUBY = "ruby"
49
49
  DEFAULT_PYTHON = "python"
50
50
  DEFAULT_NODEJS = "node"
@@ -1,5 +1,5 @@
1
1
  # Phusion Passenger - https://www.phusionpassenger.com/
2
- # Copyright (c) 2013-2015 Phusion Holding B.V.
2
+ # Copyright (c) 2013-2016 Phusion Holding B.V.
3
3
  #
4
4
  # "Passenger", "Phusion Passenger" and "Union Station" are registered
5
5
  # trademarks of Phusion Holding B.V.
@@ -92,6 +92,16 @@ LOCATION_CONFIGURATION_OPTIONS = [
92
92
  :context => [:main],
93
93
  :struct => "NGX_HTTP_MAIN_CONF_OFFSET"
94
94
  },
95
+ {
96
+ :name => 'passenger_core_file_descriptor_ulimit',
97
+ :type => :uinteger,
98
+ :context => [:main],
99
+ :struct => 'NGX_HTTP_MAIN_CONF_OFFSET'
100
+ },
101
+ {
102
+ :name => 'passenger_app_file_descriptor_ulimit',
103
+ :type => :uinteger
104
+ },
95
105
  {
96
106
  :name => 'passenger_enabled',
97
107
  :context => [:srv, :loc, :lif],
@@ -1,6 +1,6 @@
1
1
  # encoding: binary
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.
@@ -608,6 +608,11 @@ module PhusionPassenger
608
608
  apxs2_flags.gsub!('-m32 -march=i386 -mtune=generic', '')
609
609
  end
610
610
 
611
+ # Some Apache installations include '-pie' in CFLAGS, which
612
+ # won't work on shared libraries.
613
+ # https://github.com/phusion/passenger/issues/1756
614
+ apxs2_flags.gsub!('-pie', '')
615
+
611
616
  apxs2_flags.strip!
612
617
  flags << apxs2_flags
613
618
  end
@@ -1,6 +1,6 @@
1
1
  # encoding: binary
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.
@@ -215,7 +215,7 @@ module PhusionPassenger
215
215
  if !body.is_a?(Array) || headers.has_key?(X_SENDFILE_HEADER) ||
216
216
  headers.has_key?(X_ACCEL_REDIRECT_HEADER)
217
217
  # If X-Sendfile or X-Accel-Redirect is set, don't check the
218
- # body size. PassengerAgent's RequestHandler will ignore the
218
+ # body size. Passenger's Core Controller will ignore the
219
219
  # body anyway. See
220
220
  # ServerKit::HttpHeaderParser::processParseResult(const HttpParseResponse &)
221
221
  @can_keepalive = false
@@ -241,7 +241,10 @@ module PhusionPassenger
241
241
  # Disallowed by the HTTP spec
242
242
  raise "Response object may not contain both Content-Length and Transfer-Encoding"
243
243
  end
244
- elsif output_body
244
+ elsif status_code_allows_body?(status)
245
+ # This is a response for which a body is allowed, although the request
246
+ # may be one which does not expect a body (HEAD requests).
247
+ #
245
248
  # The app has set neither the Content-Length nor the Transfer-Encoding
246
249
  # header. This means we'll have to add one of those headers. We know exactly how
247
250
  # big our body will be, so we can keep-alive the connection.
@@ -270,37 +273,33 @@ module PhusionPassenger
270
273
  # If this is a request without body, write out headers without body.
271
274
  if !output_body
272
275
  connection.writev(headers_output)
273
- signal_keep_alive_allowed!
274
- return
275
- end
276
-
277
- # Otherwise, write out headers and body, then verify at the end whether what
278
- # we wrote is matches the message length. Only keep-alive connection if it
279
- # is the case.
280
- case message_length_type
281
- when :content_length
282
- if body.is_a?(Array)
283
- connection.writev2(headers_output, body)
284
- else
276
+ else
277
+ # Otherwise, write out headers and body.
278
+ case message_length_type
279
+ when :content_length
280
+ if body.is_a?(Array)
281
+ connection.writev2(headers_output, body)
282
+ else
283
+ connection.writev(headers_output)
284
+ body.each do |part|
285
+ connection.write(part.to_s)
286
+ end
287
+ end
288
+ when :chunked_by_app
285
289
  connection.writev(headers_output)
286
290
  body.each do |part|
287
291
  connection.write(part.to_s)
288
292
  end
289
- end
290
- when :chunked_by_app
291
- connection.writev(headers_output)
292
- body.each do |part|
293
- connection.write(part.to_s)
294
- end
295
- when :needs_chunking
296
- connection.writev(headers_output)
297
- body.each do |part|
298
- size = bytesize(part.to_s)
299
- if size != 0
300
- connection.writev(chunk_data(part.to_s, size))
293
+ when :needs_chunking
294
+ connection.writev(headers_output)
295
+ body.each do |part|
296
+ size = bytesize(part.to_s)
297
+ if size != 0
298
+ connection.writev(chunk_data(part.to_s, size))
299
+ end
301
300
  end
301
+ connection.write(TERMINATION_CHUNK)
302
302
  end
303
- connection.write(TERMINATION_CHUNK)
304
303
  end
305
304
 
306
305
  signal_keep_alive_allowed!
@@ -360,10 +359,12 @@ module PhusionPassenger
360
359
  nil
361
360
  end
362
361
 
362
+ def status_code_allows_body?(status)
363
+ status < 100 || (status >= 200 && status != 204 && status != 304)
364
+ end
365
+
363
366
  def should_output_body?(status, is_head_request)
364
- return (status < 100 ||
365
- (status >= 200 && status != 204 && status != 304)) &&
366
- !is_head_request
367
+ status_code_allows_body?(status) && !is_head_request
367
368
  end
368
369
 
369
370
  def chunk_data(data, size)