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
@@ -60,6 +60,7 @@ echo
60
60
  cat << END
61
61
  nginx path prefix: "$NGX_PREFIX"
62
62
  nginx binary file: "$NGX_SBIN_PATH"
63
+ nginx modules path: "$NGX_MODULES_PATH"
63
64
  nginx configuration prefix: "$NGX_CONF_PREFIX"
64
65
  nginx configuration file: "$NGX_CONF_PATH"
65
66
  nginx pid file: "$NGX_PID_PATH"
@@ -45,9 +45,6 @@ if [ -x $NGX_AUTOTEST ]; then
45
45
  fi
46
46
 
47
47
 
48
- rm -rf $NGX_AUTOTEST*
49
-
50
-
51
48
  case $ngx_size in
52
49
  4)
53
50
  ngx_max_value=2147483647
@@ -69,6 +66,11 @@ case $ngx_size in
69
66
  echo $ngx_test >> $NGX_AUTOCONF_ERR
70
67
  echo "----------" >> $NGX_AUTOCONF_ERR
71
68
 
69
+ rm -rf $NGX_AUTOTEST*
70
+
72
71
  exit 1
73
72
  esac
74
73
 
74
+
75
+ rm -rf $NGX_AUTOTEST*
76
+
@@ -49,18 +49,23 @@ END
49
49
  fi
50
50
  fi
51
51
 
52
- rm -rf $NGX_AUTOTEST*
53
-
54
52
  if [ $ngx_found = no ]; then
55
- echo $ngx_n " $ngx_try not found$ngx_c"
53
+ if [ $ngx_try = $ngx_type ]; then
54
+ echo $ngx_n " $ngx_try not found$ngx_c"
55
+ else
56
+ echo $ngx_n ", $ngx_try not found$ngx_c"
57
+ fi
56
58
 
57
59
  echo "----------" >> $NGX_AUTOCONF_ERR
58
60
  cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR
59
61
  echo "----------" >> $NGX_AUTOCONF_ERR
60
62
  echo $ngx_test >> $NGX_AUTOCONF_ERR
61
63
  echo "----------" >> $NGX_AUTOCONF_ERR
64
+ fi
65
+
66
+ rm -rf $NGX_AUTOTEST*
62
67
 
63
- else
68
+ if [ $ngx_found != no ]; then
64
69
  break
65
70
  fi
66
71
  done
@@ -4,8 +4,13 @@
4
4
 
5
5
 
6
6
  echo $ngx_n "checking for uintptr_t ...$ngx_c"
7
- echo >> $NGX_AUTOCONF_ERR
8
- echo "checking for uintptr_t" >> $NGX_AUTOCONF_ERR
7
+
8
+ cat << END >> $NGX_AUTOCONF_ERR
9
+
10
+ ----------------------------------------
11
+ checking for uintptr_t
12
+
13
+ END
9
14
 
10
15
  found=no
11
16
 
@@ -255,12 +255,12 @@ ngx_feature_test="struct statvfs fs;
255
255
 
256
256
 
257
257
  ngx_feature="dlopen()"
258
- ngx_feature_name=
258
+ ngx_feature_name="NGX_HAVE_DLOPEN"
259
259
  ngx_feature_run=no
260
260
  ngx_feature_incs="#include <dlfcn.h>"
261
261
  ngx_feature_path=
262
262
  ngx_feature_libs=
263
- ngx_feature_test="dlopen(NULL, 0)"
263
+ ngx_feature_test="dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); dlsym(NULL, NULL)"
264
264
  . auto/feature
265
265
 
266
266
 
@@ -271,6 +271,7 @@ if [ $ngx_found != yes ]; then
271
271
  . auto/feature
272
272
 
273
273
  if [ $ngx_found = yes ]; then
274
+ CORE_LIBS="$CORE_LIBS -ldl"
274
275
  NGX_LIBDL="-ldl"
275
276
  fi
276
277
  fi
@@ -304,7 +305,17 @@ ngx_feature_run=no
304
305
  ngx_feature_incs="#include <sys/socket.h>"
305
306
  ngx_feature_path=
306
307
  ngx_feature_libs=
307
- ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 4)"
308
+ ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 0)"
309
+ . auto/feature
310
+
311
+
312
+ ngx_feature="SO_REUSEPORT"
313
+ ngx_feature_name="NGX_HAVE_REUSEPORT"
314
+ ngx_feature_run=no
315
+ ngx_feature_incs="#include <sys/socket.h>"
316
+ ngx_feature_path=
317
+ ngx_feature_libs=
318
+ ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_REUSEPORT, NULL, 0)"
308
319
  . auto/feature
309
320
 
310
321
 
@@ -318,6 +329,45 @@ ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0)"
318
329
  . auto/feature
319
330
 
320
331
 
332
+ # BSD way to get IPv4 datagram destination address
333
+
334
+ ngx_feature="IP_RECVDSTADDR"
335
+ ngx_feature_name="NGX_HAVE_IP_RECVDSTADDR"
336
+ ngx_feature_run=no
337
+ ngx_feature_incs="#include <sys/socket.h>
338
+ #include <netinet/in.h>"
339
+ ngx_feature_path=
340
+ ngx_feature_libs=
341
+ ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_RECVDSTADDR, NULL, 0)"
342
+ . auto/feature
343
+
344
+
345
+ # Linux way to get IPv4 datagram destination address
346
+
347
+ ngx_feature="IP_PKTINFO"
348
+ ngx_feature_name="NGX_HAVE_IP_PKTINFO"
349
+ ngx_feature_run=no
350
+ ngx_feature_incs="#include <sys/socket.h>
351
+ #include <netinet/in.h>"
352
+ ngx_feature_path=
353
+ ngx_feature_libs=
354
+ ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_PKTINFO, NULL, 0)"
355
+ . auto/feature
356
+
357
+
358
+ # RFC 3542 way to get IPv6 datagram destination address
359
+
360
+ ngx_feature="IPV6_RECVPKTINFO"
361
+ ngx_feature_name="NGX_HAVE_IPV6_RECVPKTINFO"
362
+ ngx_feature_run=no
363
+ ngx_feature_incs="#include <sys/socket.h>
364
+ #include <netinet/in.h>"
365
+ ngx_feature_path=
366
+ ngx_feature_libs=
367
+ ngx_feature_test="setsockopt(0, IPPROTO_IPV6, IPV6_RECVPKTINFO, NULL, 0)"
368
+ . auto/feature
369
+
370
+
321
371
  ngx_feature="TCP_DEFER_ACCEPT"
322
372
  ngx_feature_name="NGX_HAVE_DEFERRED_ACCEPT"
323
373
  ngx_feature_run=no
@@ -495,15 +545,9 @@ ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value
495
545
 
496
546
  # POSIX types
497
547
 
498
- case "$NGX_AUTO_CONFIG_H" in
499
- /*)
500
- NGX_INCLUDE_AUTO_CONFIG_H="#include \"$NGX_AUTO_CONFIG_H\""
501
- ;;
502
- *)
503
- NGX_INCLUDE_AUTO_CONFIG_H="#include \"../$NGX_AUTO_CONFIG_H\""
504
- ;;
505
- esac
548
+ NGX_INCLUDE_AUTO_CONFIG_H="#include \"ngx_auto_config.h\""
506
549
 
550
+ ngx_type="uint32_t"; ngx_types="u_int32_t"; . auto/types/typedef
507
551
  ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef
508
552
 
509
553
  ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef
@@ -512,7 +556,7 @@ ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value
512
556
 
513
557
  ngx_type="socklen_t"; ngx_types="int"; . auto/types/typedef
514
558
 
515
- ngx_type="in_addr_t"; ngx_types="uint32_t"; . auto/types/typedef
559
+ ngx_type="in_addr_t"; ngx_types="uint32_t u_int32_t"; . auto/types/typedef
516
560
 
517
561
  ngx_type="in_port_t"; ngx_types="u_short"; . auto/types/typedef
518
562
 
@@ -586,6 +630,22 @@ ngx_feature_test="char buf[1]; ssize_t n; n = pwrite(1, buf, 1, 0);
586
630
  . auto/feature
587
631
 
588
632
 
633
+ # pwritev() was introduced in FreeBSD 6 and Linux 2.6.30, glibc 2.10
634
+
635
+ ngx_feature="pwritev()"
636
+ ngx_feature_name="NGX_HAVE_PWRITEV"
637
+ ngx_feature_run=no
638
+ ngx_feature_incs='#include <sys/uio.h>'
639
+ ngx_feature_path=
640
+ ngx_feature_libs=
641
+ ngx_feature_test="char buf[1]; struct iovec vec[1]; ssize_t n;
642
+ vec[0].iov_base = buf;
643
+ vec[0].iov_len = 1;
644
+ n = pwritev(1, vec, 1, 0);
645
+ if (n == -1) return 1"
646
+ . auto/feature
647
+
648
+
589
649
  ngx_feature="sys_nerr"
590
650
  ngx_feature_name="NGX_SYS_NERR"
591
651
  ngx_feature_run=value
@@ -10,6 +10,7 @@ fastcgi_param REQUEST_URI $request_uri;
10
10
  fastcgi_param DOCUMENT_URI $document_uri;
11
11
  fastcgi_param DOCUMENT_ROOT $document_root;
12
12
  fastcgi_param SERVER_PROTOCOL $server_protocol;
13
+ fastcgi_param REQUEST_SCHEME $scheme;
13
14
  fastcgi_param HTTPS $https if_not_empty;
14
15
 
15
16
  fastcgi_param GATEWAY_INTERFACE CGI/1.1;
@@ -9,6 +9,7 @@ fastcgi_param REQUEST_URI $request_uri;
9
9
  fastcgi_param DOCUMENT_URI $document_uri;
10
10
  fastcgi_param DOCUMENT_ROOT $document_root;
11
11
  fastcgi_param SERVER_PROTOCOL $server_protocol;
12
+ fastcgi_param REQUEST_SCHEME $scheme;
12
13
  fastcgi_param HTTPS $https if_not_empty;
13
14
 
14
15
  fastcgi_param GATEWAY_INTERFACE CGI/1.1;
@@ -8,6 +8,7 @@ scgi_param DOCUMENT_URI $document_uri;
8
8
  scgi_param DOCUMENT_ROOT $document_root;
9
9
  scgi_param SCGI 1;
10
10
  scgi_param SERVER_PROTOCOL $server_protocol;
11
+ scgi_param REQUEST_SCHEME $scheme;
11
12
  scgi_param HTTPS $https if_not_empty;
12
13
 
13
14
  scgi_param REMOTE_ADDR $remote_addr;
@@ -8,6 +8,7 @@ uwsgi_param REQUEST_URI $request_uri;
8
8
  uwsgi_param PATH_INFO $document_uri;
9
9
  uwsgi_param DOCUMENT_ROOT $document_root;
10
10
  uwsgi_param SERVER_PROTOCOL $server_protocol;
11
+ uwsgi_param REQUEST_SCHEME $scheme;
11
12
  uwsgi_param HTTPS $https if_not_empty;
12
13
 
13
14
  uwsgi_param REMOTE_ADDR $remote_addr;
@@ -11,7 +11,7 @@ export LC_ALL
11
11
  . auto/init
12
12
  . auto/sources
13
13
 
14
- test -d $NGX_OBJS || mkdir $NGX_OBJS
14
+ test -d $NGX_OBJS || mkdir -p $NGX_OBJS
15
15
 
16
16
  echo > $NGX_AUTO_HEADERS_H
17
17
  echo > $NGX_AUTOCONF_ERR
@@ -57,6 +57,7 @@ syn keyword ngxDirectiveError post_action
57
57
  syn keyword ngxDirectiveDeprecated connections
58
58
  syn keyword ngxDirectiveDeprecated imap
59
59
  syn keyword ngxDirectiveDeprecated limit_zone
60
+ syn keyword ngxDirectiveDeprecated mysql_test
60
61
  syn keyword ngxDirectiveDeprecated open_file_cache_retest
61
62
  syn keyword ngxDirectiveDeprecated optimize_server_names
62
63
  syn keyword ngxDirectiveDeprecated satisfy_any
@@ -246,7 +247,6 @@ syn keyword ngxDirective mp4_max_buffer_size
246
247
  syn keyword ngxDirective msie_padding
247
248
  syn keyword ngxDirective msie_refresh
248
249
  syn keyword ngxDirective multi_accept
249
- syn keyword ngxDirective mysql_test
250
250
  syn keyword ngxDirective open_file_cache
251
251
  syn keyword ngxDirective open_file_cache_errors
252
252
  syn keyword ngxDirective open_file_cache_events
@@ -604,7 +604,7 @@ syn keyword ngxDirectiveThirdParty echo_subrequest
604
604
  syn keyword ngxDirectiveThirdParty echo_subrequest_async
605
605
 
606
606
  " Events Module <http://docs.dutov.org/nginx_modules_events_en.html>
607
- " Privides options for start/stop events.
607
+ " Provides options for start/stop events.
608
608
  syn keyword ngxDirectiveThirdParty on_start
609
609
  syn keyword ngxDirectiveThirdParty on_stop
610
610
 
@@ -25,7 +25,7 @@
25
25
  .\" SUCH DAMAGE.
26
26
  .\"
27
27
  .\"
28
- .Dd March 6, 2012
28
+ .Dd June 16, 2015
29
29
  .Dt NGINX 8
30
30
  .Os
31
31
  .Sh NAME
@@ -33,7 +33,7 @@
33
33
  .Nd "HTTP and reverse proxy server, mail proxy server"
34
34
  .Sh SYNOPSIS
35
35
  .Nm
36
- .Op Fl ?hqtVv
36
+ .Op Fl ?hqTtVv
37
37
  .Op Fl c Ar file
38
38
  .Op Fl g Ar directives
39
39
  .Op Fl p Ar prefix
@@ -87,6 +87,10 @@ Do not run, just test the configuration file.
87
87
  .Nm
88
88
  checks the configuration file syntax and then tries to open files
89
89
  referenced in the configuration file.
90
+ .It Fl T
91
+ Same as
92
+ .Fl t ,
93
+ but additionally dump configuration files to standard output.
90
94
  .It Fl V
91
95
  Print the
92
96
  .Nm
@@ -10,6 +10,7 @@
10
10
  #include <nginx.h>
11
11
 
12
12
 
13
+ static void ngx_show_version_info(void);
13
14
  static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle);
14
15
  static ngx_int_t ngx_get_options(int argc, char *const *argv);
15
16
  static ngx_int_t ngx_process_options(ngx_cycle_t *cycle);
@@ -23,6 +24,10 @@ static char *ngx_set_cpu_affinity(ngx_conf_t *cf, ngx_command_t *cmd,
23
24
  void *conf);
24
25
  static char *ngx_set_worker_processes(ngx_conf_t *cf, ngx_command_t *cmd,
25
26
  void *conf);
27
+ static char *ngx_load_module(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
28
+ #if (NGX_HAVE_DLOPEN)
29
+ static void ngx_unload_module(void *data);
30
+ #endif
26
31
 
27
32
 
28
33
  static ngx_conf_enum_t ngx_debug_points[] = {
@@ -118,13 +123,6 @@ static ngx_command_t ngx_core_commands[] = {
118
123
  offsetof(ngx_core_conf_t, rlimit_core),
119
124
  NULL },
120
125
 
121
- { ngx_string("worker_rlimit_sigpending"),
122
- NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
123
- ngx_conf_set_num_slot,
124
- 0,
125
- offsetof(ngx_core_conf_t, rlimit_sigpending),
126
- NULL },
127
-
128
126
  { ngx_string("working_directory"),
129
127
  NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
130
128
  ngx_conf_set_str_slot,
@@ -139,24 +137,13 @@ static ngx_command_t ngx_core_commands[] = {
139
137
  0,
140
138
  NULL },
141
139
 
142
- #if (NGX_OLD_THREADS)
143
-
144
- { ngx_string("worker_threads"),
140
+ { ngx_string("load_module"),
145
141
  NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
146
- ngx_conf_set_num_slot,
142
+ ngx_load_module,
147
143
  0,
148
- offsetof(ngx_core_conf_t, worker_threads),
149
- NULL },
150
-
151
- { ngx_string("thread_stack_size"),
152
- NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
153
- ngx_conf_set_size_slot,
154
144
  0,
155
- offsetof(ngx_core_conf_t, thread_stack_size),
156
145
  NULL },
157
146
 
158
- #endif
159
-
160
147
  ngx_null_command
161
148
  };
162
149
 
@@ -184,8 +171,6 @@ ngx_module_t ngx_core_module = {
184
171
  };
185
172
 
186
173
 
187
- ngx_uint_t ngx_max_module;
188
-
189
174
  static ngx_uint_t ngx_show_help;
190
175
  static ngx_uint_t ngx_show_version;
191
176
  static ngx_uint_t ngx_show_configure;
@@ -201,9 +186,11 @@ static char **ngx_os_environ;
201
186
  int ngx_cdecl
202
187
  main(int argc, char *const *argv)
203
188
  {
204
- ngx_int_t i;
189
+ ngx_buf_t *b;
205
190
  ngx_log_t *log;
191
+ ngx_uint_t i;
206
192
  ngx_cycle_t *cycle, init_cycle;
193
+ ngx_conf_dump_t *cd;
207
194
  ngx_core_conf_t *ccf;
208
195
 
209
196
  ngx_debug_init();
@@ -217,62 +204,7 @@ main(int argc, char *const *argv)
217
204
  }
218
205
 
219
206
  if (ngx_show_version) {
220
- ngx_write_stderr("nginx version: " NGINX_VER_BUILD NGX_LINEFEED);
221
-
222
- if (ngx_show_help) {
223
- ngx_write_stderr(
224
- "Usage: nginx [-?hvVtq] [-s signal] [-c filename] "
225
- "[-p prefix] [-g directives]" NGX_LINEFEED
226
- NGX_LINEFEED
227
- "Options:" NGX_LINEFEED
228
- " -?,-h : this help" NGX_LINEFEED
229
- " -v : show version and exit" NGX_LINEFEED
230
- " -V : show version and configure options then exit"
231
- NGX_LINEFEED
232
- " -t : test configuration and exit" NGX_LINEFEED
233
- " -q : suppress non-error messages "
234
- "during configuration testing" NGX_LINEFEED
235
- " -s signal : send signal to a master process: "
236
- "stop, quit, reopen, reload" NGX_LINEFEED
237
- #ifdef NGX_PREFIX
238
- " -p prefix : set prefix path (default: "
239
- NGX_PREFIX ")" NGX_LINEFEED
240
- #else
241
- " -p prefix : set prefix path (default: NONE)" NGX_LINEFEED
242
- #endif
243
- " -c filename : set configuration file (default: "
244
- NGX_CONF_PATH ")" NGX_LINEFEED
245
- " -g directives : set global directives out of configuration "
246
- "file" NGX_LINEFEED NGX_LINEFEED
247
- );
248
- }
249
-
250
- if (ngx_show_configure) {
251
-
252
- #ifdef NGX_COMPILER
253
- ngx_write_stderr("built by " NGX_COMPILER NGX_LINEFEED);
254
- #endif
255
-
256
- #if (NGX_SSL)
257
- if (SSLeay() == SSLEAY_VERSION_NUMBER) {
258
- ngx_write_stderr("built with " OPENSSL_VERSION_TEXT
259
- NGX_LINEFEED);
260
- } else {
261
- ngx_write_stderr("built with " OPENSSL_VERSION_TEXT
262
- " (running with ");
263
- ngx_write_stderr((char *) (uintptr_t)
264
- SSLeay_version(SSLEAY_VERSION));
265
- ngx_write_stderr(")" NGX_LINEFEED);
266
- }
267
- #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
268
- ngx_write_stderr("TLS SNI support enabled" NGX_LINEFEED);
269
- #else
270
- ngx_write_stderr("TLS SNI support disabled" NGX_LINEFEED);
271
- #endif
272
- #endif
273
-
274
- ngx_write_stderr("configure arguments:" NGX_CONFIGURE NGX_LINEFEED);
275
- }
207
+ ngx_show_version_info();
276
208
 
277
209
  if (!ngx_test_config) {
278
210
  return 0;
@@ -337,9 +269,8 @@ main(int argc, char *const *argv)
337
269
  return 1;
338
270
  }
339
271
 
340
- ngx_max_module = 0;
341
- for (i = 0; ngx_modules[i]; i++) {
342
- ngx_modules[i]->index = ngx_max_module++;
272
+ if (ngx_preinit_modules() != NGX_OK) {
273
+ return 1;
343
274
  }
344
275
 
345
276
  cycle = ngx_init_cycle(&init_cycle);
@@ -358,6 +289,23 @@ main(int argc, char *const *argv)
358
289
  cycle->conf_file.data);
359
290
  }
360
291
 
292
+ if (ngx_dump_config) {
293
+ cd = cycle->config_dump.elts;
294
+
295
+ for (i = 0; i < cycle->config_dump.nelts; i++) {
296
+
297
+ ngx_write_stdout("# configuration file ");
298
+ (void) ngx_write_fd(ngx_stdout, cd[i].name.data,
299
+ cd[i].name.len);
300
+ ngx_write_stdout(":" NGX_LINEFEED);
301
+
302
+ b = cd[i].buffer;
303
+
304
+ (void) ngx_write_fd(ngx_stdout, b->pos, b->last - b->pos);
305
+ ngx_write_stdout(NGX_LINEFEED);
306
+ }
307
+ }
308
+
361
309
  return 0;
362
310
  }
363
311
 
@@ -423,6 +371,68 @@ main(int argc, char *const *argv)
423
371
  }
424
372
 
425
373
 
374
+ static void
375
+ ngx_show_version_info(void)
376
+ {
377
+ ngx_write_stderr("nginx version: " NGINX_VER_BUILD NGX_LINEFEED);
378
+
379
+ if (ngx_show_help) {
380
+ ngx_write_stderr(
381
+ "Usage: nginx [-?hvVtTq] [-s signal] [-c filename] "
382
+ "[-p prefix] [-g directives]" NGX_LINEFEED
383
+ NGX_LINEFEED
384
+ "Options:" NGX_LINEFEED
385
+ " -?,-h : this help" NGX_LINEFEED
386
+ " -v : show version and exit" NGX_LINEFEED
387
+ " -V : show version and configure options then exit"
388
+ NGX_LINEFEED
389
+ " -t : test configuration and exit" NGX_LINEFEED
390
+ " -T : test configuration, dump it and exit"
391
+ NGX_LINEFEED
392
+ " -q : suppress non-error messages "
393
+ "during configuration testing" NGX_LINEFEED
394
+ " -s signal : send signal to a master process: "
395
+ "stop, quit, reopen, reload" NGX_LINEFEED
396
+ #ifdef NGX_PREFIX
397
+ " -p prefix : set prefix path (default: " NGX_PREFIX ")"
398
+ NGX_LINEFEED
399
+ #else
400
+ " -p prefix : set prefix path (default: NONE)" NGX_LINEFEED
401
+ #endif
402
+ " -c filename : set configuration file (default: " NGX_CONF_PATH
403
+ ")" NGX_LINEFEED
404
+ " -g directives : set global directives out of configuration "
405
+ "file" NGX_LINEFEED NGX_LINEFEED
406
+ );
407
+ }
408
+
409
+ if (ngx_show_configure) {
410
+
411
+ #ifdef NGX_COMPILER
412
+ ngx_write_stderr("built by " NGX_COMPILER NGX_LINEFEED);
413
+ #endif
414
+
415
+ #if (NGX_SSL)
416
+ if (ngx_strcmp(ngx_ssl_version(), OPENSSL_VERSION_TEXT) == 0) {
417
+ ngx_write_stderr("built with " OPENSSL_VERSION_TEXT NGX_LINEFEED);
418
+ } else {
419
+ ngx_write_stderr("built with " OPENSSL_VERSION_TEXT
420
+ " (running with ");
421
+ ngx_write_stderr((char *) (uintptr_t) ngx_ssl_version());
422
+ ngx_write_stderr(")" NGX_LINEFEED);
423
+ }
424
+ #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
425
+ ngx_write_stderr("TLS SNI support enabled" NGX_LINEFEED);
426
+ #else
427
+ ngx_write_stderr("TLS SNI support disabled" NGX_LINEFEED);
428
+ #endif
429
+ #endif
430
+
431
+ ngx_write_stderr("configure arguments:" NGX_CONFIGURE NGX_LINEFEED);
432
+ }
433
+ }
434
+
435
+
426
436
  static ngx_int_t
427
437
  ngx_add_inherited_sockets(ngx_cycle_t *cycle)
428
438
  {
@@ -470,6 +480,12 @@ ngx_add_inherited_sockets(ngx_cycle_t *cycle)
470
480
  }
471
481
  }
472
482
 
483
+ if (v != p) {
484
+ ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
485
+ "invalid socket number \"%s\" in " NGINX_VAR
486
+ " environment variable, ignoring", v);
487
+ }
488
+
473
489
  ngx_inherited = 1;
474
490
 
475
491
  return ngx_set_inherited_sockets(cycle);
@@ -714,6 +730,11 @@ ngx_get_options(int argc, char *const *argv)
714
730
  ngx_test_config = 1;
715
731
  break;
716
732
 
733
+ case 'T':
734
+ ngx_test_config = 1;
735
+ ngx_dump_config = 1;
736
+ break;
737
+
717
738
  case 'q':
718
739
  ngx_quiet_mode = 1;
719
740
  break;
@@ -953,6 +974,7 @@ ngx_core_module_create_conf(ngx_cycle_t *cycle)
953
974
  * ccf->pid = NULL;
954
975
  * ccf->oldpid = NULL;
955
976
  * ccf->priority = 0;
977
+ * ccf->cpu_affinity_auto = 0;
956
978
  * ccf->cpu_affinity_n = 0;
957
979
  * ccf->cpu_affinity = NULL;
958
980
  */
@@ -966,16 +988,10 @@ ngx_core_module_create_conf(ngx_cycle_t *cycle)
966
988
 
967
989
  ccf->rlimit_nofile = NGX_CONF_UNSET;
968
990
  ccf->rlimit_core = NGX_CONF_UNSET;
969
- ccf->rlimit_sigpending = NGX_CONF_UNSET;
970
991
 
971
992
  ccf->user = (ngx_uid_t) NGX_CONF_UNSET_UINT;
972
993
  ccf->group = (ngx_gid_t) NGX_CONF_UNSET_UINT;
973
994
 
974
- #if (NGX_OLD_THREADS)
975
- ccf->worker_threads = NGX_CONF_UNSET;
976
- ccf->thread_stack_size = NGX_CONF_UNSET_SIZE;
977
- #endif
978
-
979
995
  if (ngx_array_init(&ccf->env, cycle->pool, 1, sizeof(ngx_str_t))
980
996
  != NGX_OK)
981
997
  {
@@ -1000,7 +1016,8 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
1000
1016
 
1001
1017
  #if (NGX_HAVE_CPU_AFFINITY)
1002
1018
 
1003
- if (ccf->cpu_affinity_n
1019
+ if (!ccf->cpu_affinity_auto
1020
+ && ccf->cpu_affinity_n
1004
1021
  && ccf->cpu_affinity_n != 1
1005
1022
  && ccf->cpu_affinity_n != (ngx_uint_t) ccf->worker_processes)
1006
1023
  {
@@ -1010,14 +1027,6 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
1010
1027
  "using last mask for remaining worker processes");
1011
1028
  }
1012
1029
 
1013
- #endif
1014
-
1015
- #if (NGX_OLD_THREADS)
1016
-
1017
- ngx_conf_init_value(ccf->worker_threads, 0);
1018
- ngx_threads_n = ccf->worker_threads;
1019
- ngx_conf_init_size_value(ccf->thread_stack_size, 2 * 1024 * 1024);
1020
-
1021
1030
  #endif
1022
1031
 
1023
1032
 
@@ -1152,7 +1161,7 @@ ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1152
1161
  return NGX_CONF_OK;
1153
1162
  }
1154
1163
 
1155
- value = (ngx_str_t *) cf->args->elts;
1164
+ value = cf->args->elts;
1156
1165
 
1157
1166
  ccf->username = (char *) value[1].data;
1158
1167
 
@@ -1260,16 +1269,16 @@ ngx_set_cpu_affinity(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1260
1269
  #if (NGX_HAVE_CPU_AFFINITY)
1261
1270
  ngx_core_conf_t *ccf = conf;
1262
1271
 
1263
- u_char ch;
1264
- uint64_t *mask;
1272
+ u_char ch, *p;
1265
1273
  ngx_str_t *value;
1266
1274
  ngx_uint_t i, n;
1275
+ ngx_cpuset_t *mask;
1267
1276
 
1268
1277
  if (ccf->cpu_affinity) {
1269
1278
  return "is duplicate";
1270
1279
  }
1271
1280
 
1272
- mask = ngx_palloc(cf->pool, (cf->args->nelts - 1) * sizeof(uint64_t));
1281
+ mask = ngx_palloc(cf->pool, (cf->args->nelts - 1) * sizeof(ngx_cpuset_t));
1273
1282
  if (mask == NULL) {
1274
1283
  return NGX_CONF_ERROR;
1275
1284
  }
@@ -1279,32 +1288,58 @@ ngx_set_cpu_affinity(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1279
1288
 
1280
1289
  value = cf->args->elts;
1281
1290
 
1282
- for (n = 1; n < cf->args->nelts; n++) {
1291
+ if (ngx_strcmp(value[1].data, "auto") == 0) {
1283
1292
 
1284
- if (value[n].len > 64) {
1293
+ if (cf->args->nelts > 3) {
1285
1294
  ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1286
- "\"worker_cpu_affinity\" supports up to 64 CPUs only");
1295
+ "invalid number of arguments in "
1296
+ "\"worker_cpu_affinity\" directive");
1287
1297
  return NGX_CONF_ERROR;
1288
1298
  }
1289
1299
 
1290
- mask[n - 1] = 0;
1300
+ ccf->cpu_affinity_auto = 1;
1301
+
1302
+ CPU_ZERO(&mask[0]);
1303
+ for (i = 0; i < (ngx_uint_t) ngx_min(ngx_ncpu, CPU_SETSIZE); i++) {
1304
+ CPU_SET(i, &mask[0]);
1305
+ }
1291
1306
 
1292
- for (i = 0; i < value[n].len; i++) {
1307
+ n = 2;
1308
+
1309
+ } else {
1310
+ n = 1;
1311
+ }
1293
1312
 
1294
- ch = value[n].data[i];
1313
+ for ( /* void */ ; n < cf->args->nelts; n++) {
1314
+
1315
+ if (value[n].len > CPU_SETSIZE) {
1316
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1317
+ "\"worker_cpu_affinity\" supports up to %d CPUs only",
1318
+ CPU_SETSIZE);
1319
+ return NGX_CONF_ERROR;
1320
+ }
1321
+
1322
+ i = 0;
1323
+ CPU_ZERO(&mask[n - 1]);
1324
+
1325
+ for (p = value[n].data + value[n].len - 1;
1326
+ p >= value[n].data;
1327
+ p--)
1328
+ {
1329
+ ch = *p;
1295
1330
 
1296
1331
  if (ch == ' ') {
1297
1332
  continue;
1298
1333
  }
1299
1334
 
1300
- mask[n - 1] <<= 1;
1335
+ i++;
1301
1336
 
1302
1337
  if (ch == '0') {
1303
1338
  continue;
1304
1339
  }
1305
1340
 
1306
1341
  if (ch == '1') {
1307
- mask[n - 1] |= 1;
1342
+ CPU_SET(i - 1, &mask[n - 1]);
1308
1343
  continue;
1309
1344
  }
1310
1345
 
@@ -1326,23 +1361,57 @@ ngx_set_cpu_affinity(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1326
1361
  }
1327
1362
 
1328
1363
 
1329
- uint64_t
1364
+ ngx_cpuset_t *
1330
1365
  ngx_get_cpu_affinity(ngx_uint_t n)
1331
1366
  {
1367
+ #if (NGX_HAVE_CPU_AFFINITY)
1368
+ ngx_uint_t i, j;
1369
+ ngx_cpuset_t *mask;
1332
1370
  ngx_core_conf_t *ccf;
1333
1371
 
1372
+ static ngx_cpuset_t result;
1373
+
1334
1374
  ccf = (ngx_core_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx,
1335
1375
  ngx_core_module);
1336
1376
 
1337
1377
  if (ccf->cpu_affinity == NULL) {
1338
- return 0;
1378
+ return NULL;
1379
+ }
1380
+
1381
+ if (ccf->cpu_affinity_auto) {
1382
+ mask = &ccf->cpu_affinity[ccf->cpu_affinity_n - 1];
1383
+
1384
+ for (i = 0, j = n; /* void */ ; i++) {
1385
+
1386
+ if (CPU_ISSET(i % CPU_SETSIZE, mask) && j-- == 0) {
1387
+ break;
1388
+ }
1389
+
1390
+ if (i == CPU_SETSIZE && j == n) {
1391
+ /* empty mask */
1392
+ return NULL;
1393
+ }
1394
+
1395
+ /* void */
1396
+ }
1397
+
1398
+ CPU_ZERO(&result);
1399
+ CPU_SET(i % CPU_SETSIZE, &result);
1400
+
1401
+ return &result;
1339
1402
  }
1340
1403
 
1341
1404
  if (ccf->cpu_affinity_n > n) {
1342
- return ccf->cpu_affinity[n];
1405
+ return &ccf->cpu_affinity[n];
1343
1406
  }
1344
1407
 
1345
- return ccf->cpu_affinity[ccf->cpu_affinity_n - 1];
1408
+ return &ccf->cpu_affinity[ccf->cpu_affinity_n - 1];
1409
+
1410
+ #else
1411
+
1412
+ return NULL;
1413
+
1414
+ #endif
1346
1415
  }
1347
1416
 
1348
1417
 
@@ -1358,7 +1427,7 @@ ngx_set_worker_processes(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1358
1427
  return "is duplicate";
1359
1428
  }
1360
1429
 
1361
- value = (ngx_str_t *) cf->args->elts;
1430
+ value = cf->args->elts;
1362
1431
 
1363
1432
  if (ngx_strcmp(value[1].data, "auto") == 0) {
1364
1433
  ccf->worker_processes = ngx_ncpu;
@@ -1373,3 +1442,101 @@ ngx_set_worker_processes(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1373
1442
 
1374
1443
  return NGX_CONF_OK;
1375
1444
  }
1445
+
1446
+
1447
+ static char *
1448
+ ngx_load_module(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1449
+ {
1450
+ #if (NGX_HAVE_DLOPEN)
1451
+ void *handle;
1452
+ char **names, **order;
1453
+ ngx_str_t *value, file;
1454
+ ngx_uint_t i;
1455
+ ngx_module_t *module, **modules;
1456
+ ngx_pool_cleanup_t *cln;
1457
+
1458
+ if (cf->cycle->modules_used) {
1459
+ return "is specified too late";
1460
+ }
1461
+
1462
+ value = cf->args->elts;
1463
+
1464
+ file = value[1];
1465
+
1466
+ if (ngx_conf_full_name(cf->cycle, &file, 0) != NGX_OK) {
1467
+ return NGX_CONF_ERROR;
1468
+ }
1469
+
1470
+ cln = ngx_pool_cleanup_add(cf->cycle->pool, 0);
1471
+ if (cln == NULL) {
1472
+ return NGX_CONF_ERROR;
1473
+ }
1474
+
1475
+ handle = ngx_dlopen(file.data);
1476
+ if (handle == NULL) {
1477
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1478
+ ngx_dlopen_n " \"%s\" failed (%s)",
1479
+ file.data, ngx_dlerror());
1480
+ return NGX_CONF_ERROR;
1481
+ }
1482
+
1483
+ cln->handler = ngx_unload_module;
1484
+ cln->data = handle;
1485
+
1486
+ modules = ngx_dlsym(handle, "ngx_modules");
1487
+ if (modules == NULL) {
1488
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1489
+ ngx_dlsym_n " \"%V\", \"%s\" failed (%s)",
1490
+ &value[1], "ngx_modules", ngx_dlerror());
1491
+ return NGX_CONF_ERROR;
1492
+ }
1493
+
1494
+ names = ngx_dlsym(handle, "ngx_module_names");
1495
+ if (names == NULL) {
1496
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1497
+ ngx_dlsym_n " \"%V\", \"%s\" failed (%s)",
1498
+ &value[1], "ngx_module_names", ngx_dlerror());
1499
+ return NGX_CONF_ERROR;
1500
+ }
1501
+
1502
+ order = ngx_dlsym(handle, "ngx_module_order");
1503
+
1504
+ for (i = 0; modules[i]; i++) {
1505
+ module = modules[i];
1506
+ module->name = names[i];
1507
+
1508
+ if (ngx_add_module(cf, &file, module, order) != NGX_OK) {
1509
+ return NGX_CONF_ERROR;
1510
+ }
1511
+
1512
+ ngx_log_debug2(NGX_LOG_DEBUG_CORE, cf->log, 0, "module: %s i:%ui",
1513
+ module->name, module->index);
1514
+ }
1515
+
1516
+ return NGX_CONF_OK;
1517
+
1518
+ #else
1519
+
1520
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1521
+ "\"load_module\" is not supported "
1522
+ "on this platform");
1523
+ return NGX_CONF_ERROR;
1524
+
1525
+ #endif
1526
+ }
1527
+
1528
+
1529
+ #if (NGX_HAVE_DLOPEN)
1530
+
1531
+ static void
1532
+ ngx_unload_module(void *data)
1533
+ {
1534
+ void *handle = data;
1535
+
1536
+ if (ngx_dlclose(handle) != 0) {
1537
+ ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
1538
+ ngx_dlclose_n " failed (%s)", ngx_dlerror());
1539
+ }
1540
+ }
1541
+
1542
+ #endif