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
@@ -109,6 +109,7 @@ static ngx_conf_bitmask_t ngx_http_uwsgi_next_upstream_masks[] = {
109
109
  { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR },
110
110
  { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT },
111
111
  { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
112
+ { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT },
112
113
  { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
113
114
  { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
114
115
  { ngx_string("http_403"), NGX_HTTP_UPSTREAM_FT_HTTP_403 },
@@ -771,10 +772,11 @@ ngx_http_uwsgi_eval(ngx_http_request_t *r, ngx_http_uwsgi_loc_conf_t * uwcf)
771
772
 
772
773
  } else {
773
774
  u->resolved->host = url.host;
774
- u->resolved->port = url.port;
775
- u->resolved->no_port = url.no_port;
776
775
  }
777
776
 
777
+ u->resolved->port = url.port;
778
+ u->resolved->no_port = url.no_port;
779
+
778
780
  return NGX_OK;
779
781
  }
780
782
 
@@ -1724,9 +1726,8 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
1724
1726
  prev->upstream.ssl_session_reuse, 1);
1725
1727
 
1726
1728
  ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
1727
- (NGX_CONF_BITMASK_SET|NGX_SSL_SSLv3
1728
- |NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
1729
- |NGX_SSL_TLSv1_2));
1729
+ (NGX_CONF_BITMASK_SET|NGX_SSL_TLSv1
1730
+ |NGX_SSL_TLSv1_1|NGX_SSL_TLSv1_2));
1730
1731
 
1731
1732
  ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
1732
1733
  "DEFAULT");
@@ -98,6 +98,9 @@ ngx_http_perl_output(ngx_http_request_t *r, ngx_buf_t *b)
98
98
  MODULE = nginx PACKAGE = nginx
99
99
 
100
100
 
101
+ PROTOTYPES: DISABLE
102
+
103
+
101
104
  void
102
105
  status(r, code)
103
106
  CODE:
@@ -268,19 +271,16 @@ header_in(r, key)
268
271
  }
269
272
  #endif
270
273
 
271
- if (hh->offset) {
272
-
273
- ph = (ngx_table_elt_t **) ((char *) &r->headers_in + hh->offset);
274
+ ph = (ngx_table_elt_t **) ((char *) &r->headers_in + hh->offset);
274
275
 
275
- if (*ph) {
276
- ngx_http_perl_set_targ((*ph)->value.data, (*ph)->value.len);
277
-
278
- goto done;
279
- }
276
+ if (*ph) {
277
+ ngx_http_perl_set_targ((*ph)->value.data, (*ph)->value.len);
280
278
 
281
- XSRETURN_UNDEF;
279
+ goto done;
282
280
  }
283
281
 
282
+ XSRETURN_UNDEF;
283
+
284
284
  multi:
285
285
 
286
286
  /* Cookie, X-Forwarded-For */
@@ -128,6 +128,10 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
128
128
  ngx_http_core_srv_conf_t **cscfp;
129
129
  ngx_http_core_main_conf_t *cmcf;
130
130
 
131
+ if (*(ngx_http_conf_ctx_t **) conf) {
132
+ return "is duplicate";
133
+ }
134
+
131
135
  /* the main http context */
132
136
 
133
137
  ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t));
@@ -140,14 +144,7 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
140
144
 
141
145
  /* count the number of the http modules and set up their indices */
142
146
 
143
- ngx_http_max_module = 0;
144
- for (m = 0; ngx_modules[m]; m++) {
145
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
146
- continue;
147
- }
148
-
149
- ngx_modules[m]->ctx_index = ngx_http_max_module++;
150
- }
147
+ ngx_http_max_module = ngx_count_modules(cf->cycle, NGX_HTTP_MODULE);
151
148
 
152
149
 
153
150
  /* the http main_conf context, it is the same in the all http contexts */
@@ -186,13 +183,13 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
186
183
  * of the all http modules
187
184
  */
188
185
 
189
- for (m = 0; ngx_modules[m]; m++) {
190
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
186
+ for (m = 0; cf->cycle->modules[m]; m++) {
187
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
191
188
  continue;
192
189
  }
193
190
 
194
- module = ngx_modules[m]->ctx;
195
- mi = ngx_modules[m]->ctx_index;
191
+ module = cf->cycle->modules[m]->ctx;
192
+ mi = cf->cycle->modules[m]->ctx_index;
196
193
 
197
194
  if (module->create_main_conf) {
198
195
  ctx->main_conf[mi] = module->create_main_conf(cf);
@@ -219,12 +216,12 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
219
216
  pcf = *cf;
220
217
  cf->ctx = ctx;
221
218
 
222
- for (m = 0; ngx_modules[m]; m++) {
223
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
219
+ for (m = 0; cf->cycle->modules[m]; m++) {
220
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
224
221
  continue;
225
222
  }
226
223
 
227
- module = ngx_modules[m]->ctx;
224
+ module = cf->cycle->modules[m]->ctx;
228
225
 
229
226
  if (module->preconfiguration) {
230
227
  if (module->preconfiguration(cf) != NGX_OK) {
@@ -251,13 +248,13 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
251
248
  cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
252
249
  cscfp = cmcf->servers.elts;
253
250
 
254
- for (m = 0; ngx_modules[m]; m++) {
255
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
251
+ for (m = 0; cf->cycle->modules[m]; m++) {
252
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
256
253
  continue;
257
254
  }
258
255
 
259
- module = ngx_modules[m]->ctx;
260
- mi = ngx_modules[m]->ctx_index;
256
+ module = cf->cycle->modules[m]->ctx;
257
+ mi = cf->cycle->modules[m]->ctx_index;
261
258
 
262
259
  /* init http{} main_conf's */
263
260
 
@@ -300,12 +297,12 @@ ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
300
297
  }
301
298
 
302
299
 
303
- for (m = 0; ngx_modules[m]; m++) {
304
- if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
300
+ for (m = 0; cf->cycle->modules[m]; m++) {
301
+ if (cf->cycle->modules[m]->type != NGX_HTTP_MODULE) {
305
302
  continue;
306
303
  }
307
304
 
308
- module = ngx_modules[m]->ctx;
305
+ module = cf->cycle->modules[m]->ctx;
309
306
 
310
307
  if (module->postconfiguration) {
311
308
  if (module->postconfiguration(cf) != NGX_OK) {
@@ -1229,8 +1226,8 @@ ngx_http_add_addresses(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf,
1229
1226
  #if (NGX_HTTP_SSL)
1230
1227
  ngx_uint_t ssl;
1231
1228
  #endif
1232
- #if (NGX_HTTP_SPDY)
1233
- ngx_uint_t spdy;
1229
+ #if (NGX_HTTP_V2)
1230
+ ngx_uint_t http2;
1234
1231
  #endif
1235
1232
 
1236
1233
  /*
@@ -1286,8 +1283,8 @@ ngx_http_add_addresses(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf,
1286
1283
  #if (NGX_HTTP_SSL)
1287
1284
  ssl = lsopt->ssl || addr[i].opt.ssl;
1288
1285
  #endif
1289
- #if (NGX_HTTP_SPDY)
1290
- spdy = lsopt->spdy || addr[i].opt.spdy;
1286
+ #if (NGX_HTTP_V2)
1287
+ http2 = lsopt->http2 || addr[i].opt.http2;
1291
1288
  #endif
1292
1289
 
1293
1290
  if (lsopt->set) {
@@ -1320,8 +1317,8 @@ ngx_http_add_addresses(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf,
1320
1317
  #if (NGX_HTTP_SSL)
1321
1318
  addr[i].opt.ssl = ssl;
1322
1319
  #endif
1323
- #if (NGX_HTTP_SPDY)
1324
- addr[i].opt.spdy = spdy;
1320
+ #if (NGX_HTTP_V2)
1321
+ addr[i].opt.http2 = http2;
1325
1322
  #endif
1326
1323
 
1327
1324
  return NGX_OK;
@@ -1353,14 +1350,17 @@ ngx_http_add_address(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf,
1353
1350
  }
1354
1351
  }
1355
1352
 
1356
- #if (NGX_HTTP_SPDY && NGX_HTTP_SSL \
1353
+ #if (NGX_HTTP_V2 && NGX_HTTP_SSL \
1357
1354
  && !defined TLSEXT_TYPE_application_layer_protocol_negotiation \
1358
1355
  && !defined TLSEXT_TYPE_next_proto_neg)
1359
- if (lsopt->spdy && lsopt->ssl) {
1356
+
1357
+ if (lsopt->http2 && lsopt->ssl) {
1360
1358
  ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
1361
- "nginx was built without OpenSSL ALPN or NPN "
1362
- "support, SPDY is not enabled for %s", lsopt->addr);
1359
+ "nginx was built with OpenSSL that lacks ALPN "
1360
+ "and NPN support, HTTP/2 is not enabled for %s",
1361
+ lsopt->addr);
1363
1362
  }
1363
+
1364
1364
  #endif
1365
1365
 
1366
1366
  addr = ngx_array_push(&port->addrs);
@@ -1719,13 +1719,7 @@ ngx_http_init_listening(ngx_conf_t *cf, ngx_http_conf_port_t *port)
1719
1719
 
1720
1720
  ls->servers = hport;
1721
1721
 
1722
- if (i == last - 1) {
1723
- hport->naddrs = last;
1724
-
1725
- } else {
1726
- hport->naddrs = 1;
1727
- i = 0;
1728
- }
1722
+ hport->naddrs = i + 1;
1729
1723
 
1730
1724
  switch (ls->sockaddr->sa_family) {
1731
1725
 
@@ -1743,6 +1737,10 @@ ngx_http_init_listening(ngx_conf_t *cf, ngx_http_conf_port_t *port)
1743
1737
  break;
1744
1738
  }
1745
1739
 
1740
+ if (ngx_clone_listening(cf, ls) != NGX_OK) {
1741
+ return NGX_ERROR;
1742
+ }
1743
+
1746
1744
  addr++;
1747
1745
  last--;
1748
1746
  }
@@ -1821,6 +1819,10 @@ ngx_http_add_listening(ngx_conf_t *cf, ngx_http_conf_addr_t *addr)
1821
1819
  ls->fastopen = addr->opt.fastopen;
1822
1820
  #endif
1823
1821
 
1822
+ #if (NGX_HAVE_REUSEPORT)
1823
+ ls->reuseport = addr->opt.reuseport;
1824
+ #endif
1825
+
1824
1826
  return ls;
1825
1827
  }
1826
1828
 
@@ -1850,8 +1852,8 @@ ngx_http_add_addrs(ngx_conf_t *cf, ngx_http_port_t *hport,
1850
1852
  #if (NGX_HTTP_SSL)
1851
1853
  addrs[i].conf.ssl = addr[i].opt.ssl;
1852
1854
  #endif
1853
- #if (NGX_HTTP_SPDY)
1854
- addrs[i].conf.spdy = addr[i].opt.spdy;
1855
+ #if (NGX_HTTP_V2)
1856
+ addrs[i].conf.http2 = addr[i].opt.http2;
1855
1857
  #endif
1856
1858
  addrs[i].conf.proxy_protocol = addr[i].opt.proxy_protocol;
1857
1859
 
@@ -1915,9 +1917,10 @@ ngx_http_add_addrs6(ngx_conf_t *cf, ngx_http_port_t *hport,
1915
1917
  #if (NGX_HTTP_SSL)
1916
1918
  addrs6[i].conf.ssl = addr[i].opt.ssl;
1917
1919
  #endif
1918
- #if (NGX_HTTP_SPDY)
1919
- addrs6[i].conf.spdy = addr[i].opt.spdy;
1920
+ #if (NGX_HTTP_V2)
1921
+ addrs6[i].conf.http2 = addr[i].opt.http2;
1920
1922
  #endif
1923
+ addrs6[i].conf.proxy_protocol = addr[i].opt.proxy_protocol;
1921
1924
 
1922
1925
  if (addr[i].hash.buckets == NULL
1923
1926
  && (addr[i].wc_head == NULL
@@ -20,8 +20,8 @@ typedef struct ngx_http_file_cache_s ngx_http_file_cache_t;
20
20
  typedef struct ngx_http_log_ctx_s ngx_http_log_ctx_t;
21
21
  typedef struct ngx_http_chunked_s ngx_http_chunked_t;
22
22
 
23
- #if (NGX_HTTP_SPDY)
24
- typedef struct ngx_http_spdy_stream_s ngx_http_spdy_stream_t;
23
+ #if (NGX_HTTP_V2)
24
+ typedef struct ngx_http_v2_stream_s ngx_http_v2_stream_t;
25
25
  #endif
26
26
 
27
27
  typedef ngx_int_t (*ngx_http_header_handler_pt)(ngx_http_request_t *r,
@@ -38,8 +38,8 @@ typedef u_char *(*ngx_http_log_handler_pt)(ngx_http_request_t *r,
38
38
  #include <ngx_http_upstream_round_robin.h>
39
39
  #include <ngx_http_core_module.h>
40
40
 
41
- #if (NGX_HTTP_SPDY)
42
- #include <ngx_http_spdy.h>
41
+ #if (NGX_HTTP_V2)
42
+ #include <ngx_http_v2.h>
43
43
  #endif
44
44
  #if (NGX_HTTP_CACHE)
45
45
  #include <ngx_http_cache.h>
@@ -148,11 +148,6 @@ ngx_int_t ngx_http_filter_finalize_request(ngx_http_request_t *r,
148
148
  void ngx_http_clean_header(ngx_http_request_t *r);
149
149
 
150
150
 
151
- time_t ngx_http_parse_time(u_char *value, size_t len);
152
- size_t ngx_http_get_time(char *buf, time_t t);
153
-
154
-
155
-
156
151
  ngx_int_t ngx_http_discard_request_body(ngx_http_request_t *r);
157
152
  void ngx_http_discarded_request_body_handler(ngx_http_request_t *r);
158
153
  void ngx_http_block_reading(ngx_http_request_t *r);
@@ -138,6 +138,8 @@ typedef struct {
138
138
  ngx_atomic_t cold;
139
139
  ngx_atomic_t loading;
140
140
  off_t size;
141
+ ngx_uint_t count;
142
+ ngx_uint_t watermark;
141
143
  } ngx_http_file_cache_sh_t;
142
144
 
143
145
 
@@ -153,6 +155,8 @@ struct ngx_http_file_cache_s {
153
155
 
154
156
  time_t inactive;
155
157
 
158
+ time_t fail_time;
159
+
156
160
  ngx_uint_t files;
157
161
  ngx_uint_t loader_files;
158
162
  ngx_msec_t last;
@@ -204,10 +204,11 @@ ngx_http_copy_aio_event_handler(ngx_event_t *ev)
204
204
  static ssize_t
205
205
  ngx_http_copy_aio_sendfile_preload(ngx_buf_t *file)
206
206
  {
207
- ssize_t n;
208
- static u_char buf[1];
209
- ngx_event_aio_t *aio;
210
- ngx_http_request_t *r;
207
+ ssize_t n;
208
+ static u_char buf[1];
209
+ ngx_event_aio_t *aio;
210
+ ngx_http_request_t *r;
211
+ ngx_output_chain_ctx_t *ctx;
211
212
 
212
213
  n = ngx_file_aio_read(file->file, buf, 1, file->file_pos, NULL);
213
214
 
@@ -218,6 +219,9 @@ ngx_http_copy_aio_sendfile_preload(ngx_buf_t *file)
218
219
  r = aio->data;
219
220
  r->main->blocked++;
220
221
  r->aio = 1;
222
+
223
+ ctx = ngx_http_get_module_ctx(r, ngx_http_copy_filter_module);
224
+ ctx->aio = 1;
221
225
  }
222
226
 
223
227
  return n;
@@ -252,6 +256,7 @@ ngx_http_copy_thread_handler(ngx_thread_task_t *task, ngx_file_t *file)
252
256
  ngx_str_t name;
253
257
  ngx_thread_pool_t *tp;
254
258
  ngx_http_request_t *r;
259
+ ngx_output_chain_ctx_t *ctx;
255
260
  ngx_http_core_loc_conf_t *clcf;
256
261
 
257
262
  r = file->thread_ctx;
@@ -285,6 +290,9 @@ ngx_http_copy_thread_handler(ngx_thread_task_t *task, ngx_file_t *file)
285
290
  r->main->blocked++;
286
291
  r->aio = 1;
287
292
 
293
+ ctx = ngx_http_get_module_ctx(r, ngx_http_copy_filter_module);
294
+ ctx->aio = 1;
295
+
288
296
  return NGX_OK;
289
297
  }
290
298
 
@@ -327,7 +335,7 @@ ngx_http_copy_filter_merge_conf(ngx_conf_t *cf, void *parent, void *child)
327
335
  ngx_http_copy_filter_conf_t *prev = parent;
328
336
  ngx_http_copy_filter_conf_t *conf = child;
329
337
 
330
- ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 1, 32768);
338
+ ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 2, 32768);
331
339
 
332
340
  return NULL;
333
341
  }
@@ -96,18 +96,6 @@ static ngx_conf_post_t ngx_http_core_lowat_post =
96
96
  static ngx_conf_post_handler_pt ngx_http_core_pool_size_p =
97
97
  ngx_http_core_pool_size;
98
98
 
99
- static ngx_conf_deprecated_t ngx_conf_deprecated_optimize_server_names = {
100
- ngx_conf_deprecated, "optimize_server_names", "server_name_in_redirect"
101
- };
102
-
103
- static ngx_conf_deprecated_t ngx_conf_deprecated_open_file_cache_retest = {
104
- ngx_conf_deprecated, "open_file_cache_retest", "open_file_cache_valid"
105
- };
106
-
107
- static ngx_conf_deprecated_t ngx_conf_deprecated_satisfy_any = {
108
- ngx_conf_deprecated, "satisfy_any", "satisfy"
109
- };
110
-
111
99
 
112
100
  static ngx_conf_enum_t ngx_http_core_request_body_in_file[] = {
113
101
  { ngx_string("off"), NGX_HTTP_REQUEST_BODY_FILE_OFF },
@@ -255,13 +243,6 @@ static ngx_command_t ngx_http_core_commands[] = {
255
243
  offsetof(ngx_http_core_srv_conf_t, large_client_header_buffers),
256
244
  NULL },
257
245
 
258
- { ngx_string("optimize_server_names"),
259
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
260
- ngx_conf_set_flag_slot,
261
- NGX_HTTP_LOC_CONF_OFFSET,
262
- offsetof(ngx_http_core_loc_conf_t, server_name_in_redirect),
263
- &ngx_conf_deprecated_optimize_server_names },
264
-
265
246
  { ngx_string("ignore_invalid_headers"),
266
247
  NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
267
248
  ngx_conf_set_flag_slot,
@@ -419,6 +400,13 @@ static ngx_command_t ngx_http_core_commands[] = {
419
400
  0,
420
401
  NULL },
421
402
 
403
+ { ngx_string("aio_write"),
404
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
405
+ ngx_conf_set_flag_slot,
406
+ NGX_HTTP_LOC_CONF_OFFSET,
407
+ offsetof(ngx_http_core_loc_conf_t, aio_write),
408
+ NULL },
409
+
422
410
  { ngx_string("read_ahead"),
423
411
  NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
424
412
  ngx_conf_set_size_slot,
@@ -519,13 +507,6 @@ static ngx_command_t ngx_http_core_commands[] = {
519
507
  offsetof(ngx_http_core_loc_conf_t, satisfy),
520
508
  &ngx_http_core_satisfy },
521
509
 
522
- { ngx_string("satisfy_any"),
523
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
524
- ngx_conf_set_flag_slot,
525
- NGX_HTTP_LOC_CONF_OFFSET,
526
- offsetof(ngx_http_core_loc_conf_t, satisfy),
527
- &ngx_conf_deprecated_satisfy_any },
528
-
529
510
  { ngx_string("internal"),
530
511
  NGX_HTTP_LOC_CONF|NGX_CONF_NOARGS,
531
512
  ngx_http_core_internal,
@@ -689,13 +670,6 @@ static ngx_command_t ngx_http_core_commands[] = {
689
670
  offsetof(ngx_http_core_loc_conf_t, open_file_cache_valid),
690
671
  NULL },
691
672
 
692
- { ngx_string("open_file_cache_retest"),
693
- NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
694
- ngx_conf_set_sec_slot,
695
- NGX_HTTP_LOC_CONF_OFFSET,
696
- offsetof(ngx_http_core_loc_conf_t, open_file_cache_valid),
697
- &ngx_conf_deprecated_open_file_cache_retest },
698
-
699
673
  { ngx_string("open_file_cache_min_uses"),
700
674
  NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
701
675
  ngx_conf_set_num_slot,
@@ -809,7 +783,7 @@ ngx_module_t ngx_http_core_module = {
809
783
  };
810
784
 
811
785
 
812
- ngx_str_t ngx_http_core_get_method = { 3, (u_char *) "GET " };
786
+ ngx_str_t ngx_http_core_get_method = { 3, (u_char *) "GET" };
813
787
 
814
788
 
815
789
  void
@@ -1248,7 +1222,7 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r,
1248
1222
  }
1249
1223
 
1250
1224
  name = path.data + root;
1251
- }
1225
+ }
1252
1226
 
1253
1227
  if (tf->values == NULL) {
1254
1228
 
@@ -1449,7 +1423,7 @@ ngx_http_update_location_config(ngx_http_request_t *r)
1449
1423
  }
1450
1424
 
1451
1425
  if (r == r->main) {
1452
- ngx_http_set_connection_log(r->connection, clcf->error_log);
1426
+ ngx_set_connection_log(r->connection, clcf->error_log);
1453
1427
  }
1454
1428
 
1455
1429
  if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
@@ -1623,7 +1597,8 @@ ngx_http_core_find_static_location(ngx_http_request_t *r,
1623
1597
  }
1624
1598
 
1625
1599
  ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1626
- "test location: \"%*s\"", node->len, node->name);
1600
+ "test location: \"%*s\"",
1601
+ (size_t) node->len, node->name);
1627
1602
 
1628
1603
  n = (len <= (size_t) node->len) ? len : node->len;
1629
1604
 
@@ -2165,13 +2140,6 @@ ngx_http_gzip_ok(ngx_http_request_t *r)
2165
2140
  return NGX_DECLINED;
2166
2141
  }
2167
2142
 
2168
- #if (NGX_HTTP_SPDY)
2169
- if (r->spdy_stream) {
2170
- r->gzip_ok = 1;
2171
- return NGX_OK;
2172
- }
2173
- #endif
2174
-
2175
2143
  ae = r->headers_in.accept_encoding;
2176
2144
  if (ae == NULL) {
2177
2145
  return NGX_DECLINED;
@@ -2232,7 +2200,7 @@ ngx_http_gzip_ok(ngx_http_request_t *r)
2232
2200
  return NGX_DECLINED;
2233
2201
  }
2234
2202
 
2235
- expires = ngx_http_parse_time(e->value.data, e->value.len);
2203
+ expires = ngx_parse_http_time(e->value.data, e->value.len);
2236
2204
  if (expires == NGX_ERROR) {
2237
2205
  return NGX_DECLINED;
2238
2206
  }
@@ -2240,7 +2208,7 @@ ngx_http_gzip_ok(ngx_http_request_t *r)
2240
2208
  d = r->headers_out.date;
2241
2209
 
2242
2210
  if (d) {
2243
- date = ngx_http_parse_time(d->value.data, d->value.len);
2211
+ date = ngx_parse_http_time(d->value.data, d->value.len);
2244
2212
  if (date == NGX_ERROR) {
2245
2213
  return NGX_DECLINED;
2246
2214
  }
@@ -2460,12 +2428,19 @@ ngx_http_subrequest(ngx_http_request_t *r,
2460
2428
  ngx_http_core_srv_conf_t *cscf;
2461
2429
  ngx_http_postponed_request_t *pr, *p;
2462
2430
 
2463
- r->main->subrequests--;
2464
-
2465
- if (r->main->subrequests == 0) {
2431
+ if (r->subrequests == 0) {
2466
2432
  ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
2467
2433
  "subrequests cycle while processing \"%V\"", uri);
2468
- r->main->subrequests = 1;
2434
+ return NGX_ERROR;
2435
+ }
2436
+
2437
+ /*
2438
+ * 1000 is reserved for other purposes.
2439
+ */
2440
+ if (r->main->count >= 65535 - 1000) {
2441
+ ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
2442
+ "request reference counter overflow "
2443
+ "while processing \"%V\"", uri);
2469
2444
  return NGX_ERROR;
2470
2445
  }
2471
2446
 
@@ -2506,8 +2481,8 @@ ngx_http_subrequest(ngx_http_request_t *r,
2506
2481
 
2507
2482
  sr->request_body = r->request_body;
2508
2483
 
2509
- #if (NGX_HTTP_SPDY)
2510
- sr->spdy_stream = r->spdy_stream;
2484
+ #if (NGX_HTTP_V2)
2485
+ sr->stream = r->stream;
2511
2486
  #endif
2512
2487
 
2513
2488
  sr->method = NGX_HTTP_GET;
@@ -2570,6 +2545,7 @@ ngx_http_subrequest(ngx_http_request_t *r,
2570
2545
  sr->main_filter_need_in_memory = r->main_filter_need_in_memory;
2571
2546
 
2572
2547
  sr->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1;
2548
+ sr->subrequests = r->subrequests - 1;
2573
2549
 
2574
2550
  tp = ngx_timeofday();
2575
2551
  sr->start_sec = tp->sec;
@@ -3000,12 +2976,12 @@ ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
3000
2976
  return NGX_CONF_ERROR;
3001
2977
  }
3002
2978
 
3003
- for (i = 0; ngx_modules[i]; i++) {
3004
- if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
2979
+ for (i = 0; cf->cycle->modules[i]; i++) {
2980
+ if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
3005
2981
  continue;
3006
2982
  }
3007
2983
 
3008
- module = ngx_modules[i]->ctx;
2984
+ module = cf->cycle->modules[i]->ctx;
3009
2985
 
3010
2986
  if (module->create_srv_conf) {
3011
2987
  mconf = module->create_srv_conf(cf);
@@ -3013,7 +2989,7 @@ ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
3013
2989
  return NGX_CONF_ERROR;
3014
2990
  }
3015
2991
 
3016
- ctx->srv_conf[ngx_modules[i]->ctx_index] = mconf;
2992
+ ctx->srv_conf[cf->cycle->modules[i]->ctx_index] = mconf;
3017
2993
  }
3018
2994
 
3019
2995
  if (module->create_loc_conf) {
@@ -3022,7 +2998,7 @@ ngx_http_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
3022
2998
  return NGX_CONF_ERROR;
3023
2999
  }
3024
3000
 
3025
- ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
3001
+ ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
3026
3002
  }
3027
3003
  }
3028
3004
 
@@ -3118,18 +3094,18 @@ ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
3118
3094
  return NGX_CONF_ERROR;
3119
3095
  }
3120
3096
 
3121
- for (i = 0; ngx_modules[i]; i++) {
3122
- if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
3097
+ for (i = 0; cf->cycle->modules[i]; i++) {
3098
+ if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
3123
3099
  continue;
3124
3100
  }
3125
3101
 
3126
- module = ngx_modules[i]->ctx;
3102
+ module = cf->cycle->modules[i]->ctx;
3127
3103
 
3128
3104
  if (module->create_loc_conf) {
3129
- ctx->loc_conf[ngx_modules[i]->ctx_index] =
3105
+ ctx->loc_conf[cf->cycle->modules[i]->ctx_index] =
3130
3106
  module->create_loc_conf(cf);
3131
- if (ctx->loc_conf[ngx_modules[i]->ctx_index] == NULL) {
3132
- return NGX_CONF_ERROR;
3107
+ if (ctx->loc_conf[cf->cycle->modules[i]->ctx_index] == NULL) {
3108
+ return NGX_CONF_ERROR;
3133
3109
  }
3134
3110
  }
3135
3111
  }
@@ -3221,7 +3197,7 @@ ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy)
3221
3197
 
3222
3198
  pclcf = pctx->loc_conf[ngx_http_core_module.ctx_index];
3223
3199
 
3224
- if (pclcf->name.len) {
3200
+ if (cf->cmd_type == NGX_HTTP_LOC_CONF) {
3225
3201
 
3226
3202
  /* nested location */
3227
3203
 
@@ -3535,7 +3511,7 @@ ngx_http_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
3535
3511
  /* TODO: it does not merge, it inits only */
3536
3512
 
3537
3513
  ngx_conf_merge_size_value(conf->connection_pool_size,
3538
- prev->connection_pool_size, 256);
3514
+ prev->connection_pool_size, 64 * sizeof(void *));
3539
3515
  ngx_conf_merge_size_value(conf->request_pool_size,
3540
3516
  prev->request_pool_size, 4096);
3541
3517
  ngx_conf_merge_msec_value(conf->client_header_timeout,
@@ -3638,6 +3614,7 @@ ngx_http_core_create_loc_conf(ngx_conf_t *cf)
3638
3614
  clcf->sendfile = NGX_CONF_UNSET;
3639
3615
  clcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE;
3640
3616
  clcf->aio = NGX_CONF_UNSET;
3617
+ clcf->aio_write = NGX_CONF_UNSET;
3641
3618
  #if (NGX_THREADS)
3642
3619
  clcf->thread_pool = NGX_CONF_UNSET_PTR;
3643
3620
  clcf->thread_pool_value = NGX_CONF_UNSET_PTR;
@@ -3859,6 +3836,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
3859
3836
  prev->sendfile_max_chunk, 0);
3860
3837
  #if (NGX_HAVE_FILE_AIO || NGX_THREADS)
3861
3838
  ngx_conf_merge_value(conf->aio, prev->aio, NGX_HTTP_AIO_OFF);
3839
+ ngx_conf_merge_value(conf->aio_write, prev->aio_write, 0);
3862
3840
  #endif
3863
3841
  #if (NGX_THREADS)
3864
3842
  ngx_conf_merge_ptr_value(conf->thread_pool, prev->thread_pool, NULL);
@@ -4203,6 +4181,19 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
4203
4181
  #endif
4204
4182
  }
4205
4183
 
4184
+ if (ngx_strcmp(value[n].data, "reuseport") == 0) {
4185
+ #if (NGX_HAVE_REUSEPORT)
4186
+ lsopt.reuseport = 1;
4187
+ lsopt.set = 1;
4188
+ lsopt.bind = 1;
4189
+ #else
4190
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
4191
+ "reuseport is not supported "
4192
+ "on this platform, ignored");
4193
+ #endif
4194
+ continue;
4195
+ }
4196
+
4206
4197
  if (ngx_strcmp(value[n].data, "ssl") == 0) {
4207
4198
  #if (NGX_HTTP_SSL)
4208
4199
  lsopt.ssl = 1;
@@ -4215,18 +4206,26 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
4215
4206
  #endif
4216
4207
  }
4217
4208
 
4218
- if (ngx_strcmp(value[n].data, "spdy") == 0) {
4219
- #if (NGX_HTTP_SPDY)
4220
- lsopt.spdy = 1;
4209
+ if (ngx_strcmp(value[n].data, "http2") == 0) {
4210
+ #if (NGX_HTTP_V2)
4211
+ lsopt.http2 = 1;
4221
4212
  continue;
4222
4213
  #else
4223
4214
  ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
4224
- "the \"spdy\" parameter requires "
4225
- "ngx_http_spdy_module");
4215
+ "the \"http2\" parameter requires "
4216
+ "ngx_http_v2_module");
4226
4217
  return NGX_CONF_ERROR;
4227
4218
  #endif
4228
4219
  }
4229
4220
 
4221
+ if (ngx_strcmp(value[n].data, "spdy") == 0) {
4222
+ ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
4223
+ "invalid parameter \"spdy\": "
4224
+ "ngx_http_spdy_module was superseded "
4225
+ "by ngx_http_v2_module");
4226
+ continue;
4227
+ }
4228
+
4230
4229
  if (ngx_strncmp(value[n].data, "so_keepalive=", 13) == 0) {
4231
4230
 
4232
4231
  if (ngx_strcmp(&value[n].data[13], "on") == 0) {
@@ -4500,7 +4499,9 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
4500
4499
  clcf->alias = alias ? clcf->name.len : 0;
4501
4500
  clcf->root = value[1];
4502
4501
 
4503
- if (!alias && clcf->root.data[clcf->root.len - 1] == '/') {
4502
+ if (!alias && clcf->root.len > 0
4503
+ && clcf->root.data[clcf->root.len - 1] == '/')
4504
+ {
4504
4505
  clcf->root.len--;
4505
4506
  }
4506
4507
 
@@ -4540,21 +4541,21 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
4540
4541
 
4541
4542
 
4542
4543
  static ngx_http_method_name_t ngx_methods_names[] = {
4543
- { (u_char *) "GET", (uint32_t) ~NGX_HTTP_GET },
4544
- { (u_char *) "HEAD", (uint32_t) ~NGX_HTTP_HEAD },
4545
- { (u_char *) "POST", (uint32_t) ~NGX_HTTP_POST },
4546
- { (u_char *) "PUT", (uint32_t) ~NGX_HTTP_PUT },
4547
- { (u_char *) "DELETE", (uint32_t) ~NGX_HTTP_DELETE },
4548
- { (u_char *) "MKCOL", (uint32_t) ~NGX_HTTP_MKCOL },
4549
- { (u_char *) "COPY", (uint32_t) ~NGX_HTTP_COPY },
4550
- { (u_char *) "MOVE", (uint32_t) ~NGX_HTTP_MOVE },
4551
- { (u_char *) "OPTIONS", (uint32_t) ~NGX_HTTP_OPTIONS },
4552
- { (u_char *) "PROPFIND", (uint32_t) ~NGX_HTTP_PROPFIND },
4553
- { (u_char *) "PROPPATCH", (uint32_t) ~NGX_HTTP_PROPPATCH },
4554
- { (u_char *) "LOCK", (uint32_t) ~NGX_HTTP_LOCK },
4555
- { (u_char *) "UNLOCK", (uint32_t) ~NGX_HTTP_UNLOCK },
4556
- { (u_char *) "PATCH", (uint32_t) ~NGX_HTTP_PATCH },
4557
- { NULL, 0 }
4544
+ { (u_char *) "GET", (uint32_t) ~NGX_HTTP_GET },
4545
+ { (u_char *) "HEAD", (uint32_t) ~NGX_HTTP_HEAD },
4546
+ { (u_char *) "POST", (uint32_t) ~NGX_HTTP_POST },
4547
+ { (u_char *) "PUT", (uint32_t) ~NGX_HTTP_PUT },
4548
+ { (u_char *) "DELETE", (uint32_t) ~NGX_HTTP_DELETE },
4549
+ { (u_char *) "MKCOL", (uint32_t) ~NGX_HTTP_MKCOL },
4550
+ { (u_char *) "COPY", (uint32_t) ~NGX_HTTP_COPY },
4551
+ { (u_char *) "MOVE", (uint32_t) ~NGX_HTTP_MOVE },
4552
+ { (u_char *) "OPTIONS", (uint32_t) ~NGX_HTTP_OPTIONS },
4553
+ { (u_char *) "PROPFIND", (uint32_t) ~NGX_HTTP_PROPFIND },
4554
+ { (u_char *) "PROPPATCH", (uint32_t) ~NGX_HTTP_PROPPATCH },
4555
+ { (u_char *) "LOCK", (uint32_t) ~NGX_HTTP_LOCK },
4556
+ { (u_char *) "UNLOCK", (uint32_t) ~NGX_HTTP_UNLOCK },
4557
+ { (u_char *) "PATCH", (uint32_t) ~NGX_HTTP_PATCH },
4558
+ { NULL, 0 }
4558
4559
  };
4559
4560
 
4560
4561
 
@@ -4616,21 +4617,21 @@ ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
4616
4617
  return NGX_CONF_ERROR;
4617
4618
  }
4618
4619
 
4619
- for (i = 0; ngx_modules[i]; i++) {
4620
- if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
4620
+ for (i = 0; cf->cycle->modules[i]; i++) {
4621
+ if (cf->cycle->modules[i]->type != NGX_HTTP_MODULE) {
4621
4622
  continue;
4622
4623
  }
4623
4624
 
4624
- module = ngx_modules[i]->ctx;
4625
+ module = cf->cycle->modules[i]->ctx;
4625
4626
 
4626
4627
  if (module->create_loc_conf) {
4627
4628
 
4628
4629
  mconf = module->create_loc_conf(cf);
4629
4630
  if (mconf == NULL) {
4630
- return NGX_CONF_ERROR;
4631
+ return NGX_CONF_ERROR;
4631
4632
  }
4632
4633
 
4633
- ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
4634
+ ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf;
4634
4635
  }
4635
4636
  }
4636
4637