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
@@ -51,6 +51,8 @@ struct ngx_listening_s {
51
51
  ngx_listening_t *previous;
52
52
  ngx_connection_t *connection;
53
53
 
54
+ ngx_uint_t worker;
55
+
54
56
  unsigned open:1;
55
57
  unsigned remain:1;
56
58
  unsigned ignore:1;
@@ -62,9 +64,14 @@ struct ngx_listening_s {
62
64
  unsigned nonblocking:1;
63
65
  unsigned shared:1; /* shared between threads or processes */
64
66
  unsigned addr_ntop:1;
67
+ unsigned wildcard:1;
65
68
 
66
69
  #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
67
70
  unsigned ipv6only:1;
71
+ #endif
72
+ #if (NGX_HAVE_REUSEPORT)
73
+ unsigned reuseport:1;
74
+ unsigned add_reuseport:1;
68
75
  #endif
69
76
  unsigned keepalive:2;
70
77
 
@@ -88,31 +95,31 @@ struct ngx_listening_s {
88
95
 
89
96
 
90
97
  typedef enum {
91
- NGX_ERROR_ALERT = 0,
92
- NGX_ERROR_ERR,
93
- NGX_ERROR_INFO,
94
- NGX_ERROR_IGNORE_ECONNRESET,
95
- NGX_ERROR_IGNORE_EINVAL
98
+ NGX_ERROR_ALERT = 0,
99
+ NGX_ERROR_ERR,
100
+ NGX_ERROR_INFO,
101
+ NGX_ERROR_IGNORE_ECONNRESET,
102
+ NGX_ERROR_IGNORE_EINVAL
96
103
  } ngx_connection_log_error_e;
97
104
 
98
105
 
99
106
  typedef enum {
100
- NGX_TCP_NODELAY_UNSET = 0,
101
- NGX_TCP_NODELAY_SET,
102
- NGX_TCP_NODELAY_DISABLED
107
+ NGX_TCP_NODELAY_UNSET = 0,
108
+ NGX_TCP_NODELAY_SET,
109
+ NGX_TCP_NODELAY_DISABLED
103
110
  } ngx_connection_tcp_nodelay_e;
104
111
 
105
112
 
106
113
  typedef enum {
107
- NGX_TCP_NOPUSH_UNSET = 0,
108
- NGX_TCP_NOPUSH_SET,
109
- NGX_TCP_NOPUSH_DISABLED
114
+ NGX_TCP_NOPUSH_UNSET = 0,
115
+ NGX_TCP_NOPUSH_SET,
116
+ NGX_TCP_NOPUSH_DISABLED
110
117
  } ngx_connection_tcp_nopush_e;
111
118
 
112
119
 
113
120
  #define NGX_LOWLEVEL_BUFFERED 0x0f
114
121
  #define NGX_SSL_BUFFERED 0x01
115
- #define NGX_SPDY_BUFFERED 0x02
122
+ #define NGX_HTTP_V2_BUFFERED 0x02
116
123
 
117
124
 
118
125
  struct ngx_connection_s {
@@ -135,6 +142,8 @@ struct ngx_connection_s {
135
142
 
136
143
  ngx_pool_t *pool;
137
144
 
145
+ int type;
146
+
138
147
  struct sockaddr *sockaddr;
139
148
  socklen_t socklen;
140
149
  ngx_str_t addr_text;
@@ -168,6 +177,7 @@ struct ngx_connection_s {
168
177
  unsigned idle:1;
169
178
  unsigned reusable:1;
170
179
  unsigned close:1;
180
+ unsigned shared:1;
171
181
 
172
182
  unsigned sendfile:1;
173
183
  unsigned sndlowat:1;
@@ -190,13 +200,26 @@ struct ngx_connection_s {
190
200
  };
191
201
 
192
202
 
203
+ #define ngx_set_connection_log(c, l) \
204
+ \
205
+ c->log->file = l->file; \
206
+ c->log->next = l->next; \
207
+ c->log->writer = l->writer; \
208
+ c->log->wdata = l->wdata; \
209
+ if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { \
210
+ c->log->log_level = l->log_level; \
211
+ }
212
+
213
+
193
214
  ngx_listening_t *ngx_create_listening(ngx_conf_t *cf, void *sockaddr,
194
215
  socklen_t socklen);
216
+ ngx_int_t ngx_clone_listening(ngx_conf_t *cf, ngx_listening_t *ls);
195
217
  ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle);
196
218
  ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle);
197
219
  void ngx_configure_listening_sockets(ngx_cycle_t *cycle);
198
220
  void ngx_close_listening_sockets(ngx_cycle_t *cycle);
199
221
  void ngx_close_connection(ngx_connection_t *c);
222
+ void ngx_close_idle_connections(ngx_cycle_t *cycle);
200
223
  ngx_int_t ngx_connection_local_sockaddr(ngx_connection_t *c, ngx_str_t *s,
201
224
  ngx_uint_t port);
202
225
  ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text);
@@ -53,7 +53,9 @@ typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);
53
53
  #include <ngx_shmem.h>
54
54
  #include <ngx_process.h>
55
55
  #include <ngx_user.h>
56
+ #include <ngx_dlopen.h>
56
57
  #include <ngx_parse.h>
58
+ #include <ngx_parse_time.h>
57
59
  #include <ngx_log.h>
58
60
  #include <ngx_alloc.h>
59
61
  #include <ngx_palloc.h>
@@ -71,6 +73,7 @@ typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);
71
73
  #endif
72
74
  #include <ngx_radix_tree.h>
73
75
  #include <ngx_times.h>
76
+ #include <ngx_rwlock.h>
74
77
  #include <ngx_shmtx.h>
75
78
  #include <ngx_slab.h>
76
79
  #include <ngx_inet.h>
@@ -81,6 +84,7 @@ typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);
81
84
  #endif
82
85
  #include <ngx_process_cycle.h>
83
86
  #include <ngx_conf_file.h>
87
+ #include <ngx_module.h>
84
88
  #include <ngx_open_file_cache.h>
85
89
  #include <ngx_os.h>
86
90
  #include <ngx_connection.h>
@@ -165,8 +165,8 @@ ngx_crypt_to64(u_char *p, uint32_t v, size_t n)
165
165
  "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
166
166
 
167
167
  while (n--) {
168
- *p++ = itoa64[v & 0x3f];
169
- v >>= 6;
168
+ *p++ = itoa64[v & 0x3f];
169
+ v >>= 6;
170
170
  }
171
171
 
172
172
  return p;
@@ -24,12 +24,9 @@ static ngx_pool_t *ngx_temp_pool;
24
24
  static ngx_event_t ngx_cleaner_event;
25
25
 
26
26
  ngx_uint_t ngx_test_config;
27
+ ngx_uint_t ngx_dump_config;
27
28
  ngx_uint_t ngx_quiet_mode;
28
29
 
29
- #if (NGX_OLD_THREADS)
30
- ngx_tls_key_t ngx_core_tls_key;
31
- #endif
32
-
33
30
 
34
31
  /* STUB NAME */
35
32
  static ngx_connection_t dumb;
@@ -128,6 +125,13 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
128
125
  cycle->paths.pool = pool;
129
126
 
130
127
 
128
+ if (ngx_array_init(&cycle->config_dump, pool, 1, sizeof(ngx_conf_dump_t))
129
+ != NGX_OK)
130
+ {
131
+ ngx_destroy_pool(pool);
132
+ return NULL;
133
+ }
134
+
131
135
  if (old_cycle->open_files.part.nelts) {
132
136
  n = old_cycle->open_files.part.nelts;
133
137
  for (part = old_cycle->open_files.part.next; part; part = part->next) {
@@ -208,12 +212,18 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
208
212
  ngx_strlow(cycle->hostname.data, (u_char *) hostname, cycle->hostname.len);
209
213
 
210
214
 
211
- for (i = 0; ngx_modules[i]; i++) {
212
- if (ngx_modules[i]->type != NGX_CORE_MODULE) {
215
+ if (ngx_cycle_modules(cycle) != NGX_OK) {
216
+ ngx_destroy_pool(pool);
217
+ return NULL;
218
+ }
219
+
220
+
221
+ for (i = 0; cycle->modules[i]; i++) {
222
+ if (cycle->modules[i]->type != NGX_CORE_MODULE) {
213
223
  continue;
214
224
  }
215
225
 
216
- module = ngx_modules[i]->ctx;
226
+ module = cycle->modules[i]->ctx;
217
227
 
218
228
  if (module->create_conf) {
219
229
  rv = module->create_conf(cycle);
@@ -221,7 +231,7 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
221
231
  ngx_destroy_pool(pool);
222
232
  return NULL;
223
233
  }
224
- cycle->conf_ctx[ngx_modules[i]->index] = rv;
234
+ cycle->conf_ctx[cycle->modules[i]->index] = rv;
225
235
  }
226
236
  }
227
237
 
@@ -272,15 +282,16 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
272
282
  cycle->conf_file.data);
273
283
  }
274
284
 
275
- for (i = 0; ngx_modules[i]; i++) {
276
- if (ngx_modules[i]->type != NGX_CORE_MODULE) {
285
+ for (i = 0; cycle->modules[i]; i++) {
286
+ if (cycle->modules[i]->type != NGX_CORE_MODULE) {
277
287
  continue;
278
288
  }
279
289
 
280
- module = ngx_modules[i]->ctx;
290
+ module = cycle->modules[i]->ctx;
281
291
 
282
292
  if (module->init_conf) {
283
- if (module->init_conf(cycle, cycle->conf_ctx[ngx_modules[i]->index])
293
+ if (module->init_conf(cycle,
294
+ cycle->conf_ctx[cycle->modules[i]->index])
284
295
  == NGX_CONF_ERROR)
285
296
  {
286
297
  environ = senv;
@@ -441,9 +452,13 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
441
452
  }
442
453
 
443
454
  if (shm_zone[i].tag == oshm_zone[n].tag
444
- && shm_zone[i].shm.size == oshm_zone[n].shm.size)
455
+ && shm_zone[i].shm.size == oshm_zone[n].shm.size
456
+ && !shm_zone[i].noreuse)
445
457
  {
446
458
  shm_zone[i].shm.addr = oshm_zone[n].shm.addr;
459
+ #if (NGX_WIN32)
460
+ shm_zone[i].shm.handle = oshm_zone[n].shm.handle;
461
+ #endif
447
462
 
448
463
  if (shm_zone[i].init(&shm_zone[i], oshm_zone[n].data)
449
464
  != NGX_OK)
@@ -493,6 +508,14 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
493
508
  continue;
494
509
  }
495
510
 
511
+ if (ls[i].remain) {
512
+ continue;
513
+ }
514
+
515
+ if (ls[i].type != nls[n].type) {
516
+ continue;
517
+ }
518
+
496
519
  if (ngx_cmp_sockaddr(nls[n].sockaddr, nls[n].socklen,
497
520
  ls[i].sockaddr, ls[i].socklen, 1)
498
521
  == NGX_OK)
@@ -540,6 +563,13 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
540
563
  nls[n].add_deferred = 1;
541
564
  }
542
565
  #endif
566
+
567
+ #if (NGX_HAVE_REUSEPORT)
568
+ if (nls[n].reuseport && !ls[i].reuseport) {
569
+ nls[n].add_reuseport = 1;
570
+ }
571
+ #endif
572
+
543
573
  break;
544
574
  }
545
575
  }
@@ -593,13 +623,9 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
593
623
 
594
624
  pool->log = cycle->log;
595
625
 
596
- for (i = 0; ngx_modules[i]; i++) {
597
- if (ngx_modules[i]->init_module) {
598
- if (ngx_modules[i]->init_module(cycle) != NGX_OK) {
599
- /* fatal */
600
- exit(1);
601
- }
602
- }
626
+ if (ngx_init_modules(cycle) != NGX_OK) {
627
+ /* fatal */
628
+ exit(1);
603
629
  }
604
630
 
605
631
 
@@ -863,6 +889,22 @@ ngx_init_zone_pool(ngx_cycle_t *cycle, ngx_shm_zone_t *zn)
863
889
  return NGX_OK;
864
890
  }
865
891
 
892
+ #if (NGX_WIN32)
893
+
894
+ /* remap at the required address */
895
+
896
+ if (ngx_shm_remap(&zn->shm, sp->addr) != NGX_OK) {
897
+ return NGX_ERROR;
898
+ }
899
+
900
+ sp = (ngx_slab_pool_t *) zn->shm.addr;
901
+
902
+ if (sp == sp->addr) {
903
+ return NGX_OK;
904
+ }
905
+
906
+ #endif
907
+
866
908
  ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
867
909
  "shared zone \"%V\" has no equal addresses: %p vs %p",
868
910
  &zn->shm.name, sp->addr, sp);
@@ -964,7 +1006,7 @@ ngx_int_t
964
1006
  ngx_signal_process(ngx_cycle_t *cycle, char *sig)
965
1007
  {
966
1008
  ssize_t n;
967
- ngx_int_t pid;
1009
+ ngx_pid_t pid;
968
1010
  ngx_file_t file;
969
1011
  ngx_core_conf_t *ccf;
970
1012
  u_char buf[NGX_INT64_LEN + 2];
@@ -1002,7 +1044,7 @@ ngx_signal_process(ngx_cycle_t *cycle, char *sig)
1002
1044
 
1003
1045
  pid = ngx_atoi(buf, ++n);
1004
1046
 
1005
- if (pid == NGX_ERROR) {
1047
+ if (pid == (ngx_pid_t) NGX_ERROR) {
1006
1048
  ngx_log_error(NGX_LOG_ERR, cycle->log, 0,
1007
1049
  "invalid PID number \"%*s\" in \"%s\"",
1008
1050
  n, buf, file.name.data);
@@ -1210,6 +1252,10 @@ ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name, size_t size, void *tag)
1210
1252
  return NULL;
1211
1253
  }
1212
1254
 
1255
+ if (shm_zone[i].shm.size == 0) {
1256
+ shm_zone[i].shm.size = size;
1257
+ }
1258
+
1213
1259
  if (size && size != shm_zone[i].shm.size) {
1214
1260
  ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1215
1261
  "the size %uz of shared memory zone \"%V\" "
@@ -1234,6 +1280,7 @@ ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name, size_t size, void *tag)
1234
1280
  shm_zone->shm.exists = 0;
1235
1281
  shm_zone->init = NULL;
1236
1282
  shm_zone->tag = tag;
1283
+ shm_zone->noreuse = 0;
1237
1284
 
1238
1285
  return shm_zone;
1239
1286
  }
@@ -1266,7 +1313,7 @@ ngx_clean_old_cycles(ngx_event_t *ev)
1266
1313
  if (cycle[i]->connections[n].fd != (ngx_socket_t) -1) {
1267
1314
  found = 1;
1268
1315
 
1269
- ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "live fd:%d", n);
1316
+ ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "live fd:%ui", n);
1270
1317
 
1271
1318
  break;
1272
1319
  }
@@ -1277,13 +1324,13 @@ ngx_clean_old_cycles(ngx_event_t *ev)
1277
1324
  continue;
1278
1325
  }
1279
1326
 
1280
- ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "clean old cycle: %d", i);
1327
+ ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "clean old cycle: %ui", i);
1281
1328
 
1282
1329
  ngx_destroy_pool(cycle[i]->pool);
1283
1330
  cycle[i] = NULL;
1284
1331
  }
1285
1332
 
1286
- ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "old cycles status: %d", live);
1333
+ ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "old cycles status: %ui", live);
1287
1334
 
1288
1335
  if (live) {
1289
1336
  ngx_add_timer(ev, 30000);
@@ -31,6 +31,7 @@ struct ngx_shm_zone_s {
31
31
  ngx_shm_t shm;
32
32
  ngx_shm_zone_init_pt init;
33
33
  void *tag;
34
+ ngx_uint_t noreuse; /* unsigned noreuse:1; */
34
35
  };
35
36
 
36
37
 
@@ -47,10 +48,15 @@ struct ngx_cycle_s {
47
48
  ngx_connection_t *free_connections;
48
49
  ngx_uint_t free_connection_n;
49
50
 
51
+ ngx_module_t **modules;
52
+ ngx_uint_t modules_n;
53
+ ngx_uint_t modules_used; /* unsigned modules_used:1; */
54
+
50
55
  ngx_queue_t reusable_connections_queue;
51
56
 
52
57
  ngx_array_t listening;
53
58
  ngx_array_t paths;
59
+ ngx_array_t config_dump;
54
60
  ngx_list_t open_files;
55
61
  ngx_list_t shared_memory;
56
62
 
@@ -73,53 +79,38 @@ struct ngx_cycle_s {
73
79
 
74
80
 
75
81
  typedef struct {
76
- ngx_flag_t daemon;
77
- ngx_flag_t master;
78
-
79
- ngx_msec_t timer_resolution;
80
-
81
- ngx_int_t worker_processes;
82
- ngx_int_t debug_points;
82
+ ngx_flag_t daemon;
83
+ ngx_flag_t master;
83
84
 
84
- ngx_int_t rlimit_nofile;
85
- ngx_int_t rlimit_sigpending;
86
- off_t rlimit_core;
85
+ ngx_msec_t timer_resolution;
87
86
 
88
- int priority;
87
+ ngx_int_t worker_processes;
88
+ ngx_int_t debug_points;
89
89
 
90
- ngx_uint_t cpu_affinity_n;
91
- uint64_t *cpu_affinity;
90
+ ngx_int_t rlimit_nofile;
91
+ off_t rlimit_core;
92
92
 
93
- char *username;
94
- ngx_uid_t user;
95
- ngx_gid_t group;
93
+ int priority;
96
94
 
97
- ngx_str_t working_directory;
98
- ngx_str_t lock_file;
95
+ ngx_uint_t cpu_affinity_auto;
96
+ ngx_uint_t cpu_affinity_n;
97
+ ngx_cpuset_t *cpu_affinity;
99
98
 
100
- ngx_str_t pid;
101
- ngx_str_t oldpid;
99
+ char *username;
100
+ ngx_uid_t user;
101
+ ngx_gid_t group;
102
102
 
103
- ngx_array_t env;
104
- char **environment;
103
+ ngx_str_t working_directory;
104
+ ngx_str_t lock_file;
105
105
 
106
- #if (NGX_OLD_THREADS)
107
- ngx_int_t worker_threads;
108
- size_t thread_stack_size;
109
- #endif
106
+ ngx_str_t pid;
107
+ ngx_str_t oldpid;
110
108
 
109
+ ngx_array_t env;
110
+ char **environment;
111
111
  } ngx_core_conf_t;
112
112
 
113
113
 
114
- #if (NGX_OLD_THREADS)
115
-
116
- typedef struct {
117
- ngx_pool_t *pool; /* pcre's malloc() pool */
118
- } ngx_core_tls_t;
119
-
120
- #endif
121
-
122
-
123
114
  #define ngx_is_init_cycle(cycle) (cycle->conf_ctx == NULL)
124
115
 
125
116
 
@@ -130,7 +121,7 @@ ngx_int_t ngx_signal_process(ngx_cycle_t *cycle, char *sig);
130
121
  void ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user);
131
122
  char **ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last);
132
123
  ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv);
133
- uint64_t ngx_get_cpu_affinity(ngx_uint_t n);
124
+ ngx_cpuset_t *ngx_get_cpu_affinity(ngx_uint_t n);
134
125
  ngx_shm_zone_t *ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name,
135
126
  size_t size, void *tag);
136
127
 
@@ -139,10 +130,8 @@ extern volatile ngx_cycle_t *ngx_cycle;
139
130
  extern ngx_array_t ngx_old_cycles;
140
131
  extern ngx_module_t ngx_core_module;
141
132
  extern ngx_uint_t ngx_test_config;
133
+ extern ngx_uint_t ngx_dump_config;
142
134
  extern ngx_uint_t ngx_quiet_mode;
143
- #if (NGX_OLD_THREADS)
144
- extern ngx_tls_key_t ngx_core_tls_key;
145
- #endif
146
135
 
147
136
 
148
137
  #endif /* _NGX_CYCLE_H_INCLUDED_ */