nginxtra 1.0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -0
- data/bin/nginxtra +5 -0
- data/lib/nginxtra.rb +12 -0
- data/lib/nginxtra/action.rb +36 -0
- data/lib/nginxtra/actions/compile.rb +60 -0
- data/lib/nginxtra/actions/install.rb +99 -0
- data/lib/nginxtra/actions/reload.rb +14 -0
- data/lib/nginxtra/actions/restart.rb +15 -0
- data/lib/nginxtra/actions/start.rb +53 -0
- data/lib/nginxtra/actions/status.rb +31 -0
- data/lib/nginxtra/actions/stop.rb +14 -0
- data/lib/nginxtra/cli.rb +77 -0
- data/lib/nginxtra/config.rb +339 -0
- data/lib/nginxtra/error.rb +13 -0
- data/lib/nginxtra/status.rb +57 -0
- data/src/nginx/CHANGES +5630 -0
- data/src/nginx/CHANGES.ru +5716 -0
- data/src/nginx/LICENSE +25 -0
- data/src/nginx/README +3 -0
- data/src/nginx/auto/cc/acc +15 -0
- data/src/nginx/auto/cc/bcc +72 -0
- data/src/nginx/auto/cc/ccc +46 -0
- data/src/nginx/auto/cc/conf +189 -0
- data/src/nginx/auto/cc/gcc +183 -0
- data/src/nginx/auto/cc/icc +121 -0
- data/src/nginx/auto/cc/msvc +138 -0
- data/src/nginx/auto/cc/name +101 -0
- data/src/nginx/auto/cc/owc +104 -0
- data/src/nginx/auto/cc/sunc +158 -0
- data/src/nginx/auto/define +12 -0
- data/src/nginx/auto/endianess +45 -0
- data/src/nginx/auto/feature +123 -0
- data/src/nginx/auto/have +12 -0
- data/src/nginx/auto/have_headers +12 -0
- data/src/nginx/auto/headers +13 -0
- data/src/nginx/auto/include +61 -0
- data/src/nginx/auto/init +51 -0
- data/src/nginx/auto/install +184 -0
- data/src/nginx/auto/lib/conf +83 -0
- data/src/nginx/auto/lib/geoip/conf +79 -0
- data/src/nginx/auto/lib/google-perftools/conf +45 -0
- data/src/nginx/auto/lib/libatomic/conf +43 -0
- data/src/nginx/auto/lib/libatomic/make +14 -0
- data/src/nginx/auto/lib/libgd/conf +83 -0
- data/src/nginx/auto/lib/libxslt/conf +156 -0
- data/src/nginx/auto/lib/make +32 -0
- data/src/nginx/auto/lib/md5/conf +103 -0
- data/src/nginx/auto/lib/md5/make +96 -0
- data/src/nginx/auto/lib/md5/makefile.bcc +22 -0
- data/src/nginx/auto/lib/md5/makefile.msvc +22 -0
- data/src/nginx/auto/lib/md5/makefile.owc +11 -0
- data/src/nginx/auto/lib/openssl/conf +74 -0
- data/src/nginx/auto/lib/openssl/make +67 -0
- data/src/nginx/auto/lib/openssl/makefile.bcc +18 -0
- data/src/nginx/auto/lib/openssl/makefile.msvc +14 -0
- data/src/nginx/auto/lib/pcre/conf +180 -0
- data/src/nginx/auto/lib/pcre/make +64 -0
- data/src/nginx/auto/lib/pcre/makefile.bcc +26 -0
- data/src/nginx/auto/lib/pcre/makefile.msvc +22 -0
- data/src/nginx/auto/lib/pcre/makefile.owc +24 -0
- data/src/nginx/auto/lib/perl/conf +60 -0
- data/src/nginx/auto/lib/perl/make +36 -0
- data/src/nginx/auto/lib/sha1/conf +79 -0
- data/src/nginx/auto/lib/sha1/make +96 -0
- data/src/nginx/auto/lib/sha1/makefile.bcc +22 -0
- data/src/nginx/auto/lib/sha1/makefile.msvc +22 -0
- data/src/nginx/auto/lib/sha1/makefile.owc +11 -0
- data/src/nginx/auto/lib/test +40 -0
- data/src/nginx/auto/lib/zlib/conf +76 -0
- data/src/nginx/auto/lib/zlib/make +114 -0
- data/src/nginx/auto/lib/zlib/makefile.bcc +15 -0
- data/src/nginx/auto/lib/zlib/makefile.msvc +14 -0
- data/src/nginx/auto/lib/zlib/makefile.owc +14 -0
- data/src/nginx/auto/lib/zlib/patch.zlib.h +10 -0
- data/src/nginx/auto/make +417 -0
- data/src/nginx/auto/modules +479 -0
- data/src/nginx/auto/nohave +12 -0
- data/src/nginx/auto/options +490 -0
- data/src/nginx/auto/os/conf +105 -0
- data/src/nginx/auto/os/darwin +116 -0
- data/src/nginx/auto/os/freebsd +136 -0
- data/src/nginx/auto/os/linux +152 -0
- data/src/nginx/auto/os/solaris +60 -0
- data/src/nginx/auto/os/win32 +29 -0
- data/src/nginx/auto/sources +518 -0
- data/src/nginx/auto/stubs +8 -0
- data/src/nginx/auto/summary +114 -0
- data/src/nginx/auto/types/sizeof +83 -0
- data/src/nginx/auto/types/typedef +77 -0
- data/src/nginx/auto/types/uintptr_t +42 -0
- data/src/nginx/auto/types/value +12 -0
- data/src/nginx/auto/unix +719 -0
- data/src/nginx/conf/fastcgi.conf +24 -0
- data/src/nginx/conf/fastcgi_params +23 -0
- data/src/nginx/conf/koi-utf +109 -0
- data/src/nginx/conf/koi-win +103 -0
- data/src/nginx/conf/mime.types +80 -0
- data/src/nginx/conf/nginx.conf +118 -0
- data/src/nginx/conf/scgi_params +15 -0
- data/src/nginx/conf/uwsgi_params +15 -0
- data/src/nginx/conf/win-utf +126 -0
- data/src/nginx/configure +108 -0
- data/src/nginx/contrib/README +15 -0
- data/src/nginx/contrib/geo2nginx.pl +58 -0
- data/src/nginx/contrib/unicode2nginx/koi-utf +131 -0
- data/src/nginx/contrib/unicode2nginx/unicode-to-nginx.pl +45 -0
- data/src/nginx/contrib/unicode2nginx/win-utf +130 -0
- data/src/nginx/html/50x.html +18 -0
- data/src/nginx/html/index.html +8 -0
- data/src/nginx/man/nginx.8 +202 -0
- data/src/nginx/src/core/nginx.c +1333 -0
- data/src/nginx/src/core/nginx.h +20 -0
- data/src/nginx/src/core/ngx_array.c +147 -0
- data/src/nginx/src/core/ngx_array.h +53 -0
- data/src/nginx/src/core/ngx_buf.c +218 -0
- data/src/nginx/src/core/ngx_buf.h +162 -0
- data/src/nginx/src/core/ngx_conf_file.c +1506 -0
- data/src/nginx/src/core/ngx_conf_file.h +348 -0
- data/src/nginx/src/core/ngx_config.h +134 -0
- data/src/nginx/src/core/ngx_connection.c +1074 -0
- data/src/nginx/src/core/ngx_connection.h +195 -0
- data/src/nginx/src/core/ngx_core.h +95 -0
- data/src/nginx/src/core/ngx_cpuinfo.c +139 -0
- data/src/nginx/src/core/ngx_crc.h +39 -0
- data/src/nginx/src/core/ngx_crc32.c +129 -0
- data/src/nginx/src/core/ngx_crc32.h +79 -0
- data/src/nginx/src/core/ngx_crypt.c +238 -0
- data/src/nginx/src/core/ngx_crypt.h +20 -0
- data/src/nginx/src/core/ngx_cycle.c +1379 -0
- data/src/nginx/src/core/ngx_cycle.h +142 -0
- data/src/nginx/src/core/ngx_file.c +993 -0
- data/src/nginx/src/core/ngx_file.h +151 -0
- data/src/nginx/src/core/ngx_hash.c +976 -0
- data/src/nginx/src/core/ngx_hash.h +122 -0
- data/src/nginx/src/core/ngx_inet.c +1008 -0
- data/src/nginx/src/core/ngx_inet.h +120 -0
- data/src/nginx/src/core/ngx_list.c +71 -0
- data/src/nginx/src/core/ngx_list.h +83 -0
- data/src/nginx/src/core/ngx_log.c +459 -0
- data/src/nginx/src/core/ngx_log.h +250 -0
- data/src/nginx/src/core/ngx_md5.c +289 -0
- data/src/nginx/src/core/ngx_md5.h +60 -0
- data/src/nginx/src/core/ngx_murmurhash.c +50 -0
- data/src/nginx/src/core/ngx_murmurhash.h +19 -0
- data/src/nginx/src/core/ngx_open_file_cache.c +882 -0
- data/src/nginx/src/core/ngx_open_file_cache.h +119 -0
- data/src/nginx/src/core/ngx_output_chain.c +673 -0
- data/src/nginx/src/core/ngx_palloc.c +433 -0
- data/src/nginx/src/core/ngx_palloc.h +95 -0
- data/src/nginx/src/core/ngx_parse.c +249 -0
- data/src/nginx/src/core/ngx_parse.h +24 -0
- data/src/nginx/src/core/ngx_queue.c +80 -0
- data/src/nginx/src/core/ngx_queue.h +112 -0
- data/src/nginx/src/core/ngx_radix_tree.c +291 -0
- data/src/nginx/src/core/ngx_radix_tree.h +46 -0
- data/src/nginx/src/core/ngx_rbtree.c +383 -0
- data/src/nginx/src/core/ngx_rbtree.h +84 -0
- data/src/nginx/src/core/ngx_regex.c +206 -0
- data/src/nginx/src/core/ngx_regex.h +56 -0
- data/src/nginx/src/core/ngx_resolver.c +2201 -0
- data/src/nginx/src/core/ngx_resolver.h +149 -0
- data/src/nginx/src/core/ngx_sha1.h +31 -0
- data/src/nginx/src/core/ngx_shmtx.c +284 -0
- data/src/nginx/src/core/ngx_shmtx.h +38 -0
- data/src/nginx/src/core/ngx_slab.c +701 -0
- data/src/nginx/src/core/ngx_slab.h +54 -0
- data/src/nginx/src/core/ngx_spinlock.c +53 -0
- data/src/nginx/src/core/ngx_string.c +1837 -0
- data/src/nginx/src/core/ngx_string.h +231 -0
- data/src/nginx/src/core/ngx_times.c +407 -0
- data/src/nginx/src/core/ngx_times.h +51 -0
- data/src/nginx/src/event/modules/ngx_aio_module.c +171 -0
- data/src/nginx/src/event/modules/ngx_devpoll_module.c +569 -0
- data/src/nginx/src/event/modules/ngx_epoll_module.c +833 -0
- data/src/nginx/src/event/modules/ngx_eventport_module.c +602 -0
- data/src/nginx/src/event/modules/ngx_kqueue_module.c +785 -0
- data/src/nginx/src/event/modules/ngx_poll_module.c +443 -0
- data/src/nginx/src/event/modules/ngx_rtsig_module.c +735 -0
- data/src/nginx/src/event/modules/ngx_select_module.c +435 -0
- data/src/nginx/src/event/modules/ngx_win32_select_module.c +400 -0
- data/src/nginx/src/event/ngx_event.c +1275 -0
- data/src/nginx/src/event/ngx_event.h +573 -0
- data/src/nginx/src/event/ngx_event_accept.c +428 -0
- data/src/nginx/src/event/ngx_event_busy_lock.c +286 -0
- data/src/nginx/src/event/ngx_event_busy_lock.h +65 -0
- data/src/nginx/src/event/ngx_event_connect.c +258 -0
- data/src/nginx/src/event/ngx_event_connect.h +76 -0
- data/src/nginx/src/event/ngx_event_mutex.c +70 -0
- data/src/nginx/src/event/ngx_event_openssl.c +2382 -0
- data/src/nginx/src/event/ngx_event_openssl.h +162 -0
- data/src/nginx/src/event/ngx_event_pipe.c +996 -0
- data/src/nginx/src/event/ngx_event_pipe.h +95 -0
- data/src/nginx/src/event/ngx_event_posted.c +173 -0
- data/src/nginx/src/event/ngx_event_posted.h +75 -0
- data/src/nginx/src/event/ngx_event_timer.c +159 -0
- data/src/nginx/src/event/ngx_event_timer.h +102 -0
- data/src/nginx/src/http/modules/ngx_http_access_module.c +384 -0
- data/src/nginx/src/http/modules/ngx_http_addition_filter_module.c +250 -0
- data/src/nginx/src/http/modules/ngx_http_auth_basic_module.c +478 -0
- data/src/nginx/src/http/modules/ngx_http_autoindex_module.c +701 -0
- data/src/nginx/src/http/modules/ngx_http_browser_module.c +713 -0
- data/src/nginx/src/http/modules/ngx_http_charset_filter_module.c +1681 -0
- data/src/nginx/src/http/modules/ngx_http_chunked_filter_module.c +242 -0
- data/src/nginx/src/http/modules/ngx_http_dav_module.c +1141 -0
- data/src/nginx/src/http/modules/ngx_http_degradation_module.c +243 -0
- data/src/nginx/src/http/modules/ngx_http_empty_gif_module.c +140 -0
- data/src/nginx/src/http/modules/ngx_http_fastcgi_module.c +2916 -0
- data/src/nginx/src/http/modules/ngx_http_flv_module.c +254 -0
- data/src/nginx/src/http/modules/ngx_http_geo_module.c +1441 -0
- data/src/nginx/src/http/modules/ngx_http_geoip_module.c +671 -0
- data/src/nginx/src/http/modules/ngx_http_gzip_filter_module.c +1206 -0
- data/src/nginx/src/http/modules/ngx_http_gzip_static_module.c +299 -0
- data/src/nginx/src/http/modules/ngx_http_headers_filter_module.c +616 -0
- data/src/nginx/src/http/modules/ngx_http_image_filter_module.c +1489 -0
- data/src/nginx/src/http/modules/ngx_http_index_module.c +516 -0
- data/src/nginx/src/http/modules/ngx_http_limit_req_module.c +809 -0
- data/src/nginx/src/http/modules/ngx_http_limit_zone_module.c +553 -0
- data/src/nginx/src/http/modules/ngx_http_log_module.c +1357 -0
- data/src/nginx/src/http/modules/ngx_http_map_module.c +575 -0
- data/src/nginx/src/http/modules/ngx_http_memcached_module.c +624 -0
- data/src/nginx/src/http/modules/ngx_http_mp4_module.c +3000 -0
- data/src/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +143 -0
- data/src/nginx/src/http/modules/ngx_http_proxy_module.c +2831 -0
- data/src/nginx/src/http/modules/ngx_http_random_index_module.c +317 -0
- data/src/nginx/src/http/modules/ngx_http_range_filter_module.c +855 -0
- data/src/nginx/src/http/modules/ngx_http_realip_module.c +476 -0
- data/src/nginx/src/http/modules/ngx_http_referer_module.c +613 -0
- data/src/nginx/src/http/modules/ngx_http_rewrite_module.c +1019 -0
- data/src/nginx/src/http/modules/ngx_http_scgi_module.c +1714 -0
- data/src/nginx/src/http/modules/ngx_http_secure_link_module.c +355 -0
- data/src/nginx/src/http/modules/ngx_http_split_clients_module.c +242 -0
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.c +2913 -0
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.h +114 -0
- data/src/nginx/src/http/modules/ngx_http_ssl_module.c +652 -0
- data/src/nginx/src/http/modules/ngx_http_ssl_module.h +52 -0
- data/src/nginx/src/http/modules/ngx_http_static_module.c +278 -0
- data/src/nginx/src/http/modules/ngx_http_stub_status_module.c +144 -0
- data/src/nginx/src/http/modules/ngx_http_sub_filter_module.c +716 -0
- data/src/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +237 -0
- data/src/nginx/src/http/modules/ngx_http_userid_filter_module.c +846 -0
- data/src/nginx/src/http/modules/ngx_http_uwsgi_module.c +1774 -0
- data/src/nginx/src/http/modules/ngx_http_xslt_filter_module.c +984 -0
- data/src/nginx/src/http/modules/perl/Makefile.PL +42 -0
- data/src/nginx/src/http/modules/perl/nginx.pm +137 -0
- data/src/nginx/src/http/modules/perl/nginx.xs +986 -0
- data/src/nginx/src/http/modules/perl/ngx_http_perl_module.c +1076 -0
- data/src/nginx/src/http/modules/perl/ngx_http_perl_module.h +67 -0
- data/src/nginx/src/http/modules/perl/typemap +3 -0
- data/src/nginx/src/http/ngx_http.c +2073 -0
- data/src/nginx/src/http/ngx_http.h +160 -0
- data/src/nginx/src/http/ngx_http_busy_lock.c +307 -0
- data/src/nginx/src/http/ngx_http_busy_lock.h +54 -0
- data/src/nginx/src/http/ngx_http_cache.h +148 -0
- data/src/nginx/src/http/ngx_http_config.h +75 -0
- data/src/nginx/src/http/ngx_http_copy_filter_module.c +300 -0
- data/src/nginx/src/http/ngx_http_core_module.c +4736 -0
- data/src/nginx/src/http/ngx_http_core_module.h +541 -0
- data/src/nginx/src/http/ngx_http_file_cache.c +1715 -0
- data/src/nginx/src/http/ngx_http_header_filter_module.c +623 -0
- data/src/nginx/src/http/ngx_http_parse.c +1734 -0
- data/src/nginx/src/http/ngx_http_parse_time.c +276 -0
- data/src/nginx/src/http/ngx_http_postpone_filter_module.c +178 -0
- data/src/nginx/src/http/ngx_http_request.c +3181 -0
- data/src/nginx/src/http/ngx_http_request.h +573 -0
- data/src/nginx/src/http/ngx_http_request_body.c +644 -0
- data/src/nginx/src/http/ngx_http_script.c +1752 -0
- data/src/nginx/src/http/ngx_http_script.h +257 -0
- data/src/nginx/src/http/ngx_http_special_response.c +789 -0
- data/src/nginx/src/http/ngx_http_upstream.c +4555 -0
- data/src/nginx/src/http/ngx_http_upstream.h +350 -0
- data/src/nginx/src/http/ngx_http_upstream_round_robin.c +791 -0
- data/src/nginx/src/http/ngx_http_upstream_round_robin.h +85 -0
- data/src/nginx/src/http/ngx_http_variables.c +2053 -0
- data/src/nginx/src/http/ngx_http_variables.h +115 -0
- data/src/nginx/src/http/ngx_http_write_filter_module.c +315 -0
- data/src/nginx/src/mail/ngx_mail.c +542 -0
- data/src/nginx/src/mail/ngx_mail.h +407 -0
- data/src/nginx/src/mail/ngx_mail_auth_http_module.c +1452 -0
- data/src/nginx/src/mail/ngx_mail_core_module.c +553 -0
- data/src/nginx/src/mail/ngx_mail_handler.c +773 -0
- data/src/nginx/src/mail/ngx_mail_imap_handler.c +457 -0
- data/src/nginx/src/mail/ngx_mail_imap_module.c +253 -0
- data/src/nginx/src/mail/ngx_mail_imap_module.h +39 -0
- data/src/nginx/src/mail/ngx_mail_parse.c +885 -0
- data/src/nginx/src/mail/ngx_mail_pop3_handler.c +500 -0
- data/src/nginx/src/mail/ngx_mail_pop3_module.c +264 -0
- data/src/nginx/src/mail/ngx_mail_pop3_module.h +38 -0
- data/src/nginx/src/mail/ngx_mail_proxy_module.c +1089 -0
- data/src/nginx/src/mail/ngx_mail_smtp_handler.c +872 -0
- data/src/nginx/src/mail/ngx_mail_smtp_module.c +308 -0
- data/src/nginx/src/mail/ngx_mail_smtp_module.h +45 -0
- data/src/nginx/src/mail/ngx_mail_ssl_module.c +491 -0
- data/src/nginx/src/mail/ngx_mail_ssl_module.h +52 -0
- data/src/nginx/src/misc/ngx_cpp_test_module.cpp +27 -0
- data/src/nginx/src/misc/ngx_google_perftools_module.c +126 -0
- data/src/nginx/src/os/unix/ngx_aio_read.c +109 -0
- data/src/nginx/src/os/unix/ngx_aio_read_chain.c +78 -0
- data/src/nginx/src/os/unix/ngx_aio_write.c +109 -0
- data/src/nginx/src/os/unix/ngx_aio_write_chain.c +100 -0
- data/src/nginx/src/os/unix/ngx_alloc.c +90 -0
- data/src/nginx/src/os/unix/ngx_alloc.h +45 -0
- data/src/nginx/src/os/unix/ngx_atomic.h +311 -0
- data/src/nginx/src/os/unix/ngx_channel.c +258 -0
- data/src/nginx/src/os/unix/ngx_channel.h +34 -0
- data/src/nginx/src/os/unix/ngx_daemon.c +69 -0
- data/src/nginx/src/os/unix/ngx_darwin.h +20 -0
- data/src/nginx/src/os/unix/ngx_darwin_config.h +96 -0
- data/src/nginx/src/os/unix/ngx_darwin_init.c +166 -0
- data/src/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +366 -0
- data/src/nginx/src/os/unix/ngx_errno.c +87 -0
- data/src/nginx/src/os/unix/ngx_errno.h +68 -0
- data/src/nginx/src/os/unix/ngx_file_aio_read.c +208 -0
- data/src/nginx/src/os/unix/ngx_files.c +566 -0
- data/src/nginx/src/os/unix/ngx_files.h +343 -0
- data/src/nginx/src/os/unix/ngx_freebsd.h +24 -0
- data/src/nginx/src/os/unix/ngx_freebsd_config.h +119 -0
- data/src/nginx/src/os/unix/ngx_freebsd_init.c +259 -0
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +756 -0
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +122 -0
- data/src/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +436 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_amd64.h +82 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_ppc.h +155 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_sparc64.h +82 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_x86.h +127 -0
- data/src/nginx/src/os/unix/ngx_linux.h +18 -0
- data/src/nginx/src/os/unix/ngx_linux_aio_read.c +137 -0
- data/src/nginx/src/os/unix/ngx_linux_config.h +117 -0
- data/src/nginx/src/os/unix/ngx_linux_init.c +91 -0
- data/src/nginx/src/os/unix/ngx_linux_sendfile_chain.c +378 -0
- data/src/nginx/src/os/unix/ngx_os.h +84 -0
- data/src/nginx/src/os/unix/ngx_posix_config.h +153 -0
- data/src/nginx/src/os/unix/ngx_posix_init.c +124 -0
- data/src/nginx/src/os/unix/ngx_process.c +590 -0
- data/src/nginx/src/os/unix/ngx_process.h +87 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.c +1390 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.h +61 -0
- data/src/nginx/src/os/unix/ngx_pthread_thread.c +278 -0
- data/src/nginx/src/os/unix/ngx_readv_chain.c +258 -0
- data/src/nginx/src/os/unix/ngx_recv.c +180 -0
- data/src/nginx/src/os/unix/ngx_send.c +73 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.c +135 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.h +52 -0
- data/src/nginx/src/os/unix/ngx_shmem.c +126 -0
- data/src/nginx/src/os/unix/ngx_shmem.h +29 -0
- data/src/nginx/src/os/unix/ngx_socket.c +116 -0
- data/src/nginx/src/os/unix/ngx_socket.h +64 -0
- data/src/nginx/src/os/unix/ngx_solaris.h +16 -0
- data/src/nginx/src/os/unix/ngx_solaris_config.h +107 -0
- data/src/nginx/src/os/unix/ngx_solaris_init.c +75 -0
- data/src/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +251 -0
- data/src/nginx/src/os/unix/ngx_sunpro_amd64.il +43 -0
- data/src/nginx/src/os/unix/ngx_sunpro_atomic_sparc64.h +61 -0
- data/src/nginx/src/os/unix/ngx_sunpro_sparc64.il +36 -0
- data/src/nginx/src/os/unix/ngx_sunpro_x86.il +44 -0
- data/src/nginx/src/os/unix/ngx_thread.h +128 -0
- data/src/nginx/src/os/unix/ngx_time.c +104 -0
- data/src/nginx/src/os/unix/ngx_time.h +66 -0
- data/src/nginx/src/os/unix/ngx_udp_recv.c +115 -0
- data/src/nginx/src/os/unix/ngx_user.c +109 -0
- data/src/nginx/src/os/unix/ngx_user.h +24 -0
- data/src/nginx/src/os/unix/ngx_writev_chain.c +181 -0
- data/src/nginx/src/os/unix/rfork_thread.S +73 -0
- metadata +419 -0
@@ -0,0 +1,1074 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Nginx, Inc.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#include <ngx_config.h>
|
9
|
+
#include <ngx_core.h>
|
10
|
+
#include <ngx_event.h>
|
11
|
+
|
12
|
+
|
13
|
+
ngx_os_io_t ngx_io;
|
14
|
+
|
15
|
+
|
16
|
+
static void ngx_drain_connections(void);
|
17
|
+
|
18
|
+
|
19
|
+
ngx_listening_t *
|
20
|
+
ngx_create_listening(ngx_conf_t *cf, void *sockaddr, socklen_t socklen)
|
21
|
+
{
|
22
|
+
size_t len;
|
23
|
+
ngx_listening_t *ls;
|
24
|
+
struct sockaddr *sa;
|
25
|
+
u_char text[NGX_SOCKADDR_STRLEN];
|
26
|
+
|
27
|
+
ls = ngx_array_push(&cf->cycle->listening);
|
28
|
+
if (ls == NULL) {
|
29
|
+
return NULL;
|
30
|
+
}
|
31
|
+
|
32
|
+
ngx_memzero(ls, sizeof(ngx_listening_t));
|
33
|
+
|
34
|
+
sa = ngx_palloc(cf->pool, socklen);
|
35
|
+
if (sa == NULL) {
|
36
|
+
return NULL;
|
37
|
+
}
|
38
|
+
|
39
|
+
ngx_memcpy(sa, sockaddr, socklen);
|
40
|
+
|
41
|
+
ls->sockaddr = sa;
|
42
|
+
ls->socklen = socklen;
|
43
|
+
|
44
|
+
len = ngx_sock_ntop(sa, text, NGX_SOCKADDR_STRLEN, 1);
|
45
|
+
ls->addr_text.len = len;
|
46
|
+
|
47
|
+
switch (ls->sockaddr->sa_family) {
|
48
|
+
#if (NGX_HAVE_INET6)
|
49
|
+
case AF_INET6:
|
50
|
+
ls->addr_text_max_len = NGX_INET6_ADDRSTRLEN;
|
51
|
+
break;
|
52
|
+
#endif
|
53
|
+
#if (NGX_HAVE_UNIX_DOMAIN)
|
54
|
+
case AF_UNIX:
|
55
|
+
ls->addr_text_max_len = NGX_UNIX_ADDRSTRLEN;
|
56
|
+
len++;
|
57
|
+
break;
|
58
|
+
#endif
|
59
|
+
case AF_INET:
|
60
|
+
ls->addr_text_max_len = NGX_INET_ADDRSTRLEN;
|
61
|
+
break;
|
62
|
+
default:
|
63
|
+
ls->addr_text_max_len = NGX_SOCKADDR_STRLEN;
|
64
|
+
break;
|
65
|
+
}
|
66
|
+
|
67
|
+
ls->addr_text.data = ngx_pnalloc(cf->pool, len);
|
68
|
+
if (ls->addr_text.data == NULL) {
|
69
|
+
return NULL;
|
70
|
+
}
|
71
|
+
|
72
|
+
ngx_memcpy(ls->addr_text.data, text, len);
|
73
|
+
|
74
|
+
ls->fd = (ngx_socket_t) -1;
|
75
|
+
ls->type = SOCK_STREAM;
|
76
|
+
|
77
|
+
ls->backlog = NGX_LISTEN_BACKLOG;
|
78
|
+
ls->rcvbuf = -1;
|
79
|
+
ls->sndbuf = -1;
|
80
|
+
|
81
|
+
#if (NGX_HAVE_SETFIB)
|
82
|
+
ls->setfib = -1;
|
83
|
+
#endif
|
84
|
+
|
85
|
+
return ls;
|
86
|
+
}
|
87
|
+
|
88
|
+
|
89
|
+
ngx_int_t
|
90
|
+
ngx_set_inherited_sockets(ngx_cycle_t *cycle)
|
91
|
+
{
|
92
|
+
size_t len;
|
93
|
+
ngx_uint_t i;
|
94
|
+
ngx_listening_t *ls;
|
95
|
+
socklen_t olen;
|
96
|
+
#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
|
97
|
+
ngx_err_t err;
|
98
|
+
struct accept_filter_arg af;
|
99
|
+
#endif
|
100
|
+
#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
|
101
|
+
int timeout;
|
102
|
+
#endif
|
103
|
+
|
104
|
+
ls = cycle->listening.elts;
|
105
|
+
for (i = 0; i < cycle->listening.nelts; i++) {
|
106
|
+
|
107
|
+
ls[i].sockaddr = ngx_palloc(cycle->pool, NGX_SOCKADDRLEN);
|
108
|
+
if (ls[i].sockaddr == NULL) {
|
109
|
+
return NGX_ERROR;
|
110
|
+
}
|
111
|
+
|
112
|
+
ls[i].socklen = NGX_SOCKADDRLEN;
|
113
|
+
if (getsockname(ls[i].fd, ls[i].sockaddr, &ls[i].socklen) == -1) {
|
114
|
+
ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_socket_errno,
|
115
|
+
"getsockname() of the inherited "
|
116
|
+
"socket #%d failed", ls[i].fd);
|
117
|
+
ls[i].ignore = 1;
|
118
|
+
continue;
|
119
|
+
}
|
120
|
+
|
121
|
+
switch (ls[i].sockaddr->sa_family) {
|
122
|
+
|
123
|
+
#if (NGX_HAVE_INET6)
|
124
|
+
case AF_INET6:
|
125
|
+
ls[i].addr_text_max_len = NGX_INET6_ADDRSTRLEN;
|
126
|
+
len = NGX_INET6_ADDRSTRLEN + sizeof(":65535") - 1;
|
127
|
+
break;
|
128
|
+
#endif
|
129
|
+
|
130
|
+
#if (NGX_HAVE_UNIX_DOMAIN)
|
131
|
+
case AF_UNIX:
|
132
|
+
ls[i].addr_text_max_len = NGX_UNIX_ADDRSTRLEN;
|
133
|
+
len = NGX_UNIX_ADDRSTRLEN;
|
134
|
+
break;
|
135
|
+
#endif
|
136
|
+
|
137
|
+
case AF_INET:
|
138
|
+
ls[i].addr_text_max_len = NGX_INET_ADDRSTRLEN;
|
139
|
+
len = NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1;
|
140
|
+
break;
|
141
|
+
|
142
|
+
default:
|
143
|
+
ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_socket_errno,
|
144
|
+
"the inherited socket #%d has "
|
145
|
+
"an unsupported protocol family", ls[i].fd);
|
146
|
+
ls[i].ignore = 1;
|
147
|
+
continue;
|
148
|
+
}
|
149
|
+
|
150
|
+
ls[i].addr_text.data = ngx_pnalloc(cycle->pool, len);
|
151
|
+
if (ls[i].addr_text.data == NULL) {
|
152
|
+
return NGX_ERROR;
|
153
|
+
}
|
154
|
+
|
155
|
+
len = ngx_sock_ntop(ls[i].sockaddr, ls[i].addr_text.data, len, 1);
|
156
|
+
if (len == 0) {
|
157
|
+
return NGX_ERROR;
|
158
|
+
}
|
159
|
+
|
160
|
+
ls[i].addr_text.len = len;
|
161
|
+
|
162
|
+
ls[i].backlog = NGX_LISTEN_BACKLOG;
|
163
|
+
|
164
|
+
olen = sizeof(int);
|
165
|
+
|
166
|
+
if (getsockopt(ls[i].fd, SOL_SOCKET, SO_RCVBUF, (void *) &ls[i].rcvbuf,
|
167
|
+
&olen)
|
168
|
+
== -1)
|
169
|
+
{
|
170
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
|
171
|
+
"getsockopt(SO_RCVBUF) %V failed, ignored",
|
172
|
+
&ls[i].addr_text);
|
173
|
+
|
174
|
+
ls[i].rcvbuf = -1;
|
175
|
+
}
|
176
|
+
|
177
|
+
olen = sizeof(int);
|
178
|
+
|
179
|
+
if (getsockopt(ls[i].fd, SOL_SOCKET, SO_SNDBUF, (void *) &ls[i].sndbuf,
|
180
|
+
&olen)
|
181
|
+
== -1)
|
182
|
+
{
|
183
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
|
184
|
+
"getsockopt(SO_SNDBUF) %V failed, ignored",
|
185
|
+
&ls[i].addr_text);
|
186
|
+
|
187
|
+
ls[i].sndbuf = -1;
|
188
|
+
}
|
189
|
+
|
190
|
+
#if 0
|
191
|
+
/* SO_SETFIB is currently a set only option */
|
192
|
+
|
193
|
+
#if (NGX_HAVE_SETFIB)
|
194
|
+
|
195
|
+
if (getsockopt(ls[i].setfib, SOL_SOCKET, SO_SETFIB,
|
196
|
+
(void *) &ls[i].setfib, &olen)
|
197
|
+
== -1)
|
198
|
+
{
|
199
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
|
200
|
+
"getsockopt(SO_SETFIB) %V failed, ignored",
|
201
|
+
&ls[i].addr_text);
|
202
|
+
|
203
|
+
ls[i].setfib = -1;
|
204
|
+
}
|
205
|
+
|
206
|
+
#endif
|
207
|
+
#endif
|
208
|
+
|
209
|
+
#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
|
210
|
+
|
211
|
+
ngx_memzero(&af, sizeof(struct accept_filter_arg));
|
212
|
+
olen = sizeof(struct accept_filter_arg);
|
213
|
+
|
214
|
+
if (getsockopt(ls[i].fd, SOL_SOCKET, SO_ACCEPTFILTER, &af, &olen)
|
215
|
+
== -1)
|
216
|
+
{
|
217
|
+
err = ngx_errno;
|
218
|
+
|
219
|
+
if (err == NGX_EINVAL) {
|
220
|
+
continue;
|
221
|
+
}
|
222
|
+
|
223
|
+
ngx_log_error(NGX_LOG_NOTICE, cycle->log, err,
|
224
|
+
"getsockopt(SO_ACCEPTFILTER) for %V failed, ignored",
|
225
|
+
&ls[i].addr_text);
|
226
|
+
continue;
|
227
|
+
}
|
228
|
+
|
229
|
+
if (olen < sizeof(struct accept_filter_arg) || af.af_name[0] == '\0') {
|
230
|
+
continue;
|
231
|
+
}
|
232
|
+
|
233
|
+
ls[i].accept_filter = ngx_palloc(cycle->pool, 16);
|
234
|
+
if (ls[i].accept_filter == NULL) {
|
235
|
+
return NGX_ERROR;
|
236
|
+
}
|
237
|
+
|
238
|
+
(void) ngx_cpystrn((u_char *) ls[i].accept_filter,
|
239
|
+
(u_char *) af.af_name, 16);
|
240
|
+
#endif
|
241
|
+
|
242
|
+
#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
|
243
|
+
|
244
|
+
timeout = 0;
|
245
|
+
olen = sizeof(int);
|
246
|
+
|
247
|
+
if (getsockopt(ls[i].fd, IPPROTO_TCP, TCP_DEFER_ACCEPT, &timeout, &olen)
|
248
|
+
== -1)
|
249
|
+
{
|
250
|
+
ngx_log_error(NGX_LOG_NOTICE, cycle->log, ngx_errno,
|
251
|
+
"getsockopt(TCP_DEFER_ACCEPT) for %V failed, ignored",
|
252
|
+
&ls[i].addr_text);
|
253
|
+
continue;
|
254
|
+
}
|
255
|
+
|
256
|
+
if (olen < sizeof(int) || timeout == 0) {
|
257
|
+
continue;
|
258
|
+
}
|
259
|
+
|
260
|
+
ls[i].deferred_accept = 1;
|
261
|
+
#endif
|
262
|
+
}
|
263
|
+
|
264
|
+
return NGX_OK;
|
265
|
+
}
|
266
|
+
|
267
|
+
|
268
|
+
ngx_int_t
|
269
|
+
ngx_open_listening_sockets(ngx_cycle_t *cycle)
|
270
|
+
{
|
271
|
+
int reuseaddr;
|
272
|
+
ngx_uint_t i, tries, failed;
|
273
|
+
ngx_err_t err;
|
274
|
+
ngx_log_t *log;
|
275
|
+
ngx_socket_t s;
|
276
|
+
ngx_listening_t *ls;
|
277
|
+
|
278
|
+
reuseaddr = 1;
|
279
|
+
#if (NGX_SUPPRESS_WARN)
|
280
|
+
failed = 0;
|
281
|
+
#endif
|
282
|
+
|
283
|
+
log = cycle->log;
|
284
|
+
|
285
|
+
/* TODO: configurable try number */
|
286
|
+
|
287
|
+
for (tries = 5; tries; tries--) {
|
288
|
+
failed = 0;
|
289
|
+
|
290
|
+
/* for each listening socket */
|
291
|
+
|
292
|
+
ls = cycle->listening.elts;
|
293
|
+
for (i = 0; i < cycle->listening.nelts; i++) {
|
294
|
+
|
295
|
+
if (ls[i].ignore) {
|
296
|
+
continue;
|
297
|
+
}
|
298
|
+
|
299
|
+
if (ls[i].fd != -1) {
|
300
|
+
continue;
|
301
|
+
}
|
302
|
+
|
303
|
+
if (ls[i].inherited) {
|
304
|
+
|
305
|
+
/* TODO: close on exit */
|
306
|
+
/* TODO: nonblocking */
|
307
|
+
/* TODO: deferred accept */
|
308
|
+
|
309
|
+
continue;
|
310
|
+
}
|
311
|
+
|
312
|
+
s = ngx_socket(ls[i].sockaddr->sa_family, ls[i].type, 0);
|
313
|
+
|
314
|
+
if (s == -1) {
|
315
|
+
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
316
|
+
ngx_socket_n " %V failed", &ls[i].addr_text);
|
317
|
+
return NGX_ERROR;
|
318
|
+
}
|
319
|
+
|
320
|
+
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
|
321
|
+
(const void *) &reuseaddr, sizeof(int))
|
322
|
+
== -1)
|
323
|
+
{
|
324
|
+
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
325
|
+
"setsockopt(SO_REUSEADDR) %V failed",
|
326
|
+
&ls[i].addr_text);
|
327
|
+
|
328
|
+
if (ngx_close_socket(s) == -1) {
|
329
|
+
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
330
|
+
ngx_close_socket_n " %V failed",
|
331
|
+
&ls[i].addr_text);
|
332
|
+
}
|
333
|
+
|
334
|
+
return NGX_ERROR;
|
335
|
+
}
|
336
|
+
|
337
|
+
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
|
338
|
+
|
339
|
+
if (ls[i].sockaddr->sa_family == AF_INET6 && ls[i].ipv6only) {
|
340
|
+
int ipv6only;
|
341
|
+
|
342
|
+
ipv6only = (ls[i].ipv6only == 1);
|
343
|
+
|
344
|
+
if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY,
|
345
|
+
(const void *) &ipv6only, sizeof(int))
|
346
|
+
== -1)
|
347
|
+
{
|
348
|
+
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
349
|
+
"setsockopt(IPV6_V6ONLY) %V failed, ignored",
|
350
|
+
&ls[i].addr_text);
|
351
|
+
}
|
352
|
+
}
|
353
|
+
#endif
|
354
|
+
/* TODO: close on exit */
|
355
|
+
|
356
|
+
if (!(ngx_event_flags & NGX_USE_AIO_EVENT)) {
|
357
|
+
if (ngx_nonblocking(s) == -1) {
|
358
|
+
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
359
|
+
ngx_nonblocking_n " %V failed",
|
360
|
+
&ls[i].addr_text);
|
361
|
+
|
362
|
+
if (ngx_close_socket(s) == -1) {
|
363
|
+
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
364
|
+
ngx_close_socket_n " %V failed",
|
365
|
+
&ls[i].addr_text);
|
366
|
+
}
|
367
|
+
|
368
|
+
return NGX_ERROR;
|
369
|
+
}
|
370
|
+
}
|
371
|
+
|
372
|
+
ngx_log_debug2(NGX_LOG_DEBUG_CORE, log, 0,
|
373
|
+
"bind() %V #%d ", &ls[i].addr_text, s);
|
374
|
+
|
375
|
+
if (bind(s, ls[i].sockaddr, ls[i].socklen) == -1) {
|
376
|
+
err = ngx_socket_errno;
|
377
|
+
|
378
|
+
if (err == NGX_EADDRINUSE && ngx_test_config) {
|
379
|
+
continue;
|
380
|
+
}
|
381
|
+
|
382
|
+
ngx_log_error(NGX_LOG_EMERG, log, err,
|
383
|
+
"bind() to %V failed", &ls[i].addr_text);
|
384
|
+
|
385
|
+
if (ngx_close_socket(s) == -1) {
|
386
|
+
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
387
|
+
ngx_close_socket_n " %V failed",
|
388
|
+
&ls[i].addr_text);
|
389
|
+
}
|
390
|
+
|
391
|
+
if (err != NGX_EADDRINUSE) {
|
392
|
+
return NGX_ERROR;
|
393
|
+
}
|
394
|
+
|
395
|
+
failed = 1;
|
396
|
+
|
397
|
+
continue;
|
398
|
+
}
|
399
|
+
|
400
|
+
#if (NGX_HAVE_UNIX_DOMAIN)
|
401
|
+
|
402
|
+
if (ls[i].sockaddr->sa_family == AF_UNIX) {
|
403
|
+
mode_t mode;
|
404
|
+
u_char *name;
|
405
|
+
|
406
|
+
name = ls[i].addr_text.data + sizeof("unix:") - 1;
|
407
|
+
mode = (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
|
408
|
+
|
409
|
+
if (chmod((char *) name, mode) == -1) {
|
410
|
+
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
411
|
+
"chmod() \"%s\" failed", name);
|
412
|
+
}
|
413
|
+
|
414
|
+
if (ngx_test_config) {
|
415
|
+
if (ngx_delete_file(name) == -1) {
|
416
|
+
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
|
417
|
+
ngx_delete_file_n " %s failed", name);
|
418
|
+
}
|
419
|
+
}
|
420
|
+
}
|
421
|
+
#endif
|
422
|
+
|
423
|
+
if (listen(s, ls[i].backlog) == -1) {
|
424
|
+
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
425
|
+
"listen() to %V, backlog %d failed",
|
426
|
+
&ls[i].addr_text, ls[i].backlog);
|
427
|
+
|
428
|
+
if (ngx_close_socket(s) == -1) {
|
429
|
+
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
|
430
|
+
ngx_close_socket_n " %V failed",
|
431
|
+
&ls[i].addr_text);
|
432
|
+
}
|
433
|
+
|
434
|
+
return NGX_ERROR;
|
435
|
+
}
|
436
|
+
|
437
|
+
ls[i].listen = 1;
|
438
|
+
|
439
|
+
ls[i].fd = s;
|
440
|
+
}
|
441
|
+
|
442
|
+
if (!failed) {
|
443
|
+
break;
|
444
|
+
}
|
445
|
+
|
446
|
+
/* TODO: delay configurable */
|
447
|
+
|
448
|
+
ngx_log_error(NGX_LOG_NOTICE, log, 0,
|
449
|
+
"try again to bind() after 500ms");
|
450
|
+
|
451
|
+
ngx_msleep(500);
|
452
|
+
}
|
453
|
+
|
454
|
+
if (failed) {
|
455
|
+
ngx_log_error(NGX_LOG_EMERG, log, 0, "still could not bind()");
|
456
|
+
return NGX_ERROR;
|
457
|
+
}
|
458
|
+
|
459
|
+
return NGX_OK;
|
460
|
+
}
|
461
|
+
|
462
|
+
|
463
|
+
void
|
464
|
+
ngx_configure_listening_sockets(ngx_cycle_t *cycle)
|
465
|
+
{
|
466
|
+
ngx_uint_t i;
|
467
|
+
ngx_listening_t *ls;
|
468
|
+
|
469
|
+
#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
|
470
|
+
struct accept_filter_arg af;
|
471
|
+
#endif
|
472
|
+
#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
|
473
|
+
int timeout;
|
474
|
+
#endif
|
475
|
+
|
476
|
+
ls = cycle->listening.elts;
|
477
|
+
for (i = 0; i < cycle->listening.nelts; i++) {
|
478
|
+
|
479
|
+
ls[i].log = *ls[i].logp;
|
480
|
+
|
481
|
+
if (ls[i].rcvbuf != -1) {
|
482
|
+
if (setsockopt(ls[i].fd, SOL_SOCKET, SO_RCVBUF,
|
483
|
+
(const void *) &ls[i].rcvbuf, sizeof(int))
|
484
|
+
== -1)
|
485
|
+
{
|
486
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
|
487
|
+
"setsockopt(SO_RCVBUF, %d) %V failed, ignored",
|
488
|
+
ls[i].rcvbuf, &ls[i].addr_text);
|
489
|
+
}
|
490
|
+
}
|
491
|
+
|
492
|
+
if (ls[i].sndbuf != -1) {
|
493
|
+
if (setsockopt(ls[i].fd, SOL_SOCKET, SO_SNDBUF,
|
494
|
+
(const void *) &ls[i].sndbuf, sizeof(int))
|
495
|
+
== -1)
|
496
|
+
{
|
497
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
|
498
|
+
"setsockopt(SO_SNDBUF, %d) %V failed, ignored",
|
499
|
+
ls[i].sndbuf, &ls[i].addr_text);
|
500
|
+
}
|
501
|
+
}
|
502
|
+
|
503
|
+
#if (NGX_HAVE_SETFIB)
|
504
|
+
if (ls[i].setfib != -1) {
|
505
|
+
if (setsockopt(ls[i].fd, SOL_SOCKET, SO_SETFIB,
|
506
|
+
(const void *) &ls[i].setfib, sizeof(int))
|
507
|
+
== -1)
|
508
|
+
{
|
509
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
|
510
|
+
"setsockopt(SO_SETFIB, %d) %V failed, ignored",
|
511
|
+
ls[i].setfib, &ls[i].addr_text);
|
512
|
+
}
|
513
|
+
}
|
514
|
+
#endif
|
515
|
+
|
516
|
+
#if 0
|
517
|
+
if (1) {
|
518
|
+
int tcp_nodelay = 1;
|
519
|
+
|
520
|
+
if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_NODELAY,
|
521
|
+
(const void *) &tcp_nodelay, sizeof(int))
|
522
|
+
== -1)
|
523
|
+
{
|
524
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
|
525
|
+
"setsockopt(TCP_NODELAY) %V failed, ignored",
|
526
|
+
&ls[i].addr_text);
|
527
|
+
}
|
528
|
+
}
|
529
|
+
#endif
|
530
|
+
|
531
|
+
if (ls[i].listen) {
|
532
|
+
|
533
|
+
/* change backlog via listen() */
|
534
|
+
|
535
|
+
if (listen(ls[i].fd, ls[i].backlog) == -1) {
|
536
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
|
537
|
+
"listen() to %V, backlog %d failed, ignored",
|
538
|
+
&ls[i].addr_text, ls[i].backlog);
|
539
|
+
}
|
540
|
+
}
|
541
|
+
|
542
|
+
/*
|
543
|
+
* setting deferred mode should be last operation on socket,
|
544
|
+
* because code may prematurely continue cycle on failure
|
545
|
+
*/
|
546
|
+
|
547
|
+
#if (NGX_HAVE_DEFERRED_ACCEPT)
|
548
|
+
|
549
|
+
#ifdef SO_ACCEPTFILTER
|
550
|
+
|
551
|
+
if (ls[i].delete_deferred) {
|
552
|
+
if (setsockopt(ls[i].fd, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0)
|
553
|
+
== -1)
|
554
|
+
{
|
555
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
556
|
+
"setsockopt(SO_ACCEPTFILTER, NULL) "
|
557
|
+
"for %V failed, ignored",
|
558
|
+
&ls[i].addr_text);
|
559
|
+
|
560
|
+
if (ls[i].accept_filter) {
|
561
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
|
562
|
+
"could not change the accept filter "
|
563
|
+
"to \"%s\" for %V, ignored",
|
564
|
+
ls[i].accept_filter, &ls[i].addr_text);
|
565
|
+
}
|
566
|
+
|
567
|
+
continue;
|
568
|
+
}
|
569
|
+
|
570
|
+
ls[i].deferred_accept = 0;
|
571
|
+
}
|
572
|
+
|
573
|
+
if (ls[i].add_deferred) {
|
574
|
+
ngx_memzero(&af, sizeof(struct accept_filter_arg));
|
575
|
+
(void) ngx_cpystrn((u_char *) af.af_name,
|
576
|
+
(u_char *) ls[i].accept_filter, 16);
|
577
|
+
|
578
|
+
if (setsockopt(ls[i].fd, SOL_SOCKET, SO_ACCEPTFILTER,
|
579
|
+
&af, sizeof(struct accept_filter_arg))
|
580
|
+
== -1)
|
581
|
+
{
|
582
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
583
|
+
"setsockopt(SO_ACCEPTFILTER, \"%s\") "
|
584
|
+
"for %V failed, ignored",
|
585
|
+
ls[i].accept_filter, &ls[i].addr_text);
|
586
|
+
continue;
|
587
|
+
}
|
588
|
+
|
589
|
+
ls[i].deferred_accept = 1;
|
590
|
+
}
|
591
|
+
|
592
|
+
#endif
|
593
|
+
|
594
|
+
#ifdef TCP_DEFER_ACCEPT
|
595
|
+
|
596
|
+
if (ls[i].add_deferred || ls[i].delete_deferred) {
|
597
|
+
|
598
|
+
if (ls[i].add_deferred) {
|
599
|
+
timeout = (int) (ls[i].post_accept_timeout / 1000);
|
600
|
+
|
601
|
+
} else {
|
602
|
+
timeout = 0;
|
603
|
+
}
|
604
|
+
|
605
|
+
if (setsockopt(ls[i].fd, IPPROTO_TCP, TCP_DEFER_ACCEPT,
|
606
|
+
&timeout, sizeof(int))
|
607
|
+
== -1)
|
608
|
+
{
|
609
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
610
|
+
"setsockopt(TCP_DEFER_ACCEPT, %d) for %V failed, "
|
611
|
+
"ignored",
|
612
|
+
timeout, &ls[i].addr_text);
|
613
|
+
|
614
|
+
continue;
|
615
|
+
}
|
616
|
+
}
|
617
|
+
|
618
|
+
if (ls[i].add_deferred) {
|
619
|
+
ls[i].deferred_accept = 1;
|
620
|
+
}
|
621
|
+
|
622
|
+
#endif
|
623
|
+
|
624
|
+
#endif /* NGX_HAVE_DEFERRED_ACCEPT */
|
625
|
+
}
|
626
|
+
|
627
|
+
return;
|
628
|
+
}
|
629
|
+
|
630
|
+
|
631
|
+
void
|
632
|
+
ngx_close_listening_sockets(ngx_cycle_t *cycle)
|
633
|
+
{
|
634
|
+
ngx_uint_t i;
|
635
|
+
ngx_listening_t *ls;
|
636
|
+
ngx_connection_t *c;
|
637
|
+
|
638
|
+
if (ngx_event_flags & NGX_USE_IOCP_EVENT) {
|
639
|
+
return;
|
640
|
+
}
|
641
|
+
|
642
|
+
ngx_accept_mutex_held = 0;
|
643
|
+
ngx_use_accept_mutex = 0;
|
644
|
+
|
645
|
+
ls = cycle->listening.elts;
|
646
|
+
for (i = 0; i < cycle->listening.nelts; i++) {
|
647
|
+
|
648
|
+
c = ls[i].connection;
|
649
|
+
|
650
|
+
if (c) {
|
651
|
+
if (c->read->active) {
|
652
|
+
if (ngx_event_flags & NGX_USE_RTSIG_EVENT) {
|
653
|
+
ngx_del_conn(c, NGX_CLOSE_EVENT);
|
654
|
+
|
655
|
+
} else if (ngx_event_flags & NGX_USE_EPOLL_EVENT) {
|
656
|
+
|
657
|
+
/*
|
658
|
+
* it seems that Linux-2.6.x OpenVZ sends events
|
659
|
+
* for closed shared listening sockets unless
|
660
|
+
* the events was explicity deleted
|
661
|
+
*/
|
662
|
+
|
663
|
+
ngx_del_event(c->read, NGX_READ_EVENT, 0);
|
664
|
+
|
665
|
+
} else {
|
666
|
+
ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT);
|
667
|
+
}
|
668
|
+
}
|
669
|
+
|
670
|
+
ngx_free_connection(c);
|
671
|
+
|
672
|
+
c->fd = (ngx_socket_t) -1;
|
673
|
+
}
|
674
|
+
|
675
|
+
ngx_log_debug2(NGX_LOG_DEBUG_CORE, cycle->log, 0,
|
676
|
+
"close listening %V #%d ", &ls[i].addr_text, ls[i].fd);
|
677
|
+
|
678
|
+
if (ngx_close_socket(ls[i].fd) == -1) {
|
679
|
+
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
|
680
|
+
ngx_close_socket_n " %V failed", &ls[i].addr_text);
|
681
|
+
}
|
682
|
+
|
683
|
+
#if (NGX_HAVE_UNIX_DOMAIN)
|
684
|
+
|
685
|
+
if (ls[i].sockaddr->sa_family == AF_UNIX
|
686
|
+
&& ngx_process <= NGX_PROCESS_MASTER
|
687
|
+
&& ngx_new_binary == 0)
|
688
|
+
{
|
689
|
+
u_char *name = ls[i].addr_text.data + sizeof("unix:") - 1;
|
690
|
+
|
691
|
+
if (ngx_delete_file(name) == -1) {
|
692
|
+
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
|
693
|
+
ngx_delete_file_n " %s failed", name);
|
694
|
+
}
|
695
|
+
}
|
696
|
+
|
697
|
+
#endif
|
698
|
+
|
699
|
+
ls[i].fd = (ngx_socket_t) -1;
|
700
|
+
}
|
701
|
+
}
|
702
|
+
|
703
|
+
|
704
|
+
ngx_connection_t *
|
705
|
+
ngx_get_connection(ngx_socket_t s, ngx_log_t *log)
|
706
|
+
{
|
707
|
+
ngx_uint_t instance;
|
708
|
+
ngx_event_t *rev, *wev;
|
709
|
+
ngx_connection_t *c;
|
710
|
+
|
711
|
+
/* disable warning: Win32 SOCKET is u_int while UNIX socket is int */
|
712
|
+
|
713
|
+
if (ngx_cycle->files && (ngx_uint_t) s >= ngx_cycle->files_n) {
|
714
|
+
ngx_log_error(NGX_LOG_ALERT, log, 0,
|
715
|
+
"the new socket has number %d, "
|
716
|
+
"but only %ui files are available",
|
717
|
+
s, ngx_cycle->files_n);
|
718
|
+
return NULL;
|
719
|
+
}
|
720
|
+
|
721
|
+
/* ngx_mutex_lock */
|
722
|
+
|
723
|
+
c = ngx_cycle->free_connections;
|
724
|
+
|
725
|
+
if (c == NULL) {
|
726
|
+
ngx_drain_connections();
|
727
|
+
c = ngx_cycle->free_connections;
|
728
|
+
}
|
729
|
+
|
730
|
+
if (c == NULL) {
|
731
|
+
ngx_log_error(NGX_LOG_ALERT, log, 0,
|
732
|
+
"%ui worker_connections are not enough",
|
733
|
+
ngx_cycle->connection_n);
|
734
|
+
|
735
|
+
/* ngx_mutex_unlock */
|
736
|
+
|
737
|
+
return NULL;
|
738
|
+
}
|
739
|
+
|
740
|
+
ngx_cycle->free_connections = c->data;
|
741
|
+
ngx_cycle->free_connection_n--;
|
742
|
+
|
743
|
+
/* ngx_mutex_unlock */
|
744
|
+
|
745
|
+
if (ngx_cycle->files) {
|
746
|
+
ngx_cycle->files[s] = c;
|
747
|
+
}
|
748
|
+
|
749
|
+
rev = c->read;
|
750
|
+
wev = c->write;
|
751
|
+
|
752
|
+
ngx_memzero(c, sizeof(ngx_connection_t));
|
753
|
+
|
754
|
+
c->read = rev;
|
755
|
+
c->write = wev;
|
756
|
+
c->fd = s;
|
757
|
+
c->log = log;
|
758
|
+
|
759
|
+
instance = rev->instance;
|
760
|
+
|
761
|
+
ngx_memzero(rev, sizeof(ngx_event_t));
|
762
|
+
ngx_memzero(wev, sizeof(ngx_event_t));
|
763
|
+
|
764
|
+
rev->instance = !instance;
|
765
|
+
wev->instance = !instance;
|
766
|
+
|
767
|
+
rev->index = NGX_INVALID_INDEX;
|
768
|
+
wev->index = NGX_INVALID_INDEX;
|
769
|
+
|
770
|
+
rev->data = c;
|
771
|
+
wev->data = c;
|
772
|
+
|
773
|
+
wev->write = 1;
|
774
|
+
|
775
|
+
return c;
|
776
|
+
}
|
777
|
+
|
778
|
+
|
779
|
+
void
|
780
|
+
ngx_free_connection(ngx_connection_t *c)
|
781
|
+
{
|
782
|
+
/* ngx_mutex_lock */
|
783
|
+
|
784
|
+
c->data = ngx_cycle->free_connections;
|
785
|
+
ngx_cycle->free_connections = c;
|
786
|
+
ngx_cycle->free_connection_n++;
|
787
|
+
|
788
|
+
/* ngx_mutex_unlock */
|
789
|
+
|
790
|
+
if (ngx_cycle->files) {
|
791
|
+
ngx_cycle->files[c->fd] = NULL;
|
792
|
+
}
|
793
|
+
}
|
794
|
+
|
795
|
+
|
796
|
+
void
|
797
|
+
ngx_close_connection(ngx_connection_t *c)
|
798
|
+
{
|
799
|
+
ngx_err_t err;
|
800
|
+
ngx_uint_t log_error, level;
|
801
|
+
ngx_socket_t fd;
|
802
|
+
|
803
|
+
if (c->fd == -1) {
|
804
|
+
ngx_log_error(NGX_LOG_ALERT, c->log, 0, "connection already closed");
|
805
|
+
return;
|
806
|
+
}
|
807
|
+
|
808
|
+
if (c->read->timer_set) {
|
809
|
+
ngx_del_timer(c->read);
|
810
|
+
}
|
811
|
+
|
812
|
+
if (c->write->timer_set) {
|
813
|
+
ngx_del_timer(c->write);
|
814
|
+
}
|
815
|
+
|
816
|
+
if (ngx_del_conn) {
|
817
|
+
ngx_del_conn(c, NGX_CLOSE_EVENT);
|
818
|
+
|
819
|
+
} else {
|
820
|
+
if (c->read->active || c->read->disabled) {
|
821
|
+
ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT);
|
822
|
+
}
|
823
|
+
|
824
|
+
if (c->write->active || c->write->disabled) {
|
825
|
+
ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT);
|
826
|
+
}
|
827
|
+
}
|
828
|
+
|
829
|
+
#if (NGX_THREADS)
|
830
|
+
|
831
|
+
/*
|
832
|
+
* we have to clean the connection information before the closing
|
833
|
+
* because another thread may reopen the same file descriptor
|
834
|
+
* before we clean the connection
|
835
|
+
*/
|
836
|
+
|
837
|
+
ngx_mutex_lock(ngx_posted_events_mutex);
|
838
|
+
|
839
|
+
if (c->read->prev) {
|
840
|
+
ngx_delete_posted_event(c->read);
|
841
|
+
}
|
842
|
+
|
843
|
+
if (c->write->prev) {
|
844
|
+
ngx_delete_posted_event(c->write);
|
845
|
+
}
|
846
|
+
|
847
|
+
c->read->closed = 1;
|
848
|
+
c->write->closed = 1;
|
849
|
+
|
850
|
+
if (c->single_connection) {
|
851
|
+
ngx_unlock(&c->lock);
|
852
|
+
c->read->locked = 0;
|
853
|
+
c->write->locked = 0;
|
854
|
+
}
|
855
|
+
|
856
|
+
ngx_mutex_unlock(ngx_posted_events_mutex);
|
857
|
+
|
858
|
+
#else
|
859
|
+
|
860
|
+
if (c->read->prev) {
|
861
|
+
ngx_delete_posted_event(c->read);
|
862
|
+
}
|
863
|
+
|
864
|
+
if (c->write->prev) {
|
865
|
+
ngx_delete_posted_event(c->write);
|
866
|
+
}
|
867
|
+
|
868
|
+
c->read->closed = 1;
|
869
|
+
c->write->closed = 1;
|
870
|
+
|
871
|
+
#endif
|
872
|
+
|
873
|
+
ngx_reusable_connection(c, 0);
|
874
|
+
|
875
|
+
log_error = c->log_error;
|
876
|
+
|
877
|
+
ngx_free_connection(c);
|
878
|
+
|
879
|
+
fd = c->fd;
|
880
|
+
c->fd = (ngx_socket_t) -1;
|
881
|
+
|
882
|
+
if (ngx_close_socket(fd) == -1) {
|
883
|
+
|
884
|
+
err = ngx_socket_errno;
|
885
|
+
|
886
|
+
if (err == NGX_ECONNRESET || err == NGX_ENOTCONN) {
|
887
|
+
|
888
|
+
switch (log_error) {
|
889
|
+
|
890
|
+
case NGX_ERROR_INFO:
|
891
|
+
level = NGX_LOG_INFO;
|
892
|
+
break;
|
893
|
+
|
894
|
+
case NGX_ERROR_ERR:
|
895
|
+
level = NGX_LOG_ERR;
|
896
|
+
break;
|
897
|
+
|
898
|
+
default:
|
899
|
+
level = NGX_LOG_CRIT;
|
900
|
+
}
|
901
|
+
|
902
|
+
} else {
|
903
|
+
level = NGX_LOG_CRIT;
|
904
|
+
}
|
905
|
+
|
906
|
+
/* we use ngx_cycle->log because c->log was in c->pool */
|
907
|
+
|
908
|
+
ngx_log_error(level, ngx_cycle->log, err,
|
909
|
+
ngx_close_socket_n " %d failed", fd);
|
910
|
+
}
|
911
|
+
}
|
912
|
+
|
913
|
+
|
914
|
+
void
|
915
|
+
ngx_reusable_connection(ngx_connection_t *c, ngx_uint_t reusable)
|
916
|
+
{
|
917
|
+
ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0,
|
918
|
+
"reusable connection: %ui", reusable);
|
919
|
+
|
920
|
+
if (c->reusable) {
|
921
|
+
ngx_queue_remove(&c->queue);
|
922
|
+
}
|
923
|
+
|
924
|
+
c->reusable = reusable;
|
925
|
+
|
926
|
+
if (reusable) {
|
927
|
+
/* need cast as ngx_cycle is volatile */
|
928
|
+
|
929
|
+
ngx_queue_insert_head(
|
930
|
+
(ngx_queue_t *) &ngx_cycle->reusable_connections_queue, &c->queue);
|
931
|
+
}
|
932
|
+
}
|
933
|
+
|
934
|
+
|
935
|
+
static void
|
936
|
+
ngx_drain_connections(void)
|
937
|
+
{
|
938
|
+
ngx_int_t i;
|
939
|
+
ngx_queue_t *q;
|
940
|
+
ngx_connection_t *c;
|
941
|
+
|
942
|
+
for (i = 0; i < 32; i++) {
|
943
|
+
if (ngx_queue_empty(&ngx_cycle->reusable_connections_queue)) {
|
944
|
+
break;
|
945
|
+
}
|
946
|
+
|
947
|
+
q = ngx_queue_last(&ngx_cycle->reusable_connections_queue);
|
948
|
+
c = ngx_queue_data(q, ngx_connection_t, queue);
|
949
|
+
|
950
|
+
ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0,
|
951
|
+
"reusing connection");
|
952
|
+
|
953
|
+
c->close = 1;
|
954
|
+
c->read->handler(c->read);
|
955
|
+
}
|
956
|
+
}
|
957
|
+
|
958
|
+
|
959
|
+
ngx_int_t
|
960
|
+
ngx_connection_local_sockaddr(ngx_connection_t *c, ngx_str_t *s,
|
961
|
+
ngx_uint_t port)
|
962
|
+
{
|
963
|
+
socklen_t len;
|
964
|
+
ngx_uint_t addr;
|
965
|
+
u_char sa[NGX_SOCKADDRLEN];
|
966
|
+
struct sockaddr_in *sin;
|
967
|
+
#if (NGX_HAVE_INET6)
|
968
|
+
ngx_uint_t i;
|
969
|
+
struct sockaddr_in6 *sin6;
|
970
|
+
#endif
|
971
|
+
|
972
|
+
switch (c->local_sockaddr->sa_family) {
|
973
|
+
|
974
|
+
#if (NGX_HAVE_INET6)
|
975
|
+
case AF_INET6:
|
976
|
+
sin6 = (struct sockaddr_in6 *) c->local_sockaddr;
|
977
|
+
|
978
|
+
for (addr = 0, i = 0; addr == 0 && i < 16; i++) {
|
979
|
+
addr |= sin6->sin6_addr.s6_addr[i];
|
980
|
+
}
|
981
|
+
|
982
|
+
break;
|
983
|
+
#endif
|
984
|
+
|
985
|
+
default: /* AF_INET */
|
986
|
+
sin = (struct sockaddr_in *) c->local_sockaddr;
|
987
|
+
addr = sin->sin_addr.s_addr;
|
988
|
+
break;
|
989
|
+
}
|
990
|
+
|
991
|
+
if (addr == 0) {
|
992
|
+
|
993
|
+
len = NGX_SOCKADDRLEN;
|
994
|
+
|
995
|
+
if (getsockname(c->fd, (struct sockaddr *) &sa, &len) == -1) {
|
996
|
+
ngx_connection_error(c, ngx_socket_errno, "getsockname() failed");
|
997
|
+
return NGX_ERROR;
|
998
|
+
}
|
999
|
+
|
1000
|
+
c->local_sockaddr = ngx_palloc(c->pool, len);
|
1001
|
+
if (c->local_sockaddr == NULL) {
|
1002
|
+
return NGX_ERROR;
|
1003
|
+
}
|
1004
|
+
|
1005
|
+
ngx_memcpy(c->local_sockaddr, &sa, len);
|
1006
|
+
}
|
1007
|
+
|
1008
|
+
if (s == NULL) {
|
1009
|
+
return NGX_OK;
|
1010
|
+
}
|
1011
|
+
|
1012
|
+
s->len = ngx_sock_ntop(c->local_sockaddr, s->data, s->len, port);
|
1013
|
+
|
1014
|
+
return NGX_OK;
|
1015
|
+
}
|
1016
|
+
|
1017
|
+
|
1018
|
+
ngx_int_t
|
1019
|
+
ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text)
|
1020
|
+
{
|
1021
|
+
ngx_uint_t level;
|
1022
|
+
|
1023
|
+
/* Winsock may return NGX_ECONNABORTED instead of NGX_ECONNRESET */
|
1024
|
+
|
1025
|
+
if ((err == NGX_ECONNRESET
|
1026
|
+
#if (NGX_WIN32)
|
1027
|
+
|| err == NGX_ECONNABORTED
|
1028
|
+
#endif
|
1029
|
+
) && c->log_error == NGX_ERROR_IGNORE_ECONNRESET)
|
1030
|
+
{
|
1031
|
+
return 0;
|
1032
|
+
}
|
1033
|
+
|
1034
|
+
#if (NGX_SOLARIS)
|
1035
|
+
if (err == NGX_EINVAL && c->log_error == NGX_ERROR_IGNORE_EINVAL) {
|
1036
|
+
return 0;
|
1037
|
+
}
|
1038
|
+
#endif
|
1039
|
+
|
1040
|
+
if (err == 0
|
1041
|
+
|| err == NGX_ECONNRESET
|
1042
|
+
#if (NGX_WIN32)
|
1043
|
+
|| err == NGX_ECONNABORTED
|
1044
|
+
#else
|
1045
|
+
|| err == NGX_EPIPE
|
1046
|
+
#endif
|
1047
|
+
|| err == NGX_ENOTCONN
|
1048
|
+
|| err == NGX_ETIMEDOUT
|
1049
|
+
|| err == NGX_ECONNREFUSED
|
1050
|
+
|| err == NGX_ENETDOWN
|
1051
|
+
|| err == NGX_ENETUNREACH
|
1052
|
+
|| err == NGX_EHOSTDOWN
|
1053
|
+
|| err == NGX_EHOSTUNREACH)
|
1054
|
+
{
|
1055
|
+
switch (c->log_error) {
|
1056
|
+
|
1057
|
+
case NGX_ERROR_IGNORE_EINVAL:
|
1058
|
+
case NGX_ERROR_IGNORE_ECONNRESET:
|
1059
|
+
case NGX_ERROR_INFO:
|
1060
|
+
level = NGX_LOG_INFO;
|
1061
|
+
break;
|
1062
|
+
|
1063
|
+
default:
|
1064
|
+
level = NGX_LOG_ERR;
|
1065
|
+
}
|
1066
|
+
|
1067
|
+
} else {
|
1068
|
+
level = NGX_LOG_ALERT;
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
ngx_log_error(level, c->log, err, text);
|
1072
|
+
|
1073
|
+
return NGX_ERROR;
|
1074
|
+
}
|