nginxtra 1.8.1.12 → 1.10.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (238) hide show
  1. checksums.yaml +4 -4
  2. data/bin/nginxtra +1 -1
  3. data/bin/nginxtra_rails +1 -1
  4. data/lib/nginxtra/version.rb +1 -1
  5. data/vendor/nginx/CHANGES +363 -25
  6. data/vendor/nginx/CHANGES.ru +365 -21
  7. data/vendor/nginx/LICENSE +2 -2
  8. data/vendor/nginx/auto/cc/conf +32 -0
  9. data/vendor/nginx/auto/cc/gcc +1 -1
  10. data/vendor/nginx/auto/cc/icc +2 -2
  11. data/vendor/nginx/auto/cc/msvc +29 -8
  12. data/vendor/nginx/auto/cc/name +2 -25
  13. data/vendor/nginx/auto/cc/sunc +3 -0
  14. data/vendor/nginx/auto/endianness +7 -2
  15. data/vendor/nginx/auto/install +60 -26
  16. data/vendor/nginx/auto/lib/conf +4 -4
  17. data/vendor/nginx/auto/lib/geoip/conf +6 -1
  18. data/vendor/nginx/auto/lib/libgd/conf +6 -1
  19. data/vendor/nginx/auto/lib/libxslt/conf +11 -2
  20. data/vendor/nginx/auto/lib/make +1 -1
  21. data/vendor/nginx/auto/lib/md5/conf +2 -2
  22. data/vendor/nginx/auto/lib/md5/make +2 -2
  23. data/vendor/nginx/auto/lib/openssl/conf +52 -3
  24. data/vendor/nginx/auto/lib/openssl/make +1 -1
  25. data/vendor/nginx/auto/lib/pcre/conf +2 -2
  26. data/vendor/nginx/auto/lib/pcre/make +2 -2
  27. data/vendor/nginx/auto/lib/perl/conf +6 -3
  28. data/vendor/nginx/auto/lib/perl/make +4 -1
  29. data/vendor/nginx/auto/lib/sha1/conf +2 -2
  30. data/vendor/nginx/auto/lib/sha1/make +2 -2
  31. data/vendor/nginx/auto/lib/zlib/conf +2 -2
  32. data/vendor/nginx/auto/lib/zlib/make +2 -2
  33. data/vendor/nginx/auto/make +281 -16
  34. data/vendor/nginx/auto/module +122 -0
  35. data/vendor/nginx/auto/modules +909 -178
  36. data/vendor/nginx/auto/options +81 -19
  37. data/vendor/nginx/auto/os/conf +9 -0
  38. data/vendor/nginx/auto/os/darwin +3 -0
  39. data/vendor/nginx/auto/os/freebsd +0 -20
  40. data/vendor/nginx/auto/os/linux +0 -12
  41. data/vendor/nginx/auto/os/win32 +5 -1
  42. data/vendor/nginx/auto/sources +11 -311
  43. data/vendor/nginx/auto/summary +1 -0
  44. data/vendor/nginx/auto/types/sizeof +5 -3
  45. data/vendor/nginx/auto/types/typedef +9 -4
  46. data/vendor/nginx/auto/types/uintptr_t +7 -2
  47. data/vendor/nginx/auto/unix +72 -12
  48. data/vendor/nginx/conf/fastcgi.conf +1 -0
  49. data/vendor/nginx/conf/fastcgi_params +1 -0
  50. data/vendor/nginx/conf/scgi_params +1 -0
  51. data/vendor/nginx/conf/uwsgi_params +1 -0
  52. data/vendor/nginx/configure +1 -1
  53. data/vendor/nginx/contrib/vim/syntax/nginx.vim +2 -2
  54. data/vendor/nginx/man/nginx.8 +6 -2
  55. data/vendor/nginx/src/core/nginx.c +281 -114
  56. data/vendor/nginx/src/core/nginx.h +2 -2
  57. data/vendor/nginx/src/core/ngx_conf_file.c +54 -13
  58. data/vendor/nginx/src/core/ngx_conf_file.h +8 -52
  59. data/vendor/nginx/src/core/ngx_config.h +0 -5
  60. data/vendor/nginx/src/core/ngx_connection.c +270 -37
  61. data/vendor/nginx/src/core/ngx_connection.h +35 -12
  62. data/vendor/nginx/src/core/ngx_core.h +4 -0
  63. data/vendor/nginx/src/core/ngx_crypt.c +2 -2
  64. data/vendor/nginx/src/core/ngx_cycle.c +72 -25
  65. data/vendor/nginx/src/core/ngx_cycle.h +28 -39
  66. data/vendor/nginx/src/core/ngx_file.c +14 -5
  67. data/vendor/nginx/src/core/ngx_file.h +2 -0
  68. data/vendor/nginx/src/core/ngx_hash.c +13 -1
  69. data/vendor/nginx/src/core/ngx_inet.c +20 -18
  70. data/vendor/nginx/src/core/ngx_log.c +12 -12
  71. data/vendor/nginx/src/core/ngx_log.h +13 -6
  72. data/vendor/nginx/src/core/ngx_module.c +360 -0
  73. data/vendor/nginx/src/core/ngx_module.h +307 -0
  74. data/vendor/nginx/src/core/ngx_open_file_cache.c +2 -2
  75. data/vendor/nginx/src/core/ngx_output_chain.c +8 -4
  76. data/vendor/nginx/src/core/ngx_palloc.c +42 -44
  77. data/vendor/nginx/src/{http/ngx_http_parse_time.c → core/ngx_parse_time.c} +2 -3
  78. data/vendor/nginx/src/core/ngx_parse_time.h +22 -0
  79. data/vendor/nginx/src/core/ngx_proxy_protocol.c +50 -1
  80. data/vendor/nginx/src/core/ngx_proxy_protocol.h +3 -1
  81. data/vendor/nginx/src/core/ngx_regex.c +1 -38
  82. data/vendor/nginx/src/core/ngx_resolver.c +1814 -320
  83. data/vendor/nginx/src/core/ngx_resolver.h +67 -10
  84. data/vendor/nginx/src/core/ngx_rwlock.c +120 -0
  85. data/vendor/nginx/src/core/ngx_rwlock.h +21 -0
  86. data/vendor/nginx/src/core/ngx_slab.c +6 -5
  87. data/vendor/nginx/src/core/ngx_string.c +1 -1
  88. data/vendor/nginx/src/core/ngx_syslog.c +11 -3
  89. data/vendor/nginx/src/core/ngx_syslog.h +2 -1
  90. data/vendor/nginx/src/core/ngx_thread_pool.c +4 -0
  91. data/vendor/nginx/src/core/ngx_times.c +2 -2
  92. data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +3 -1
  93. data/vendor/nginx/src/event/modules/ngx_epoll_module.c +5 -2
  94. data/vendor/nginx/src/event/modules/ngx_eventport_module.c +5 -5
  95. data/vendor/nginx/src/event/modules/ngx_kqueue_module.c +15 -8
  96. data/vendor/nginx/src/event/modules/ngx_poll_module.c +0 -10
  97. data/vendor/nginx/src/event/modules/ngx_select_module.c +0 -10
  98. data/vendor/nginx/src/event/ngx_event.c +60 -103
  99. data/vendor/nginx/src/event/ngx_event.h +22 -26
  100. data/vendor/nginx/src/event/ngx_event_accept.c +414 -88
  101. data/vendor/nginx/src/event/ngx_event_connect.c +27 -18
  102. data/vendor/nginx/src/event/ngx_event_connect.h +1 -0
  103. data/vendor/nginx/src/event/ngx_event_openssl.c +65 -25
  104. data/vendor/nginx/src/event/ngx_event_openssl.h +17 -0
  105. data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +73 -7
  106. data/vendor/nginx/src/event/ngx_event_pipe.c +85 -27
  107. data/vendor/nginx/src/event/ngx_event_pipe.h +10 -0
  108. data/vendor/nginx/src/http/modules/ngx_http_auth_basic_module.c +1 -1
  109. data/vendor/nginx/src/http/modules/ngx_http_auth_request_module.c +2 -2
  110. data/vendor/nginx/src/http/modules/ngx_http_chunked_filter_module.c +2 -2
  111. data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +6 -6
  112. data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +17 -11
  113. data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +2 -2
  114. data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +9 -9
  115. data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +2 -2
  116. data/vendor/nginx/src/http/modules/ngx_http_limit_conn_module.c +2 -2
  117. data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +0 -7
  118. data/vendor/nginx/src/http/modules/ngx_http_map_module.c +6 -6
  119. data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +2 -1
  120. data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +13 -13
  121. data/vendor/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +2 -2
  122. data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +26 -21
  123. data/vendor/nginx/src/http/modules/ngx_http_random_index_module.c +1 -1
  124. data/vendor/nginx/src/http/modules/ngx_http_range_filter_module.c +26 -8
  125. data/vendor/nginx/src/http/modules/ngx_http_realip_module.c +73 -3
  126. data/vendor/nginx/src/http/modules/ngx_http_referer_module.c +1 -1
  127. data/vendor/nginx/src/http/modules/ngx_http_rewrite_module.c +6 -6
  128. data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +5 -3
  129. data/vendor/nginx/src/http/modules/ngx_http_slice_filter_module.c +526 -0
  130. data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +7 -7
  131. data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +19 -16
  132. data/vendor/nginx/src/http/modules/ngx_http_static_module.c +1 -1
  133. data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +1 -1
  134. data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +373 -173
  135. data/vendor/nginx/src/http/modules/ngx_http_upstream_hash_module.c +72 -46
  136. data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +18 -30
  137. data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +50 -39
  138. data/vendor/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c +38 -129
  139. data/vendor/nginx/src/http/modules/ngx_http_upstream_zone_module.c +246 -0
  140. data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +6 -5
  141. data/vendor/nginx/src/http/modules/perl/nginx.xs +9 -9
  142. data/vendor/nginx/src/http/ngx_http.c +46 -43
  143. data/vendor/nginx/src/http/ngx_http.h +4 -9
  144. data/vendor/nginx/src/http/ngx_http_cache.h +4 -0
  145. data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +13 -5
  146. data/vendor/nginx/src/http/ngx_http_core_module.c +92 -91
  147. data/vendor/nginx/src/http/ngx_http_core_module.h +12 -8
  148. data/vendor/nginx/src/http/ngx_http_file_cache.c +61 -10
  149. data/vendor/nginx/src/http/ngx_http_request.c +37 -50
  150. data/vendor/nginx/src/http/ngx_http_request.h +10 -15
  151. data/vendor/nginx/src/http/ngx_http_request_body.c +64 -88
  152. data/vendor/nginx/src/http/ngx_http_script.c +3 -3
  153. data/vendor/nginx/src/http/ngx_http_special_response.c +1 -4
  154. data/vendor/nginx/src/http/ngx_http_upstream.c +245 -109
  155. data/vendor/nginx/src/http/ngx_http_upstream.h +11 -5
  156. data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +212 -65
  157. data/vendor/nginx/src/http/ngx_http_upstream_round_robin.h +66 -5
  158. data/vendor/nginx/src/http/ngx_http_variables.c +28 -15
  159. data/vendor/nginx/src/http/ngx_http_write_filter_module.c +1 -1
  160. data/vendor/nginx/src/http/v2/ngx_http_v2.c +4349 -0
  161. data/vendor/nginx/src/http/v2/ngx_http_v2.h +337 -0
  162. data/vendor/nginx/src/http/v2/ngx_http_v2_filter_module.c +1391 -0
  163. data/vendor/nginx/src/http/v2/ngx_http_v2_huff_decode.c +2714 -0
  164. data/vendor/nginx/src/http/v2/ngx_http_v2_huff_encode.c +254 -0
  165. data/vendor/nginx/src/http/v2/ngx_http_v2_module.c +469 -0
  166. data/vendor/nginx/src/http/{ngx_http_spdy_module.h → v2/ngx_http_v2_module.h} +10 -9
  167. data/vendor/nginx/src/http/v2/ngx_http_v2_table.c +349 -0
  168. data/vendor/nginx/src/mail/ngx_mail.c +49 -82
  169. data/vendor/nginx/src/mail/ngx_mail.h +16 -23
  170. data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +1 -1
  171. data/vendor/nginx/src/mail/ngx_mail_core_module.c +60 -34
  172. data/vendor/nginx/src/mail/ngx_mail_handler.c +17 -12
  173. data/vendor/nginx/src/mail/ngx_mail_proxy_module.c +1 -14
  174. data/vendor/nginx/src/mail/ngx_mail_smtp_handler.c +1 -1
  175. data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +5 -5
  176. data/vendor/nginx/src/os/unix/ngx_atomic.h +10 -10
  177. data/vendor/nginx/src/os/unix/ngx_channel.h +4 -4
  178. data/vendor/nginx/src/os/unix/ngx_darwin_config.h +2 -0
  179. data/vendor/nginx/src/os/unix/ngx_darwin_init.c +1 -0
  180. data/vendor/nginx/src/os/unix/ngx_dlopen.c +28 -0
  181. data/vendor/nginx/src/os/unix/ngx_dlopen.h +31 -0
  182. data/vendor/nginx/src/os/unix/ngx_errno.h +1 -0
  183. data/vendor/nginx/src/os/unix/ngx_file_aio_read.c +1 -1
  184. data/vendor/nginx/src/os/unix/ngx_files.c +313 -80
  185. data/vendor/nginx/src/os/unix/ngx_files.h +5 -2
  186. data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +3 -1
  187. data/vendor/nginx/src/os/unix/ngx_freebsd_init.c +1 -0
  188. data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +13 -0
  189. data/vendor/nginx/src/os/unix/ngx_linux.h +0 -2
  190. data/vendor/nginx/src/os/unix/ngx_linux_aio_read.c +1 -1
  191. data/vendor/nginx/src/os/unix/ngx_linux_config.h +2 -6
  192. data/vendor/nginx/src/os/unix/ngx_linux_init.c +1 -33
  193. data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +55 -12
  194. data/vendor/nginx/src/os/unix/ngx_os.h +3 -9
  195. data/vendor/nginx/src/os/unix/ngx_posix_config.h +14 -1
  196. data/vendor/nginx/src/os/unix/ngx_posix_init.c +2 -1
  197. data/vendor/nginx/src/os/unix/ngx_process.c +1 -1
  198. data/vendor/nginx/src/os/unix/ngx_process_cycle.c +25 -51
  199. data/vendor/nginx/src/os/unix/ngx_process_cycle.h +1 -0
  200. data/vendor/nginx/src/os/unix/ngx_readv_chain.c +24 -28
  201. data/vendor/nginx/src/os/unix/ngx_recv.c +30 -79
  202. data/vendor/nginx/src/os/unix/ngx_send.c +1 -1
  203. data/vendor/nginx/src/os/unix/ngx_setaffinity.c +14 -30
  204. data/vendor/nginx/src/os/unix/ngx_setaffinity.h +15 -1
  205. data/vendor/nginx/src/os/unix/ngx_solaris_config.h +2 -0
  206. data/vendor/nginx/src/os/unix/ngx_solaris_init.c +1 -0
  207. data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +23 -0
  208. data/vendor/nginx/src/os/unix/ngx_sunpro_amd64.il +3 -3
  209. data/vendor/nginx/src/os/unix/ngx_sunpro_x86.il +3 -3
  210. data/vendor/nginx/src/os/unix/ngx_udp_recv.c +5 -48
  211. data/vendor/nginx/src/os/unix/ngx_udp_send.c +56 -0
  212. data/vendor/nginx/src/stream/ngx_stream.c +564 -0
  213. data/vendor/nginx/src/stream/ngx_stream.h +212 -0
  214. data/vendor/nginx/src/stream/ngx_stream_access_module.c +451 -0
  215. data/vendor/nginx/src/stream/ngx_stream_core_module.c +562 -0
  216. data/vendor/nginx/src/stream/ngx_stream_handler.c +344 -0
  217. data/vendor/nginx/src/stream/ngx_stream_limit_conn_module.c +632 -0
  218. data/vendor/nginx/src/stream/ngx_stream_proxy_module.c +1674 -0
  219. data/vendor/nginx/src/stream/ngx_stream_ssl_module.c +460 -0
  220. data/vendor/nginx/src/stream/ngx_stream_ssl_module.h +49 -0
  221. data/vendor/nginx/src/stream/ngx_stream_upstream.c +464 -0
  222. data/vendor/nginx/src/stream/ngx_stream_upstream.h +107 -0
  223. data/vendor/nginx/src/stream/ngx_stream_upstream_hash_module.c +656 -0
  224. data/vendor/nginx/src/stream/ngx_stream_upstream_least_conn_module.c +307 -0
  225. data/vendor/nginx/src/stream/ngx_stream_upstream_round_robin.c +702 -0
  226. data/vendor/nginx/src/stream/ngx_stream_upstream_round_robin.h +139 -0
  227. data/vendor/nginx/src/stream/ngx_stream_upstream_zone_module.c +242 -0
  228. metadata +39 -15
  229. data/vendor/nginx/src/event/modules/ngx_aio_module.c +0 -171
  230. data/vendor/nginx/src/event/modules/ngx_rtsig_module.c +0 -735
  231. data/vendor/nginx/src/http/ngx_http_spdy.c +0 -3701
  232. data/vendor/nginx/src/http/ngx_http_spdy.h +0 -261
  233. data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +0 -1222
  234. data/vendor/nginx/src/http/ngx_http_spdy_module.c +0 -408
  235. data/vendor/nginx/src/os/unix/ngx_aio_read.c +0 -109
  236. data/vendor/nginx/src/os/unix/ngx_aio_read_chain.c +0 -78
  237. data/vendor/nginx/src/os/unix/ngx_aio_write.c +0 -109
  238. data/vendor/nginx/src/os/unix/ngx_aio_write_chain.c +0 -100
@@ -22,8 +22,8 @@ static ngx_int_t ngx_event_pipe_drain_chains(ngx_event_pipe_t *p);
22
22
  ngx_int_t
23
23
  ngx_event_pipe(ngx_event_pipe_t *p, ngx_int_t do_write)
24
24
  {
25
- u_int flags;
26
25
  ngx_int_t rc;
26
+ ngx_uint_t flags;
27
27
  ngx_event_t *rev, *wev;
28
28
 
29
29
  for ( ;; ) {
@@ -112,6 +112,14 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p)
112
112
  return NGX_OK;
113
113
  }
114
114
 
115
+ #if (NGX_THREADS)
116
+ if (p->aio) {
117
+ ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
118
+ "pipe read upstream: aio");
119
+ return NGX_AGAIN;
120
+ }
121
+ #endif
122
+
115
123
  ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0,
116
124
  "pipe read upstream: %d", p->upstream->read->ready);
117
125
 
@@ -258,19 +266,6 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p)
258
266
  break;
259
267
  }
260
268
 
261
- if (rc == NGX_AGAIN) {
262
- if (ngx_event_flags & NGX_USE_LEVEL_EVENT
263
- && p->upstream->read->active
264
- && p->upstream->read->ready)
265
- {
266
- if (ngx_del_event(p->upstream->read, NGX_READ_EVENT, 0)
267
- == NGX_ERROR)
268
- {
269
- return NGX_ABORT;
270
- }
271
- }
272
- }
273
-
274
269
  if (rc != NGX_OK) {
275
270
  return rc;
276
271
  }
@@ -439,7 +434,7 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p)
439
434
  /* STUB */ cl->buf->num = p->num++;
440
435
 
441
436
  if (p->input_filter(p, cl->buf) == NGX_ERROR) {
442
- return NGX_ABORT;
437
+ return NGX_ABORT;
443
438
  }
444
439
 
445
440
  ngx_free_chain(p->pool, cl);
@@ -475,8 +470,10 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p)
475
470
  ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
476
471
  "pipe write chain");
477
472
 
478
- if (ngx_event_pipe_write_chain_to_temp_file(p) == NGX_ABORT) {
479
- return NGX_ABORT;
473
+ rc = ngx_event_pipe_write_chain_to_temp_file(p);
474
+
475
+ if (rc != NGX_OK) {
476
+ return rc;
480
477
  }
481
478
  }
482
479
 
@@ -499,6 +496,18 @@ ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p)
499
496
  ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0,
500
497
  "pipe write downstream: %d", downstream->write->ready);
501
498
 
499
+ #if (NGX_THREADS)
500
+
501
+ if (p->writing) {
502
+ rc = ngx_event_pipe_write_chain_to_temp_file(p);
503
+
504
+ if (rc == NGX_ABORT) {
505
+ return NGX_ABORT;
506
+ }
507
+ }
508
+
509
+ #endif
510
+
502
511
  flushed = 0;
503
512
 
504
513
  for ( ;; ) {
@@ -532,6 +541,10 @@ ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p)
532
541
  p->out = NULL;
533
542
  }
534
543
 
544
+ if (p->writing) {
545
+ break;
546
+ }
547
+
535
548
  if (p->in) {
536
549
  ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
537
550
  "pipe write downstream flush in");
@@ -608,7 +621,7 @@ ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p)
608
621
 
609
622
  p->out = p->out->next;
610
623
 
611
- } else if (!p->cacheable && p->in) {
624
+ } else if (!p->cacheable && !p->writing && p->in) {
612
625
  cl = p->in;
613
626
 
614
627
  ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0,
@@ -647,7 +660,7 @@ ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p)
647
660
  flush:
648
661
 
649
662
  ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0,
650
- "pipe write: out:%p, f:%d", out, flush);
663
+ "pipe write: out:%p, f:%ui", out, flush);
651
664
 
652
665
  if (out == NULL) {
653
666
 
@@ -710,12 +723,38 @@ ngx_event_pipe_write_chain_to_temp_file(ngx_event_pipe_t *p)
710
723
  ssize_t size, bsize, n;
711
724
  ngx_buf_t *b;
712
725
  ngx_uint_t prev_last_shadow;
713
- ngx_chain_t *cl, *tl, *next, *out, **ll, **last_out, **last_free, fl;
726
+ ngx_chain_t *cl, *tl, *next, *out, **ll, **last_out, **last_free;
727
+
728
+ #if (NGX_THREADS)
729
+
730
+ if (p->writing) {
731
+
732
+ if (p->aio) {
733
+ return NGX_AGAIN;
734
+ }
735
+
736
+ out = p->writing;
737
+ p->writing = NULL;
738
+
739
+ n = ngx_write_chain_to_temp_file(p->temp_file, NULL);
740
+
741
+ if (n == NGX_ERROR) {
742
+ return NGX_ABORT;
743
+ }
744
+
745
+ goto done;
746
+ }
747
+
748
+ #endif
714
749
 
715
750
  if (p->buf_to_file) {
716
- fl.buf = p->buf_to_file;
717
- fl.next = p->in;
718
- out = &fl;
751
+ out = ngx_alloc_chain_link(p->pool);
752
+ if (out == NULL) {
753
+ return NGX_ABORT;
754
+ }
755
+
756
+ out->buf = p->buf_to_file;
757
+ out->next = p->in;
719
758
 
720
759
  } else {
721
760
  out = p->in;
@@ -762,12 +801,12 @@ ngx_event_pipe_write_chain_to_temp_file(ngx_event_pipe_t *p)
762
801
  }
763
802
 
764
803
  if (cl) {
765
- p->in = cl;
766
- *ll = NULL;
804
+ p->in = cl;
805
+ *ll = NULL;
767
806
 
768
807
  } else {
769
- p->in = NULL;
770
- p->last_in = &p->in;
808
+ p->in = NULL;
809
+ p->last_in = &p->in;
771
810
  }
772
811
 
773
812
  } else {
@@ -775,12 +814,31 @@ ngx_event_pipe_write_chain_to_temp_file(ngx_event_pipe_t *p)
775
814
  p->last_in = &p->in;
776
815
  }
777
816
 
817
+ #if (NGX_THREADS)
818
+ p->temp_file->thread_write = p->thread_handler ? 1 : 0;
819
+ p->temp_file->file.thread_task = p->thread_task;
820
+ p->temp_file->file.thread_handler = p->thread_handler;
821
+ p->temp_file->file.thread_ctx = p->thread_ctx;
822
+ #endif
823
+
778
824
  n = ngx_write_chain_to_temp_file(p->temp_file, out);
779
825
 
780
826
  if (n == NGX_ERROR) {
781
827
  return NGX_ABORT;
782
828
  }
783
829
 
830
+ #if (NGX_THREADS)
831
+
832
+ if (n == NGX_AGAIN) {
833
+ p->writing = out;
834
+ p->thread_task = p->temp_file->file.thread_task;
835
+ return NGX_AGAIN;
836
+ }
837
+
838
+ done:
839
+
840
+ #endif
841
+
784
842
  if (p->buf_to_file) {
785
843
  p->temp_file->offset = p->buf_to_file->last - p->buf_to_file->pos;
786
844
  n -= p->buf_to_file->last - p->buf_to_file->pos;
@@ -30,6 +30,8 @@ struct ngx_event_pipe_s {
30
30
  ngx_chain_t *in;
31
31
  ngx_chain_t **last_in;
32
32
 
33
+ ngx_chain_t *writing;
34
+
33
35
  ngx_chain_t *out;
34
36
  ngx_chain_t *free;
35
37
  ngx_chain_t *busy;
@@ -45,6 +47,13 @@ struct ngx_event_pipe_s {
45
47
  ngx_event_pipe_output_filter_pt output_filter;
46
48
  void *output_ctx;
47
49
 
50
+ #if (NGX_THREADS)
51
+ ngx_int_t (*thread_handler)(ngx_thread_task_t *task,
52
+ ngx_file_t *file);
53
+ void *thread_ctx;
54
+ ngx_thread_task_t *thread_task;
55
+ #endif
56
+
48
57
  unsigned read:1;
49
58
  unsigned cacheable:1;
50
59
  unsigned single_buf:1;
@@ -56,6 +65,7 @@ struct ngx_event_pipe_s {
56
65
  unsigned downstream_done:1;
57
66
  unsigned downstream_error:1;
58
67
  unsigned cyclic_temp_file:1;
68
+ unsigned aio:1;
59
69
 
60
70
  ngx_int_t allocated;
61
71
  ngx_bufs_t bufs;
@@ -298,7 +298,7 @@ ngx_http_auth_basic_crypt_handler(ngx_http_request_t *r,
298
298
  &encrypted);
299
299
 
300
300
  ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
301
- "rc: %d user: \"%V\" salt: \"%s\"",
301
+ "rc: %i user: \"%V\" salt: \"%s\"",
302
302
  rc, &r->headers_in.user, passwd->data);
303
303
 
304
304
  if (rc == NGX_OK) {
@@ -168,7 +168,7 @@ ngx_http_auth_request_handler(ngx_http_request_t *r)
168
168
  }
169
169
 
170
170
  ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
171
- "auth request unexpected status: %d", ctx->status);
171
+ "auth request unexpected status: %ui", ctx->status);
172
172
 
173
173
  return NGX_HTTP_INTERNAL_SERVER_ERROR;
174
174
  }
@@ -219,7 +219,7 @@ ngx_http_auth_request_done(ngx_http_request_t *r, void *data, ngx_int_t rc)
219
219
  ngx_http_auth_request_ctx_t *ctx = data;
220
220
 
221
221
  ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
222
- "auth request done s:%d", r->headers_out.status);
222
+ "auth request done s:%ui", r->headers_out.status);
223
223
 
224
224
  ctx->done = 1;
225
225
  ctx->status = r->headers_out.status;
@@ -64,7 +64,7 @@ ngx_http_chunked_header_filter(ngx_http_request_t *r)
64
64
  || r->headers_out.status == NGX_HTTP_NO_CONTENT
65
65
  || r->headers_out.status < NGX_HTTP_OK
66
66
  || r != r->main
67
- || (r->method & NGX_HTTP_HEAD))
67
+ || r->method == NGX_HTTP_HEAD)
68
68
  {
69
69
  return ngx_http_next_header_filter(r);
70
70
  }
@@ -121,7 +121,7 @@ ngx_http_chunked_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
121
121
 
122
122
  for ( ;; ) {
123
123
  ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
124
- "http chunk: %d", ngx_buf_size(cl->buf));
124
+ "http chunk: %O", ngx_buf_size(cl->buf));
125
125
 
126
126
  size += ngx_buf_size(cl->buf);
127
127
 
@@ -255,7 +255,7 @@ ngx_http_dav_put_handler(ngx_http_request_t *r)
255
255
  ext.log = r->connection->log;
256
256
 
257
257
  if (r->headers_in.date) {
258
- date = ngx_http_parse_time(r->headers_in.date->value.data,
258
+ date = ngx_parse_http_time(r->headers_in.date->value.data,
259
259
  r->headers_in.date->value.len);
260
260
 
261
261
  if (date != NGX_ERROR) {
@@ -621,11 +621,11 @@ destination_done:
621
621
  if ((r->uri.data[r->uri.len - 1] == '/' && *(last - 1) != '/')
622
622
  || (r->uri.data[r->uri.len - 1] != '/' && *(last - 1) == '/'))
623
623
  {
624
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
625
- "both URI \"%V\" and \"Destination\" URI \"%V\" "
626
- "should be either collections or non-collections",
627
- &r->uri, &dest->value);
628
- return NGX_HTTP_CONFLICT;
624
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
625
+ "both URI \"%V\" and \"Destination\" URI \"%V\" "
626
+ "should be either collections or non-collections",
627
+ &r->uri, &dest->value);
628
+ return NGX_HTTP_CONFLICT;
629
629
  }
630
630
 
631
631
  depth = ngx_http_dav_depth(r, NGX_HTTP_DAV_INFINITY_DEPTH);
@@ -206,6 +206,7 @@ static ngx_conf_bitmask_t ngx_http_fastcgi_next_upstream_masks[] = {
206
206
  { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR },
207
207
  { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
208
208
  { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
209
+ { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT },
209
210
  { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
210
211
  { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
211
212
  { ngx_string("http_403"), NGX_HTTP_UPSTREAM_FT_HTTP_403 },
@@ -750,7 +751,7 @@ ngx_http_fastcgi_eval(ngx_http_request_t *r, ngx_http_fastcgi_loc_conf_t *flcf)
750
751
  url.no_resolve = 1;
751
752
 
752
753
  if (ngx_parse_url(r->pool, &url) != NGX_OK) {
753
- if (url.err) {
754
+ if (url.err) {
754
755
  ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
755
756
  "%s in upstream \"%V\"", url.err, &url.url);
756
757
  }
@@ -773,10 +774,11 @@ ngx_http_fastcgi_eval(ngx_http_request_t *r, ngx_http_fastcgi_loc_conf_t *flcf)
773
774
 
774
775
  } else {
775
776
  u->resolved->host = url.host;
776
- u->resolved->port = url.port;
777
- u->resolved->no_port = url.no_port;
778
777
  }
779
778
 
779
+ u->resolved->port = url.port;
780
+ u->resolved->no_port = url.no_port;
781
+
780
782
  return NGX_OK;
781
783
  }
782
784
 
@@ -1175,6 +1177,11 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
1175
1177
 
1176
1178
  while (body) {
1177
1179
 
1180
+ if (ngx_buf_special(body->buf)) {
1181
+ body = body->next;
1182
+ continue;
1183
+ }
1184
+
1178
1185
  if (body->buf->in_file) {
1179
1186
  file_pos = body->buf->file_pos;
1180
1187
 
@@ -1651,7 +1658,7 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r)
1651
1658
  && f->type != NGX_HTTP_FASTCGI_STDERR)
1652
1659
  {
1653
1660
  ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
1654
- "upstream sent unexpected FastCGI record: %d",
1661
+ "upstream sent unexpected FastCGI record: %ui",
1655
1662
  f->type);
1656
1663
 
1657
1664
  return NGX_HTTP_UPSTREAM_INVALID_HEADER;
@@ -1770,7 +1777,6 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r)
1770
1777
  #if (NGX_HTTP_CACHE)
1771
1778
 
1772
1779
  if (f->large_stderr && r->cache) {
1773
- u_char *start;
1774
1780
  ssize_t len;
1775
1781
  ngx_http_fastcgi_header_t *fh;
1776
1782
 
@@ -1799,7 +1805,7 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r)
1799
1805
 
1800
1806
  } else {
1801
1807
  r->cache->header_start += u->buffer.pos - start
1802
- - sizeof(ngx_http_fastcgi_header_t);
1808
+ - sizeof(ngx_http_fastcgi_header_t);
1803
1809
  }
1804
1810
 
1805
1811
  f->large_stderr = 0;
@@ -1833,7 +1839,7 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r)
1833
1839
  rc = ngx_http_parse_header_line(r, &u->buffer, 1);
1834
1840
 
1835
1841
  ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1836
- "http fastcgi parser: %d", rc);
1842
+ "http fastcgi parser: %i", rc);
1837
1843
 
1838
1844
  if (rc == NGX_AGAIN) {
1839
1845
  break;
@@ -2504,7 +2510,7 @@ ngx_http_fastcgi_non_buffered_filter(void *data, ssize_t bytes)
2504
2510
 
2505
2511
  for (cl = u->out_bufs; cl; cl = cl->next) {
2506
2512
  ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2507
- "http fastcgi in memory %p-%p %uz",
2513
+ "http fastcgi in memory %p-%p %O",
2508
2514
  cl->buf->pos, cl->buf->last, ngx_buf_size(cl->buf));
2509
2515
 
2510
2516
  if (buf->last == cl->buf->pos) {
@@ -2557,8 +2563,8 @@ ngx_http_fastcgi_process_record(ngx_http_request_t *r,
2557
2563
  case NGX_HTTP_FASTCGI_STDOUT:
2558
2564
  case NGX_HTTP_FASTCGI_STDERR:
2559
2565
  case NGX_HTTP_FASTCGI_END_REQUEST:
2560
- f->type = (ngx_uint_t) ch;
2561
- break;
2566
+ f->type = (ngx_uint_t) ch;
2567
+ break;
2562
2568
  default:
2563
2569
  ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
2564
2570
  "upstream sent invalid FastCGI "
@@ -2653,7 +2659,7 @@ ngx_http_fastcgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
2653
2659
  static ngx_int_t
2654
2660
  ngx_http_fastcgi_add_variables(ngx_conf_t *cf)
2655
2661
  {
2656
- ngx_http_variable_t *var, *v;
2662
+ ngx_http_variable_t *var, *v;
2657
2663
 
2658
2664
  for (v = ngx_http_fastcgi_vars; v->name.len; v++) {
2659
2665
  var = ngx_http_add_variable(cf, &v->name, v->flags);
@@ -1009,14 +1009,14 @@ ngx_http_gzip_filter_alloc(void *opaque, u_int items, u_int size)
1009
1009
  ctx->allocated -= alloc;
1010
1010
 
1011
1011
  ngx_log_debug4(NGX_LOG_DEBUG_HTTP, ctx->request->connection->log, 0,
1012
- "gzip alloc: n:%ud s:%ud a:%ud p:%p",
1012
+ "gzip alloc: n:%ud s:%ud a:%ui p:%p",
1013
1013
  items, size, alloc, p);
1014
1014
 
1015
1015
  return p;
1016
1016
  }
1017
1017
 
1018
1018
  ngx_log_error(NGX_LOG_ALERT, ctx->request->connection->log, 0,
1019
- "gzip filter failed to use preallocated memory: %ud of %ud",
1019
+ "gzip filter failed to use preallocated memory: %ud of %ui",
1020
1020
  items * size, ctx->allocated);
1021
1021
 
1022
1022
  p = ngx_palloc(ctx->request->pool, items * size);
@@ -498,7 +498,7 @@ ngx_http_set_last_modified(ngx_http_request_t *r, ngx_http_header_val_t *hv,
498
498
  }
499
499
 
500
500
  r->headers_out.last_modified_time =
501
- (value->len) ? ngx_http_parse_time(value->data, value->len) : -1;
501
+ (value->len) ? ngx_parse_http_time(value->data, value->len) : -1;
502
502
 
503
503
  return NGX_OK;
504
504
  }
@@ -712,17 +712,17 @@ ngx_http_headers_add(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
712
712
 
713
713
  if (value[2].len == 0) {
714
714
  ngx_memzero(&hv->value, sizeof(ngx_http_complex_value_t));
715
- return NGX_CONF_OK;
716
- }
717
715
 
718
- ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
716
+ } else {
717
+ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
719
718
 
720
- ccv.cf = cf;
721
- ccv.value = &value[2];
722
- ccv.complex_value = &hv->value;
719
+ ccv.cf = cf;
720
+ ccv.value = &value[2];
721
+ ccv.complex_value = &hv->value;
723
722
 
724
- if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
725
- return NGX_CONF_ERROR;
723
+ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
724
+ return NGX_CONF_ERROR;
725
+ }
726
726
  }
727
727
 
728
728
  if (cf->args->nelts == 3) {