HAYASHI Kentaro
null+****@clear*****
Thu Apr 21 23:49:50 JST 2016
HAYASHI Kentaro 2016-04-21 23:49:50 +0900 (Thu, 21 Apr 2016) New Revision: 379c5433975866e5456f013ad967673394d1b61e https://github.com/groonga/groonga/commit/379c5433975866e5456f013ad967673394d1b61e Message: nginx: use latest version Added files: vendor/nginx-1.9.15/src/os/unix/ngx_udp_send.c Removed files: vendor/nginx-1.9.12/src/mysql/config vendor/nginx-1.9.12/src/mysql/ngx_http_mysql_test.c vendor/nginx-1.9.12/src/mysql/ngx_mysql.c vendor/nginx-1.9.12/src/mysql/ngx_mysql.h Modified files: nginx_version Renamed files: vendor/nginx-1.9.15/auto/cc/acc (from vendor/nginx-1.9.12/auto/cc/acc) vendor/nginx-1.9.15/auto/cc/bcc (from vendor/nginx-1.9.12/auto/cc/bcc) vendor/nginx-1.9.15/auto/cc/ccc (from vendor/nginx-1.9.12/auto/cc/ccc) vendor/nginx-1.9.15/auto/cc/clang (from vendor/nginx-1.9.12/auto/cc/clang) vendor/nginx-1.9.15/auto/cc/conf (from vendor/nginx-1.9.12/auto/cc/conf) vendor/nginx-1.9.15/auto/cc/gcc (from vendor/nginx-1.9.12/auto/cc/gcc) vendor/nginx-1.9.15/auto/cc/icc (from vendor/nginx-1.9.12/auto/cc/icc) vendor/nginx-1.9.15/auto/cc/msvc (from vendor/nginx-1.9.12/auto/cc/msvc) vendor/nginx-1.9.15/auto/cc/name (from vendor/nginx-1.9.12/auto/cc/name) vendor/nginx-1.9.15/auto/cc/owc (from vendor/nginx-1.9.12/auto/cc/owc) vendor/nginx-1.9.15/auto/cc/sunc (from vendor/nginx-1.9.12/auto/cc/sunc) vendor/nginx-1.9.15/auto/configure (from vendor/nginx-1.9.12/auto/configure) vendor/nginx-1.9.15/auto/define (from vendor/nginx-1.9.12/auto/define) vendor/nginx-1.9.15/auto/endianness (from vendor/nginx-1.9.12/auto/endianness) vendor/nginx-1.9.15/auto/feature (from vendor/nginx-1.9.12/auto/feature) vendor/nginx-1.9.15/auto/have (from vendor/nginx-1.9.12/auto/have) vendor/nginx-1.9.15/auto/have_headers (from vendor/nginx-1.9.12/auto/have_headers) vendor/nginx-1.9.15/auto/headers (from vendor/nginx-1.9.12/auto/headers) vendor/nginx-1.9.15/auto/include (from vendor/nginx-1.9.12/auto/include) vendor/nginx-1.9.15/auto/init (from vendor/nginx-1.9.12/auto/init) vendor/nginx-1.9.15/auto/install (from vendor/nginx-1.9.12/auto/install) vendor/nginx-1.9.15/auto/lib/conf (from vendor/nginx-1.9.12/auto/lib/conf) vendor/nginx-1.9.15/auto/lib/geoip/conf (from vendor/nginx-1.9.12/auto/lib/geoip/conf) vendor/nginx-1.9.15/auto/lib/google-perftools/conf (from vendor/nginx-1.9.12/auto/lib/google-perftools/conf) vendor/nginx-1.9.15/auto/lib/libatomic/conf (from vendor/nginx-1.9.12/auto/lib/libatomic/conf) vendor/nginx-1.9.15/auto/lib/libatomic/make (from vendor/nginx-1.9.12/auto/lib/libatomic/make) vendor/nginx-1.9.15/auto/lib/libgd/conf (from vendor/nginx-1.9.12/auto/lib/libgd/conf) vendor/nginx-1.9.15/auto/lib/libxslt/conf (from vendor/nginx-1.9.12/auto/lib/libxslt/conf) vendor/nginx-1.9.15/auto/lib/make (from vendor/nginx-1.9.12/auto/lib/make) vendor/nginx-1.9.15/auto/lib/md5/conf (from vendor/nginx-1.9.12/auto/lib/md5/conf) vendor/nginx-1.9.15/auto/lib/md5/make (from vendor/nginx-1.9.12/auto/lib/md5/make) vendor/nginx-1.9.15/auto/lib/md5/makefile.bcc (from vendor/nginx-1.9.12/auto/lib/md5/makefile.bcc) vendor/nginx-1.9.15/auto/lib/md5/makefile.msvc (from vendor/nginx-1.9.12/auto/lib/md5/makefile.msvc) vendor/nginx-1.9.15/auto/lib/md5/makefile.owc (from vendor/nginx-1.9.12/auto/lib/md5/makefile.owc) vendor/nginx-1.9.15/auto/lib/openssl/conf (from vendor/nginx-1.9.12/auto/lib/openssl/conf) vendor/nginx-1.9.15/auto/lib/openssl/make (from vendor/nginx-1.9.12/auto/lib/openssl/make) vendor/nginx-1.9.15/auto/lib/openssl/makefile.bcc (from vendor/nginx-1.9.12/auto/lib/openssl/makefile.bcc) vendor/nginx-1.9.15/auto/lib/openssl/makefile.msvc (from vendor/nginx-1.9.12/auto/lib/openssl/makefile.msvc) vendor/nginx-1.9.15/auto/lib/pcre/conf (from vendor/nginx-1.9.12/auto/lib/pcre/conf) vendor/nginx-1.9.15/auto/lib/pcre/make (from vendor/nginx-1.9.12/auto/lib/pcre/make) vendor/nginx-1.9.15/auto/lib/pcre/makefile.bcc (from vendor/nginx-1.9.12/auto/lib/pcre/makefile.bcc) vendor/nginx-1.9.15/auto/lib/pcre/makefile.msvc (from vendor/nginx-1.9.12/auto/lib/pcre/makefile.msvc) vendor/nginx-1.9.15/auto/lib/pcre/makefile.owc (from vendor/nginx-1.9.12/auto/lib/pcre/makefile.owc) vendor/nginx-1.9.15/auto/lib/perl/conf (from vendor/nginx-1.9.12/auto/lib/perl/conf) vendor/nginx-1.9.15/auto/lib/perl/make (from vendor/nginx-1.9.12/auto/lib/perl/make) vendor/nginx-1.9.15/auto/lib/sha1/conf (from vendor/nginx-1.9.12/auto/lib/sha1/conf) vendor/nginx-1.9.15/auto/lib/sha1/make (from vendor/nginx-1.9.12/auto/lib/sha1/make) vendor/nginx-1.9.15/auto/lib/sha1/makefile.bcc (from vendor/nginx-1.9.12/auto/lib/sha1/makefile.bcc) vendor/nginx-1.9.15/auto/lib/sha1/makefile.msvc (from vendor/nginx-1.9.12/auto/lib/sha1/makefile.msvc) vendor/nginx-1.9.15/auto/lib/sha1/makefile.owc (from vendor/nginx-1.9.12/auto/lib/sha1/makefile.owc) vendor/nginx-1.9.15/auto/lib/test (from vendor/nginx-1.9.12/auto/lib/test) vendor/nginx-1.9.15/auto/lib/zlib/conf (from vendor/nginx-1.9.12/auto/lib/zlib/conf) vendor/nginx-1.9.15/auto/lib/zlib/make (from vendor/nginx-1.9.12/auto/lib/zlib/make) vendor/nginx-1.9.15/auto/lib/zlib/makefile.bcc (from vendor/nginx-1.9.12/auto/lib/zlib/makefile.bcc) vendor/nginx-1.9.15/auto/lib/zlib/makefile.msvc (from vendor/nginx-1.9.12/auto/lib/zlib/makefile.msvc) vendor/nginx-1.9.15/auto/lib/zlib/makefile.owc (from vendor/nginx-1.9.12/auto/lib/zlib/makefile.owc) vendor/nginx-1.9.15/auto/make (from vendor/nginx-1.9.12/auto/make) vendor/nginx-1.9.15/auto/module (from vendor/nginx-1.9.12/auto/module) vendor/nginx-1.9.15/auto/modules (from vendor/nginx-1.9.12/auto/modules) vendor/nginx-1.9.15/auto/nohave (from vendor/nginx-1.9.12/auto/nohave) vendor/nginx-1.9.15/auto/options (from vendor/nginx-1.9.12/auto/options) vendor/nginx-1.9.15/auto/os/conf (from vendor/nginx-1.9.12/auto/os/conf) vendor/nginx-1.9.15/auto/os/darwin (from vendor/nginx-1.9.12/auto/os/darwin) vendor/nginx-1.9.15/auto/os/freebsd (from vendor/nginx-1.9.12/auto/os/freebsd) vendor/nginx-1.9.15/auto/os/linux (from vendor/nginx-1.9.12/auto/os/linux) vendor/nginx-1.9.15/auto/os/solaris (from vendor/nginx-1.9.12/auto/os/solaris) vendor/nginx-1.9.15/auto/os/win32 (from vendor/nginx-1.9.12/auto/os/win32) vendor/nginx-1.9.15/auto/sources (from vendor/nginx-1.9.12/auto/sources) vendor/nginx-1.9.15/auto/stubs (from vendor/nginx-1.9.12/auto/stubs) vendor/nginx-1.9.15/auto/summary (from vendor/nginx-1.9.12/auto/summary) vendor/nginx-1.9.15/auto/threads (from vendor/nginx-1.9.12/auto/threads) vendor/nginx-1.9.15/auto/types/sizeof (from vendor/nginx-1.9.12/auto/types/sizeof) vendor/nginx-1.9.15/auto/types/typedef (from vendor/nginx-1.9.12/auto/types/typedef) vendor/nginx-1.9.15/auto/types/uintptr_t (from vendor/nginx-1.9.12/auto/types/uintptr_t) vendor/nginx-1.9.15/auto/types/value (from vendor/nginx-1.9.12/auto/types/value) vendor/nginx-1.9.15/auto/unix (from vendor/nginx-1.9.12/auto/unix) vendor/nginx-1.9.15/conf/fastcgi.conf (from vendor/nginx-1.9.12/conf/fastcgi.conf) vendor/nginx-1.9.15/conf/fastcgi_params (from vendor/nginx-1.9.12/conf/fastcgi_params) vendor/nginx-1.9.15/conf/koi-utf (from vendor/nginx-1.9.12/conf/koi-utf) vendor/nginx-1.9.15/conf/koi-win (from vendor/nginx-1.9.12/conf/koi-win) vendor/nginx-1.9.15/conf/mime.types (from vendor/nginx-1.9.12/conf/mime.types) vendor/nginx-1.9.15/conf/nginx.conf (from vendor/nginx-1.9.12/conf/nginx.conf) vendor/nginx-1.9.15/conf/scgi_params (from vendor/nginx-1.9.12/conf/scgi_params) vendor/nginx-1.9.15/conf/uwsgi_params (from vendor/nginx-1.9.12/conf/uwsgi_params) vendor/nginx-1.9.15/conf/win-utf (from vendor/nginx-1.9.12/conf/win-utf) vendor/nginx-1.9.15/contrib/README (from vendor/nginx-1.9.12/contrib/README) vendor/nginx-1.9.15/contrib/geo2nginx.pl (from vendor/nginx-1.9.12/contrib/geo2nginx.pl) vendor/nginx-1.9.15/contrib/unicode2nginx/koi-utf (from vendor/nginx-1.9.12/contrib/unicode2nginx/koi-utf) vendor/nginx-1.9.15/contrib/unicode2nginx/unicode-to-nginx.pl (from vendor/nginx-1.9.12/contrib/unicode2nginx/unicode-to-nginx.pl) vendor/nginx-1.9.15/contrib/unicode2nginx/win-utf (from vendor/nginx-1.9.12/contrib/unicode2nginx/win-utf) vendor/nginx-1.9.15/contrib/vim/ftdetect/nginx.vim (from vendor/nginx-1.9.12/contrib/vim/ftdetect/nginx.vim) vendor/nginx-1.9.15/contrib/vim/indent/nginx.vim (from vendor/nginx-1.9.12/contrib/vim/indent/nginx.vim) vendor/nginx-1.9.15/contrib/vim/syntax/nginx.vim (from vendor/nginx-1.9.12/contrib/vim/syntax/nginx.vim) vendor/nginx-1.9.15/docs/GNUmakefile (from vendor/nginx-1.9.12/docs/GNUmakefile) vendor/nginx-1.9.15/docs/dtd/change_log_conf.dtd (from vendor/nginx-1.9.12/docs/dtd/change_log_conf.dtd) vendor/nginx-1.9.15/docs/dtd/changes.dtd (from vendor/nginx-1.9.12/docs/dtd/changes.dtd) vendor/nginx-1.9.15/docs/html/50x.html (from vendor/nginx-1.9.12/docs/html/50x.html) vendor/nginx-1.9.15/docs/html/index.html (from vendor/nginx-1.9.12/docs/html/index.html) vendor/nginx-1.9.15/docs/man/nginx.8 (from vendor/nginx-1.9.12/docs/man/nginx.8) vendor/nginx-1.9.15/docs/text/LICENSE (from vendor/nginx-1.9.12/docs/text/LICENSE) vendor/nginx-1.9.15/docs/text/README (from vendor/nginx-1.9.12/docs/text/README) vendor/nginx-1.9.15/docs/xml/change_log_conf.xml (from vendor/nginx-1.9.12/docs/xml/change_log_conf.xml) vendor/nginx-1.9.15/docs/xml/nginx/changes.xml (from vendor/nginx-1.9.12/docs/xml/nginx/changes.xml) vendor/nginx-1.9.15/docs/xsls/changes.xsls (from vendor/nginx-1.9.12/docs/xsls/changes.xsls) vendor/nginx-1.9.15/docs/xslt/changes.xslt (from vendor/nginx-1.9.12/docs/xslt/changes.xslt) vendor/nginx-1.9.15/misc/GNUmakefile (from vendor/nginx-1.9.12/misc/GNUmakefile) vendor/nginx-1.9.15/misc/README (from vendor/nginx-1.9.12/misc/README) vendor/nginx-1.9.15/src/core/nginx.c (from vendor/nginx-1.9.12/src/core/nginx.c) vendor/nginx-1.9.15/src/core/nginx.h (from vendor/nginx-1.9.12/src/core/nginx.h) vendor/nginx-1.9.15/src/core/ngx_array.c (from vendor/nginx-1.9.12/src/core/ngx_array.c) vendor/nginx-1.9.15/src/core/ngx_array.h (from vendor/nginx-1.9.12/src/core/ngx_array.h) vendor/nginx-1.9.15/src/core/ngx_buf.c (from vendor/nginx-1.9.12/src/core/ngx_buf.c) vendor/nginx-1.9.15/src/core/ngx_buf.h (from vendor/nginx-1.9.12/src/core/ngx_buf.h) vendor/nginx-1.9.15/src/core/ngx_conf_file.c (from vendor/nginx-1.9.12/src/core/ngx_conf_file.c) vendor/nginx-1.9.15/src/core/ngx_conf_file.h (from vendor/nginx-1.9.12/src/core/ngx_conf_file.h) vendor/nginx-1.9.15/src/core/ngx_config.h (from vendor/nginx-1.9.12/src/core/ngx_config.h) vendor/nginx-1.9.15/src/core/ngx_connection.c (from vendor/nginx-1.9.12/src/core/ngx_connection.c) vendor/nginx-1.9.15/src/core/ngx_connection.h (from vendor/nginx-1.9.12/src/core/ngx_connection.h) vendor/nginx-1.9.15/src/core/ngx_core.h (from vendor/nginx-1.9.12/src/core/ngx_core.h) vendor/nginx-1.9.15/src/core/ngx_cpuinfo.c (from vendor/nginx-1.9.12/src/core/ngx_cpuinfo.c) vendor/nginx-1.9.15/src/core/ngx_crc.h (from vendor/nginx-1.9.12/src/core/ngx_crc.h) vendor/nginx-1.9.15/src/core/ngx_crc32.c (from vendor/nginx-1.9.12/src/core/ngx_crc32.c) vendor/nginx-1.9.15/src/core/ngx_crc32.h (from vendor/nginx-1.9.12/src/core/ngx_crc32.h) vendor/nginx-1.9.15/src/core/ngx_crypt.c (from vendor/nginx-1.9.12/src/core/ngx_crypt.c) vendor/nginx-1.9.15/src/core/ngx_crypt.h (from vendor/nginx-1.9.12/src/core/ngx_crypt.h) vendor/nginx-1.9.15/src/core/ngx_cycle.c (from vendor/nginx-1.9.12/src/core/ngx_cycle.c) vendor/nginx-1.9.15/src/core/ngx_cycle.h (from vendor/nginx-1.9.12/src/core/ngx_cycle.h) vendor/nginx-1.9.15/src/core/ngx_file.c (from vendor/nginx-1.9.12/src/core/ngx_file.c) vendor/nginx-1.9.15/src/core/ngx_file.h (from vendor/nginx-1.9.12/src/core/ngx_file.h) vendor/nginx-1.9.15/src/core/ngx_hash.c (from vendor/nginx-1.9.12/src/core/ngx_hash.c) vendor/nginx-1.9.15/src/core/ngx_hash.h (from vendor/nginx-1.9.12/src/core/ngx_hash.h) vendor/nginx-1.9.15/src/core/ngx_inet.c (from vendor/nginx-1.9.12/src/core/ngx_inet.c) vendor/nginx-1.9.15/src/core/ngx_inet.h (from vendor/nginx-1.9.12/src/core/ngx_inet.h) vendor/nginx-1.9.15/src/core/ngx_list.c (from vendor/nginx-1.9.12/src/core/ngx_list.c) vendor/nginx-1.9.15/src/core/ngx_list.h (from vendor/nginx-1.9.12/src/core/ngx_list.h) vendor/nginx-1.9.15/src/core/ngx_log.c (from vendor/nginx-1.9.12/src/core/ngx_log.c) vendor/nginx-1.9.15/src/core/ngx_log.h (from vendor/nginx-1.9.12/src/core/ngx_log.h) vendor/nginx-1.9.15/src/core/ngx_md5.c (from vendor/nginx-1.9.12/src/core/ngx_md5.c) vendor/nginx-1.9.15/src/core/ngx_md5.h (from vendor/nginx-1.9.12/src/core/ngx_md5.h) vendor/nginx-1.9.15/src/core/ngx_module.c (from vendor/nginx-1.9.12/src/core/ngx_module.c) vendor/nginx-1.9.15/src/core/ngx_module.h (from vendor/nginx-1.9.12/src/core/ngx_module.h) vendor/nginx-1.9.15/src/core/ngx_murmurhash.c (from vendor/nginx-1.9.12/src/core/ngx_murmurhash.c) vendor/nginx-1.9.15/src/core/ngx_murmurhash.h (from vendor/nginx-1.9.12/src/core/ngx_murmurhash.h) vendor/nginx-1.9.15/src/core/ngx_open_file_cache.c (from vendor/nginx-1.9.12/src/core/ngx_open_file_cache.c) vendor/nginx-1.9.15/src/core/ngx_open_file_cache.h (from vendor/nginx-1.9.12/src/core/ngx_open_file_cache.h) vendor/nginx-1.9.15/src/core/ngx_output_chain.c (from vendor/nginx-1.9.12/src/core/ngx_output_chain.c) vendor/nginx-1.9.15/src/core/ngx_palloc.c (from vendor/nginx-1.9.12/src/core/ngx_palloc.c) vendor/nginx-1.9.15/src/core/ngx_palloc.h (from vendor/nginx-1.9.12/src/core/ngx_palloc.h) vendor/nginx-1.9.15/src/core/ngx_parse.c (from vendor/nginx-1.9.12/src/core/ngx_parse.c) vendor/nginx-1.9.15/src/core/ngx_parse.h (from vendor/nginx-1.9.12/src/core/ngx_parse.h) vendor/nginx-1.9.15/src/core/ngx_parse_time.c (from vendor/nginx-1.9.12/src/core/ngx_parse_time.c) vendor/nginx-1.9.15/src/core/ngx_parse_time.h (from vendor/nginx-1.9.12/src/core/ngx_parse_time.h) vendor/nginx-1.9.15/src/core/ngx_proxy_protocol.c (from vendor/nginx-1.9.12/src/core/ngx_proxy_protocol.c) vendor/nginx-1.9.15/src/core/ngx_proxy_protocol.h (from vendor/nginx-1.9.12/src/core/ngx_proxy_protocol.h) vendor/nginx-1.9.15/src/core/ngx_queue.c (from vendor/nginx-1.9.12/src/core/ngx_queue.c) vendor/nginx-1.9.15/src/core/ngx_queue.h (from vendor/nginx-1.9.12/src/core/ngx_queue.h) vendor/nginx-1.9.15/src/core/ngx_radix_tree.c (from vendor/nginx-1.9.12/src/core/ngx_radix_tree.c) vendor/nginx-1.9.15/src/core/ngx_radix_tree.h (from vendor/nginx-1.9.12/src/core/ngx_radix_tree.h) vendor/nginx-1.9.15/src/core/ngx_rbtree.c (from vendor/nginx-1.9.12/src/core/ngx_rbtree.c) vendor/nginx-1.9.15/src/core/ngx_rbtree.h (from vendor/nginx-1.9.12/src/core/ngx_rbtree.h) vendor/nginx-1.9.15/src/core/ngx_regex.c (from vendor/nginx-1.9.12/src/core/ngx_regex.c) vendor/nginx-1.9.15/src/core/ngx_regex.h (from vendor/nginx-1.9.12/src/core/ngx_regex.h) vendor/nginx-1.9.15/src/core/ngx_resolver.c (from vendor/nginx-1.9.12/src/core/ngx_resolver.c) vendor/nginx-1.9.15/src/core/ngx_resolver.h (from vendor/nginx-1.9.12/src/core/ngx_resolver.h) vendor/nginx-1.9.15/src/core/ngx_rwlock.c (from vendor/nginx-1.9.12/src/core/ngx_rwlock.c) vendor/nginx-1.9.15/src/core/ngx_rwlock.h (from vendor/nginx-1.9.12/src/core/ngx_rwlock.h) vendor/nginx-1.9.15/src/core/ngx_sha1.h (from vendor/nginx-1.9.12/src/core/ngx_sha1.h) vendor/nginx-1.9.15/src/core/ngx_shmtx.c (from vendor/nginx-1.9.12/src/core/ngx_shmtx.c) vendor/nginx-1.9.15/src/core/ngx_shmtx.h (from vendor/nginx-1.9.12/src/core/ngx_shmtx.h) vendor/nginx-1.9.15/src/core/ngx_slab.c (from vendor/nginx-1.9.12/src/core/ngx_slab.c) vendor/nginx-1.9.15/src/core/ngx_slab.h (from vendor/nginx-1.9.12/src/core/ngx_slab.h) vendor/nginx-1.9.15/src/core/ngx_spinlock.c (from vendor/nginx-1.9.12/src/core/ngx_spinlock.c) vendor/nginx-1.9.15/src/core/ngx_string.c (from vendor/nginx-1.9.12/src/core/ngx_string.c) vendor/nginx-1.9.15/src/core/ngx_string.h (from vendor/nginx-1.9.12/src/core/ngx_string.h) vendor/nginx-1.9.15/src/core/ngx_syslog.c (from vendor/nginx-1.9.12/src/core/ngx_syslog.c) vendor/nginx-1.9.15/src/core/ngx_syslog.h (from vendor/nginx-1.9.12/src/core/ngx_syslog.h) vendor/nginx-1.9.15/src/core/ngx_thread_pool.c (from vendor/nginx-1.9.12/src/core/ngx_thread_pool.c) vendor/nginx-1.9.15/src/core/ngx_thread_pool.h (from vendor/nginx-1.9.12/src/core/ngx_thread_pool.h) vendor/nginx-1.9.15/src/core/ngx_times.c (from vendor/nginx-1.9.12/src/core/ngx_times.c) vendor/nginx-1.9.15/src/core/ngx_times.h (from vendor/nginx-1.9.12/src/core/ngx_times.h) vendor/nginx-1.9.15/src/event/modules/ngx_devpoll_module.c (from vendor/nginx-1.9.12/src/event/modules/ngx_devpoll_module.c) vendor/nginx-1.9.15/src/event/modules/ngx_epoll_module.c (from vendor/nginx-1.9.12/src/event/modules/ngx_epoll_module.c) vendor/nginx-1.9.15/src/event/modules/ngx_eventport_module.c (from vendor/nginx-1.9.12/src/event/modules/ngx_eventport_module.c) vendor/nginx-1.9.15/src/event/modules/ngx_iocp_module.c (from vendor/nginx-1.9.12/src/event/modules/ngx_iocp_module.c) vendor/nginx-1.9.15/src/event/modules/ngx_iocp_module.h (from vendor/nginx-1.9.12/src/event/modules/ngx_iocp_module.h) vendor/nginx-1.9.15/src/event/modules/ngx_kqueue_module.c (from vendor/nginx-1.9.12/src/event/modules/ngx_kqueue_module.c) vendor/nginx-1.9.15/src/event/modules/ngx_poll_module.c (from vendor/nginx-1.9.12/src/event/modules/ngx_poll_module.c) vendor/nginx-1.9.15/src/event/modules/ngx_select_module.c (from vendor/nginx-1.9.12/src/event/modules/ngx_select_module.c) vendor/nginx-1.9.15/src/event/modules/ngx_win32_select_module.c (from vendor/nginx-1.9.12/src/event/modules/ngx_win32_select_module.c) vendor/nginx-1.9.15/src/event/ngx_event.c (from vendor/nginx-1.9.12/src/event/ngx_event.c) vendor/nginx-1.9.15/src/event/ngx_event.h (from vendor/nginx-1.9.12/src/event/ngx_event.h) vendor/nginx-1.9.15/src/event/ngx_event_accept.c (from vendor/nginx-1.9.12/src/event/ngx_event_accept.c) vendor/nginx-1.9.15/src/event/ngx_event_acceptex.c (from vendor/nginx-1.9.12/src/event/ngx_event_acceptex.c) vendor/nginx-1.9.15/src/event/ngx_event_connect.c (from vendor/nginx-1.9.12/src/event/ngx_event_connect.c) vendor/nginx-1.9.15/src/event/ngx_event_connect.h (from vendor/nginx-1.9.12/src/event/ngx_event_connect.h) vendor/nginx-1.9.15/src/event/ngx_event_connectex.c (from vendor/nginx-1.9.12/src/event/ngx_event_connectex.c) vendor/nginx-1.9.15/src/event/ngx_event_openssl.c (from vendor/nginx-1.9.12/src/event/ngx_event_openssl.c) vendor/nginx-1.9.15/src/event/ngx_event_openssl.h (from vendor/nginx-1.9.12/src/event/ngx_event_openssl.h) vendor/nginx-1.9.15/src/event/ngx_event_openssl_stapling.c (from vendor/nginx-1.9.12/src/event/ngx_event_openssl_stapling.c) vendor/nginx-1.9.15/src/event/ngx_event_pipe.c (from vendor/nginx-1.9.12/src/event/ngx_event_pipe.c) vendor/nginx-1.9.15/src/event/ngx_event_pipe.h (from vendor/nginx-1.9.12/src/event/ngx_event_pipe.h) vendor/nginx-1.9.15/src/event/ngx_event_posted.c (from vendor/nginx-1.9.12/src/event/ngx_event_posted.c) vendor/nginx-1.9.15/src/event/ngx_event_posted.h (from vendor/nginx-1.9.12/src/event/ngx_event_posted.h) vendor/nginx-1.9.15/src/event/ngx_event_timer.c (from vendor/nginx-1.9.12/src/event/ngx_event_timer.c) vendor/nginx-1.9.15/src/event/ngx_event_timer.h (from vendor/nginx-1.9.12/src/event/ngx_event_timer.h) vendor/nginx-1.9.15/src/http/modules/ngx_http_access_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_access_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_addition_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_addition_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_auth_basic_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_auth_basic_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_auth_request_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_auth_request_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_autoindex_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_autoindex_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_browser_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_browser_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_charset_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_charset_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_chunked_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_chunked_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_dav_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_dav_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_degradation_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_degradation_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_empty_gif_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_empty_gif_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_fastcgi_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_fastcgi_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_flv_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_flv_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_geo_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_geo_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_geoip_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_geoip_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_gunzip_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_gunzip_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_gzip_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_gzip_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_gzip_static_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_gzip_static_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_headers_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_headers_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_image_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_image_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_index_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_index_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_limit_conn_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_limit_conn_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_limit_req_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_limit_req_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_log_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_log_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_map_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_map_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_memcached_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_memcached_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_mp4_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_mp4_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_not_modified_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_not_modified_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_proxy_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_proxy_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_random_index_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_random_index_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_range_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_range_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_realip_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_realip_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_referer_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_referer_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_rewrite_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_rewrite_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_scgi_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_scgi_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_secure_link_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_secure_link_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_slice_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_slice_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_split_clients_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_split_clients_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_ssi_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_ssi_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_ssi_filter_module.h (from vendor/nginx-1.9.12/src/http/modules/ngx_http_ssi_filter_module.h) vendor/nginx-1.9.15/src/http/modules/ngx_http_ssl_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_ssl_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_ssl_module.h (from vendor/nginx-1.9.12/src/http/modules/ngx_http_ssl_module.h) vendor/nginx-1.9.15/src/http/modules/ngx_http_static_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_static_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_stub_status_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_stub_status_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_sub_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_sub_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_hash_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_upstream_hash_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_ip_hash_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_upstream_ip_hash_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_keepalive_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_upstream_keepalive_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_least_conn_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_upstream_least_conn_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_zone_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_upstream_zone_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_userid_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_userid_filter_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_uwsgi_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_uwsgi_module.c) vendor/nginx-1.9.15/src/http/modules/ngx_http_xslt_filter_module.c (from vendor/nginx-1.9.12/src/http/modules/ngx_http_xslt_filter_module.c) vendor/nginx-1.9.15/src/http/modules/perl/Makefile.PL (from vendor/nginx-1.9.12/src/http/modules/perl/Makefile.PL) vendor/nginx-1.9.15/src/http/modules/perl/nginx.pm (from vendor/nginx-1.9.12/src/http/modules/perl/nginx.pm) vendor/nginx-1.9.15/src/http/modules/perl/nginx.xs (from vendor/nginx-1.9.12/src/http/modules/perl/nginx.xs) vendor/nginx-1.9.15/src/http/modules/perl/ngx_http_perl_module.c (from vendor/nginx-1.9.12/src/http/modules/perl/ngx_http_perl_module.c) vendor/nginx-1.9.15/src/http/modules/perl/ngx_http_perl_module.h (from vendor/nginx-1.9.12/src/http/modules/perl/ngx_http_perl_module.h) vendor/nginx-1.9.15/src/http/modules/perl/typemap (from vendor/nginx-1.9.12/src/http/modules/perl/typemap) vendor/nginx-1.9.15/src/http/ngx_http.c (from vendor/nginx-1.9.12/src/http/ngx_http.c) vendor/nginx-1.9.15/src/http/ngx_http.h (from vendor/nginx-1.9.12/src/http/ngx_http.h) vendor/nginx-1.9.15/src/http/ngx_http_cache.h (from vendor/nginx-1.9.12/src/http/ngx_http_cache.h) vendor/nginx-1.9.15/src/http/ngx_http_config.h (from vendor/nginx-1.9.12/src/http/ngx_http_config.h) vendor/nginx-1.9.15/src/http/ngx_http_copy_filter_module.c (from vendor/nginx-1.9.12/src/http/ngx_http_copy_filter_module.c) vendor/nginx-1.9.15/src/http/ngx_http_core_module.c (from vendor/nginx-1.9.12/src/http/ngx_http_core_module.c) vendor/nginx-1.9.15/src/http/ngx_http_core_module.h (from vendor/nginx-1.9.12/src/http/ngx_http_core_module.h) vendor/nginx-1.9.15/src/http/ngx_http_file_cache.c (from vendor/nginx-1.9.12/src/http/ngx_http_file_cache.c) vendor/nginx-1.9.15/src/http/ngx_http_header_filter_module.c (from vendor/nginx-1.9.12/src/http/ngx_http_header_filter_module.c) vendor/nginx-1.9.15/src/http/ngx_http_parse.c (from vendor/nginx-1.9.12/src/http/ngx_http_parse.c) vendor/nginx-1.9.15/src/http/ngx_http_postpone_filter_module.c (from vendor/nginx-1.9.12/src/http/ngx_http_postpone_filter_module.c) vendor/nginx-1.9.15/src/http/ngx_http_request.c (from vendor/nginx-1.9.12/src/http/ngx_http_request.c) vendor/nginx-1.9.15/src/http/ngx_http_request.h (from vendor/nginx-1.9.12/src/http/ngx_http_request.h) vendor/nginx-1.9.15/src/http/ngx_http_request_body.c (from vendor/nginx-1.9.12/src/http/ngx_http_request_body.c) vendor/nginx-1.9.15/src/http/ngx_http_script.c (from vendor/nginx-1.9.12/src/http/ngx_http_script.c) vendor/nginx-1.9.15/src/http/ngx_http_script.h (from vendor/nginx-1.9.12/src/http/ngx_http_script.h) vendor/nginx-1.9.15/src/http/ngx_http_special_response.c (from vendor/nginx-1.9.12/src/http/ngx_http_special_response.c) vendor/nginx-1.9.15/src/http/ngx_http_upstream.c (from vendor/nginx-1.9.12/src/http/ngx_http_upstream.c) vendor/nginx-1.9.15/src/http/ngx_http_upstream.h (from vendor/nginx-1.9.12/src/http/ngx_http_upstream.h) vendor/nginx-1.9.15/src/http/ngx_http_upstream_round_robin.c (from vendor/nginx-1.9.12/src/http/ngx_http_upstream_round_robin.c) vendor/nginx-1.9.15/src/http/ngx_http_upstream_round_robin.h (from vendor/nginx-1.9.12/src/http/ngx_http_upstream_round_robin.h) vendor/nginx-1.9.15/src/http/ngx_http_variables.c (from vendor/nginx-1.9.12/src/http/ngx_http_variables.c) vendor/nginx-1.9.15/src/http/ngx_http_variables.h (from vendor/nginx-1.9.12/src/http/ngx_http_variables.h) vendor/nginx-1.9.15/src/http/ngx_http_write_filter_module.c (from vendor/nginx-1.9.12/src/http/ngx_http_write_filter_module.c) vendor/nginx-1.9.15/src/http/v2/ngx_http_v2.c (from vendor/nginx-1.9.12/src/http/v2/ngx_http_v2.c) vendor/nginx-1.9.15/src/http/v2/ngx_http_v2.h (from vendor/nginx-1.9.12/src/http/v2/ngx_http_v2.h) vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_filter_module.c (from vendor/nginx-1.9.12/src/http/v2/ngx_http_v2_filter_module.c) vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_huff_decode.c (from vendor/nginx-1.9.12/src/http/v2/ngx_http_v2_huff_decode.c) vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_huff_encode.c (from vendor/nginx-1.9.12/src/http/v2/ngx_http_v2_huff_encode.c) vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_module.c (from vendor/nginx-1.9.12/src/http/v2/ngx_http_v2_module.c) vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_module.h (from vendor/nginx-1.9.12/src/http/v2/ngx_http_v2_module.h) vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_table.c (from vendor/nginx-1.9.12/src/http/v2/ngx_http_v2_table.c) vendor/nginx-1.9.15/src/mail/ngx_mail.c (from vendor/nginx-1.9.12/src/mail/ngx_mail.c) vendor/nginx-1.9.15/src/mail/ngx_mail.h (from vendor/nginx-1.9.12/src/mail/ngx_mail.h) vendor/nginx-1.9.15/src/mail/ngx_mail_auth_http_module.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_auth_http_module.c) vendor/nginx-1.9.15/src/mail/ngx_mail_core_module.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_core_module.c) vendor/nginx-1.9.15/src/mail/ngx_mail_handler.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_handler.c) vendor/nginx-1.9.15/src/mail/ngx_mail_imap_handler.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_imap_handler.c) vendor/nginx-1.9.15/src/mail/ngx_mail_imap_module.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_imap_module.c) vendor/nginx-1.9.15/src/mail/ngx_mail_imap_module.h (from vendor/nginx-1.9.12/src/mail/ngx_mail_imap_module.h) vendor/nginx-1.9.15/src/mail/ngx_mail_parse.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_parse.c) vendor/nginx-1.9.15/src/mail/ngx_mail_pop3_handler.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_pop3_handler.c) vendor/nginx-1.9.15/src/mail/ngx_mail_pop3_module.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_pop3_module.c) vendor/nginx-1.9.15/src/mail/ngx_mail_pop3_module.h (from vendor/nginx-1.9.12/src/mail/ngx_mail_pop3_module.h) vendor/nginx-1.9.15/src/mail/ngx_mail_proxy_module.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_proxy_module.c) vendor/nginx-1.9.15/src/mail/ngx_mail_smtp_handler.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_smtp_handler.c) vendor/nginx-1.9.15/src/mail/ngx_mail_smtp_module.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_smtp_module.c) vendor/nginx-1.9.15/src/mail/ngx_mail_smtp_module.h (from vendor/nginx-1.9.12/src/mail/ngx_mail_smtp_module.h) vendor/nginx-1.9.15/src/mail/ngx_mail_ssl_module.c (from vendor/nginx-1.9.12/src/mail/ngx_mail_ssl_module.c) vendor/nginx-1.9.15/src/mail/ngx_mail_ssl_module.h (from vendor/nginx-1.9.12/src/mail/ngx_mail_ssl_module.h) vendor/nginx-1.9.15/src/misc/ngx_cpp_test_module.cpp (from vendor/nginx-1.9.12/src/misc/ngx_cpp_test_module.cpp) vendor/nginx-1.9.15/src/misc/ngx_google_perftools_module.c (from vendor/nginx-1.9.12/src/misc/ngx_google_perftools_module.c) vendor/nginx-1.9.15/src/os/unix/ngx_alloc.c (from vendor/nginx-1.9.12/src/os/unix/ngx_alloc.c) vendor/nginx-1.9.15/src/os/unix/ngx_alloc.h (from vendor/nginx-1.9.12/src/os/unix/ngx_alloc.h) vendor/nginx-1.9.15/src/os/unix/ngx_atomic.h (from vendor/nginx-1.9.12/src/os/unix/ngx_atomic.h) vendor/nginx-1.9.15/src/os/unix/ngx_channel.c (from vendor/nginx-1.9.12/src/os/unix/ngx_channel.c) vendor/nginx-1.9.15/src/os/unix/ngx_channel.h (from vendor/nginx-1.9.12/src/os/unix/ngx_channel.h) vendor/nginx-1.9.15/src/os/unix/ngx_daemon.c (from vendor/nginx-1.9.12/src/os/unix/ngx_daemon.c) vendor/nginx-1.9.15/src/os/unix/ngx_darwin.h (from vendor/nginx-1.9.12/src/os/unix/ngx_darwin.h) vendor/nginx-1.9.15/src/os/unix/ngx_darwin_config.h (from vendor/nginx-1.9.12/src/os/unix/ngx_darwin_config.h) vendor/nginx-1.9.15/src/os/unix/ngx_darwin_init.c (from vendor/nginx-1.9.12/src/os/unix/ngx_darwin_init.c) vendor/nginx-1.9.15/src/os/unix/ngx_darwin_sendfile_chain.c (from vendor/nginx-1.9.12/src/os/unix/ngx_darwin_sendfile_chain.c) vendor/nginx-1.9.15/src/os/unix/ngx_dlopen.c (from vendor/nginx-1.9.12/src/os/unix/ngx_dlopen.c) vendor/nginx-1.9.15/src/os/unix/ngx_dlopen.h (from vendor/nginx-1.9.12/src/os/unix/ngx_dlopen.h) vendor/nginx-1.9.15/src/os/unix/ngx_errno.c (from vendor/nginx-1.9.12/src/os/unix/ngx_errno.c) vendor/nginx-1.9.15/src/os/unix/ngx_errno.h (from vendor/nginx-1.9.12/src/os/unix/ngx_errno.h) vendor/nginx-1.9.15/src/os/unix/ngx_file_aio_read.c (from vendor/nginx-1.9.12/src/os/unix/ngx_file_aio_read.c) vendor/nginx-1.9.15/src/os/unix/ngx_files.c (from vendor/nginx-1.9.12/src/os/unix/ngx_files.c) vendor/nginx-1.9.15/src/os/unix/ngx_files.h (from vendor/nginx-1.9.12/src/os/unix/ngx_files.h) vendor/nginx-1.9.15/src/os/unix/ngx_freebsd.h (from vendor/nginx-1.9.12/src/os/unix/ngx_freebsd.h) vendor/nginx-1.9.15/src/os/unix/ngx_freebsd_config.h (from vendor/nginx-1.9.12/src/os/unix/ngx_freebsd_config.h) vendor/nginx-1.9.15/src/os/unix/ngx_freebsd_init.c (from vendor/nginx-1.9.12/src/os/unix/ngx_freebsd_init.c) vendor/nginx-1.9.15/src/os/unix/ngx_freebsd_sendfile_chain.c (from vendor/nginx-1.9.12/src/os/unix/ngx_freebsd_sendfile_chain.c) vendor/nginx-1.9.15/src/os/unix/ngx_gcc_atomic_amd64.h (from vendor/nginx-1.9.12/src/os/unix/ngx_gcc_atomic_amd64.h) vendor/nginx-1.9.15/src/os/unix/ngx_gcc_atomic_ppc.h (from vendor/nginx-1.9.12/src/os/unix/ngx_gcc_atomic_ppc.h) vendor/nginx-1.9.15/src/os/unix/ngx_gcc_atomic_sparc64.h (from vendor/nginx-1.9.12/src/os/unix/ngx_gcc_atomic_sparc64.h) vendor/nginx-1.9.15/src/os/unix/ngx_gcc_atomic_x86.h (from vendor/nginx-1.9.12/src/os/unix/ngx_gcc_atomic_x86.h) vendor/nginx-1.9.15/src/os/unix/ngx_linux.h (from vendor/nginx-1.9.12/src/os/unix/ngx_linux.h) vendor/nginx-1.9.15/src/os/unix/ngx_linux_aio_read.c (from vendor/nginx-1.9.12/src/os/unix/ngx_linux_aio_read.c) vendor/nginx-1.9.15/src/os/unix/ngx_linux_config.h (from vendor/nginx-1.9.12/src/os/unix/ngx_linux_config.h) vendor/nginx-1.9.15/src/os/unix/ngx_linux_init.c (from vendor/nginx-1.9.12/src/os/unix/ngx_linux_init.c) vendor/nginx-1.9.15/src/os/unix/ngx_linux_sendfile_chain.c (from vendor/nginx-1.9.12/src/os/unix/ngx_linux_sendfile_chain.c) vendor/nginx-1.9.15/src/os/unix/ngx_os.h (from vendor/nginx-1.9.12/src/os/unix/ngx_os.h) vendor/nginx-1.9.15/src/os/unix/ngx_posix_config.h (from vendor/nginx-1.9.12/src/os/unix/ngx_posix_config.h) vendor/nginx-1.9.15/src/os/unix/ngx_posix_init.c (from vendor/nginx-1.9.12/src/os/unix/ngx_posix_init.c) vendor/nginx-1.9.15/src/os/unix/ngx_process.c (from vendor/nginx-1.9.12/src/os/unix/ngx_process.c) vendor/nginx-1.9.15/src/os/unix/ngx_process.h (from vendor/nginx-1.9.12/src/os/unix/ngx_process.h) vendor/nginx-1.9.15/src/os/unix/ngx_process_cycle.c (from vendor/nginx-1.9.12/src/os/unix/ngx_process_cycle.c) vendor/nginx-1.9.15/src/os/unix/ngx_process_cycle.h (from vendor/nginx-1.9.12/src/os/unix/ngx_process_cycle.h) vendor/nginx-1.9.15/src/os/unix/ngx_readv_chain.c (from vendor/nginx-1.9.12/src/os/unix/ngx_readv_chain.c) vendor/nginx-1.9.15/src/os/unix/ngx_recv.c (from vendor/nginx-1.9.12/src/os/unix/ngx_recv.c) vendor/nginx-1.9.15/src/os/unix/ngx_send.c (from vendor/nginx-1.9.12/src/os/unix/ngx_send.c) vendor/nginx-1.9.15/src/os/unix/ngx_setaffinity.c (from vendor/nginx-1.9.12/src/os/unix/ngx_setaffinity.c) vendor/nginx-1.9.15/src/os/unix/ngx_setaffinity.h (from vendor/nginx-1.9.12/src/os/unix/ngx_setaffinity.h) vendor/nginx-1.9.15/src/os/unix/ngx_setproctitle.c (from vendor/nginx-1.9.12/src/os/unix/ngx_setproctitle.c) vendor/nginx-1.9.15/src/os/unix/ngx_setproctitle.h (from vendor/nginx-1.9.12/src/os/unix/ngx_setproctitle.h) vendor/nginx-1.9.15/src/os/unix/ngx_shmem.c (from vendor/nginx-1.9.12/src/os/unix/ngx_shmem.c) vendor/nginx-1.9.15/src/os/unix/ngx_shmem.h (from vendor/nginx-1.9.12/src/os/unix/ngx_shmem.h) vendor/nginx-1.9.15/src/os/unix/ngx_socket.c (from vendor/nginx-1.9.12/src/os/unix/ngx_socket.c) vendor/nginx-1.9.15/src/os/unix/ngx_socket.h (from vendor/nginx-1.9.12/src/os/unix/ngx_socket.h) vendor/nginx-1.9.15/src/os/unix/ngx_solaris.h (from vendor/nginx-1.9.12/src/os/unix/ngx_solaris.h) vendor/nginx-1.9.15/src/os/unix/ngx_solaris_config.h (from vendor/nginx-1.9.12/src/os/unix/ngx_solaris_config.h) vendor/nginx-1.9.15/src/os/unix/ngx_solaris_init.c (from vendor/nginx-1.9.12/src/os/unix/ngx_solaris_init.c) vendor/nginx-1.9.15/src/os/unix/ngx_solaris_sendfilev_chain.c (from vendor/nginx-1.9.12/src/os/unix/ngx_solaris_sendfilev_chain.c) vendor/nginx-1.9.15/src/os/unix/ngx_sunpro_amd64.il (from vendor/nginx-1.9.12/src/os/unix/ngx_sunpro_amd64.il) vendor/nginx-1.9.15/src/os/unix/ngx_sunpro_atomic_sparc64.h (from vendor/nginx-1.9.12/src/os/unix/ngx_sunpro_atomic_sparc64.h) vendor/nginx-1.9.15/src/os/unix/ngx_sunpro_sparc64.il (from vendor/nginx-1.9.12/src/os/unix/ngx_sunpro_sparc64.il) vendor/nginx-1.9.15/src/os/unix/ngx_sunpro_x86.il (from vendor/nginx-1.9.12/src/os/unix/ngx_sunpro_x86.il) vendor/nginx-1.9.15/src/os/unix/ngx_thread.h (from vendor/nginx-1.9.12/src/os/unix/ngx_thread.h) vendor/nginx-1.9.15/src/os/unix/ngx_thread_cond.c (from vendor/nginx-1.9.12/src/os/unix/ngx_thread_cond.c) vendor/nginx-1.9.15/src/os/unix/ngx_thread_id.c (from vendor/nginx-1.9.12/src/os/unix/ngx_thread_id.c) vendor/nginx-1.9.15/src/os/unix/ngx_thread_mutex.c (from vendor/nginx-1.9.12/src/os/unix/ngx_thread_mutex.c) vendor/nginx-1.9.15/src/os/unix/ngx_time.c (from vendor/nginx-1.9.12/src/os/unix/ngx_time.c) vendor/nginx-1.9.15/src/os/unix/ngx_time.h (from vendor/nginx-1.9.12/src/os/unix/ngx_time.h) vendor/nginx-1.9.15/src/os/unix/ngx_udp_recv.c (from vendor/nginx-1.9.12/src/os/unix/ngx_udp_recv.c) vendor/nginx-1.9.15/src/os/unix/ngx_user.c (from vendor/nginx-1.9.12/src/os/unix/ngx_user.c) vendor/nginx-1.9.15/src/os/unix/ngx_user.h (from vendor/nginx-1.9.12/src/os/unix/ngx_user.h) vendor/nginx-1.9.15/src/os/unix/ngx_writev_chain.c (from vendor/nginx-1.9.12/src/os/unix/ngx_writev_chain.c) vendor/nginx-1.9.15/src/os/win32/nginx.ico (from vendor/nginx-1.9.12/src/os/win32/nginx.ico) vendor/nginx-1.9.15/src/os/win32/nginx.rc (from vendor/nginx-1.9.12/src/os/win32/nginx.rc) vendor/nginx-1.9.15/src/os/win32/nginx_icon16.xpm (from vendor/nginx-1.9.12/src/os/win32/nginx_icon16.xpm) vendor/nginx-1.9.15/src/os/win32/nginx_icon32.xpm (from vendor/nginx-1.9.12/src/os/win32/nginx_icon32.xpm) vendor/nginx-1.9.15/src/os/win32/nginx_icon48.xpm (from vendor/nginx-1.9.12/src/os/win32/nginx_icon48.xpm) vendor/nginx-1.9.15/src/os/win32/ngx_alloc.c (from vendor/nginx-1.9.12/src/os/win32/ngx_alloc.c) vendor/nginx-1.9.15/src/os/win32/ngx_alloc.h (from vendor/nginx-1.9.12/src/os/win32/ngx_alloc.h) vendor/nginx-1.9.15/src/os/win32/ngx_atomic.h (from vendor/nginx-1.9.12/src/os/win32/ngx_atomic.h) vendor/nginx-1.9.15/src/os/win32/ngx_dlopen.c (from vendor/nginx-1.9.12/src/os/win32/ngx_dlopen.c) vendor/nginx-1.9.15/src/os/win32/ngx_dlopen.h (from vendor/nginx-1.9.12/src/os/win32/ngx_dlopen.h) vendor/nginx-1.9.15/src/os/win32/ngx_errno.c (from vendor/nginx-1.9.12/src/os/win32/ngx_errno.c) vendor/nginx-1.9.15/src/os/win32/ngx_errno.h (from vendor/nginx-1.9.12/src/os/win32/ngx_errno.h) vendor/nginx-1.9.15/src/os/win32/ngx_event_log.c (from vendor/nginx-1.9.12/src/os/win32/ngx_event_log.c) vendor/nginx-1.9.15/src/os/win32/ngx_files.c (from vendor/nginx-1.9.12/src/os/win32/ngx_files.c) vendor/nginx-1.9.15/src/os/win32/ngx_files.h (from vendor/nginx-1.9.12/src/os/win32/ngx_files.h) vendor/nginx-1.9.15/src/os/win32/ngx_os.h (from vendor/nginx-1.9.12/src/os/win32/ngx_os.h) vendor/nginx-1.9.15/src/os/win32/ngx_process.c (from vendor/nginx-1.9.12/src/os/win32/ngx_process.c) vendor/nginx-1.9.15/src/os/win32/ngx_process.h (from vendor/nginx-1.9.12/src/os/win32/ngx_process.h) vendor/nginx-1.9.15/src/os/win32/ngx_process_cycle.c (from vendor/nginx-1.9.12/src/os/win32/ngx_process_cycle.c) vendor/nginx-1.9.15/src/os/win32/ngx_process_cycle.h (from vendor/nginx-1.9.12/src/os/win32/ngx_process_cycle.h) vendor/nginx-1.9.15/src/os/win32/ngx_service.c (from vendor/nginx-1.9.12/src/os/win32/ngx_service.c) vendor/nginx-1.9.15/src/os/win32/ngx_shmem.c (from vendor/nginx-1.9.12/src/os/win32/ngx_shmem.c) vendor/nginx-1.9.15/src/os/win32/ngx_shmem.h (from vendor/nginx-1.9.12/src/os/win32/ngx_shmem.h) vendor/nginx-1.9.15/src/os/win32/ngx_socket.c (from vendor/nginx-1.9.12/src/os/win32/ngx_socket.c) vendor/nginx-1.9.15/src/os/win32/ngx_socket.h (from vendor/nginx-1.9.12/src/os/win32/ngx_socket.h) vendor/nginx-1.9.15/src/os/win32/ngx_stat.c (from vendor/nginx-1.9.12/src/os/win32/ngx_stat.c) vendor/nginx-1.9.15/src/os/win32/ngx_thread.c (from vendor/nginx-1.9.12/src/os/win32/ngx_thread.c) vendor/nginx-1.9.15/src/os/win32/ngx_thread.h (from vendor/nginx-1.9.12/src/os/win32/ngx_thread.h) vendor/nginx-1.9.15/src/os/win32/ngx_time.c (from vendor/nginx-1.9.12/src/os/win32/ngx_time.c) vendor/nginx-1.9.15/src/os/win32/ngx_time.h (from vendor/nginx-1.9.12/src/os/win32/ngx_time.h) vendor/nginx-1.9.15/src/os/win32/ngx_udp_wsarecv.c (from vendor/nginx-1.9.12/src/os/win32/ngx_udp_wsarecv.c) vendor/nginx-1.9.15/src/os/win32/ngx_user.c (from vendor/nginx-1.9.12/src/os/win32/ngx_user.c) vendor/nginx-1.9.15/src/os/win32/ngx_user.h (from vendor/nginx-1.9.12/src/os/win32/ngx_user.h) vendor/nginx-1.9.15/src/os/win32/ngx_win32_config.h (from vendor/nginx-1.9.12/src/os/win32/ngx_win32_config.h) vendor/nginx-1.9.15/src/os/win32/ngx_win32_init.c (from vendor/nginx-1.9.12/src/os/win32/ngx_win32_init.c) vendor/nginx-1.9.15/src/os/win32/ngx_wsarecv.c (from vendor/nginx-1.9.12/src/os/win32/ngx_wsarecv.c) vendor/nginx-1.9.15/src/os/win32/ngx_wsarecv_chain.c (from vendor/nginx-1.9.12/src/os/win32/ngx_wsarecv_chain.c) vendor/nginx-1.9.15/src/os/win32/ngx_wsasend.c (from vendor/nginx-1.9.12/src/os/win32/ngx_wsasend.c) vendor/nginx-1.9.15/src/os/win32/ngx_wsasend_chain.c (from vendor/nginx-1.9.12/src/os/win32/ngx_wsasend_chain.c) vendor/nginx-1.9.15/src/stream/ngx_stream.c (from vendor/nginx-1.9.12/src/stream/ngx_stream.c) vendor/nginx-1.9.15/src/stream/ngx_stream.h (from vendor/nginx-1.9.12/src/stream/ngx_stream.h) vendor/nginx-1.9.15/src/stream/ngx_stream_access_module.c (from vendor/nginx-1.9.12/src/stream/ngx_stream_access_module.c) vendor/nginx-1.9.15/src/stream/ngx_stream_core_module.c (from vendor/nginx-1.9.12/src/stream/ngx_stream_core_module.c) vendor/nginx-1.9.15/src/stream/ngx_stream_handler.c (from vendor/nginx-1.9.12/src/stream/ngx_stream_handler.c) vendor/nginx-1.9.15/src/stream/ngx_stream_limit_conn_module.c (from vendor/nginx-1.9.12/src/stream/ngx_stream_limit_conn_module.c) vendor/nginx-1.9.15/src/stream/ngx_stream_proxy_module.c (from vendor/nginx-1.9.12/src/stream/ngx_stream_proxy_module.c) vendor/nginx-1.9.15/src/stream/ngx_stream_ssl_module.c (from vendor/nginx-1.9.12/src/stream/ngx_stream_ssl_module.c) vendor/nginx-1.9.15/src/stream/ngx_stream_ssl_module.h (from vendor/nginx-1.9.12/src/stream/ngx_stream_ssl_module.h) vendor/nginx-1.9.15/src/stream/ngx_stream_upstream.c (from vendor/nginx-1.9.12/src/stream/ngx_stream_upstream.c) vendor/nginx-1.9.15/src/stream/ngx_stream_upstream.h (from vendor/nginx-1.9.12/src/stream/ngx_stream_upstream.h) vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_hash_module.c (from vendor/nginx-1.9.12/src/stream/ngx_stream_upstream_hash_module.c) vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_least_conn_module.c (from vendor/nginx-1.9.12/src/stream/ngx_stream_upstream_least_conn_module.c) vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_round_robin.c (from vendor/nginx-1.9.12/src/stream/ngx_stream_upstream_round_robin.c) vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_round_robin.h (from vendor/nginx-1.9.12/src/stream/ngx_stream_upstream_round_robin.h) vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_zone_module.c (from vendor/nginx-1.9.12/src/stream/ngx_stream_upstream_zone_module.c) Modified: nginx_version (+1 -1) =================================================================== --- nginx_version 2016-04-20 22:22:29 +0900 (1fe2d37) +++ nginx_version 2016-04-21 23:49:50 +0900 (1bcb9da) @@ -1 +1 @@ -1.9.12 +1.9.15 Deleted: vendor/nginx-1.9.12/src/mysql/config (+0 -13) 100644 =================================================================== --- vendor/nginx-1.9.12/src/mysql/config 2016-04-20 22:22:29 +0900 (cdec639) +++ /dev/null @@ -1,13 +0,0 @@ - -ngx_addon_name=ngx_mysql - -HTTP_MODULES="$HTTP_MODULES ngx_http_mysql_test_module" - -HTTP_INCS="$HTTP_INCS $ngx_addon_dir" -HTTP_DEPS="$HTTP_DEPS $ngx_addon_dir/ngx_mysql.h" -#CORE_LIBS="$CORE_LIBS -lmd" - -USE_SHA1=YES - -NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_mysql.c" -NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_mysql_test.c" Deleted: vendor/nginx-1.9.12/src/mysql/ngx_http_mysql_test.c (+0 -204) 100644 =================================================================== --- vendor/nginx-1.9.12/src/mysql/ngx_http_mysql_test.c 2016-04-20 22:22:29 +0900 (5303db9) +++ /dev/null @@ -1,204 +0,0 @@ - -/* - * Copyright (C) Igor Sysoev - * Copyright (C) Nginx, Inc. - */ - -#include <ngx_config.h> -#include <ngx_core.h> -#include <ngx_mysql.h> -#include <ngx_http.h> - - -typedef struct { - ngx_addr_t *peers; - ngx_uint_t npeers; -} ngx_http_mysql_test_conf_t; - - -static void ngx_http_mysql_auth(ngx_mysql_t *m); -static void ngx_http_mysql_done(ngx_mysql_t *m); -static void *ngx_http_mysql_test_create_loc_conf(ngx_conf_t *cf); -static char *ngx_http_mysql_test(ngx_conf_t *cf, ngx_command_t *cmd, - void *conf); - -static ngx_command_t ngx_http_mysql_test_commands[] = { - - { ngx_string("mysql_test"), - NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, - ngx_http_mysql_test, - NGX_HTTP_LOC_CONF_OFFSET, - 0, - NULL }, - - ngx_null_command -}; - - -static ngx_http_module_t ngx_http_mysql_test_module_ctx = { - NULL, /* preconfiguration */ - NULL, /* postconfiguration */ - - NULL, /* create main configuration */ - NULL, /* init main configuration */ - - NULL, /* create server configuration */ - NULL, /* merge server configuration */ - - ngx_http_mysql_test_create_loc_conf, /* create location configuration */ - NULL /* merge location configuration */ -}; - - -ngx_module_t ngx_http_mysql_test_module = { - NGX_MODULE_V1, - &ngx_http_mysql_test_module_ctx, /* module context */ - ngx_http_mysql_test_commands, /* module directives */ - NGX_HTTP_MODULE, /* module type */ - NULL, /* init master */ - NULL, /* init module */ - NULL, /* init process */ - NULL, /* init thread */ - NULL, /* exit thread */ - NULL, /* exit process */ - NULL, /* exit master */ - NGX_MODULE_V1_PADDING -}; - - -static ngx_str_t ngx_mysql_login = ngx_string("root"); -static ngx_str_t ngx_mysql_passwd = ngx_string("tp"); -static ngx_str_t ngx_mysql_database = ngx_string("mysql"); -static ngx_str_t ngx_mysql_command_query = - ngx_string("select * from user"); - - -static ngx_int_t -ngx_http_mysql_test_handler(ngx_http_request_t *r) -{ - ngx_int_t rc; - ngx_mysql_t *m; - ngx_http_mysql_test_conf_t *mtcf; - - mtcf = ngx_http_get_module_loc_conf(r, ngx_http_mysql_test_module); - - m = ngx_pcalloc(r->pool, sizeof(ngx_mysql_t)); - - if (m == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - - m->pool = r->pool; - m->handler = ngx_http_mysql_auth; - m->data = r; - - m->login = &ngx_mysql_login; - m->passwd = &ngx_mysql_passwd; - m->database = &ngx_mysql_database; - - /* STUB */ - m->peer.sockaddr = mtcf->peers[0].sockaddr; - m->peer.socklen = mtcf->peers[0].socklen; - m->peer.name = &mtcf->peers[0].name; - m->peer.tries = mtcf->npeers; - m->peer.get = ngx_event_get_peer; - /**/ - m->peer.log = r->connection->log; - m->peer.log_error = NGX_ERROR_ERR; - - rc = ngx_mysql_connect(m); - - if (rc == NGX_OK || rc == NGX_AGAIN) { - return NGX_DONE; - } - - return NGX_HTTP_INTERNAL_SERVER_ERROR; -} - - -static void -ngx_http_mysql_auth(ngx_mysql_t *m) -{ - ngx_http_request_t *r; - - r = m->data; - - if (m->state != NGX_OK) { - ngx_http_finalize_request(r, NGX_HTTP_NO_CONTENT); - return; - } - - m->query.len = NGX_MYSQL_CMDPKT_LEN + ngx_mysql_command_query.len; - - m->query.data = ngx_pnalloc(r->pool, m->query.len); - if (m->query.data == NULL) { - ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); - return; - } - - ngx_memcpy(m->query.data + NGX_MYSQL_CMDPKT_LEN, - ngx_mysql_command_query.data, ngx_mysql_command_query.len); - - m->handler = ngx_http_mysql_done; - - ngx_mysql_query(m); -} - - -static void -ngx_http_mysql_done(ngx_mysql_t *m) -{ - ngx_http_request_t *r; - - r = m->data; - - ngx_http_finalize_request(r, NGX_HTTP_NO_CONTENT); -} - - -static void * -ngx_http_mysql_test_create_loc_conf(ngx_conf_t *cf) -{ - ngx_http_mysql_test_conf_t *conf; - - conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_mysql_test_conf_t)); - if (conf == NULL) { - return NGX_CONF_ERROR; - } - - return conf; -} - -static char * -ngx_http_mysql_test(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) -{ - ngx_http_mysql_test_conf_t *mtcf = conf; - - ngx_str_t *value; - ngx_url_t u; - ngx_http_core_loc_conf_t *clcf; - - clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); - clcf->handler = ngx_http_mysql_test_handler; - - value = cf->args->elts; - - ngx_memzero(&u, sizeof(ngx_url_t)); - - u.url = value[1]; - u.default_port = 3306; - - if (ngx_parse_url(cf->pool, &u) != NGX_OK) { - if (u.err) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "%s in upstream \"%V\"", u.err, &u.url); - } - - return NGX_CONF_ERROR; - } - - mtcf->peers = u.addrs; - mtcf->npeers = u.naddrs; - - return NGX_CONF_OK; -} Deleted: vendor/nginx-1.9.12/src/mysql/ngx_mysql.c (+0 -465) 100644 =================================================================== --- vendor/nginx-1.9.12/src/mysql/ngx_mysql.c 2016-04-20 22:22:29 +0900 (60647ec) +++ /dev/null @@ -1,465 +0,0 @@ - -/* - * Copyright (C) Igor Sysoev - * Copyright (C) Nginx, Inc. - */ - - -/* the library supports the subset of the MySQL 4.1+ protocol (version 10) */ - - -#include <ngx_config.h> -#include <ngx_core.h> -#include <ngx_event.h> -#include <ngx_event_connect.h> -#include <ngx_mysql.h> -#include <ngx_sha1.h> - - -#define NGX_MYSQL_LONG_PASSWORD 0x0001 -#define NGX_MYSQL_CONNECT_WITH_DB 0x0008 -#define NGX_MYSQL_PROTOCOL_41 0x0200 -#define NGX_MYSQL_SECURE_CONNECTION 0x8000 - - -#define NGX_MYSQL_CMD_QUERY 3 - - -typedef struct { - u_char pktlen[3]; - u_char pktn; - - u_char protocol; - u_char version[1]; /* NULL-terminated string */ -} ngx_mysql_greeting1_pkt_t; - - -typedef struct { - u_char thread[4]; - u_char salt1[9]; - u_char capacity[2]; - u_char charset; - u_char status[2]; - u_char zero[13]; - u_char salt2[13]; -} ngx_mysql_greeting2_pkt_t; - - -typedef struct { - u_char pktlen[3]; - u_char pktn; - - u_char capacity[4]; - u_char max_packet[4]; - u_char charset; - u_char zero[23]; - u_char login[1]; /* NULL-terminated string */ - - /* - * u_char passwd_len; 0 if no password - * u_char passwd[20]; - * - * u_char database[1]; NULL-terminated string - */ - -} ngx_mysql_auth_pkt_t; - - -typedef struct { - u_char pktlen[3]; - u_char pktn; - u_char fields; -} ngx_mysql_response_pkt_t; - - -typedef struct { - u_char pktlen[3]; - u_char pktn; - u_char err; - u_char code[2]; - u_char message[1]; /* string */ -} ngx_mysql_error_pkt_t; - - -typedef struct { - u_char pktlen[3]; - u_char pktn; - u_char command; - u_char arg[1]; /* string */ -} ngx_mysql_command_pkt_t; - - -static void ngx_mysql_read_server_greeting(ngx_event_t *rev); -static void ngx_mysql_empty_handler(ngx_event_t *wev); -static void ngx_mysql_read_auth_result(ngx_event_t *rev); -static void ngx_mysql_read_query_result(ngx_event_t *rev); -static void ngx_mysql_close(ngx_mysql_t *m, ngx_int_t rc); - - -ngx_int_t -ngx_mysql_connect(ngx_mysql_t *m) -{ - ngx_int_t rc; - -#if 0 - if (cached) { - return NGX_OK; - } -#endif - - m->peer.log->action = "connecting to mysql server"; - - rc = ngx_event_connect_peer(&m->peer); - - if (rc == NGX_ERROR || rc == NGX_BUSY || rc == NGX_DECLINED) { - return rc; - } - - m->peer.connection->data = m; - - m->peer.connection->read->handler = ngx_mysql_read_server_greeting; - m->peer.connection->write->handler = ngx_mysql_empty_handler; - - ngx_add_timer(m->peer.connection->read, /* STUB */ 5000); - - return NGX_OK; -} - - -static void -ngx_mysql_read_server_greeting(ngx_event_t *rev) -{ - size_t len; - u_char *p; - ssize_t n; - ngx_uint_t i, capacity; - ngx_mysql_t *m; - ngx_connection_t *c; - ngx_mysql_greeting1_pkt_t *gr1; - ngx_mysql_greeting2_pkt_t *gr2; - ngx_mysql_auth_pkt_t *auth; - ngx_sha1_t sha; - u_char hash1[20], hash2[20]; - - c = rev->data; - m = c->data; - - if (rev->timedout) { - ngx_log_error(NGX_LOG_ERR, rev->log, NGX_ETIMEDOUT, - "mysql server %V timed out", m->peer.name); - - ngx_mysql_close(m, NGX_ERROR); - return; - } - - if (m->buf == NULL) { - m->peer.log->action = "reading mysql server greeting"; - - m->buf = ngx_create_temp_buf(m->pool, /* STUB */ 1024); - if (m->buf == NULL) { - ngx_mysql_close(m, NGX_ERROR); - return; - } - } - - n = ngx_recv(m->peer.connection, m->buf->pos, /* STUB */ 1024); - - if (n == NGX_AGAIN) { - return; - } - - if (n < 5) { - ngx_mysql_close(m, NGX_ERROR); - return; - } - - gr1 = (ngx_mysql_greeting1_pkt_t *) m->buf->pos; - - if (ngx_m24toh(gr1->pktlen) > n - 4) { - ngx_log_error(NGX_LOG_ERR, rev->log, 0, - "mysql server %V sent incomplete greeting packet", - m->peer.name); - - ngx_mysql_close(m, NGX_ERROR); - return; - } - - if (gr1->protocol < 10) { - ngx_log_error(NGX_LOG_ERR, rev->log, 0, - "mysql server %V sent unsupported protocol version %ud", - m->peer.name, gr1->protocol); - - ngx_mysql_close(m, NGX_ERROR); - return; - } - - gr2 = (ngx_mysql_greeting2_pkt_t *) - (gr1->version + ngx_strlen(gr1->version) + 1); - - capacity = ngx_m16toh(gr2->capacity); - - ngx_log_debug8(NGX_LOG_DEBUG_MYSQL, rev->log, 0, - "mysql version: %ud, \"%s\", thread: %ud, salt: \"%s\", " - "capacity: %Xd, charset: %ud, status: %ud, salt rest \"%s\"", - gr1->protocol, gr1->version, ngx_m32toh(gr2->thread), - gr2->salt1, capacity, gr2->charset, - ngx_m16toh(gr2->status), &gr2->salt2); - - capacity = NGX_MYSQL_LONG_PASSWORD - | NGX_MYSQL_CONNECT_WITH_DB - | NGX_MYSQL_PROTOCOL_41 - | NGX_MYSQL_SECURE_CONNECTION; - - len = 4 + 4 + 4 + 1 + 23 + m->login->len + 1 + 1 + m->database->len + 1; - - if (m->passwd->len) { - len += 20; - } - - auth = ngx_pnalloc(m->pool, len); - if (auth == NULL) { - ngx_mysql_close(m, NGX_ERROR); - return; - } - - ngx_htom24(auth->pktlen, len - 4); - auth->pktn = (u_char) (gr1->pktn + 1); - - ngx_htom32(auth->capacity, capacity); - ngx_htom32(auth->max_packet, 0x01000000); /* max packet size 2^24 */ - ngx_memzero(auth->zero, 24); - auth->charset = gr2->charset; - - p = ngx_copy(auth->login, m->login->data, m->login->len); - *p++ = '\0'; - - if (m->passwd->len) { - - *p++ = (u_char) 20; - - ngx_sha1_init(&sha); - ngx_sha1_update(&sha, m->passwd->data, m->passwd->len); - ngx_sha1_final(hash1, &sha); - - ngx_sha1_init(&sha); - ngx_sha1_update(&sha, hash1, 20); - ngx_sha1_final(hash2, &sha); - - ngx_sha1_init(&sha); - ngx_sha1_update(&sha, gr2->salt1, 8); - ngx_sha1_update(&sha, gr2->salt2, 12); - ngx_sha1_update(&sha, hash2, 20); - ngx_sha1_final(hash2, &sha); - - for (i = 0; i < 20; i++) { - *p++ = (u_char) (hash1[i] ^ hash2[i]); - } - - } else { - *p++ = '\0'; - } - - p = ngx_copy(p, m->database->data, m->database->len); - *p = '\0'; - - - n = ngx_send(m->peer.connection, (void *) auth, len); - - if (n < (ssize_t) len) { - ngx_log_error(NGX_LOG_ERR, rev->log, 0, - "the incomplete packet was sent to mysql server %V", - m->peer.name); - - ngx_mysql_close(m, NGX_ERROR); - return; - } - - m->peer.connection->read->handler = ngx_mysql_read_auth_result; - - ngx_add_timer(m->peer.connection->read, /* STUB */ 5000); -} - - -static void -ngx_mysql_empty_handler(ngx_event_t *wev) -{ - ngx_log_debug0(NGX_LOG_DEBUG_HTTP, wev->log, 0, "mysql empty handler"); - - return; -} - - -static void -ngx_mysql_read_auth_result(ngx_event_t *rev) -{ - ssize_t n, len; - ngx_str_t msg; - ngx_mysql_t *m; - ngx_connection_t *c; - ngx_mysql_error_pkt_t *epkt; - ngx_mysql_response_pkt_t *pkt; - - ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, "mysql read auth"); - - c = rev->data; - m = c->data; - - m->peer.log->action = "reading mysql auth result"; - - n = ngx_recv(m->peer.connection, m->buf->pos, /* STUB */ 1024); - - if (n == NGX_AGAIN) { - return; - } - - if (n < 5) { - ngx_mysql_close(m, NGX_ERROR); - return; - } - - pkt = (ngx_mysql_response_pkt_t *) m->buf->pos; - - len = ngx_m24toh(pkt->pktlen); - - if (len > n - 4) { - ngx_log_error(NGX_LOG_ERR, rev->log, 0, - "mysql server %V sent incomplete response packet", - m->peer.name); - - ngx_mysql_close(m, NGX_ERROR); - return; - } - - if (pkt->fields == 0) { - ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, "mysql auth OK"); - - m->state = NGX_OK; - m->pktn = 0; - - m->handler(m); - - return; - } - - epkt = (ngx_mysql_error_pkt_t *) pkt; - - msg.len = (u_char *) epkt + 4 + len - epkt->message; - msg.data = epkt->message; - - ngx_log_error(NGX_LOG_ERR, rev->log, 0, - "mysql server %V sent error (%ud): \"%V\"", - m->peer.name, ngx_m16toh(epkt->code), &msg); - - ngx_mysql_close(m, NGX_ERROR); -} - - -ngx_int_t -ngx_mysql_query(ngx_mysql_t *m) -{ - ssize_t n; - ngx_mysql_command_pkt_t *pkt; - - pkt = (ngx_mysql_command_pkt_t *) m->query.data; - - ngx_htom24(pkt->pktlen, m->query.len - 4); - pkt->pktn = (u_char) m->pktn++; - pkt->command = NGX_MYSQL_CMD_QUERY; - - n = ngx_send(m->peer.connection, m->query.data, m->query.len); - - if (n < (ssize_t) m->query.len) { - ngx_log_error(NGX_LOG_ERR, m->peer.log, 0, - "the incomplete packet was sent to mysql server %V", - m->peer.name); - - ngx_mysql_close(m, NGX_ERROR); - return NGX_OK; - } - - m->peer.connection->read->handler = ngx_mysql_read_query_result; - - ngx_add_timer(m->peer.connection->read, /* STUB */ 5000); - - /* STUB handle event */ - - return NGX_OK; -} - - -static void -ngx_mysql_read_query_result(ngx_event_t *rev) -{ - ssize_t n, len; - ngx_str_t msg; - ngx_mysql_t *m; - ngx_connection_t *c; - ngx_mysql_error_pkt_t *epkt; - ngx_mysql_response_pkt_t *pkt; - - ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, "mysql read query result"); - - c = rev->data; - m = c->data; - - m->peer.log->action = "reading mysql read query result"; - - n = ngx_recv(m->peer.connection, m->buf->pos, /* STUB */ 1024); - - if (n == NGX_AGAIN) { - return; - } - - if (n < 5) { - ngx_mysql_close(m, NGX_ERROR); - return; - } - - pkt = (ngx_mysql_response_pkt_t *) m->buf->pos; - - len = ngx_m24toh(pkt->pktlen); - - if (len > n - 4) { - ngx_log_error(NGX_LOG_ERR, rev->log, 0, - "mysql server %V sent incomplete response packet", - m->peer.name); - - ngx_mysql_close(m, NGX_ERROR); - return; - } - - if (pkt->fields != 0xff) { - ngx_log_debug0(NGX_LOG_DEBUG_HTTP, rev->log, 0, "mysql query OK"); - - m->state = NGX_OK; - m->pktn = pkt->pktn; - - m->handler(m); - - return; - } - - epkt = (ngx_mysql_error_pkt_t *) pkt; - - msg.len = (u_char *) epkt + 4 + len - epkt->message; - msg.data = epkt->message; - - ngx_log_error(NGX_LOG_ERR, rev->log, 0, - "mysql server %V sent error (%ud): \"%V\"", - m->peer.name, ngx_m16toh(epkt->code), &msg); - - ngx_mysql_close(m, NGX_ERROR); -} - - -static void -ngx_mysql_close(ngx_mysql_t *m, ngx_int_t rc) -{ - if (rc == NGX_ERROR) { - ngx_close_connection(m->peer.connection); - } - - m->state = rc; - - m->handler(m); -} Deleted: vendor/nginx-1.9.12/src/mysql/ngx_mysql.h (+0 -85) 100644 =================================================================== --- vendor/nginx-1.9.12/src/mysql/ngx_mysql.h 2016-04-20 22:22:29 +0900 (cc2e255) +++ /dev/null @@ -1,85 +0,0 @@ - -/* - * Copyright (C) Igor Sysoev - * Copyright (C) Nginx, Inc. - */ - - -#ifndef _NGX_MYSQL_H_INCLUDED_ -#define _NGX_MYSQL_H_INCLUDED_ - - -#include <ngx_config.h> -#include <ngx_core.h> -#include <ngx_event.h> -#include <ngx_event_connect.h> - - -typedef struct ngx_mysql_s ngx_mysql_t; - -typedef void (*ngx_mysql_handler_pt)(ngx_mysql_t *m); - - -struct ngx_mysql_s { - ngx_peer_connection_t peer; - - ngx_buf_t *buf; - ngx_pool_t *pool; - - ngx_str_t *login; - ngx_str_t *passwd; - ngx_str_t *database; - - ngx_str_t query; - - ngx_uint_t pktn; - - ngx_mysql_handler_pt handler; - void *data; - ngx_int_t state; - -}; - - -#define NGX_MYSQL_CMDPKT_LEN 5 - - -#if (NGX_HAVE_LITTLE_ENDIAN && NGX_HAVE_NONALIGNED && 0) - -#define ngx_m16toh(n) (*(uint32_t *) n & 0x0000ffff) -#define ngx_m24toh(n) (*(uint32_t *) n & 0x00ffffff) -#define ngx_m32toh(n) *(uint32_t *) n - -#define ngx_htom16(n, m) *(uint16_t *) n = (uint16_t) ((m) & 0xffff) - -#define ngx_htom24(n, m) (n)[0] = (u_char) ((m) & 0xff); \ - (n)[1] = (u_char) (((m) >> 8) & 0xff); \ - (n)[2] = (u_char) (((m) >> 16) & 0xff) - -#define ngx_htom32(n, m) *(uint32_t *) (n) = (m) - -#else - -#define ngx_m16toh(n) (n[0] | n[1] << 8) -#define ngx_m24toh(n) (n[0] | n[1] << 8 | n[2] << 16) -#define ngx_m32toh(n) (n[0] | n[1] << 8 | n[2] << 16 | n[3] << 24) - -#define ngx_htom16(n, m) (n)[0] = (u_char) (m); (n)[1] = (u_char) ((m) >> 8) - -#define ngx_htom24(n, m) (n)[0] = (u_char) ((m) & 0xff); \ - (n)[1] = (u_char) (((m) >> 8) & 0xff); \ - (n)[2] = (u_char) (((m) >> 16) & 0xff) - -#define ngx_htom32(n, m) (n)[0] = (u_char) ((m) & 0xff); \ - (n)[1] = (u_char) (((m) >> 8) & 0xff); \ - (n)[2] = (u_char) (((m) >> 16) & 0xff); \ - (n)[3] = (u_char) (((m) >> 24) & 0xff) - -#endif - - -ngx_int_t ngx_mysql_connect(ngx_mysql_t *m); -ngx_int_t ngx_mysql_query(ngx_mysql_t *m); - - -#endif /* _NGX_MYSQL_H_INCLUDED_ */ Renamed: vendor/nginx-1.9.15/auto/cc/acc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/cc/bcc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/cc/ccc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/cc/clang (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/cc/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/cc/gcc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/cc/icc (+2 -2) 95% =================================================================== --- vendor/nginx-1.9.12/auto/cc/icc 2016-04-20 22:22:29 +0900 (1d83ed3) +++ vendor/nginx-1.9.15/auto/cc/icc 2016-04-21 23:49:50 +0900 (1c0df1a) @@ -89,7 +89,7 @@ CFLAGS="$CFLAGS -wd1419" case "$NGX_ICC_VER" in 9.*) - # "cc" clobber ignored, warnings for Liunx's htonl()/htons() + # "cc" clobber ignored, warnings for Linux's htonl()/htons() CFLAGS="$CFLAGS -wd1469" # explicit conversion of a 64-bit integral type to a smaller # integral type @@ -103,7 +103,7 @@ case "$NGX_ICC_VER" in ;; 8.*) - # "cc" clobber ignored, warnings for Liunx's htonl()/htons() + # "cc" clobber ignored, warnings for Linux's htonl()/htons() CFLAGS="$CFLAGS -wd1469" # floating-point equality and inequality comparisons are unreliable, # warning on SvTRUE() Renamed: vendor/nginx-1.9.15/auto/cc/msvc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/cc/name (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/cc/owc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/cc/sunc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/configure (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/define (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/endianness (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/feature (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/have (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/have_headers (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/headers (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/include (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/init (+0 -1) 98% =================================================================== --- vendor/nginx-1.9.12/auto/init 2016-04-20 22:22:29 +0900 (c593eda) +++ vendor/nginx-1.9.15/auto/init 2016-04-21 23:49:50 +0900 (910f529) @@ -5,7 +5,6 @@ NGX_MAKEFILE=$NGX_OBJS/Makefile NGX_MODULES_C=$NGX_OBJS/ngx_modules.c -NGX_MODULES= NGX_AUTO_HEADERS_H=$NGX_OBJS/ngx_auto_headers.h NGX_AUTO_CONFIG_H=$NGX_OBJS/ngx_auto_config.h Renamed: vendor/nginx-1.9.15/auto/install (+40 -23) 70% =================================================================== --- vendor/nginx-1.9.12/auto/install 2016-04-20 22:22:29 +0900 (9469a49) +++ vendor/nginx-1.9.15/auto/install 2016-04-21 23:49:50 +0900 (d884487) @@ -3,7 +3,7 @@ # Copyright (C) Nginx, Inc. -if [ $USE_PERL = YES ]; then +if [ $USE_PERL != NO ]; then cat << END >> $NGX_MAKEFILE @@ -107,54 +107,54 @@ $NGX_OBJS/nginx.8: $NGX_MAN $NGX_AUTO_CONFIG_H install: build $NGX_INSTALL_PERL_MODULES test -d '\$(DESTDIR)$NGX_PREFIX' || mkdir -p '\$(DESTDIR)$NGX_PREFIX' - test -d '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`' \ + test -d '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`' \\ || mkdir -p '\$(DESTDIR)`dirname "$NGX_SBIN_PATH"`' - test ! -f '\$(DESTDIR)$NGX_SBIN_PATH' \ - || mv '\$(DESTDIR)$NGX_SBIN_PATH' \ + test ! -f '\$(DESTDIR)$NGX_SBIN_PATH' \\ + || mv '\$(DESTDIR)$NGX_SBIN_PATH' \\ '\$(DESTDIR)$NGX_SBIN_PATH.old' cp $NGX_OBJS/nginx '\$(DESTDIR)$NGX_SBIN_PATH' - test -d '\$(DESTDIR)$NGX_CONF_PREFIX' \ + test -d '\$(DESTDIR)$NGX_CONF_PREFIX' \\ || mkdir -p '\$(DESTDIR)$NGX_CONF_PREFIX' cp conf/koi-win '\$(DESTDIR)$NGX_CONF_PREFIX' cp conf/koi-utf '\$(DESTDIR)$NGX_CONF_PREFIX' cp conf/win-utf '\$(DESTDIR)$NGX_CONF_PREFIX' - test -f '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types' \ + test -f '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types' \\ || cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX' cp conf/mime.types '\$(DESTDIR)$NGX_CONF_PREFIX/mime.types.default' - test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params' \ + test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params' \\ || cp conf/fastcgi_params '\$(DESTDIR)$NGX_CONF_PREFIX' - cp conf/fastcgi_params \ + cp conf/fastcgi_params \\ '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi_params.default' - test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf' \ + test -f '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf' \\ || cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX' cp conf/fastcgi.conf '\$(DESTDIR)$NGX_CONF_PREFIX/fastcgi.conf.default' - test -f '\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params' \ + test -f '\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params' \\ || cp conf/uwsgi_params '\$(DESTDIR)$NGX_CONF_PREFIX' - cp conf/uwsgi_params \ + cp conf/uwsgi_params \\ '\$(DESTDIR)$NGX_CONF_PREFIX/uwsgi_params.default' - test -f '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params' \ + test -f '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params' \\ || cp conf/scgi_params '\$(DESTDIR)$NGX_CONF_PREFIX' - cp conf/scgi_params \ + cp conf/scgi_params \\ '\$(DESTDIR)$NGX_CONF_PREFIX/scgi_params.default' - test -f '\$(DESTDIR)$NGX_CONF_PATH' \ + test -f '\$(DESTDIR)$NGX_CONF_PATH' \\ || cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PATH' cp conf/nginx.conf '\$(DESTDIR)$NGX_CONF_PREFIX/nginx.conf.default' - test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \ + test -d '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' \\ || mkdir -p '\$(DESTDIR)`dirname "$NGX_PID_PATH"`' - test -d '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' || \ - mkdir -p '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' + test -d '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' \\ + || mkdir -p '\$(DESTDIR)`dirname "$NGX_HTTP_LOG_PATH"`' - test -d '\$(DESTDIR)$NGX_PREFIX/html' \ + test -d '\$(DESTDIR)$NGX_PREFIX/html' \\ || cp -R $NGX_HTML '\$(DESTDIR)$NGX_PREFIX' END @@ -162,24 +162,38 @@ END if test -n "$NGX_ERROR_LOG_PATH"; then cat << END >> $NGX_MAKEFILE - test -d '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' || \ - mkdir -p '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' + test -d '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' \\ + || mkdir -p '\$(DESTDIR)`dirname "$NGX_ERROR_LOG_PATH"`' END fi -if test -n "$NGX_MODULES"; then +if test -n "$DYNAMIC_MODULES"; then cat << END >> $NGX_MAKEFILE - test -d '\$(DESTDIR)$NGX_MODULES_PATH' \ + test -d '\$(DESTDIR)$NGX_MODULES_PATH' \\ || mkdir -p '\$(DESTDIR)$NGX_MODULES_PATH' - cp $NGX_MODULES '\$(DESTDIR)$NGX_MODULES_PATH' END fi +for ngx_module in $DYNAMIC_MODULES +do + ngx_module=$ngx_module$ngx_modext + + cat << END >> $NGX_MAKEFILE + + test ! -f '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' \\ + || mv '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' \\ + '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module.old' + cp $NGX_OBJS/$ngx_module '\$(DESTDIR)$NGX_MODULES_PATH/$ngx_module' +END + +done + + # create Makefile cat << END >> Makefile @@ -190,6 +204,9 @@ build: install: \$(MAKE) -f $NGX_MAKEFILE install +modules: + \$(MAKE) -f $NGX_MAKEFILE modules + upgrade: $NGX_SBIN_PATH -t Renamed: vendor/nginx-1.9.15/auto/lib/conf (+1 -1) 98% =================================================================== --- vendor/nginx-1.9.12/auto/lib/conf 2016-04-20 22:22:29 +0900 (6aaa43a) +++ vendor/nginx-1.9.15/auto/lib/conf 2016-04-21 23:49:50 +0900 (a6242e7) @@ -66,7 +66,7 @@ if [ $USE_LIBGD != NO ]; then . auto/lib/libgd/conf fi -if [ $USE_PERL = YES ]; then +if [ $USE_PERL != NO ]; then . auto/lib/perl/conf fi Renamed: vendor/nginx-1.9.15/auto/lib/geoip/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/google-perftools/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/libatomic/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/libatomic/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/libgd/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/libxslt/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/make (+1 -1) 95% =================================================================== --- vendor/nginx-1.9.12/auto/lib/make 2016-04-20 22:22:29 +0900 (58a84a3) +++ vendor/nginx-1.9.15/auto/lib/make 2016-04-21 23:49:50 +0900 (6298b94) @@ -27,6 +27,6 @@ if [ $NGX_LIBATOMIC != NO -a $NGX_LIBATOMIC != YES ]; then . auto/lib/libatomic/make fi -if [ $USE_PERL = YES ]; then +if [ $USE_PERL != NO ]; then . auto/lib/perl/make fi Renamed: vendor/nginx-1.9.15/auto/lib/md5/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/md5/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/md5/makefile.bcc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/md5/makefile.msvc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/md5/makefile.owc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/openssl/conf (+1 -1) 98% =================================================================== --- vendor/nginx-1.9.12/auto/lib/openssl/conf 2016-04-20 22:22:29 +0900 (e438050) +++ vendor/nginx-1.9.15/auto/lib/openssl/conf 2016-04-21 23:49:50 +0900 (39d9602) @@ -52,7 +52,7 @@ else ngx_feature_incs="#include <openssl/ssl.h>" ngx_feature_path= ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL" - ngx_feature_test="SSL_library_init()" + ngx_feature_test="SSL_CTX_set_options(NULL, 0)" . auto/feature if [ $ngx_found = no ]; then Renamed: vendor/nginx-1.9.15/auto/lib/openssl/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/openssl/makefile.bcc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/openssl/makefile.msvc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/pcre/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/pcre/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/pcre/makefile.bcc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/pcre/makefile.msvc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/pcre/makefile.owc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/perl/conf (+5 -2) 94% =================================================================== --- vendor/nginx-1.9.12/auto/lib/perl/conf 2016-04-20 22:22:29 +0900 (4d1bcf1) +++ vendor/nginx-1.9.15/auto/lib/perl/conf 2016-04-21 23:49:50 +0900 (f5f5d3e) @@ -60,8 +60,11 @@ if test -n "$NGX_PERL_VER"; then | sed -e 's/-arch i386//' -e 's/-arch x86_64//'` fi - CORE_LINK="$CORE_LINK $ngx_perl_ldopts" - LINK_DEPS="$LINK_DEPS $NGX_OBJS/$ngx_perl_module" + if [ $USE_PERL = YES ]; then + CORE_LINK="$CORE_LINK $ngx_perl_ldopts" + fi + + NGX_LIB_PERL="$ngx_perl_ldopts" if test -n "$NGX_PERL_MODULES"; then have=NGX_PERL_MODULES value="(u_char *) \"$NGX_PERL_MODULES\"" Renamed: vendor/nginx-1.9.15/auto/lib/perl/make (+4 -1) 91% =================================================================== --- vendor/nginx-1.9.12/auto/lib/perl/make 2016-04-20 22:22:29 +0900 (d1c1b9e) +++ vendor/nginx-1.9.15/auto/lib/perl/make 2016-04-21 23:49:50 +0900 (8af8902) @@ -8,7 +8,10 @@ v=`grep 'define NGINX_VERSION' src/core/nginx.h | sed -e 's/^.*"\(.*\)".*/\1/'` cat << END >> $NGX_MAKEFILE -$NGX_OBJS/src/http/modules/perl/blib/arch/auto/nginx/nginx.$ngx_perl_dlext: \\ +$NGX_OBJS/src/http/modules/perl/ngx_http_perl_module.o: \\ + $NGX_OBJS/$ngx_perl_module + +$NGX_OBJS/$ngx_perl_module: \\ \$(CORE_DEPS) \$(HTTP_DEPS) \\ src/http/modules/perl/ngx_http_perl_module.h \\ $NGX_OBJS/src/http/modules/perl/Makefile Renamed: vendor/nginx-1.9.15/auto/lib/sha1/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/sha1/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/sha1/makefile.bcc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/sha1/makefile.msvc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/sha1/makefile.owc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/test (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/zlib/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/zlib/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/zlib/makefile.bcc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/zlib/makefile.msvc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/lib/zlib/makefile.owc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/make (+28 -17) 93% =================================================================== --- vendor/nginx-1.9.12/auto/make 2016-04-20 22:22:29 +0900 (560924b) +++ vendor/nginx-1.9.15/auto/make 2016-04-21 23:49:50 +0900 (5589bee) @@ -225,12 +225,12 @@ cat << END >> $NGX_MAKEFILE build: binary modules manpage -binary: $NGX_OBJS${ngx_dirsep}nginx${ngx_binext} +binary: $NGX_OBJS${ngx_dirsep}nginx$ngx_binext -$NGX_OBJS${ngx_dirsep}nginx${ngx_binext}: $ngx_deps$ngx_spacer - \$(LINK) ${ngx_long_start}${ngx_binout}$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_main_link +$NGX_OBJS${ngx_dirsep}nginx$ngx_binext: $ngx_deps$ngx_spacer + \$(LINK) $ngx_long_start$ngx_binout$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_main_link $ngx_rcc -${ngx_long_end} +$ngx_long_end modules: END @@ -281,7 +281,7 @@ if [ $HTTP = YES ]; then ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)" else ngx_cc="\$(CC) $ngx_compile_opt \$(CFLAGS) \$(CORE_INCS) \$(HTTP_INCS)" - ngx_perl_cc="\$(CC) $ngx_compile_opt \$(NGX_PERL_CFLAGS) " + ngx_perl_cc="\$(CC) $ngx_compile_opt \$(NGX_PERL_CFLAGS)" ngx_perl_cc="$ngx_perl_cc \$(CORE_INCS) \$(HTTP_INCS)" fi @@ -437,9 +437,9 @@ fi # the addons config.make -if test -n "$NGX_ADDONS"; then +if test -n "$NGX_ADDONS$DYNAMIC_ADDONS"; then - for ngx_addon_dir in $NGX_ADDONS + for ngx_addon_dir in $NGX_ADDONS $DYNAMIC_ADDONS do if test -f $ngx_addon_dir/config.make; then . $ngx_addon_dir/config.make @@ -494,6 +494,8 @@ if test -n "$NGX_PCH"; then ngx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) $ngx_use_pch \$(ALL_INCS)" else ngx_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(CFLAGS) \$(ALL_INCS)" + ngx_perl_cc="\$(CC) $ngx_compile_opt $ngx_pic_opt \$(NGX_PERL_CFLAGS)" + ngx_perl_cc="$ngx_perl_cc \$(ALL_INCS)" fi ngx_obj_deps="\$(CORE_DEPS)" @@ -605,9 +607,7 @@ END | sed -e "s/ *\([^ ][^ ]*\)/$ngx_long_regex_cont\1/g" \ -e "s/\//$ngx_regex_dirsep/g"` - ngx_obj=$NGX_OBJS${ngx_dirsep}${ngx_module}${ngx_modext} - - NGX_MODULES="$NGX_MODULES $ngx_obj" + ngx_obj=$NGX_OBJS$ngx_dirsep$ngx_module$ngx_modext if [ "$NGX_PLATFORM" = win32 ]; then ngx_module_libs="$CORE_LIBS $ngx_module_libs" @@ -639,15 +639,15 @@ $ngx_modules_obj: \$(CORE_DEPS)$ngx_cont$ngx_modules_c END - for ngx_src in $ngx_module_srcs + for ngx_source in $ngx_module_srcs do - case "$ngx_src" in + case "$ngx_source" in src/*) - ngx_obj=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"` + ngx_obj=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"` ;; *) - ngx_obj="addon/`basename \`dirname $ngx_src\``" - ngx_obj=`echo $ngx_obj/\`basename $ngx_src\` \ + ngx_obj="addon/`basename \`dirname $ngx_source\``" + ngx_obj=`echo $ngx_obj/\`basename $ngx_source\` \ | sed -e "s/\//$ngx_regex_dirsep/g"` ;; esac @@ -658,14 +658,25 @@ END -e "s#^\(.*\.\)c\\$#$ngx_objs_dir\1$ngx_objext#g" \ -e "s#^\(.*\.\)S\\$#$ngx_objs_dir\1$ngx_objext#g"` - ngx_src=`echo $ngx_src | sed -e "s/\//$ngx_regex_dirsep/g"` + ngx_src=`echo $ngx_source | sed -e "s/\//$ngx_regex_dirsep/g"` - cat << END >> $NGX_MAKEFILE + if [ $ngx_source = src/http/modules/perl/ngx_http_perl_module.c ]; then + + cat << END >> $NGX_MAKEFILE + +$ngx_obj: $ngx_obj_deps$ngx_cont$ngx_src + $ngx_perl_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX + +END + else + + cat << END >> $NGX_MAKEFILE $ngx_obj: $ngx_obj_deps$ngx_cont$ngx_src $ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX END + fi done done Renamed: vendor/nginx-1.9.15/auto/module (+2 -2) 96% =================================================================== --- vendor/nginx-1.9.12/auto/module 2016-04-20 22:22:29 +0900 (908f0c6) +++ vendor/nginx-1.9.15/auto/module 2016-04-21 23:49:50 +0900 (16a816f) @@ -40,7 +40,7 @@ if [ "$ngx_module_link" = DYNAMIC ]; then do case $lib in - LIBXSLT | LIBGD | GEOIP) + LIBXSLT | LIBGD | GEOIP | PERL) libs="$libs \$NGX_LIB_$lib" if eval [ "\$USE_${lib}" = NO ] ; then @@ -48,7 +48,7 @@ if [ "$ngx_module_link" = DYNAMIC ]; then fi ;; - PCRE | OPENSSL | MD5 | SHA1 | ZLIB | PERL) + PCRE | OPENSSL | MD5 | SHA1 | ZLIB) eval USE_${lib}=YES ;; Renamed: vendor/nginx-1.9.15/auto/modules (+2 -4) 99% =================================================================== --- vendor/nginx-1.9.12/auto/modules 2016-04-20 22:22:29 +0900 (ebfc91d) +++ vendor/nginx-1.9.15/auto/modules 2016-04-21 23:49:50 +0900 (22ff6d9) @@ -727,14 +727,12 @@ if [ $HTTP_SCGI = YES ]; then . auto/module fi -if [ $HTTP_PERL = YES ]; then - USE_PERL=YES - +if [ $HTTP_PERL != NO ]; then ngx_module_name=ngx_http_perl_module ngx_module_incs=src/http/modules/perl ngx_module_deps=src/http/modules/perl/ngx_http_perl_module.h ngx_module_srcs=src/http/modules/perl/ngx_http_perl_module.c - ngx_module_libs= + ngx_module_libs=PERL ngx_module_link=$HTTP_PERL . auto/module Renamed: vendor/nginx-1.9.15/auto/nohave (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/options (+4 -2) 98% =================================================================== --- vendor/nginx-1.9.12/auto/options 2016-04-20 22:22:29 +0900 (36b34bc) +++ vendor/nginx-1.9.15/auto/options 2016-04-21 23:49:50 +0900 (ac8beb1) @@ -271,6 +271,7 @@ do --without-http_upstream_zone_module) HTTP_UPSTREAM_ZONE=NO ;; --with-http_perl_module) HTTP_PERL=YES ;; + --with-http_perl_module=dynamic) HTTP_PERL=DYNAMIC ;; --with-perl_modules_path=*) NGX_PERL_MODULES="$value" ;; --with-perl=*) NGX_PERL="$value" ;; @@ -452,6 +453,7 @@ cat << END disable ngx_http_upstream_zone_module --with-http_perl_module enable ngx_http_perl_module + --with-http_perl_module=dynamic enable dynamic ngx_http_perl_module --with-perl_modules_path=PATH set Perl modules path --with-perl=PATH set perl binary pathname @@ -477,8 +479,8 @@ cat << END --without-mail_imap_module disable ngx_mail_imap_module --without-mail_smtp_module disable ngx_mail_smtp_module - --with-stream enable TCP proxy module - --with-stream=dynamic enable dynamic TCP proxy module + --with-stream enable TCP/UDP proxy module + --with-stream=dynamic enable dynamic TCP/UDP proxy module --with-stream_ssl_module enable ngx_stream_ssl_module --without-stream_limit_conn_module disable ngx_stream_limit_conn_module --without-stream_access_module disable ngx_stream_access_module Renamed: vendor/nginx-1.9.15/auto/os/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/os/darwin (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/os/freebsd (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/os/linux (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/os/solaris (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/os/win32 (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/sources (+1 -0) 99% =================================================================== --- vendor/nginx-1.9.12/auto/sources 2016-04-20 22:22:29 +0900 (e08e863) +++ vendor/nginx-1.9.15/auto/sources 2016-04-21 23:49:50 +0900 (27849e6) @@ -165,6 +165,7 @@ UNIX_SRCS="$CORE_SRCS $EVENT_SRCS \ src/os/unix/ngx_udp_recv.c \ src/os/unix/ngx_send.c \ src/os/unix/ngx_writev_chain.c \ + src/os/unix/ngx_udp_send.c \ src/os/unix/ngx_channel.c \ src/os/unix/ngx_shmem.c \ src/os/unix/ngx_process.c \ Renamed: vendor/nginx-1.9.15/auto/stubs (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/summary (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/threads (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/types/sizeof (+5 -3) 97% =================================================================== --- vendor/nginx-1.9.12/auto/types/sizeof 2016-04-20 22:22:29 +0900 (a5f66bb) +++ vendor/nginx-1.9.15/auto/types/sizeof 2016-04-21 23:49:50 +0900 (b5b71bb) @@ -45,9 +45,6 @@ if [ -x $NGX_AUTOTEST ]; then fi -rm -rf $NGX_AUTOTEST* - - case $ngx_size in 4) ngx_max_value=2147483647 @@ -69,6 +66,11 @@ case $ngx_size in echo $ngx_test >> $NGX_AUTOCONF_ERR echo "----------" >> $NGX_AUTOCONF_ERR + rm -rf $NGX_AUTOTEST* + exit 1 esac + +rm -rf $NGX_AUTOTEST* + Renamed: vendor/nginx-1.9.15/auto/types/typedef (+9 -4) 87% =================================================================== --- vendor/nginx-1.9.12/auto/types/typedef 2016-04-20 22:22:29 +0900 (8b5c368) +++ vendor/nginx-1.9.15/auto/types/typedef 2016-04-21 23:49:50 +0900 (b55237e) @@ -49,18 +49,23 @@ END fi fi - rm -rf $NGX_AUTOTEST* - if [ $ngx_found = no ]; then - echo $ngx_n " $ngx_try not found$ngx_c" + if [ $ngx_try = $ngx_type ]; then + echo $ngx_n " $ngx_try not found$ngx_c" + else + echo $ngx_n ", $ngx_try not found$ngx_c" + fi echo "----------" >> $NGX_AUTOCONF_ERR cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR echo "----------" >> $NGX_AUTOCONF_ERR echo $ngx_test >> $NGX_AUTOCONF_ERR echo "----------" >> $NGX_AUTOCONF_ERR + fi + + rm -rf $NGX_AUTOTEST* - else + if [ $ngx_found != no ]; then break fi done Renamed: vendor/nginx-1.9.15/auto/types/uintptr_t (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/types/value (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/auto/unix (+42 -2) 94% =================================================================== --- vendor/nginx-1.9.12/auto/unix 2016-04-20 22:22:29 +0900 (ce01791) +++ vendor/nginx-1.9.15/auto/unix 2016-04-21 23:49:50 +0900 (8c0e813) @@ -260,7 +260,7 @@ ngx_feature_run=no ngx_feature_incs="#include <dlfcn.h>" ngx_feature_path= ngx_feature_libs= -ngx_feature_test="dlopen(NULL, 0); dlsym(NULL, NULL)" +ngx_feature_test="dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); dlsym(NULL, NULL)" . auto/feature @@ -329,6 +329,45 @@ ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0)" . auto/feature +# BSD way to get IPv4 datagram destination address + +ngx_feature="IP_RECVDSTADDR" +ngx_feature_name="NGX_HAVE_IP_RECVDSTADDR" +ngx_feature_run=no +ngx_feature_incs="#include <sys/socket.h> + #include <netinet/in.h>" +ngx_feature_path= +ngx_feature_libs= +ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_RECVDSTADDR, NULL, 0)" +. auto/feature + + +# Linux way to get IPv4 datagram destination address + +ngx_feature="IP_PKTINFO" +ngx_feature_name="NGX_HAVE_IP_PKTINFO" +ngx_feature_run=no +ngx_feature_incs="#include <sys/socket.h> + #include <netinet/in.h>" +ngx_feature_path= +ngx_feature_libs= +ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_PKTINFO, NULL, 0)" +. auto/feature + + +# RFC 3542 way to get IPv6 datagram destination address + +ngx_feature="IPV6_RECVPKTINFO" +ngx_feature_name="NGX_HAVE_IPV6_RECVPKTINFO" +ngx_feature_run=no +ngx_feature_incs="#include <sys/socket.h> + #include <netinet/in.h>" +ngx_feature_path= +ngx_feature_libs= +ngx_feature_test="setsockopt(0, IPPROTO_IPV6, IPV6_RECVPKTINFO, NULL, 0)" +. auto/feature + + ngx_feature="TCP_DEFER_ACCEPT" ngx_feature_name="NGX_HAVE_DEFERRED_ACCEPT" ngx_feature_run=no @@ -508,6 +547,7 @@ ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value NGX_INCLUDE_AUTO_CONFIG_H="#include \"ngx_auto_config.h\"" +ngx_type="uint32_t"; ngx_types="u_int32_t"; . auto/types/typedef ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef @@ -516,7 +556,7 @@ ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value ngx_type="socklen_t"; ngx_types="int"; . auto/types/typedef -ngx_type="in_addr_t"; ngx_types="uint32_t"; . auto/types/typedef +ngx_type="in_addr_t"; ngx_types="uint32_t u_int32_t"; . auto/types/typedef ngx_type="in_port_t"; ngx_types="u_short"; . auto/types/typedef Renamed: vendor/nginx-1.9.15/conf/fastcgi.conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/conf/fastcgi_params (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/conf/koi-utf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/conf/koi-win (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/conf/mime.types (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/conf/nginx.conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/conf/scgi_params (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/conf/uwsgi_params (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/conf/win-utf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/contrib/README (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/contrib/geo2nginx.pl (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/contrib/unicode2nginx/koi-utf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/contrib/unicode2nginx/unicode-to-nginx.pl (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/contrib/unicode2nginx/win-utf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/contrib/vim/ftdetect/nginx.vim (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/contrib/vim/indent/nginx.vim (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/contrib/vim/syntax/nginx.vim (+2 -2) 99% =================================================================== --- vendor/nginx-1.9.12/contrib/vim/syntax/nginx.vim 2016-04-20 22:22:29 +0900 (444d96e) +++ vendor/nginx-1.9.15/contrib/vim/syntax/nginx.vim 2016-04-21 23:49:50 +0900 (f1fd48a) @@ -57,6 +57,7 @@ syn keyword ngxDirectiveError post_action syn keyword ngxDirectiveDeprecated connections syn keyword ngxDirectiveDeprecated imap syn keyword ngxDirectiveDeprecated limit_zone +syn keyword ngxDirectiveDeprecated mysql_test syn keyword ngxDirectiveDeprecated open_file_cache_retest syn keyword ngxDirectiveDeprecated optimize_server_names syn keyword ngxDirectiveDeprecated satisfy_any @@ -246,7 +247,6 @@ syn keyword ngxDirective mp4_max_buffer_size syn keyword ngxDirective msie_padding syn keyword ngxDirective msie_refresh syn keyword ngxDirective multi_accept -syn keyword ngxDirective mysql_test syn keyword ngxDirective open_file_cache syn keyword ngxDirective open_file_cache_errors syn keyword ngxDirective open_file_cache_events @@ -604,7 +604,7 @@ syn keyword ngxDirectiveThirdParty echo_subrequest syn keyword ngxDirectiveThirdParty echo_subrequest_async " Events Module <http://docs.dutov.org/nginx_modules_events_en.html> -" Privides options for start/stop events. +" Provides options for start/stop events. syn keyword ngxDirectiveThirdParty on_start syn keyword ngxDirectiveThirdParty on_stop Renamed: vendor/nginx-1.9.15/docs/GNUmakefile (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/docs/dtd/change_log_conf.dtd (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/docs/dtd/changes.dtd (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/docs/html/50x.html (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/docs/html/index.html (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/docs/man/nginx.8 (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/docs/text/LICENSE (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/docs/text/README (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/docs/xml/change_log_conf.xml (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/docs/xml/nginx/changes.xml (+280 -1) 98% =================================================================== --- vendor/nginx-1.9.12/docs/xml/nginx/changes.xml 2016-04-20 22:22:29 +0900 (f126886) +++ vendor/nginx-1.9.15/docs/xml/nginx/changes.xml 2016-04-21 23:49:50 +0900 (5f40bbc) @@ -5,6 +5,285 @@ <change_log title="nginx"> +<changes ver="1.9.15" date="19.04.2016"> + +<change type="bugfix"> +<para lang="ru"> +при использовании HHVM в качестве FastCGI-сервера +могли возникать ошибки "recv() failed". +</para> +<para lang="en"> +"recv() failed" errors might occur +when using HHVM as a FastCGI server. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании HTTP/2 и директив limit_req или auth_request +при чтении тела запроса мог произойти таймаут +или ошибка "client violated flow control"; +ошибка появилась в 1.9.14. +</para> +<para lang="en"> +when using HTTP/2 and the "limit_req" or "auth_request" directives +a timeout or a "client violated flow control" error +might occur while reading client request body; +the bug had appeared in 1.9.14. +</para> +</change> + +<change type="workaround"> +<para lang="ru"> +при использовании HTTP/2 ответ мог не показываться некоторыми браузерами, +если тело запроса было прочитано не целиком; +ошибка появилась в 1.9.14. +</para> +<para lang="en"> +a response might not be shown by some browsers +if HTTP/2 was used and client request body was not fully read; +the bug had appeared in 1.9.14. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании директивы "aio threads" соединения могли зависать.<br/> +Спасибо Mindaugas Rasiukevicius. +</para> +<para lang="en"> +connections might hang when using the "aio threads" directive.<br/> +Thanks to Mindaugas Rasiukevicius. +</para> +</change> + +</changes> + + +<changes ver="1.9.14" date="05.04.2016"> + +<change type="feature"> +<para lang="ru"> +совместимость с OpenSSL 1.1.0. +</para> +<para lang="en"> +OpenSSL 1.1.0 compatibility. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +директивы proxy_request_buffering, fastcgi_request_buffering, +scgi_request_buffering и uwsgi_request_buffering +теперь работают при использовании HTTP/2. +</para> +<para lang="en"> +the "proxy_request_buffering", "fastcgi_request_buffering", +"scgi_request_buffering", and "uwsgi_request_buffering" directives +now work with HTTP/2. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании HTTP/2 +в логах могли появляться сообщения "zero size buf in output". +</para> +<para lang="en"> +"zero size buf in output" alerts might appear in logs +when using HTTP/2. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании HTTP/2 +директива client_max_body_size могла работать неверно. +</para> +<para lang="en"> +the "client_max_body_size" directive might work incorrectly +when using HTTP/2. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +незначительных ошибок логгирования. +</para> +<para lang="en"> +of minor bugs in logging. +</para> +</change> + +</changes> + + +<changes ver="1.9.13" date="29.03.2016"> + +<change type="change"> +<para lang="ru"> +неидемпотентные запросы (POST, LOCK, PATCH) +теперь по умолчанию не передаются на другой сервер, +если запрос уже был отправлен на бэкенд; +параметр non_idempotent директивы proxy_next_upstream +явно разрешает повторять такие запросы. +</para> +<para lang="en"> +non-idempotent requests (POST, LOCK, PATCH) +are no longer passed to the next server by default +if a request has been sent to a backend; +the "non_idempotent" parameter of the "proxy_next_upstream" directive +explicitly allows retrying such requests. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +модуль ngx_http_perl_module теперь можно собрать динамически. +</para> +<para lang="en"> +the ngx_http_perl_module can be built dynamically. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +поддержка UDP в модуле stream. +</para> +<para lang="en"> +UDP support in the stream module. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +директива aio_write. +</para> +<para lang="en"> +the "aio_write" directive. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +теперь cache manager следит за количеством элементов в кэше +и старается не допускать переполнений зоны разделяемой памяти. +</para> +<para lang="en"> +now cache manager monitors number of elements in caches +and tries to avoid cache keys zone overflows. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании директив sendfile и aio с подзапросами +в логах могли появляться сообщения "task already active" и "second aio post". +</para> +<para lang="en"> + +"task already active" and "second aio post" alerts might appear in logs +when using the "sendfile" and "aio" directives with subrequests. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании кэширования +в логах могли появляться сообщения "zero size buf in output", +если клиент закрывал соединение преждевременно. +</para> +<para lang="en"> +"zero size buf in output" alerts might appear in logs +if caching was used +and a client closed a connection prematurely. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании кэширования +соединения с клиентами могли закрываться без необходимости.<br/> +Спасибо Justin Li. +</para> +<para lang="en"> +connections with clients might be closed needlessly +if caching was used.<br/> +Thanks to Justin Li. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +nginx мог нагружать процессор +при использовании директивы sendfile на Linux и Solaris, +если отправляемый файл был изменён в процессе отправки. +</para> +<para lang="en"> +nginx might hog CPU +if the "sendfile" directive was used on Linux or Solaris +and a file being sent was changed during sending. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании директив sendfile и "aio threads" +соединения могли зависать. +</para> +<para lang="en"> +connections might hang +when using the "sendfile" and "aio threads" directives. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +в директивах proxy_pass, fastcgi_pass, scgi_pass и uwsgi_pass +при использовании переменных.<br/> +Спасибо Piotr Sikora. +</para> +<para lang="en"> +in the "proxy_pass", "fastcgi_pass", "scgi_pass", and "uwsgi_pass" directives +when using variables.<br/> +Thanks to Piotr Sikora. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +в модуле ngx_http_sub_filter_module. +</para> +<para lang="en"> +in the ngx_http_sub_filter_module. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +если в закэшированном соединении к бэкенду происходила ошибка, +запрос передавался на другой сервер +без учёта директивы proxy_next_upstream. +</para> +<para lang="en"> +if an error occurred in a cached backend connection, +the request was passed to the next server +regardless of the proxy_next_upstream directive. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +ошибки "CreateFile() failed" при создании временных файлов на Windows. +</para> +<para lang="en"> +"CreateFile() failed" errors when creating temporary files on Windows. +</para> +</change> + +</changes> + + <changes ver="1.9.12" date="24.02.2016"> <change type="feature"> @@ -6199,7 +6478,7 @@ successfully respond to the request. теперь символы 0x7F-0xFF в access_log записываются в виде \xXX. </para> <para lang="en"> -now the 0x7F-0x1F characters are escaped as \xXX in an access_log. +now the 0x7F-0xFF characters are escaped as \xXX in an access_log. </para> </change> Renamed: vendor/nginx-1.9.15/docs/xsls/changes.xsls (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/docs/xslt/changes.xslt (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/misc/GNUmakefile (+1 -3) 98% =================================================================== --- vendor/nginx-1.9.12/misc/GNUmakefile 2016-04-20 22:22:29 +0900 (adec088) +++ vendor/nginx-1.9.15/misc/GNUmakefile 2016-04-21 23:49:50 +0900 (1f021c5) @@ -5,7 +5,7 @@ NGINX = nginx-$(VER) TEMP = tmp OBJS = objs.msvc8 -OPENSSL = openssl-1.0.2f +OPENSSL = openssl-1.0.2g ZLIB = zlib-1.2.8 PCRE = pcre-8.38 @@ -20,8 +20,6 @@ release: export rm $(TEMP)/$(NGINX)/src/event/modules/ngx_iocp_module.* rm -r $(TEMP)/$(NGINX)/src/os/win32 - rm -r $(TEMP)/$(NGINX)/src/mysql - mv $(TEMP)/$(NGINX)/docs/text/LICENSE $(TEMP)/$(NGINX) mv $(TEMP)/$(NGINX)/docs/text/README $(TEMP)/$(NGINX) mv $(TEMP)/$(NGINX)/docs/html $(TEMP)/$(NGINX) Renamed: vendor/nginx-1.9.15/misc/README (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/nginx.c (+5 -6) 99% =================================================================== --- vendor/nginx-1.9.12/src/core/nginx.c 2016-04-20 22:22:29 +0900 (cdc067e) +++ vendor/nginx-1.9.15/src/core/nginx.c 2016-04-21 23:49:50 +0900 (60f8fe7) @@ -10,7 +10,7 @@ #include <nginx.h> -static void ngx_show_version_info(); +static void ngx_show_version_info(void); static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle); static ngx_int_t ngx_get_options(int argc, char *const *argv); static ngx_int_t ngx_process_options(ngx_cycle_t *cycle); @@ -372,7 +372,7 @@ main(int argc, char *const *argv) static void -ngx_show_version_info() +ngx_show_version_info(void) { ngx_write_stderr("nginx version: " NGINX_VER_BUILD NGX_LINEFEED); @@ -413,13 +413,12 @@ ngx_show_version_info() #endif #if (NGX_SSL) - if (SSLeay() == SSLEAY_VERSION_NUMBER) { + if (ngx_strcmp(ngx_ssl_version(), OPENSSL_VERSION_TEXT) == 0) { ngx_write_stderr("built with " OPENSSL_VERSION_TEXT NGX_LINEFEED); } else { ngx_write_stderr("built with " OPENSSL_VERSION_TEXT " (running with "); - ngx_write_stderr((char *) (uintptr_t) - SSLeay_version(SSLEAY_VERSION)); + ngx_write_stderr((char *) (uintptr_t) ngx_ssl_version()); ngx_write_stderr(")" NGX_LINEFEED); } #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME @@ -1510,7 +1509,7 @@ ngx_load_module(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } - ngx_log_debug2(NGX_LOG_DEBUG_CORE, cf->log, 0, "module: %s i:%i", + ngx_log_debug2(NGX_LOG_DEBUG_CORE, cf->log, 0, "module: %s i:%ui", module->name, module->index); } Renamed: vendor/nginx-1.9.15/src/core/nginx.h (+2 -2) 85% =================================================================== --- vendor/nginx-1.9.12/src/core/nginx.h 2016-04-20 22:22:29 +0900 (dec7b88) +++ vendor/nginx-1.9.15/src/core/nginx.h 2016-04-21 23:49:50 +0900 (ba8a9c2) @@ -9,8 +9,8 @@ #define _NGINX_H_INCLUDED_ -#define nginx_version 1009012 -#define NGINX_VERSION "1.9.12" +#define nginx_version 1009015 +#define NGINX_VERSION "1.9.15" #define NGINX_VER "nginx/" NGINX_VERSION #ifdef NGX_BUILD Renamed: vendor/nginx-1.9.15/src/core/ngx_array.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_array.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_buf.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_buf.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_conf_file.c (+3 -3) 99% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_conf_file.c 2016-04-20 22:22:29 +0900 (fb72656) +++ vendor/nginx-1.9.15/src/core/ngx_conf_file.c 2016-04-21 23:49:50 +0900 (c60d5fb) @@ -613,9 +613,9 @@ ngx_conf_read_token(ngx_conf_t *cf) need_space = 0; } else { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "unexpected \"%c\"", ch); - return NGX_ERROR; + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "unexpected \"%c\"", ch); + return NGX_ERROR; } } Renamed: vendor/nginx-1.9.15/src/core/ngx_conf_file.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_config.h (+0 -5) 95% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_config.h 2016-04-20 22:22:29 +0900 (145e43a) +++ vendor/nginx-1.9.15/src/core/ngx_config.h 2016-04-21 23:49:50 +0900 (a0bfa63) @@ -125,12 +125,7 @@ typedef intptr_t ngx_flag_t; #endif -#if ((__GNU__ == 2) && (__GNUC_MINOR__ < 8)) -#define NGX_MAX_UINT32_VALUE (uint32_t) 0xffffffffLL -#else #define NGX_MAX_UINT32_VALUE (uint32_t) 0xffffffff -#endif - #define NGX_MAX_INT32_VALUE (uint32_t) 0x7fffffff Renamed: vendor/nginx-1.9.15/src/core/ngx_connection.c (+116 -28) 90% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_connection.c 2016-04-20 22:22:29 +0900 (0c19d5d) +++ vendor/nginx-1.9.15/src/core/ngx_connection.c 2016-04-21 23:49:50 +0900 (5a53bac) @@ -47,21 +47,21 @@ ngx_create_listening(ngx_conf_t *cf, void *sockaddr, socklen_t socklen) switch (ls->sockaddr->sa_family) { #if (NGX_HAVE_INET6) case AF_INET6: - ls->addr_text_max_len = NGX_INET6_ADDRSTRLEN; - break; + ls->addr_text_max_len = NGX_INET6_ADDRSTRLEN; + break; #endif #if (NGX_HAVE_UNIX_DOMAIN) case AF_UNIX: - ls->addr_text_max_len = NGX_UNIX_ADDRSTRLEN; - len++; - break; + ls->addr_text_max_len = NGX_UNIX_ADDRSTRLEN; + len++; + break; #endif case AF_INET: - ls->addr_text_max_len = NGX_INET_ADDRSTRLEN; - break; + ls->addr_text_max_len = NGX_INET_ADDRSTRLEN; + break; default: - ls->addr_text_max_len = NGX_SOCKADDR_STRLEN; - break; + ls->addr_text_max_len = NGX_SOCKADDR_STRLEN; + break; } ls->addr_text.data = ngx_pnalloc(cf->pool, len); @@ -168,22 +168,22 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle) #if (NGX_HAVE_INET6) case AF_INET6: - ls[i].addr_text_max_len = NGX_INET6_ADDRSTRLEN; - len = NGX_INET6_ADDRSTRLEN + sizeof("[]:65535") - 1; - break; + ls[i].addr_text_max_len = NGX_INET6_ADDRSTRLEN; + len = NGX_INET6_ADDRSTRLEN + sizeof("[]:65535") - 1; + break; #endif #if (NGX_HAVE_UNIX_DOMAIN) case AF_UNIX: - ls[i].addr_text_max_len = NGX_UNIX_ADDRSTRLEN; - len = NGX_UNIX_ADDRSTRLEN; - break; + ls[i].addr_text_max_len = NGX_UNIX_ADDRSTRLEN; + len = NGX_UNIX_ADDRSTRLEN; + break; #endif case AF_INET: - ls[i].addr_text_max_len = NGX_INET_ADDRSTRLEN; - len = NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1; - break; + ls[i].addr_text_max_len = NGX_INET_ADDRSTRLEN; + len = NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1; + break; default: ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_socket_errno, @@ -210,6 +210,18 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle) olen = sizeof(int); + if (getsockopt(ls[i].fd, SOL_SOCKET, SO_TYPE, (void *) &ls[i].type, + &olen) + == -1) + { + ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_socket_errno, + "getsockopt(SO_TYPE) %V failed", &ls[i].addr_text); + ls[i].ignore = 1; + continue; + } + + olen = sizeof(int); + if (getsockopt(ls[i].fd, SOL_SOCKET, SO_RCVBUF, (void *) &ls[i].rcvbuf, &olen) == -1) @@ -274,6 +286,10 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle) #endif + if (ls[i].type != SOCK_STREAM) { + continue; + } + #if (NGX_HAVE_TCP_FASTOPEN) olen = sizeof(int); @@ -566,6 +582,11 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle) } #endif + if (ls[i].type != SOCK_STREAM) { + ls[i].fd = s; + continue; + } + if (listen(s, ls[i].backlog) == -1) { err = ngx_socket_errno; @@ -865,6 +886,67 @@ ngx_configure_listening_sockets(ngx_cycle_t *cycle) #endif #endif /* NGX_HAVE_DEFERRED_ACCEPT */ + +#if (NGX_HAVE_IP_RECVDSTADDR) + + if (ls[i].wildcard + && ls[i].type == SOCK_DGRAM + && ls[i].sockaddr->sa_family == AF_INET) + { + value = 1; + + if (setsockopt(ls[i].fd, IPPROTO_IP, IP_RECVDSTADDR, + (const void *) &value, sizeof(int)) + == -1) + { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno, + "setsockopt(IP_RECVDSTADDR) " + "for %V failed, ignored", + &ls[i].addr_text); + } + } + +#elif (NGX_HAVE_IP_PKTINFO) + + if (ls[i].wildcard + && ls[i].type == SOCK_DGRAM + && ls[i].sockaddr->sa_family == AF_INET) + { + value = 1; + + if (setsockopt(ls[i].fd, IPPROTO_IP, IP_PKTINFO, + (const void *) &value, sizeof(int)) + == -1) + { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno, + "setsockopt(IP_PKTINFO) " + "for %V failed, ignored", + &ls[i].addr_text); + } + } + +#endif + +#if (NGX_HAVE_INET6 && NGX_HAVE_IPV6_RECVPKTINFO) + + if (ls[i].wildcard + && ls[i].type == SOCK_DGRAM + && ls[i].sockaddr->sa_family == AF_INET6) + { + value = 1; + + if (setsockopt(ls[i].fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, + (const void *) &value, sizeof(int)) + == -1) + { + ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno, + "setsockopt(IPV6_RECVPKTINFO) " + "for %V failed, ignored", + &ls[i].addr_text); + } + } + +#endif } return; @@ -978,7 +1060,7 @@ ngx_get_connection(ngx_socket_t s, ngx_log_t *log) ngx_cycle->free_connections = c->data; ngx_cycle->free_connection_n--; - if (ngx_cycle->files) { + if (ngx_cycle->files && ngx_cycle->files[s] == NULL) { ngx_cycle->files[s] = c; } @@ -1019,7 +1101,7 @@ ngx_free_connection(ngx_connection_t *c) ngx_cycle->free_connections = c; ngx_cycle->free_connection_n++; - if (ngx_cycle->files) { + if (ngx_cycle->files && ngx_cycle->files[c->fd] == c) { ngx_cycle->files[c->fd] = NULL; } } @@ -1045,16 +1127,18 @@ ngx_close_connection(ngx_connection_t *c) ngx_del_timer(c->write); } - if (ngx_del_conn) { - ngx_del_conn(c, NGX_CLOSE_EVENT); + if (!c->shared) { + if (ngx_del_conn) { + ngx_del_conn(c, NGX_CLOSE_EVENT); - } else { - if (c->read->active || c->read->disabled) { - ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT); - } + } else { + if (c->read->active || c->read->disabled) { + ngx_del_event(c->read, NGX_READ_EVENT, NGX_CLOSE_EVENT); + } - if (c->write->active || c->write->disabled) { - ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT); + if (c->write->active || c->write->disabled) { + ngx_del_event(c->write, NGX_WRITE_EVENT, NGX_CLOSE_EVENT); + } } } @@ -1078,6 +1162,10 @@ ngx_close_connection(ngx_connection_t *c) fd = c->fd; c->fd = (ngx_socket_t) -1; + if (c->shared) { + return; + } + if (ngx_close_socket(fd) == -1) { err = ngx_socket_errno; Renamed: vendor/nginx-1.9.15/src/core/ngx_connection.h (+15 -11) 93% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_connection.h 2016-04-20 22:22:29 +0900 (977f028) +++ vendor/nginx-1.9.15/src/core/ngx_connection.h 2016-04-21 23:49:50 +0900 (b0d162a) @@ -64,6 +64,7 @@ struct ngx_listening_s { unsigned nonblocking:1; unsigned shared:1; /* shared between threads or processes */ unsigned addr_ntop:1; + unsigned wildcard:1; #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) unsigned ipv6only:1; @@ -94,25 +95,25 @@ struct ngx_listening_s { typedef enum { - NGX_ERROR_ALERT = 0, - NGX_ERROR_ERR, - NGX_ERROR_INFO, - NGX_ERROR_IGNORE_ECONNRESET, - NGX_ERROR_IGNORE_EINVAL + NGX_ERROR_ALERT = 0, + NGX_ERROR_ERR, + NGX_ERROR_INFO, + NGX_ERROR_IGNORE_ECONNRESET, + NGX_ERROR_IGNORE_EINVAL } ngx_connection_log_error_e; typedef enum { - NGX_TCP_NODELAY_UNSET = 0, - NGX_TCP_NODELAY_SET, - NGX_TCP_NODELAY_DISABLED + NGX_TCP_NODELAY_UNSET = 0, + NGX_TCP_NODELAY_SET, + NGX_TCP_NODELAY_DISABLED } ngx_connection_tcp_nodelay_e; typedef enum { - NGX_TCP_NOPUSH_UNSET = 0, - NGX_TCP_NOPUSH_SET, - NGX_TCP_NOPUSH_DISABLED + NGX_TCP_NOPUSH_UNSET = 0, + NGX_TCP_NOPUSH_SET, + NGX_TCP_NOPUSH_DISABLED } ngx_connection_tcp_nopush_e; @@ -141,6 +142,8 @@ struct ngx_connection_s { ngx_pool_t *pool; + int type; + struct sockaddr *sockaddr; socklen_t socklen; ngx_str_t addr_text; @@ -174,6 +177,7 @@ struct ngx_connection_s { unsigned idle:1; unsigned reusable:1; unsigned close:1; + unsigned shared:1; unsigned sendfile:1; unsigned sndlowat:1; Renamed: vendor/nginx-1.9.15/src/core/ngx_core.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_cpuinfo.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_crc.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_crc32.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_crc32.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_crypt.c (+2 -2) 99% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_crypt.c 2016-04-20 22:22:29 +0900 (d7d068c) +++ vendor/nginx-1.9.15/src/core/ngx_crypt.c 2016-04-21 23:49:50 +0900 (9db74f4) @@ -165,8 +165,8 @@ ngx_crypt_to64(u_char *p, uint32_t v, size_t n) "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; while (n--) { - *p++ = itoa64[v & 0x3f]; - v >>= 6; + *p++ = itoa64[v & 0x3f]; + v >>= 6; } return p; Renamed: vendor/nginx-1.9.15/src/core/ngx_crypt.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_cycle.c (+9 -5) 99% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_cycle.c 2016-04-20 22:22:29 +0900 (f103266) +++ vendor/nginx-1.9.15/src/core/ngx_cycle.c 2016-04-21 23:49:50 +0900 (98599f3) @@ -512,6 +512,10 @@ ngx_init_cycle(ngx_cycle_t *old_cycle) continue; } + if (ls[i].type != nls[n].type) { + continue; + } + if (ngx_cmp_sockaddr(nls[n].sockaddr, nls[n].socklen, ls[i].sockaddr, ls[i].socklen, 1) == NGX_OK) @@ -1002,7 +1006,7 @@ ngx_int_t ngx_signal_process(ngx_cycle_t *cycle, char *sig) { ssize_t n; - ngx_int_t pid; + ngx_pid_t pid; ngx_file_t file; ngx_core_conf_t *ccf; u_char buf[NGX_INT64_LEN + 2]; @@ -1040,7 +1044,7 @@ ngx_signal_process(ngx_cycle_t *cycle, char *sig) pid = ngx_atoi(buf, ++n); - if (pid == NGX_ERROR) { + if (pid == (ngx_pid_t) NGX_ERROR) { ngx_log_error(NGX_LOG_ERR, cycle->log, 0, "invalid PID number \"%*s\" in \"%s\"", n, buf, file.name.data); @@ -1309,7 +1313,7 @@ ngx_clean_old_cycles(ngx_event_t *ev) if (cycle[i]->connections[n].fd != (ngx_socket_t) -1) { found = 1; - ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "live fd:%d", n); + ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "live fd:%ui", n); break; } @@ -1320,13 +1324,13 @@ ngx_clean_old_cycles(ngx_event_t *ev) continue; } - ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "clean old cycle: %d", i); + ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "clean old cycle: %ui", i); ngx_destroy_pool(cycle[i]->pool); cycle[i] = NULL; } - ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "old cycles status: %d", live); + ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "old cycles status: %ui", live); if (live) { ngx_add_timer(ev, 30000); Renamed: vendor/nginx-1.9.15/src/core/ngx_cycle.h (+20 -20) 78% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_cycle.h 2016-04-20 22:22:29 +0900 (cfdbb55) +++ vendor/nginx-1.9.15/src/core/ngx_cycle.h 2016-04-21 23:49:50 +0900 (c51b7ff) @@ -79,35 +79,35 @@ struct ngx_cycle_s { typedef struct { - ngx_flag_t daemon; - ngx_flag_t master; + ngx_flag_t daemon; + ngx_flag_t master; - ngx_msec_t timer_resolution; + ngx_msec_t timer_resolution; - ngx_int_t worker_processes; - ngx_int_t debug_points; + ngx_int_t worker_processes; + ngx_int_t debug_points; - ngx_int_t rlimit_nofile; - off_t rlimit_core; + ngx_int_t rlimit_nofile; + off_t rlimit_core; - int priority; + int priority; - ngx_uint_t cpu_affinity_auto; - ngx_uint_t cpu_affinity_n; - ngx_cpuset_t *cpu_affinity; + ngx_uint_t cpu_affinity_auto; + ngx_uint_t cpu_affinity_n; + ngx_cpuset_t *cpu_affinity; - char *username; - ngx_uid_t user; - ngx_gid_t group; + char *username; + ngx_uid_t user; + ngx_gid_t group; - ngx_str_t working_directory; - ngx_str_t lock_file; + ngx_str_t working_directory; + ngx_str_t lock_file; - ngx_str_t pid; - ngx_str_t oldpid; + ngx_str_t pid; + ngx_str_t oldpid; - ngx_array_t env; - char **environment; + ngx_array_t env; + char **environment; } ngx_core_conf_t; Renamed: vendor/nginx-1.9.15/src/core/ngx_file.c (+14 -5) 98% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_file.c 2016-04-20 22:22:29 +0900 (3ebd73d) +++ vendor/nginx-1.9.15/src/core/ngx_file.c 2016-04-21 23:49:50 +0900 (fc2dfd3) @@ -124,6 +124,15 @@ ngx_write_chain_to_temp_file(ngx_temp_file_t *tf, ngx_chain_t *chain) } } +#if (NGX_THREADS && NGX_HAVE_PWRITEV) + + if (tf->thread_write) { + return ngx_thread_write_chain_to_file(&tf->file, chain, tf->offset, + tf->pool); + } + +#endif + return ngx_write_chain_to_file(&tf->file, chain, tf->offset, tf->pool); } @@ -146,7 +155,7 @@ ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool, #if 0 for (i = 0; i < file->name.len; i++) { - file->name.data[i] = 'X'; + file->name.data[i] = 'X'; } #endif @@ -187,7 +196,7 @@ ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool, err = ngx_errno; - if (err == NGX_EEXIST) { + if (err == NGX_EEXIST_FILE) { n = (uint32_t) ngx_next_temp_number(1); continue; } @@ -683,7 +692,7 @@ ngx_ext_rename_file(ngx_str_t *src, ngx_str_t *to, ngx_ext_rename_file_t *ext) #if (NGX_WIN32) - if (err == NGX_EEXIST) { + if (err == NGX_EEXIST || err == NGX_EEXIST_FILE) { err = ngx_win32_rename_file(src, to, ext->log); if (err == 0) { @@ -832,7 +841,7 @@ ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf) if ((size_t) n != len) { ngx_log_error(NGX_LOG_ALERT, cf->log, 0, - ngx_read_fd_n " has read only %z of %uz from %s", + ngx_read_fd_n " has read only %z of %O from %s", n, size, from); goto failed; } @@ -847,7 +856,7 @@ ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf) if ((size_t) n != len) { ngx_log_error(NGX_LOG_ALERT, cf->log, 0, - ngx_write_fd_n " has written only %z of %uz to %s", + ngx_write_fd_n " has written only %z of %O to %s", n, size, to); goto failed; } Renamed: vendor/nginx-1.9.15/src/core/ngx_file.h (+2 -0) 97% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_file.h 2016-04-20 22:22:29 +0900 (301b191) +++ vendor/nginx-1.9.15/src/core/ngx_file.h 2016-04-21 23:49:50 +0900 (5f8228b) @@ -27,6 +27,7 @@ struct ngx_file_s { ngx_int_t (*thread_handler)(ngx_thread_task_t *task, ngx_file_t *file); void *thread_ctx; + ngx_thread_task_t *thread_task; #endif #if (NGX_HAVE_FILE_AIO) @@ -77,6 +78,7 @@ typedef struct { unsigned log_level:8; unsigned persistent:1; unsigned clean:1; + unsigned thread_write:1; } ngx_temp_file_t; Renamed: vendor/nginx-1.9.15/src/core/ngx_hash.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_hash.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_inet.c (+15 -13) 98% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_inet.c 2016-04-20 22:22:29 +0900 (96a04fd) +++ vendor/nginx-1.9.15/src/core/ngx_inet.c 2016-04-21 23:49:50 +0900 (33b303d) @@ -348,7 +348,7 @@ ngx_inet6_ntop(u_char *p, u_char *text, size_t len) continue; } - dst = ngx_sprintf(dst, "%uxi", p[i] * 256 + p[i + 1]); + dst = ngx_sprintf(dst, "%xd", p[i] * 256 + p[i + 1]); if (i < 14) { *dst++ = ':'; @@ -529,14 +529,16 @@ ngx_int_t ngx_parse_url(ngx_pool_t *pool, ngx_url_t *u) { u_char *p; + size_t len; p = u->url.data; + len = u->url.len; - if (ngx_strncasecmp(p, (u_char *) "unix:", 5) == 0) { + if (len >= 5 && ngx_strncasecmp(p, (u_char *) "unix:", 5) == 0) { return ngx_parse_unix_domain_url(pool, u); } - if (p[0] == '[') { + if (len && p[0] == '[') { return ngx_parse_inet6_url(pool, u); } @@ -1240,19 +1242,19 @@ ngx_cmp_sockaddr(struct sockaddr *sa1, socklen_t slen1, #if (NGX_HAVE_UNIX_DOMAIN) case AF_UNIX: - /* TODO length */ + /* TODO length */ - saun1 = (struct sockaddr_un *) sa1; - saun2 = (struct sockaddr_un *) sa2; + saun1 = (struct sockaddr_un *) sa1; + saun2 = (struct sockaddr_un *) sa2; - if (ngx_memcmp(&saun1->sun_path, &saun2->sun_path, - sizeof(saun1->sun_path)) - != 0) - { - return NGX_DECLINED; - } + if (ngx_memcmp(&saun1->sun_path, &saun2->sun_path, + sizeof(saun1->sun_path)) + != 0) + { + return NGX_DECLINED; + } - break; + break; #endif default: /* AF_INET */ Renamed: vendor/nginx-1.9.15/src/core/ngx_inet.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_list.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_list.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_log.c (+11 -11) 98% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_log.c 2016-04-20 22:22:29 +0900 (0893871) +++ vendor/nginx-1.9.15/src/core/ngx_log.c 2016-04-21 23:49:50 +0900 (8e9408d) @@ -33,14 +33,14 @@ typedef struct { static ngx_command_t ngx_errlog_commands[] = { - {ngx_string("error_log"), - NGX_MAIN_CONF|NGX_CONF_1MORE, - ngx_error_log, - 0, - 0, - NULL}, - - ngx_null_command + { ngx_string("error_log"), + NGX_MAIN_CONF|NGX_CONF_1MORE, + ngx_error_log, + 0, + 0, + NULL }, + + ngx_null_command }; @@ -86,7 +86,7 @@ static ngx_str_t err_levels[] = { static const char *debug_levels[] = { "debug_core", "debug_alloc", "debug_mutex", "debug_event", - "debug_http", "debug_mail", "debug_mysql", "debug_stream" + "debug_http", "debug_mail", "debug_stream" }; @@ -585,7 +585,7 @@ ngx_log_set_log(ngx_conf_t *cf, ngx_log_t **head) return NGX_CONF_ERROR; } - } else if (ngx_strncmp(value[1].data, "memory:", 7) == 0) { + } else if (ngx_strncmp(value[1].data, "memory:", 7) == 0) { #if (NGX_DEBUG) size_t size, needed; @@ -644,7 +644,7 @@ ngx_log_set_log(ngx_conf_t *cf, ngx_log_t **head) return NGX_CONF_ERROR; #endif - } else if (ngx_strncmp(value[1].data, "syslog:", 7) == 0) { + } else if (ngx_strncmp(value[1].data, "syslog:", 7) == 0) { peer = ngx_pcalloc(cf->pool, sizeof(ngx_syslog_peer_t)); if (peer == NULL) { return NGX_CONF_ERROR; Renamed: vendor/nginx-1.9.15/src/core/ngx_log.h (+1 -2) 99% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_log.h 2016-04-20 22:22:29 +0900 (618d3ad) +++ vendor/nginx-1.9.15/src/core/ngx_log.h 2016-04-21 23:49:50 +0900 (afb73bf) @@ -29,8 +29,7 @@ #define NGX_LOG_DEBUG_EVENT 0x080 #define NGX_LOG_DEBUG_HTTP 0x100 #define NGX_LOG_DEBUG_MAIL 0x200 -#define NGX_LOG_DEBUG_MYSQL 0x400 -#define NGX_LOG_DEBUG_STREAM 0x800 +#define NGX_LOG_DEBUG_STREAM 0x400 /* * do not forget to update debug_levels[] in src/core/ngx_log.c Renamed: vendor/nginx-1.9.15/src/core/ngx_md5.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_md5.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_module.c (+1 -2) 99% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_module.c 2016-04-20 22:22:29 +0900 (f5ec86a) +++ vendor/nginx-1.9.15/src/core/ngx_module.c 2016-04-21 23:49:50 +0900 (3e3c506) @@ -23,11 +23,10 @@ static ngx_uint_t ngx_modules_n; ngx_int_t -ngx_preinit_modules() +ngx_preinit_modules(void) { ngx_uint_t i; - ngx_max_module = 0; for (i = 0; ngx_modules[i]; i++) { ngx_modules[i]->index = i; ngx_modules[i]->name = ngx_module_names[i]; Renamed: vendor/nginx-1.9.15/src/core/ngx_module.h (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_module.h 2016-04-20 22:22:29 +0900 (3e74def) +++ vendor/nginx-1.9.15/src/core/ngx_module.h 2016-04-21 23:49:50 +0900 (e911cb4) @@ -288,7 +288,7 @@ typedef struct { } ngx_core_module_t; -ngx_int_t ngx_preinit_modules(); +ngx_int_t ngx_preinit_modules(void); ngx_int_t ngx_cycle_modules(ngx_cycle_t *cycle); ngx_int_t ngx_init_modules(ngx_cycle_t *cycle); ngx_int_t ngx_count_modules(ngx_cycle_t *cycle, ngx_uint_t type); Renamed: vendor/nginx-1.9.15/src/core/ngx_murmurhash.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_murmurhash.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_open_file_cache.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_open_file_cache.c 2016-04-20 22:22:29 +0900 (f8bb2e3) +++ vendor/nginx-1.9.15/src/core/ngx_open_file_cache.c 2016-04-21 23:49:50 +0900 (b23ee78) @@ -544,7 +544,7 @@ failed: if (ngx_close_file(fd) == NGX_FILE_ERROR) { ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, - ngx_close_file_n " \"%V\" failed", name); + ngx_close_file_n " \"%s\" failed", name); } ngx_set_errno(err); Renamed: vendor/nginx-1.9.15/src/core/ngx_open_file_cache.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_output_chain.c (+8 -4) 97% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_output_chain.c 2016-04-20 22:22:29 +0900 (252359a) +++ vendor/nginx-1.9.15/src/core/ngx_output_chain.c 2016-04-21 23:49:50 +0900 (f784578) @@ -577,11 +577,15 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx) } else #endif #if (NGX_THREADS) - if (src->file->thread_handler) { - n = ngx_thread_read(&ctx->thread_task, src->file, dst->pos, - (size_t) size, src->file_pos, ctx->pool); + if (ctx->thread_handler) { + src->file->thread_task = ctx->thread_task; + src->file->thread_handler = ctx->thread_handler; + src->file->thread_ctx = ctx->filter_ctx; + + n = ngx_thread_read(src->file, dst->pos, (size_t) size, + src->file_pos, ctx->pool); if (n == NGX_AGAIN) { - ctx->aio = 1; + ctx->thread_task = src->file->thread_task; return NGX_AGAIN; } Renamed: vendor/nginx-1.9.15/src/core/ngx_palloc.c (+42 -44) 89% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_palloc.c 2016-04-20 22:22:29 +0900 (ef4a647) +++ vendor/nginx-1.9.15/src/core/ngx_palloc.c 2016-04-21 23:49:50 +0900 (d3044ac) @@ -9,6 +9,8 @@ #include <ngx_core.h> +static ngx_inline void *ngx_palloc_small(ngx_pool_t *pool, size_t size, + ngx_uint_t align); static void *ngx_palloc_block(ngx_pool_t *pool, size_t size); static void *ngx_palloc_large(ngx_pool_t *pool, size_t size); @@ -56,15 +58,6 @@ ngx_destroy_pool(ngx_pool_t *pool) } } - for (l = pool->large; l; l = l->next) { - - ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, "free: %p", l->alloc); - - if (l->alloc) { - ngx_free(l->alloc); - } - } - #if (NGX_DEBUG) /* @@ -72,6 +65,10 @@ ngx_destroy_pool(ngx_pool_t *pool) * so we cannot use this log while free()ing the pool */ + for (l = pool->large; l; l = l->next) { + ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, pool->log, 0, "free: %p", l->alloc); + } + for (p = pool, n = pool->d.next; /* void */; p = n, n = n->d.next) { ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, pool->log, 0, "free: %p, unused: %uz", p, p->d.end - p->d.last); @@ -83,6 +80,12 @@ ngx_destroy_pool(ngx_pool_t *pool) #endif + for (l = pool->large; l; l = l->next) { + if (l->alloc) { + ngx_free(l->alloc); + } + } + for (p = pool, n = pool->d.next; /* void */; p = n, n = n->d.next) { ngx_free(p); @@ -119,60 +122,55 @@ ngx_reset_pool(ngx_pool_t *pool) void * ngx_palloc(ngx_pool_t *pool, size_t size) { - u_char *m; - ngx_pool_t *p; - +#if !(NGX_DEBUG_PALLOC) if (size <= pool->max) { + return ngx_palloc_small(pool, size, 1); + } +#endif - p = pool->current; - - do { - m = ngx_align_ptr(p->d.last, NGX_ALIGNMENT); - - if ((size_t) (p->d.end - m) >= size) { - p->d.last = m + size; - - return m; - } - - p = p->d.next; + return ngx_palloc_large(pool, size); +} - } while (p); - return ngx_palloc_block(pool, size); +void * +ngx_pnalloc(ngx_pool_t *pool, size_t size) +{ +#if !(NGX_DEBUG_PALLOC) + if (size <= pool->max) { + return ngx_palloc_small(pool, size, 0); } +#endif return ngx_palloc_large(pool, size); } -void * -ngx_pnalloc(ngx_pool_t *pool, size_t size) +static ngx_inline void * +ngx_palloc_small(ngx_pool_t *pool, size_t size, ngx_uint_t align) { u_char *m; ngx_pool_t *p; - if (size <= pool->max) { - - p = pool->current; + p = pool->current; - do { - m = p->d.last; + do { + m = p->d.last; - if ((size_t) (p->d.end - m) >= size) { - p->d.last = m + size; + if (align) { + m = ngx_align_ptr(m, NGX_ALIGNMENT); + } - return m; - } + if ((size_t) (p->d.end - m) >= size) { + p->d.last = m + size; - p = p->d.next; + return m; + } - } while (p); + p = p->d.next; - return ngx_palloc_block(pool, size); - } + } while (p); - return ngx_palloc_large(pool, size); + return ngx_palloc_block(pool, size); } @@ -237,7 +235,7 @@ ngx_palloc_large(ngx_pool_t *pool, size_t size) } } - large = ngx_palloc(pool, sizeof(ngx_pool_large_t)); + large = ngx_palloc_small(pool, sizeof(ngx_pool_large_t), 1); if (large == NULL) { ngx_free(p); return NULL; @@ -262,7 +260,7 @@ ngx_pmemalign(ngx_pool_t *pool, size_t size, size_t alignment) return NULL; } - large = ngx_palloc(pool, sizeof(ngx_pool_large_t)); + large = ngx_palloc_small(pool, sizeof(ngx_pool_large_t), 1); if (large == NULL) { ngx_free(p); return NULL; Renamed: vendor/nginx-1.9.15/src/core/ngx_palloc.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_parse.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_parse.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_parse_time.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_parse_time.c 2016-04-20 22:22:29 +0900 (831cc71) +++ vendor/nginx-1.9.15/src/core/ngx_parse_time.c 2016-04-21 23:49:50 +0900 (13afde3) @@ -220,7 +220,7 @@ ngx_parse_http_time(u_char *value, size_t len) } if (hour > 23 || min > 59 || sec > 59) { - return NGX_ERROR; + return NGX_ERROR; } if (day == 29 && month == 1) { Renamed: vendor/nginx-1.9.15/src/core/ngx_parse_time.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_proxy_protocol.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_proxy_protocol.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_queue.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_queue.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_radix_tree.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_radix_tree.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_rbtree.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_rbtree.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_regex.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_regex.c 2016-04-20 22:22:29 +0900 (416622d) +++ vendor/nginx-1.9.15/src/core/ngx_regex.c 2016-04-21 23:49:50 +0900 (9939dce) @@ -32,7 +32,7 @@ static ngx_conf_post_t ngx_regex_pcre_jit_post = { ngx_regex_pcre_jit }; static ngx_command_t ngx_regex_commands[] = { { ngx_string("pcre_jit"), - NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1, + NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_FLAG, ngx_conf_set_flag_slot, 0, offsetof(ngx_regex_conf_t, pcre_jit), Renamed: vendor/nginx-1.9.15/src/core/ngx_regex.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_resolver.c (+1085 -153) 77% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_resolver.c 2016-04-20 22:22:29 +0900 (7f0d3ad) +++ vendor/nginx-1.9.15/src/core/ngx_resolver.c 2016-04-21 23:49:50 +0900 (e00fe22) @@ -74,8 +74,10 @@ static ngx_int_t ngx_resolver_send_tcp_query(ngx_resolver_t *r, ngx_resolver_connection_t *rec, u_char *query, u_short qlen); static ngx_int_t ngx_resolver_create_name_query(ngx_resolver_t *r, ngx_resolver_node_t *rn, ngx_str_t *name); +static ngx_int_t ngx_resolver_create_srv_query(ngx_resolver_t *r, + ngx_resolver_node_t *rn, ngx_str_t *name); static ngx_int_t ngx_resolver_create_addr_query(ngx_resolver_t *r, - ngx_resolver_node_t *rn, ngx_addr_t *addr); + ngx_resolver_node_t *rn, ngx_resolver_addr_t *addr); static void ngx_resolver_resend_handler(ngx_event_t *ev); static time_t ngx_resolver_resend(ngx_resolver_t *r, ngx_rbtree_t *tree, ngx_queue_t *queue); @@ -88,10 +90,15 @@ static void ngx_resolver_process_response(ngx_resolver_t *r, u_char *buf, static void ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t n, ngx_uint_t ident, ngx_uint_t code, ngx_uint_t qtype, ngx_uint_t nan, ngx_uint_t trunc, ngx_uint_t ans); +static void ngx_resolver_process_srv(ngx_resolver_t *r, u_char *buf, size_t n, + ngx_uint_t ident, ngx_uint_t code, ngx_uint_t nan, + ngx_uint_t trunc, ngx_uint_t ans); static void ngx_resolver_process_ptr(ngx_resolver_t *r, u_char *buf, size_t n, ngx_uint_t ident, ngx_uint_t code, ngx_uint_t nan); static ngx_resolver_node_t *ngx_resolver_lookup_name(ngx_resolver_t *r, ngx_str_t *name, uint32_t hash); +static ngx_resolver_node_t *ngx_resolver_lookup_srv(ngx_resolver_t *r, + ngx_str_t *name, uint32_t hash); static ngx_resolver_node_t *ngx_resolver_lookup_addr(ngx_resolver_t *r, in_addr_t addr); static void ngx_resolver_rbtree_insert_value(ngx_rbtree_node_t *temp, @@ -105,9 +112,14 @@ static void *ngx_resolver_calloc(ngx_resolver_t *r, size_t size); static void ngx_resolver_free(ngx_resolver_t *r, void *p); static void ngx_resolver_free_locked(ngx_resolver_t *r, void *p); static void *ngx_resolver_dup(ngx_resolver_t *r, void *src, size_t size); -static ngx_addr_t *ngx_resolver_export(ngx_resolver_t *r, +static ngx_resolver_addr_t *ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn, ngx_uint_t rotate); +static void ngx_resolver_report_srv(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx); static u_char *ngx_resolver_log_error(ngx_log_t *log, u_char *buf, size_t len); +static void ngx_resolver_resolve_srv_names(ngx_resolver_ctx_t *ctx, + ngx_resolver_node_t *rn); +static void ngx_resolver_srv_names_handler(ngx_resolver_ctx_t *ctx); +static ngx_int_t ngx_resolver_cmp_srvs(const void *one, const void *two); #if (NGX_HAVE_INET6) static void ngx_resolver_rbtree_insert_addr6_value(ngx_rbtree_node_t *temp, @@ -149,13 +161,18 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_str_t *names, ngx_uint_t n) ngx_rbtree_init(&r->name_rbtree, &r->name_sentinel, ngx_resolver_rbtree_insert_value); + ngx_rbtree_init(&r->srv_rbtree, &r->srv_sentinel, + ngx_resolver_rbtree_insert_value); + ngx_rbtree_init(&r->addr_rbtree, &r->addr_sentinel, ngx_rbtree_insert_value); ngx_queue_init(&r->name_resend_queue); + ngx_queue_init(&r->srv_resend_queue); ngx_queue_init(&r->addr_resend_queue); ngx_queue_init(&r->name_expire_queue); + ngx_queue_init(&r->srv_expire_queue); ngx_queue_init(&r->addr_expire_queue); #if (NGX_HAVE_INET6) @@ -274,6 +291,8 @@ ngx_resolver_cleanup(void *data) ngx_resolver_cleanup_tree(r, &r->name_rbtree); + ngx_resolver_cleanup_tree(r, &r->srv_rbtree); + ngx_resolver_cleanup_tree(r, &r->addr_rbtree); #if (NGX_HAVE_INET6) @@ -383,7 +402,9 @@ ngx_resolve_start(ngx_resolver_t *r, ngx_resolver_ctx_t *temp) ngx_int_t ngx_resolve_name(ngx_resolver_ctx_t *ctx) { + size_t slen; ngx_int_t rc; + ngx_str_t name; ngx_resolver_t *r; r = ctx->resolver; @@ -400,9 +421,41 @@ ngx_resolve_name(ngx_resolver_ctx_t *ctx) return NGX_OK; } - /* lock name mutex */ + if (ctx->service.len) { + slen = ctx->service.len; + + if (ngx_strlchr(ctx->service.data, + ctx->service.data + ctx->service.len, '.') + == NULL) + { + slen += sizeof("_._tcp") - 1; + } + + name.len = slen + 1 + ctx->name.len; + + name.data = ngx_resolver_alloc(r, name.len); + if (name.data == NULL) { + return NGX_ERROR; + } + + if (slen == ctx->service.len) { + ngx_sprintf(name.data, "%V.%V", &ctx->service, &ctx->name); - rc = ngx_resolve_name_locked(r, ctx, &ctx->name); + } else { + ngx_sprintf(name.data, "_%V._tcp.%V", &ctx->service, &ctx->name); + } + + /* lock name mutex */ + + rc = ngx_resolve_name_locked(r, ctx, &name); + + ngx_resolver_free(r, name.data); + + } else { + /* lock name mutex */ + + rc = ngx_resolve_name_locked(r, ctx, &ctx->name); + } if (rc == NGX_OK) { return NGX_OK; @@ -429,6 +482,7 @@ ngx_resolve_name(ngx_resolver_ctx_t *ctx) void ngx_resolve_name_done(ngx_resolver_ctx_t *ctx) { + ngx_uint_t i; ngx_resolver_t *r; ngx_resolver_ctx_t *w, **p; ngx_resolver_node_t *rn; @@ -448,6 +502,23 @@ ngx_resolve_name_done(ngx_resolver_ctx_t *ctx) /* lock name mutex */ + if (ctx->nsrvs) { + for (i = 0; i < ctx->nsrvs; i++) { + if (ctx->srvs[i].ctx) { + ngx_resolve_name_done(ctx->srvs[i].ctx); + } + + if (ctx->srvs[i].addrs) { + ngx_resolver_free(r, ctx->srvs[i].addrs->sockaddr); + ngx_resolver_free(r, ctx->srvs[i].addrs); + } + + ngx_resolver_free(r, ctx->srvs[i].name.data); + } + + ngx_resolver_free(r, ctx->srvs); + } + if (ctx->state == NGX_AGAIN || ctx->state == NGX_RESOLVE_TIMEDOUT) { rn = ctx->node; @@ -466,15 +537,20 @@ ngx_resolve_name_done(ngx_resolver_ctx_t *ctx) p = &w->next; w = w->next; } - } - ngx_log_error(NGX_LOG_ALERT, r->log, 0, - "could not cancel %V resolving", &ctx->name); + ngx_log_error(NGX_LOG_ALERT, r->log, 0, + "could not cancel %V resolving", &ctx->name); + } } done: - ngx_resolver_expire(r, &r->name_rbtree, &r->name_expire_queue); + if (ctx->service.len) { + ngx_resolver_expire(r, &r->srv_rbtree, &r->srv_expire_queue); + + } else { + ngx_resolver_expire(r, &r->name_rbtree, &r->name_expire_queue); + } /* unlock name mutex */ @@ -501,16 +577,31 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx, uint32_t hash; ngx_int_t rc; ngx_str_t cname; - ngx_uint_t naddrs; - ngx_addr_t *addrs; + ngx_uint_t i, naddrs; + ngx_queue_t *resend_queue, *expire_queue; + ngx_rbtree_t *tree; ngx_resolver_ctx_t *next, *last; + ngx_resolver_addr_t *addrs; ngx_resolver_node_t *rn; ngx_strlow(name->data, name->data, name->len); hash = ngx_crc32_short(name->data, name->len); - rn = ngx_resolver_lookup_name(r, name, hash); + if (ctx->service.len) { + rn = ngx_resolver_lookup_srv(r, name, hash); + + tree = &r->srv_rbtree; + resend_queue = &r->srv_resend_queue; + expire_queue = &r->srv_expire_queue; + + } else { + rn = ngx_resolver_lookup_name(r, name, hash); + + tree = &r->name_rbtree; + resend_queue = &r->name_resend_queue; + expire_queue = &r->name_expire_queue; + } if (rn) { @@ -525,7 +616,7 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx, rn->expire = ngx_time() + r->expire; - ngx_queue_insert_head(&r->name_expire_queue, &rn->queue); + ngx_queue_insert_head(expire_queue, &rn->queue); naddrs = (rn->naddrs == (u_short) -1) ? 0 : rn->naddrs; #if (NGX_HAVE_INET6) @@ -551,6 +642,7 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx, do { ctx->state = NGX_OK; + ctx->valid = rn->valid; ctx->naddrs = naddrs; if (addrs == NULL) { @@ -580,6 +672,23 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx, return NGX_OK; } + if (rn->nsrvs) { + last->next = rn->waiting; + rn->waiting = NULL; + + /* unlock name mutex */ + + do { + next = ctx->next; + + ngx_resolver_resolve_srv_names(ctx, rn); + + ctx = next; + } while (ctx); + + return NGX_OK; + } + /* NGX_RESOLVE_CNAME */ if (ctx->recursion++ < NGX_RESOLVER_MAX_RECURSION) { @@ -597,6 +706,7 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx, do { ctx->state = NGX_RESOLVE_NXDOMAIN; + ctx->valid = ngx_time() + (r->valid ? r->valid : 10); next = ctx->next; ctx->handler(ctx); @@ -609,7 +719,7 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx, if (rn->waiting) { - if (ctx->event == NULL) { + if (ctx->event == NULL && ctx->timeout) { ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); if (ctx->event == NULL) { return NGX_ERROR; @@ -661,6 +771,16 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx, } #endif + if (rn->nsrvs) { + for (i = 0; i < rn->nsrvs; i++) { + if (rn->u.srvs[i].name.data) { + ngx_resolver_free_locked(r, rn->u.srvs[i].name.data); + } + } + + ngx_resolver_free_locked(r, rn->u.srvs); + } + /* unlock alloc mutex */ } else { @@ -683,17 +803,22 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx, rn->query6 = NULL; #endif - ngx_rbtree_insert(&r->name_rbtree, &rn->node); + ngx_rbtree_insert(tree, &rn->node); } - rc = ngx_resolver_create_name_query(r, rn, name); + if (ctx->service.len) { + rc = ngx_resolver_create_srv_query(r, rn, name); + + } else { + rc = ngx_resolver_create_name_query(r, rn, name); + } if (rc == NGX_ERROR) { goto failed; } if (rc == NGX_DECLINED) { - ngx_rbtree_delete(&r->name_rbtree, &rn->node); + ngx_rbtree_delete(tree, &rn->node); ngx_resolver_free(r, rn->query); ngx_resolver_free(r, rn->name); @@ -722,12 +847,13 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx, rn->naddrs6 = r->ipv6 ? (u_short) -1 : 0; rn->tcp6 = 0; #endif + rn->nsrvs = 0; if (ngx_resolver_send_query(r, rn) != NGX_OK) { goto failed; } - if (ctx->event == NULL) { + if (ctx->event == NULL && ctx->timeout) { ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); if (ctx->event == NULL) { goto failed; @@ -741,13 +867,13 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx, ngx_add_timer(ctx->event, ctx->timeout); } - if (ngx_queue_empty(&r->name_resend_queue)) { + if (ngx_queue_empty(resend_queue)) { ngx_add_timer(r->event, (ngx_msec_t) (r->resend_timeout * 1000)); } rn->expire = ngx_time() + r->resend_timeout; - ngx_queue_insert_head(&r->name_resend_queue, &rn->queue); + ngx_queue_insert_head(resend_queue, &rn->queue); rn->code = 0; rn->cnlen = 0; @@ -766,7 +892,7 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx, failed: - ngx_rbtree_delete(&r->name_rbtree, &rn->node); + ngx_rbtree_delete(tree, &rn->node); if (rn->query) { ngx_resolver_free(r, rn->query); @@ -859,6 +985,7 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx) /* unlock addr mutex */ ctx->state = NGX_OK; + ctx->valid = rn->valid; ctx->handler(ctx); @@ -869,17 +996,19 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx) if (rn->waiting) { - ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); - if (ctx->event == NULL) { - return NGX_ERROR; - } + if (ctx->event == NULL && ctx->timeout) { + ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); + if (ctx->event == NULL) { + return NGX_ERROR; + } - ctx->event->handler = ngx_resolver_timeout_handler; - ctx->event->data = ctx; - ctx->event->log = r->log; - ctx->ident = -1; + ctx->event->handler = ngx_resolver_timeout_handler; + ctx->event->data = ctx; + ctx->event->log = r->log; + ctx->ident = -1; - ngx_add_timer(ctx->event, ctx->timeout); + ngx_add_timer(ctx->event, ctx->timeout); + } ctx->next = rn->waiting; rn->waiting = ctx; @@ -941,22 +1070,25 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx) rn->naddrs6 = (u_short) -1; rn->tcp6 = 0; #endif + rn->nsrvs = 0; if (ngx_resolver_send_query(r, rn) != NGX_OK) { goto failed; } - ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); - if (ctx->event == NULL) { - goto failed; - } + if (ctx->event == NULL && ctx->timeout) { + ctx->event = ngx_resolver_calloc(r, sizeof(ngx_event_t)); + if (ctx->event == NULL) { + goto failed; + } - ctx->event->handler = ngx_resolver_timeout_handler; - ctx->event->data = ctx; - ctx->event->log = r->log; - ctx->ident = -1; + ctx->event->handler = ngx_resolver_timeout_handler; + ctx->event->data = ctx; + ctx->event->log = r->log; + ctx->ident = -1; - ngx_add_timer(ctx->event, ctx->timeout); + ngx_add_timer(ctx->event, ctx->timeout); + } if (ngx_queue_empty(resend_queue)) { ngx_add_timer(r->event, (ngx_msec_t) (r->resend_timeout * 1000)); @@ -1294,7 +1426,7 @@ ngx_resolver_send_tcp_query(ngx_resolver_t *r, ngx_resolver_connection_t *rec, static void ngx_resolver_resend_handler(ngx_event_t *ev) { - time_t timer, atimer, ntimer; + time_t timer, atimer, stimer, ntimer; #if (NGX_HAVE_INET6) time_t a6timer; #endif @@ -1309,6 +1441,8 @@ ngx_resolver_resend_handler(ngx_event_t *ev) ntimer = ngx_resolver_resend(r, &r->name_rbtree, &r->name_resend_queue); + stimer = ngx_resolver_resend(r, &r->srv_rbtree, &r->srv_resend_queue); + /* unlock name mutex */ /* lock addr mutex */ @@ -1336,6 +1470,13 @@ ngx_resolver_resend_handler(ngx_event_t *ev) timer = ngx_min(timer, atimer); } + if (timer == 0) { + timer = stimer; + + } else if (stimer) { + timer = ngx_min(timer, stimer); + } + #if (NGX_HAVE_INET6) if (timer == 0) { @@ -1592,7 +1733,7 @@ ngx_resolver_process_response(ngx_resolver_t *r, u_char *buf, size_t n, trunc = flags & 0x0200; ngx_log_debug6(NGX_LOG_DEBUG_CORE, r->log, 0, - "resolver DNS response %ui fl:%04Xui %ui/%ui/%ud/%ud", + "resolver DNS response %ui fl:%04Xi %ui/%ui/%ud/%ud", ident, flags, nqs, nan, (response->nns_hi << 8) + response->nns_lo, (response->nar_hi << 8) + response->nar_lo); @@ -1600,7 +1741,7 @@ ngx_resolver_process_response(ngx_resolver_t *r, u_char *buf, size_t n, /* response to a standard query */ if ((flags & 0xf870) != 0x8000 || (trunc && tcp)) { ngx_log_error(r->log_level, r->log, 0, - "invalid %s DNS response %ui fl:%04Xui", + "invalid %s DNS response %ui fl:%04Xi", tcp ? "TCP" : "UDP", ident, flags); return; } @@ -1696,6 +1837,13 @@ found: break; + case NGX_RESOLVE_SRV: + + ngx_resolver_process_srv(r, buf, n, ident, code, nan, trunc, + i + sizeof(ngx_resolver_qs_t)); + + break; + case NGX_RESOLVE_PTR: ngx_resolver_process_ptr(r, buf, n, ident, code, nan); @@ -1725,7 +1873,7 @@ dns_error_name: ngx_log_error(r->log_level, r->log, 0, "DNS error (%ui: %s), query id:%ui, name:\"%*s\"", code, ngx_resolver_strerror(code), ident, - rn->nlen, rn->name); + (size_t) rn->nlen, rn->name); return; dns_error: @@ -1749,7 +1897,6 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t n, uint32_t hash; in_addr_t *addr; ngx_str_t name; - ngx_addr_t *addrs; ngx_uint_t type, class, qident, naddrs, a, i, j, start; #if (NGX_HAVE_INET6) struct in6_addr *addr6; @@ -1757,6 +1904,7 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t n, ngx_resolver_an_t *an; ngx_resolver_ctx_t *ctx, *next; ngx_resolver_node_t *rn; + ngx_resolver_addr_t *addrs; ngx_resolver_connection_t *rec; if (ngx_resolver_copy(r, &name, buf, @@ -1948,6 +2096,7 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t n, while (next) { ctx = next; ctx->state = code; + ctx->valid = ngx_time() + (r->valid ? r->valid : 10); next = ctx->next; ctx->handler(ctx); @@ -2262,6 +2411,7 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t n, while (next) { ctx = next; ctx->state = NGX_OK; + ctx->valid = rn->valid; ctx->naddrs = naddrs; if (addrs == NULL) { @@ -2391,26 +2541,22 @@ next: static void -ngx_resolver_process_ptr(ngx_resolver_t *r, u_char *buf, size_t n, - ngx_uint_t ident, ngx_uint_t code, ngx_uint_t nan) +ngx_resolver_process_srv(ngx_resolver_t *r, u_char *buf, size_t n, + ngx_uint_t ident, ngx_uint_t code, ngx_uint_t nan, + ngx_uint_t trunc, ngx_uint_t ans) { - char *err; - size_t len; - in_addr_t addr; - int32_t ttl; - ngx_int_t octet; - ngx_str_t name; - ngx_uint_t mask, type, class, qident, a, i, start; - ngx_queue_t *expire_queue; - ngx_rbtree_t *tree; - ngx_resolver_an_t *an; - ngx_resolver_ctx_t *ctx, *next; - ngx_resolver_node_t *rn; -#if (NGX_HAVE_INET6) - uint32_t hash; - ngx_int_t digit; - struct in6_addr addr6; -#endif + char *err; + u_char *cname; + size_t len; + int32_t ttl; + uint32_t hash; + ngx_str_t name; + ngx_uint_t type, qident, class, start, nsrvs, a, i, j; + ngx_resolver_an_t *an; + ngx_resolver_ctx_t *ctx, *next; + ngx_resolver_srv_t *srvs; + ngx_resolver_node_t *rn; + ngx_resolver_connection_t *rec; if (ngx_resolver_copy(r, &name, buf, buf + sizeof(ngx_resolver_hdr_t), buf + n) @@ -2421,109 +2567,62 @@ ngx_resolver_process_ptr(ngx_resolver_t *r, u_char *buf, size_t n, ngx_log_debug1(NGX_LOG_DEBUG_CORE, r->log, 0, "resolver qs:%V", &name); - /* AF_INET */ - - addr = 0; - i = sizeof(ngx_resolver_hdr_t); - - for (mask = 0; mask < 32; mask += 8) { - len = buf[i++]; + hash = ngx_crc32_short(name.data, name.len); - octet = ngx_atoi(&buf[i], len); - if (octet == NGX_ERROR || octet > 255) { - goto invalid_in_addr_arpa; - } + rn = ngx_resolver_lookup_srv(r, &name, hash); - addr += octet << mask; - i += len; + if (rn == NULL || rn->query == NULL) { + ngx_log_error(r->log_level, r->log, 0, + "unexpected response for %V", &name); + ngx_resolver_free(r, name.data); + goto failed; } - if (ngx_strcasecmp(&buf[i], (u_char *) "\7in-addr\4arpa") == 0) { - i += sizeof("\7in-addr\4arpa"); - - /* lock addr mutex */ - - rn = ngx_resolver_lookup_addr(r, addr); - - tree = &r->addr_rbtree; - expire_queue = &r->addr_expire_queue; - - goto valid; + if (trunc && rn->tcp) { + ngx_resolver_free(r, name.data); + goto failed; } -invalid_in_addr_arpa: - -#if (NGX_HAVE_INET6) - - i = sizeof(ngx_resolver_hdr_t); + qident = (rn->query[0] << 8) + rn->query[1]; - for (octet = 15; octet >= 0; octet--) { - if (buf[i++] != '\1') { - goto invalid_ip6_arpa; - } + if (ident != qident) { + ngx_log_error(r->log_level, r->log, 0, + "wrong ident %ui response for %V, expect %ui", + ident, &name, qident); + ngx_resolver_free(r, name.data); + goto failed; + } - digit = ngx_hextoi(&buf[i++], 1); - if (digit == NGX_ERROR) { - goto invalid_ip6_arpa; - } + ngx_resolver_free(r, name.data); - addr6.s6_addr[octet] = (u_char) digit; + if (trunc) { - if (buf[i++] != '\1') { - goto invalid_ip6_arpa; - } + ngx_queue_remove(&rn->queue); - digit = ngx_hextoi(&buf[i++], 1); - if (digit == NGX_ERROR) { - goto invalid_ip6_arpa; + if (rn->waiting == NULL) { + ngx_rbtree_delete(&r->srv_rbtree, &rn->node); + ngx_resolver_free_node(r, rn); + return; } - addr6.s6_addr[octet] += (u_char) (digit * 16); - } - - if (ngx_strcasecmp(&buf[i], (u_char *) "\3ip6\4arpa") == 0) { - i += sizeof("\3ip6\4arpa"); - - /* lock addr mutex */ - - hash = ngx_crc32_short(addr6.s6_addr, 16); - rn = ngx_resolver_lookup_addr6(r, &addr6, hash); - - tree = &r->addr6_rbtree; - expire_queue = &r->addr6_expire_queue; + rec = r->connections.elts; + rec = &rec[rn->last_connection]; - goto valid; - } + rn->tcp = 1; -invalid_ip6_arpa: -#endif + (void) ngx_resolver_send_tcp_query(r, rec, rn->query, rn->qlen); - ngx_log_error(r->log_level, r->log, 0, - "invalid in-addr.arpa or ip6.arpa name in DNS response"); - ngx_resolver_free(r, name.data); - return; + rn->expire = ngx_time() + r->resend_timeout; -valid: + ngx_queue_insert_head(&r->srv_resend_queue, &rn->queue); - if (rn == NULL || rn->query == NULL) { - ngx_log_error(r->log_level, r->log, 0, - "unexpected response for %V", &name); - ngx_resolver_free(r, name.data); - goto failed; + return; } - qident = (rn->query[0] << 8) + rn->query[1]; - - if (ident != qident) { - ngx_log_error(r->log_level, r->log, 0, - "wrong ident %ui response for %V, expect %ui", - ident, &name, qident); - ngx_resolver_free(r, name.data); - goto failed; + if (code == 0 && rn->code) { + code = rn->code; } - ngx_resolver_free(r, name.data); - if (code == 0 && nan == 0) { code = NGX_RESOLVE_NXDOMAIN; } @@ -2534,13 +2633,12 @@ valid: ngx_queue_remove(&rn->queue); - ngx_rbtree_delete(tree, &rn->node); - - /* unlock addr mutex */ + ngx_rbtree_delete(&r->srv_rbtree, &rn->node); while (next) { ctx = next; ctx->state = code; + ctx->valid = ngx_time() + (r->valid ? r->valid : 10); next = ctx->next; ctx->handler(ctx); @@ -2551,7 +2649,9 @@ valid: return; } - i += sizeof(ngx_resolver_qs_t); + i = ans; + nsrvs = 0; + cname = NULL; for (a = 0; a < nan; a++) { @@ -2577,7 +2677,7 @@ valid: test_length: if (i - start < 2) { - err = "invalid name in DNS response"; + err = "invalid name DNS response"; goto invalid; } @@ -2605,7 +2705,588 @@ valid: ttl = 0; } - ngx_log_debug3(NGX_LOG_DEBUG_CORE, r->log, 0, + rn->ttl = ngx_min(rn->ttl, (uint32_t) ttl); + + i += sizeof(ngx_resolver_an_t); + + switch (type) { + + case NGX_RESOLVE_SRV: + + if (i + 6 > n) { + goto short_response; + } + + if (ngx_resolver_copy(r, NULL, buf, &buf[i + 6], buf + n) + != NGX_OK) + { + goto failed; + } + + nsrvs++; + + break; + + case NGX_RESOLVE_CNAME: + + cname = &buf[i]; + + break; + + case NGX_RESOLVE_DNAME: + + break; + + default: + + ngx_log_error(r->log_level, r->log, 0, + "unexpected RR type %ui", type); + } + + i += len; + } + + ngx_log_debug3(NGX_LOG_DEBUG_CORE, r->log, 0, + "resolver nsrvs:%ui cname:%p ttl:%uD", + nsrvs, cname, rn->ttl); + + if (nsrvs) { + + srvs = ngx_resolver_calloc(r, nsrvs * sizeof(ngx_resolver_srv_t)); + if (srvs == NULL) { + goto failed; + } + + rn->u.srvs = srvs; + rn->nsrvs = (u_short) nsrvs; + + j = 0; + i = ans; + + for (a = 0; a < nan; a++) { + + for ( ;; ) { + + if (buf[i] & 0xc0) { + i += 2; + break; + } + + if (buf[i] == 0) { + i++; + break; + } + + i += 1 + buf[i]; + } + + an = (ngx_resolver_an_t *) &buf[i]; + + type = (an->type_hi << 8) + an->type_lo; + len = (an->len_hi << 8) + an->len_lo; + + i += sizeof(ngx_resolver_an_t); + + if (type == NGX_RESOLVE_SRV) { + + srvs[j].priority = (buf[i] << 8) + buf[i + 1]; + srvs[j].weight = (buf[i + 2] << 8) + buf[i + 3]; + + if (srvs[j].weight == 0) { + srvs[j].weight = 1; + } + + srvs[j].port = (buf[i + 4] << 8) + buf[i + 5]; + + if (ngx_resolver_copy(r, &srvs[j].name, buf, &buf[i + 6], + buf + n) + != NGX_OK) + { + goto failed; + } + + j++; + } + + i += len; + } + + ngx_sort(srvs, nsrvs, sizeof(ngx_resolver_srv_t), + ngx_resolver_cmp_srvs); + + ngx_resolver_free(r, rn->query); + rn->query = NULL; + + ngx_queue_remove(&rn->queue); + + rn->valid = ngx_time() + (r->valid ? r->valid : (time_t) rn->ttl); + rn->expire = ngx_time() + r->expire; + + ngx_queue_insert_head(&r->srv_expire_queue, &rn->queue); + + next = rn->waiting; + rn->waiting = NULL; + + while (next) { + ctx = next; + next = ctx->next; + + ngx_resolver_resolve_srv_names(ctx, rn); + } + + return; + } + + rn->nsrvs = 0; + + if (cname) { + + /* CNAME only */ + + if (ngx_resolver_copy(r, &name, buf, cname, buf + n) != NGX_OK) { + goto failed; + } + + ngx_log_debug1(NGX_LOG_DEBUG_CORE, r->log, 0, + "resolver cname:\"%V\"", &name); + + ngx_queue_remove(&rn->queue); + + rn->cnlen = (u_short) name.len; + rn->u.cname = name.data; + + rn->valid = ngx_time() + (r->valid ? r->valid : (time_t) rn->ttl); + rn->expire = ngx_time() + r->expire; + + ngx_queue_insert_head(&r->srv_expire_queue, &rn->queue); + + ngx_resolver_free(r, rn->query); + rn->query = NULL; +#if (NGX_HAVE_INET6) + rn->query6 = NULL; +#endif + + ctx = rn->waiting; + rn->waiting = NULL; + + if (ctx) { + + if (ctx->recursion++ >= NGX_RESOLVER_MAX_RECURSION) { + + /* unlock name mutex */ + + do { + ctx->state = NGX_RESOLVE_NXDOMAIN; + next = ctx->next; + + ctx->handler(ctx); + + ctx = next; + } while (ctx); + + return; + } + + for (next = ctx; next; next = next->next) { + next->node = NULL; + } + + (void) ngx_resolve_name_locked(r, ctx, &name); + } + + /* unlock name mutex */ + + return; + } + + ngx_log_error(r->log_level, r->log, 0, "no SRV type in DNS response"); + + return; + +short_response: + + err = "short DNS response"; + +invalid: + + /* unlock name mutex */ + + ngx_log_error(r->log_level, r->log, 0, err); + + return; + +failed: + + /* unlock name mutex */ + + return; +} + + +static void +ngx_resolver_resolve_srv_names(ngx_resolver_ctx_t *ctx, ngx_resolver_node_t *rn) +{ + ngx_uint_t i; + ngx_resolver_t *r; + ngx_resolver_ctx_t *cctx; + ngx_resolver_srv_name_t *srvs; + + r = ctx->resolver; + + ctx->node = NULL; + ctx->state = NGX_OK; + ctx->valid = rn->valid; + ctx->count = rn->nsrvs; + + srvs = ngx_resolver_calloc(r, rn->nsrvs * sizeof(ngx_resolver_srv_name_t)); + if (srvs == NULL) { + goto failed; + } + + ctx->srvs = srvs; + ctx->nsrvs = rn->nsrvs; + + for (i = 0; i < rn->nsrvs; i++) { + srvs[i].name.data = ngx_resolver_alloc(r, rn->u.srvs[i].name.len); + if (srvs[i].name.data == NULL) { + goto failed; + } + + srvs[i].name.len = rn->u.srvs[i].name.len; + ngx_memcpy(srvs[i].name.data, rn->u.srvs[i].name.data, + srvs[i].name.len); + + cctx = ngx_resolve_start(r, NULL); + if (cctx == NULL) { + goto failed; + } + + cctx->name = srvs[i].name; + cctx->handler = ngx_resolver_srv_names_handler; + cctx->data = ctx; + cctx->srvs = &srvs[i]; + cctx->timeout = 0; + + srvs[i].priority = rn->u.srvs[i].priority; + srvs[i].weight = rn->u.srvs[i].weight; + srvs[i].port = rn->u.srvs[i].port; + srvs[i].ctx = cctx; + + if (ngx_resolve_name(cctx) == NGX_ERROR) { + srvs[i].ctx = NULL; + goto failed; + } + } + + return; + +failed: + + ctx->state = NGX_ERROR; + ctx->valid = ngx_time() + (r->valid ? r->valid : 10); + + ctx->handler(ctx); +} + + +static void +ngx_resolver_srv_names_handler(ngx_resolver_ctx_t *cctx) +{ + ngx_uint_t i; + u_char (*sockaddr)[NGX_SOCKADDRLEN]; + ngx_addr_t *addrs; + ngx_resolver_t *r; + struct sockaddr_in *sin; + ngx_resolver_ctx_t *ctx; + ngx_resolver_srv_name_t *srv; +#if (NGX_HAVE_INET6) + struct sockaddr_in6 *sin6; +#endif + + r = cctx->resolver; + ctx = cctx->data; + srv = cctx->srvs; + + ctx->count--; + + srv->ctx = NULL; + + if (cctx->naddrs) { + + ctx->valid = ngx_min(ctx->valid, cctx->valid); + + addrs = ngx_resolver_calloc(r, cctx->naddrs * sizeof(ngx_addr_t)); + if (addrs == NULL) { + ngx_resolve_name_done(cctx); + + ctx->state = NGX_ERROR; + ctx->valid = ngx_time() + (r->valid ? r->valid : 10); + + ctx->handler(ctx); + return; + } + + sockaddr = ngx_resolver_alloc(r, cctx->naddrs * NGX_SOCKADDRLEN); + if (sockaddr == NULL) { + ngx_resolver_free(r, addrs); + ngx_resolve_name_done(cctx); + + ctx->state = NGX_ERROR; + ctx->valid = ngx_time() + (r->valid ? r->valid : 10); + + ctx->handler(ctx); + return; + } + + for (i = 0; i < cctx->naddrs; i++) { + addrs[i].sockaddr = (struct sockaddr *) sockaddr[i]; + addrs[i].socklen = cctx->addrs[i].socklen; + + ngx_memcpy(sockaddr[i], cctx->addrs[i].sockaddr, + addrs[i].socklen); + + switch (addrs[i].sockaddr->sa_family) { +#if (NGX_HAVE_INET6) + case AF_INET6: + sin6 = (struct sockaddr_in6 *) addrs[i].sockaddr; + sin6->sin6_port = htons(srv->port); + break; +#endif + default: /* AF_INET */ + sin = (struct sockaddr_in *) addrs[i].sockaddr; + sin->sin_port = htons(srv->port); + } + } + + srv->addrs = addrs; + srv->naddrs = cctx->naddrs; + } + + ngx_resolve_name_done(cctx); + + if (ctx->count == 0) { + ngx_resolver_report_srv(r, ctx); + } +} + + +static void +ngx_resolver_process_ptr(ngx_resolver_t *r, u_char *buf, size_t n, + ngx_uint_t ident, ngx_uint_t code, ngx_uint_t nan) +{ + char *err; + size_t len; + in_addr_t addr; + int32_t ttl; + ngx_int_t octet; + ngx_str_t name; + ngx_uint_t mask, type, class, qident, a, i, start; + ngx_queue_t *expire_queue; + ngx_rbtree_t *tree; + ngx_resolver_an_t *an; + ngx_resolver_ctx_t *ctx, *next; + ngx_resolver_node_t *rn; +#if (NGX_HAVE_INET6) + uint32_t hash; + ngx_int_t digit; + struct in6_addr addr6; +#endif + + if (ngx_resolver_copy(r, &name, buf, + buf + sizeof(ngx_resolver_hdr_t), buf + n) + != NGX_OK) + { + return; + } + + ngx_log_debug1(NGX_LOG_DEBUG_CORE, r->log, 0, "resolver qs:%V", &name); + + /* AF_INET */ + + addr = 0; + i = sizeof(ngx_resolver_hdr_t); + + for (mask = 0; mask < 32; mask += 8) { + len = buf[i++]; + + octet = ngx_atoi(&buf[i], len); + if (octet == NGX_ERROR || octet > 255) { + goto invalid_in_addr_arpa; + } + + addr += octet << mask; + i += len; + } + + if (ngx_strcasecmp(&buf[i], (u_char *) "\7in-addr\4arpa") == 0) { + i += sizeof("\7in-addr\4arpa"); + + /* lock addr mutex */ + + rn = ngx_resolver_lookup_addr(r, addr); + + tree = &r->addr_rbtree; + expire_queue = &r->addr_expire_queue; + + goto valid; + } + +invalid_in_addr_arpa: + +#if (NGX_HAVE_INET6) + + i = sizeof(ngx_resolver_hdr_t); + + for (octet = 15; octet >= 0; octet--) { + if (buf[i++] != '\1') { + goto invalid_ip6_arpa; + } + + digit = ngx_hextoi(&buf[i++], 1); + if (digit == NGX_ERROR) { + goto invalid_ip6_arpa; + } + + addr6.s6_addr[octet] = (u_char) digit; + + if (buf[i++] != '\1') { + goto invalid_ip6_arpa; + } + + digit = ngx_hextoi(&buf[i++], 1); + if (digit == NGX_ERROR) { + goto invalid_ip6_arpa; + } + + addr6.s6_addr[octet] += (u_char) (digit * 16); + } + + if (ngx_strcasecmp(&buf[i], (u_char *) "\3ip6\4arpa") == 0) { + i += sizeof("\3ip6\4arpa"); + + /* lock addr mutex */ + + hash = ngx_crc32_short(addr6.s6_addr, 16); + rn = ngx_resolver_lookup_addr6(r, &addr6, hash); + + tree = &r->addr6_rbtree; + expire_queue = &r->addr6_expire_queue; + + goto valid; + } + +invalid_ip6_arpa: +#endif + + ngx_log_error(r->log_level, r->log, 0, + "invalid in-addr.arpa or ip6.arpa name in DNS response"); + ngx_resolver_free(r, name.data); + return; + +valid: + + if (rn == NULL || rn->query == NULL) { + ngx_log_error(r->log_level, r->log, 0, + "unexpected response for %V", &name); + ngx_resolver_free(r, name.data); + goto failed; + } + + qident = (rn->query[0] << 8) + rn->query[1]; + + if (ident != qident) { + ngx_log_error(r->log_level, r->log, 0, + "wrong ident %ui response for %V, expect %ui", + ident, &name, qident); + ngx_resolver_free(r, name.data); + goto failed; + } + + ngx_resolver_free(r, name.data); + + if (code == 0 && nan == 0) { + code = NGX_RESOLVE_NXDOMAIN; + } + + if (code) { + next = rn->waiting; + rn->waiting = NULL; + + ngx_queue_remove(&rn->queue); + + ngx_rbtree_delete(tree, &rn->node); + + /* unlock addr mutex */ + + while (next) { + ctx = next; + ctx->state = code; + ctx->valid = ngx_time() + (r->valid ? r->valid : 10); + next = ctx->next; + + ctx->handler(ctx); + } + + ngx_resolver_free_node(r, rn); + + return; + } + + i += sizeof(ngx_resolver_qs_t); + + for (a = 0; a < nan; a++) { + + start = i; + + while (i < n) { + + if (buf[i] & 0xc0) { + i += 2; + goto found; + } + + if (buf[i] == 0) { + i++; + goto test_length; + } + + i += 1 + buf[i]; + } + + goto short_response; + + test_length: + + if (i - start < 2) { + err = "invalid name in DNS response"; + goto invalid; + } + + found: + + if (i + sizeof(ngx_resolver_an_t) >= n) { + goto short_response; + } + + an = (ngx_resolver_an_t *) &buf[i]; + + type = (an->type_hi << 8) + an->type_lo; + class = (an->class_hi << 8) + an->class_lo; + len = (an->len_hi << 8) + an->len_lo; + ttl = (an->ttl[0] << 24) + (an->ttl[1] << 16) + + (an->ttl[2] << 8) + (an->ttl[3]); + + if (class != 1) { + ngx_log_error(r->log_level, r->log, 0, + "unexpected RR class %ui", class); + goto failed; + } + + if (ttl < 0) { + ttl = 0; + } + + ngx_log_debug3(NGX_LOG_DEBUG_CORE, r->log, 0, "resolver qt:%ui cl:%ui len:%uz", type, class, len); @@ -2675,6 +3356,7 @@ ptr: while (next) { ctx = next; ctx->state = NGX_OK; + ctx->valid = rn->valid; ctx->name = name; next = ctx->next; @@ -2747,6 +3429,47 @@ ngx_resolver_lookup_name(ngx_resolver_t *r, ngx_str_t *name, uint32_t hash) static ngx_resolver_node_t * +ngx_resolver_lookup_srv(ngx_resolver_t *r, ngx_str_t *name, uint32_t hash) +{ + ngx_int_t rc; + ngx_rbtree_node_t *node, *sentinel; + ngx_resolver_node_t *rn; + + node = r->srv_rbtree.root; + sentinel = r->srv_rbtree.sentinel; + + while (node != sentinel) { + + if (hash < node->key) { + node = node->left; + continue; + } + + if (hash > node->key) { + node = node->right; + continue; + } + + /* hash == node->key */ + + rn = ngx_resolver_node(node); + + rc = ngx_memn2cmp(name->data, rn->name, name->len, rn->nlen); + + if (rc == 0) { + return rn; + } + + node = (rc < 0) ? node->left : node->right; + } + + /* not found */ + + return NULL; +} + + +static ngx_resolver_node_t * ngx_resolver_lookup_addr(ngx_resolver_t *r, in_addr_t addr) { ngx_rbtree_node_t *node, *sentinel; @@ -3034,8 +3757,96 @@ ngx_resolver_create_name_query(ngx_resolver_t *r, ngx_resolver_node_t *rn, static ngx_int_t +ngx_resolver_create_srv_query(ngx_resolver_t *r, ngx_resolver_node_t *rn, + ngx_str_t *name) +{ + u_char *p, *s; + size_t len, nlen; + ngx_uint_t ident; + ngx_resolver_qs_t *qs; + ngx_resolver_hdr_t *query; + + nlen = name->len ? (1 + name->len + 1) : 1; + + len = sizeof(ngx_resolver_hdr_t) + nlen + sizeof(ngx_resolver_qs_t); + + p = ngx_resolver_alloc(r, len); + if (p == NULL) { + return NGX_ERROR; + } + + rn->qlen = (u_short) len; + rn->query = p; + + query = (ngx_resolver_hdr_t *) p; + + ident = ngx_random(); + + ngx_log_debug2(NGX_LOG_DEBUG_CORE, r->log, 0, + "resolve: \"%V\" SRV %i", name, ident & 0xffff); + + query->ident_hi = (u_char) ((ident >> 8) & 0xff); + query->ident_lo = (u_char) (ident & 0xff); + + /* recursion query */ + query->flags_hi = 1; query->flags_lo = 0; + + /* one question */ + query->nqs_hi = 0; query->nqs_lo = 1; + query->nan_hi = 0; query->nan_lo = 0; + query->nns_hi = 0; query->nns_lo = 0; + query->nar_hi = 0; query->nar_lo = 0; + + p += sizeof(ngx_resolver_hdr_t) + nlen; + + qs = (ngx_resolver_qs_t *) p; + + /* query type */ + qs->type_hi = 0; qs->type_lo = NGX_RESOLVE_SRV; + + /* IN query class */ + qs->class_hi = 0; qs->class_lo = 1; + + /* converts "www.example.com" to "\3www\7example\3com\0" */ + + len = 0; + p--; + *p-- = '\0'; + + if (name->len == 0) { + return NGX_DECLINED; + } + + for (s = name->data + name->len - 1; s >= name->data; s--) { + if (*s != '.') { + *p = *s; + len++; + + } else { + if (len == 0 || len > 255) { + return NGX_DECLINED; + } + + *p = (u_char) len; + len = 0; + } + + p--; + } + + if (len == 0 || len > 255) { + return NGX_DECLINED; + } + + *p = (u_char) len; + + return NGX_OK; +} + + +static ngx_int_t ngx_resolver_create_addr_query(ngx_resolver_t *r, ngx_resolver_node_t *rn, - ngx_addr_t *addr) + ngx_resolver_addr_t *addr) { u_char *p, *d; size_t len; @@ -3239,6 +4050,8 @@ ngx_resolver_timeout_handler(ngx_event_t *ev) static void ngx_resolver_free_node(ngx_resolver_t *r, ngx_resolver_node_t *rn) { + ngx_uint_t i; + /* lock alloc mutex */ if (rn->query) { @@ -3263,6 +4076,16 @@ ngx_resolver_free_node(ngx_resolver_t *r, ngx_resolver_node_t *rn) } #endif + if (rn->nsrvs) { + for (i = 0; i < rn->nsrvs; i++) { + if (rn->u.srvs[i].name.data) { + ngx_resolver_free_locked(r, rn->u.srvs[i].name.data); + } + } + + ngx_resolver_free_locked(r, rn->u.srvs); + } + ngx_resolver_free_locked(r, rn); /* unlock alloc mutex */ @@ -3334,15 +4157,15 @@ ngx_resolver_dup(ngx_resolver_t *r, void *src, size_t size) } -static ngx_addr_t * +static ngx_resolver_addr_t * ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn, ngx_uint_t rotate) { - ngx_addr_t *dst; ngx_uint_t d, i, j, n; u_char (*sockaddr)[NGX_SOCKADDRLEN]; in_addr_t *addr; struct sockaddr_in *sin; + ngx_resolver_addr_t *dst; #if (NGX_HAVE_INET6) struct in6_addr *addr6; struct sockaddr_in6 *sin6; @@ -3353,7 +4176,7 @@ ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn, n += rn->naddrs6; #endif - dst = ngx_resolver_calloc(r, n * sizeof(ngx_addr_t)); + dst = ngx_resolver_calloc(r, n * sizeof(ngx_resolver_addr_t)); if (dst == NULL) { return NULL; } @@ -3417,6 +4240,99 @@ ngx_resolver_export(ngx_resolver_t *r, ngx_resolver_node_t *rn, } +static void +ngx_resolver_report_srv(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx) +{ + ngx_uint_t naddrs, nsrvs, nw, i, j, k, l, m, n, w; + ngx_resolver_addr_t *addrs; + ngx_resolver_srv_name_t *srvs; + + naddrs = 0; + + for (i = 0; i < ctx->nsrvs; i++) { + naddrs += ctx->srvs[i].naddrs; + } + + if (naddrs == 0) { + ctx->state = NGX_RESOLVE_NXDOMAIN; + ctx->valid = ngx_time() + (r->valid ? r->valid : 10); + + ctx->handler(ctx); + return; + } + + addrs = ngx_resolver_calloc(r, naddrs * sizeof(ngx_resolver_addr_t)); + if (addrs == NULL) { + ctx->state = NGX_ERROR; + ctx->valid = ngx_time() + (r->valid ? r->valid : 10); + + ctx->handler(ctx); + return; + } + + srvs = ctx->srvs; + nsrvs = ctx->nsrvs; + + i = 0; + n = 0; + + do { + nw = 0; + + for (j = i; j < nsrvs; j++) { + if (srvs[j].priority != srvs[i].priority) { + break; + } + + nw += srvs[j].naddrs * srvs[j].weight; + } + + if (nw == 0) { + goto next_srv; + } + + w = ngx_random() % nw; + + for (k = i; k < j; k++) { + if (w < srvs[k].naddrs * srvs[k].weight) { + break; + } + + w -= srvs[k].naddrs * srvs[k].weight; + } + + for (l = i; l < j; l++) { + + for (m = 0; m < srvs[k].naddrs; m++) { + addrs[n].socklen = srvs[k].addrs[m].socklen; + addrs[n].sockaddr = srvs[k].addrs[m].sockaddr; + addrs[n].name = srvs[k].name; + addrs[n].priority = srvs[k].priority; + addrs[n].weight = srvs[k].weight; + n++; + } + + if (++k == j) { + k = i; + } + } + +next_srv: + + i = j; + + } while (i < ctx->nsrvs); + + ctx->state = NGX_OK; + ctx->addrs = addrs; + ctx->naddrs = naddrs; + + ctx->handler(ctx); + + ngx_resolver_free(r, addrs); +} + + char * ngx_resolver_strerror(ngx_int_t err) { @@ -3728,3 +4644,19 @@ failed: return NGX_ERROR; } + + +static ngx_int_t +ngx_resolver_cmp_srvs(const void *one, const void *two) +{ + ngx_int_t p1, p2; + ngx_resolver_srv_t *first, *second; + + first = (ngx_resolver_srv_t *) one; + second = (ngx_resolver_srv_t *) two; + + p1 = first->priority; + p2 = second->priority; + + return p1 - p2; +} Renamed: vendor/nginx-1.9.15/src/core/ngx_resolver.h (+46 -2) 80% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_resolver.h 2016-04-20 22:22:29 +0900 (3165abd) +++ vendor/nginx-1.9.15/src/core/ngx_resolver.h 2016-04-21 23:49:50 +0900 (e36cfdc) @@ -21,6 +21,7 @@ #if (NGX_HAVE_INET6) #define NGX_RESOLVE_AAAA 28 #endif +#define NGX_RESOLVE_SRV 33 #define NGX_RESOLVE_DNAME 39 #define NGX_RESOLVE_FORMERR 1 @@ -58,6 +59,36 @@ typedef void (*ngx_resolver_handler_pt)(ngx_resolver_ctx_t *ctx); typedef struct { + struct sockaddr *sockaddr; + socklen_t socklen; + ngx_str_t name; + u_short priority; + u_short weight; +} ngx_resolver_addr_t; + + +typedef struct { + ngx_str_t name; + u_short priority; + u_short weight; + u_short port; +} ngx_resolver_srv_t; + + +typedef struct { + ngx_str_t name; + u_short priority; + u_short weight; + u_short port; + + ngx_resolver_ctx_t *ctx; + + ngx_uint_t naddrs; + ngx_addr_t *addrs; +} ngx_resolver_srv_name_t; + + +typedef struct { ngx_rbtree_node_t node; ngx_queue_t queue; @@ -81,10 +112,12 @@ typedef struct { in_addr_t addr; in_addr_t *addrs; u_char *cname; + ngx_resolver_srv_t *srvs; } u; u_char code; u_short naddrs; + u_short nsrvs; u_short cnlen; #if (NGX_HAVE_INET6) @@ -127,13 +160,18 @@ struct ngx_resolver_s { ngx_rbtree_t name_rbtree; ngx_rbtree_node_t name_sentinel; + ngx_rbtree_t srv_rbtree; + ngx_rbtree_node_t srv_sentinel; + ngx_rbtree_t addr_rbtree; ngx_rbtree_node_t addr_sentinel; ngx_queue_t name_resend_queue; + ngx_queue_t srv_resend_queue; ngx_queue_t addr_resend_queue; ngx_queue_t name_expire_queue; + ngx_queue_t srv_expire_queue; ngx_queue_t addr_expire_queue; #if (NGX_HAVE_INET6) @@ -163,12 +201,18 @@ struct ngx_resolver_ctx_s { ngx_int_t state; ngx_str_t name; + ngx_str_t service; + time_t valid; ngx_uint_t naddrs; - ngx_addr_t *addrs; - ngx_addr_t addr; + ngx_resolver_addr_t *addrs; + ngx_resolver_addr_t addr; struct sockaddr_in sin; + ngx_uint_t count; + ngx_uint_t nsrvs; + ngx_resolver_srv_name_t *srvs; + ngx_resolver_handler_pt handler; void *data; ngx_msec_t timeout; Renamed: vendor/nginx-1.9.15/src/core/ngx_rwlock.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_rwlock.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_sha1.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_shmtx.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_shmtx.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_slab.c (+6 -5) 98% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_slab.c 2016-04-20 22:22:29 +0900 (c112506) +++ vendor/nginx-1.9.15/src/core/ngx_slab.c 2016-04-21 23:49:50 +0900 (56e7765) @@ -222,11 +222,11 @@ ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size) if (bitmap[n] == NGX_SLAB_BUSY) { for (n = n + 1; n < map; n++) { - if (bitmap[n] != NGX_SLAB_BUSY) { - p = (uintptr_t) bitmap + i; + if (bitmap[n] != NGX_SLAB_BUSY) { + p = (uintptr_t) bitmap + i; - goto done; - } + goto done; + } } prev = (ngx_slab_page_t *) @@ -392,7 +392,8 @@ ngx_slab_alloc_locked(ngx_slab_pool_t *pool, size_t size) done: - ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, ngx_cycle->log, 0, "slab alloc: %p", p); + ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, ngx_cycle->log, 0, + "slab alloc: %p", (void *) p); return (void *) p; } Renamed: vendor/nginx-1.9.15/src/core/ngx_slab.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_spinlock.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_string.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_string.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_syslog.c (+3 -3) 98% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_syslog.c 2016-04-20 22:22:29 +0900 (08f4c04) +++ vendor/nginx-1.9.15/src/core/ngx_syslog.c 2016-04-21 23:49:50 +0900 (0a67928) @@ -10,9 +10,9 @@ #define NGX_SYSLOG_MAX_STR \ - NGX_MAX_ERROR_STR + sizeof("<255>Jan 01 00:00:00 ") - 1 \ - + (NGX_MAXHOSTNAMELEN - 1) + 1 /* space */ \ - + 32 /* tag */ + 2 /* colon, space */ + NGX_MAX_ERROR_STR + sizeof("<255>Jan 01 00:00:00 ") - 1 \ + + (NGX_MAXHOSTNAMELEN - 1) + 1 /* space */ \ + + 32 /* tag */ + 2 /* colon, space */ static char *ngx_syslog_parse_args(ngx_conf_t *cf, ngx_syslog_peer_t *peer); Renamed: vendor/nginx-1.9.15/src/core/ngx_syslog.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_thread_pool.c (+4 -0) 99% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_thread_pool.c 2016-04-20 22:22:29 +0900 (0353085) +++ vendor/nginx-1.9.15/src/core/ngx_thread_pool.c 2016-04-21 23:49:50 +0900 (f3655aa) @@ -345,6 +345,8 @@ ngx_thread_pool_cycle(void *data) *ngx_thread_pool_done.last = task; ngx_thread_pool_done.last = &task->next; + ngx_memory_barrier(); + ngx_unlock(&ngx_thread_pool_done_lock); (void) ngx_notify(ngx_thread_pool_handler); @@ -366,6 +368,8 @@ ngx_thread_pool_handler(ngx_event_t *ev) ngx_thread_pool_done.first = NULL; ngx_thread_pool_done.last = &ngx_thread_pool_done.first; + ngx_memory_barrier(); + ngx_unlock(&ngx_thread_pool_done_lock); while (task) { Renamed: vendor/nginx-1.9.15/src/core/ngx_thread_pool.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/core/ngx_times.c (+2 -2) 98% =================================================================== --- vendor/nginx-1.9.12/src/core/ngx_times.c 2016-04-20 22:22:29 +0900 (595c122) +++ vendor/nginx-1.9.15/src/core/ngx_times.c 2016-04-21 23:49:50 +0900 (843314a) @@ -154,7 +154,7 @@ ngx_time_update(void) p2 = &cached_http_log_time[slot][0]; - (void) ngx_sprintf(p2, "%02d/%s/%d:%02d:%02d:%02d %c%02d%02d", + (void) ngx_sprintf(p2, "%02d/%s/%d:%02d:%02d:%02d %c%02i%02i", tm.ngx_tm_mday, months[tm.ngx_tm_mon - 1], tm.ngx_tm_year, tm.ngx_tm_hour, tm.ngx_tm_min, tm.ngx_tm_sec, @@ -163,7 +163,7 @@ ngx_time_update(void) p3 = &cached_http_log_iso8601[slot][0]; - (void) ngx_sprintf(p3, "%4d-%02d-%02dT%02d:%02d:%02d%c%02d:%02d", + (void) ngx_sprintf(p3, "%4d-%02d-%02dT%02d:%02d:%02d%c%02i:%02i", tm.ngx_tm_year, tm.ngx_tm_mon, tm.ngx_tm_mday, tm.ngx_tm_hour, tm.ngx_tm_min, tm.ngx_tm_sec, Renamed: vendor/nginx-1.9.15/src/core/ngx_times.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/event/modules/ngx_devpoll_module.c (+3 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/event/modules/ngx_devpoll_module.c 2016-04-20 22:22:29 +0900 (fa8aebd) +++ vendor/nginx-1.9.15/src/event/modules/ngx_devpoll_module.c 2016-04-21 23:49:50 +0900 (f985fbd) @@ -14,7 +14,9 @@ /* Solaris declarations */ +#ifndef POLLREMOVE #define POLLREMOVE 0x0800 +#endif #define DP_POLL 0xD001 #define DP_ISPOLLED 0xD002 @@ -436,7 +438,7 @@ ngx_devpoll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, default: ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, - "unexpected event %04Xd for closed and removed socket %d, ", + "unexpected event %04Xd for closed and removed socket %d, " "ioctl(DP_ISPOLLED) returned rc:%d, fd:%d, event %04Xd", revents, fd, rc, pfd.fd, pfd.revents); Renamed: vendor/nginx-1.9.15/src/event/modules/ngx_epoll_module.c (+5 -2) 99% =================================================================== --- vendor/nginx-1.9.12/src/event/modules/ngx_epoll_module.c 2016-04-20 22:22:29 +0900 (d7f915d) +++ vendor/nginx-1.9.15/src/event/modules/ngx_epoll_module.c 2016-04-21 23:49:50 +0900 (166c461) @@ -840,6 +840,9 @@ ngx_epoll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags) } wev->ready = 1; +#if (NGX_THREADS) + wev->complete = 1; +#endif if (flags & NGX_POST_EVENTS) { ngx_post_event(wev, &ngx_posted_events); @@ -899,7 +902,7 @@ ngx_epoll_eventfd_handler(ngx_event_t *ev) events = io_getevents(ngx_aio_ctx, 1, 64, event, &ts); ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ev->log, 0, - "io_getevents: %l", events); + "io_getevents: %d", events); if (events > 0) { ready -= events; @@ -907,7 +910,7 @@ ngx_epoll_eventfd_handler(ngx_event_t *ev) for (i = 0; i < events; i++) { ngx_log_debug4(NGX_LOG_DEBUG_EVENT, ev->log, 0, - "io_event: %uXL %uXL %L %L", + "io_event: %XL %XL %L %L", event[i].data, event[i].obj, event[i].res, event[i].res2); Renamed: vendor/nginx-1.9.15/src/event/modules/ngx_eventport_module.c (+5 -5) 97% =================================================================== --- vendor/nginx-1.9.12/src/event/modules/ngx_eventport_module.c 2016-04-20 22:22:29 +0900 (bacbb05) +++ vendor/nginx-1.9.15/src/event/modules/ngx_eventport_module.c 2016-04-21 23:49:50 +0900 (dafa27f) @@ -49,7 +49,7 @@ typedef struct port_notify { void *portnfy_user; /* user defined */ } port_notify_t; -#if (__FreeBSD_version < 700005) +#if (__FreeBSD__ && __FreeBSD_version < 700005) || (NGX_DARWIN) typedef struct itimerspec { /* definition per POSIX.4 */ struct timespec it_interval;/* timer period */ @@ -526,18 +526,18 @@ ngx_eventport_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "eventport: fd:%d, ev:%04Xd", - event_list[i].portev_object, revents); + (int) event_list[i].portev_object, revents); if (revents & (POLLERR|POLLHUP|POLLNVAL)) { ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0, "port_getn() error fd:%d ev:%04Xd", - event_list[i].portev_object, revents); + (int) event_list[i].portev_object, revents); } if (revents & ~(POLLIN|POLLOUT|POLLERR|POLLHUP|POLLNVAL)) { ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "strange port_getn() events fd:%d ev:%04Xd", - event_list[i].portev_object, revents); + (int) event_list[i].portev_object, revents); } if ((revents & (POLLERR|POLLHUP|POLLNVAL)) @@ -615,7 +615,7 @@ ngx_eventport_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, default: ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, "unexpected eventport object %d", - event_list[i].portev_object); + (int) event_list[i].portev_object); continue; } } Renamed: vendor/nginx-1.9.15/src/event/modules/ngx_iocp_module.c (+22 -22) 94% =================================================================== --- vendor/nginx-1.9.12/src/event/modules/ngx_iocp_module.c 2016-04-20 22:22:29 +0900 (e384707) +++ vendor/nginx-1.9.15/src/event/modules/ngx_iocp_module.c 2016-04-21 23:49:50 +0900 (8f163e3) @@ -27,28 +27,28 @@ static ngx_str_t iocp_name = ngx_string("iocp"); static ngx_command_t ngx_iocp_commands[] = { - {ngx_string("iocp_threads"), - NGX_EVENT_CONF|NGX_CONF_TAKE1, - ngx_conf_set_num_slot, - 0, - offsetof(ngx_iocp_conf_t, threads), - NULL}, - - {ngx_string("post_acceptex"), - NGX_EVENT_CONF|NGX_CONF_TAKE1, - ngx_conf_set_num_slot, - 0, - offsetof(ngx_iocp_conf_t, post_acceptex), - NULL}, - - {ngx_string("acceptex_read"), - NGX_EVENT_CONF|NGX_CONF_FLAG, - ngx_conf_set_flag_slot, - 0, - offsetof(ngx_iocp_conf_t, acceptex_read), - NULL}, - - ngx_null_command + { ngx_string("iocp_threads"), + NGX_EVENT_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + 0, + offsetof(ngx_iocp_conf_t, threads), + NULL }, + + { ngx_string("post_acceptex"), + NGX_EVENT_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + 0, + offsetof(ngx_iocp_conf_t, post_acceptex), + NULL }, + + { ngx_string("acceptex_read"), + NGX_EVENT_CONF|NGX_CONF_FLAG, + ngx_conf_set_flag_slot, + 0, + offsetof(ngx_iocp_conf_t, acceptex_read), + NULL }, + + ngx_null_command }; Renamed: vendor/nginx-1.9.15/src/event/modules/ngx_iocp_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/event/modules/ngx_kqueue_module.c (+15 -8) 96% =================================================================== --- vendor/nginx-1.9.12/src/event/modules/ngx_kqueue_module.c 2016-04-20 22:22:29 +0900 (5573cb2) +++ vendor/nginx-1.9.15/src/event/modules/ngx_kqueue_module.c 2016-04-21 23:49:50 +0900 (ca3bfe4) @@ -579,7 +579,7 @@ ngx_kqueue_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, if (event_list[i].flags & EV_ERROR) { ngx_log_error(NGX_LOG_ALERT, cycle->log, event_list[i].data, "kevent() error on %d filter:%d flags:%04Xd", - event_list[i].ident, event_list[i].filter, + (int) event_list[i].ident, event_list[i].filter, event_list[i].flags); continue; } @@ -676,13 +676,20 @@ ngx_kqueue_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, static ngx_inline void ngx_kqueue_dump_event(ngx_log_t *log, struct kevent *kev) { - ngx_log_debug6(NGX_LOG_DEBUG_EVENT, log, 0, - (kev->ident > 0x8000000 && kev->ident != (unsigned) -1) ? - "kevent: %p: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p": - "kevent: %d: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p", - kev->ident, kev->filter, - kev->flags, kev->fflags, - kev->data, kev->udata); + if (kev->ident > 0x8000000 && kev->ident != (unsigned) -1) { + ngx_log_debug6(NGX_LOG_DEBUG_EVENT, log, 0, + "kevent: %p: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p", + (void *) kev->ident, kev->filter, + kev->flags, kev->fflags, + (int) kev->data, kev->udata); + + } else { + ngx_log_debug6(NGX_LOG_DEBUG_EVENT, log, 0, + "kevent: %d: ft:%d fl:%04Xd ff:%08Xd d:%d ud:%p", + (int) kev->ident, kev->filter, + kev->flags, kev->fflags, + (int) kev->data, kev->udata); + } } Renamed: vendor/nginx-1.9.15/src/event/modules/ngx_poll_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/event/modules/ngx_select_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/event/modules/ngx_win32_select_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/event/ngx_event.c (+5 -3) 99% =================================================================== --- vendor/nginx-1.9.12/src/event/ngx_event.c 2016-04-20 22:22:29 +0900 (955622b) +++ vendor/nginx-1.9.15/src/event/ngx_event.c 2016-04-21 23:49:50 +0900 (c8ae5b2) @@ -525,7 +525,7 @@ ngx_event_module_init(ngx_cycle_t *cycle) (void) ngx_atomic_cmp_set(ngx_connection_counter, 0, 1); ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0, - "counter: %p, %d", + "counter: %p, %uA", ngx_connection_counter, *ngx_connection_counter); ngx_temp_number = (ngx_atomic_t *) (shared + 2 * cl); @@ -746,6 +746,7 @@ ngx_event_process_init(ngx_cycle_t *cycle) return NGX_ERROR; } + c->type = ls[i].type; c->log = &ls[i].log; c->listening = &ls[i]; @@ -818,7 +819,8 @@ ngx_event_process_init(ngx_cycle_t *cycle) #else - rev->handler = ngx_event_accept; + rev->handler = (c->type == SOCK_STREAM) ? ngx_event_accept + : ngx_event_recvmsg; if (ngx_use_accept_mutex #if (NGX_HAVE_REUSEPORT) @@ -1206,7 +1208,7 @@ ngx_event_core_init_conf(ngx_cycle_t *cycle, void *conf) #endif -#if (NGX_HAVE_DEVPOLL) +#if (NGX_HAVE_DEVPOLL) && !(NGX_TEST_BUILD_DEVPOLL) module = &ngx_devpoll_module; Renamed: vendor/nginx-1.9.15/src/event/ngx_event.h (+8 -3) 97% =================================================================== --- vendor/nginx-1.9.12/src/event/ngx_event.h 2016-04-20 22:22:29 +0900 (855c58d) +++ vendor/nginx-1.9.15/src/event/ngx_event.h 2016-04-21 23:49:50 +0900 (ed0682c) @@ -188,7 +188,7 @@ typedef struct { ngx_int_t (*notify)(ngx_event_handler_pt handler); ngx_int_t (*process_events)(ngx_cycle_t *cycle, ngx_msec_t timer, - ngx_uint_t flags); + ngx_uint_t flags); ngx_int_t (*init)(ngx_cycle_t *cycle, ngx_msec_t timer); void (*done)(ngx_cycle_t *cycle); @@ -343,7 +343,8 @@ extern ngx_event_actions_t ngx_event_actions; #define NGX_DISABLE_EVENT EV_DISABLE -#elif (NGX_HAVE_DEVPOLL || NGX_HAVE_EVENTPORT) +#elif (NGX_HAVE_DEVPOLL && !(NGX_TEST_BUILD_DEVPOLL)) \ + || (NGX_HAVE_EVENTPORT && !(NGX_TEST_BUILD_EVENTPORT)) #define NGX_READ_EVENT POLLIN #define NGX_WRITE_EVENT POLLOUT @@ -352,7 +353,7 @@ extern ngx_event_actions_t ngx_event_actions; #define NGX_ONESHOT_EVENT 1 -#elif (NGX_HAVE_EPOLL) +#elif (NGX_HAVE_EPOLL) && !(NGX_TEST_BUILD_EPOLL) #define NGX_READ_EVENT (EPOLLIN|EPOLLRDHUP) #define NGX_WRITE_EVENT EPOLLOUT @@ -418,6 +419,7 @@ extern ngx_os_io_t ngx_io; #define ngx_udp_recv ngx_io.udp_recv #define ngx_send ngx_io.send #define ngx_send_chain ngx_io.send_chain +#define ngx_udp_send ngx_io.udp_send #define NGX_EVENT_MODULE 0x544E5645 /* "EVNT" */ @@ -491,6 +493,9 @@ extern ngx_module_t ngx_event_core_module; void ngx_event_accept(ngx_event_t *ev); +#if !(NGX_WIN32) +void ngx_event_recvmsg(ngx_event_t *ev); +#endif ngx_int_t ngx_trylock_accept_mutex(ngx_cycle_t *cycle); u_char *ngx_accept_log_error(ngx_log_t *log, u_char *buf, size_t len); Renamed: vendor/nginx-1.9.15/src/event/ngx_event_accept.c (+384 -49) 53% =================================================================== --- vendor/nginx-1.9.12/src/event/ngx_event_accept.c 2016-04-20 22:22:29 +0900 (8888f5a) +++ vendor/nginx-1.9.15/src/event/ngx_event_accept.c 2016-04-21 23:49:50 +0900 (1c87a34) @@ -13,6 +13,10 @@ static ngx_int_t ngx_enable_accept_events(ngx_cycle_t *cycle); static ngx_int_t ngx_disable_accept_events(ngx_cycle_t *cycle, ngx_uint_t all); static void ngx_close_accepted_connection(ngx_connection_t *c); +#if (NGX_DEBUG) +static void ngx_debug_accepted_connection(ngx_event_conf_t *ecf, + ngx_connection_t *c); +#endif void @@ -149,6 +153,8 @@ ngx_event_accept(ngx_event_t *ev) return; } + c->type = SOCK_STREAM; + #if (NGX_STAT_STUB) (void) ngx_atomic_fetch_add(ngx_stat_active, 1); #endif @@ -276,79 +282,345 @@ ngx_event_accept(ngx_event_t *ev) #if (NGX_DEBUG) { + ngx_str_t addr; + u_char text[NGX_SOCKADDR_STRLEN]; - ngx_str_t addr; - struct sockaddr_in *sin; - ngx_cidr_t *cidr; - ngx_uint_t i; - u_char text[NGX_SOCKADDR_STRLEN]; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; - ngx_uint_t n; + ngx_debug_accepted_connection(ecf, c); + + if (log->log_level & NGX_LOG_DEBUG_EVENT) { + addr.data = text; + addr.len = ngx_sock_ntop(c->sockaddr, c->socklen, text, + NGX_SOCKADDR_STRLEN, 1); + + ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0, + "*%uA accept: %V fd:%d", c->number, &addr, s); + } + + } #endif - cidr = ecf->debug_connection.elts; - for (i = 0; i < ecf->debug_connection.nelts; i++) { - if (cidr[i].family != (ngx_uint_t) c->sockaddr->sa_family) { - goto next; + if (ngx_add_conn && (ngx_event_flags & NGX_USE_EPOLL_EVENT) == 0) { + if (ngx_add_conn(c) == NGX_ERROR) { + ngx_close_accepted_connection(c); + return; } + } - switch (cidr[i].family) { + log->data = NULL; + log->handler = NULL; -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = (struct sockaddr_in6 *) c->sockaddr; - for (n = 0; n < 16; n++) { - if ((sin6->sin6_addr.s6_addr[n] - & cidr[i].u.in6.mask.s6_addr[n]) - != cidr[i].u.in6.addr.s6_addr[n]) - { - goto next; - } - } - break; + ls->handler(c); + + if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { + ev->available--; + } + + } while (ev->available); +} + + +#if !(NGX_WIN32) + +void +ngx_event_recvmsg(ngx_event_t *ev) +{ + ssize_t n; + ngx_log_t *log; + ngx_err_t err; + ngx_event_t *rev, *wev; + struct iovec iov[1]; + struct msghdr msg; + ngx_listening_t *ls; + ngx_event_conf_t *ecf; + ngx_connection_t *c, *lc; + u_char sa[NGX_SOCKADDRLEN]; + static u_char buffer[65535]; + +#if (NGX_HAVE_MSGHDR_MSG_CONTROL) + +#if (NGX_HAVE_IP_RECVDSTADDR) + u_char msg_control[CMSG_SPACE(sizeof(struct in_addr))]; +#elif (NGX_HAVE_IP_PKTINFO) + u_char msg_control[CMSG_SPACE(sizeof(struct in_pktinfo))]; #endif -#if (NGX_HAVE_UNIX_DOMAIN) - case AF_UNIX: - break; +#if (NGX_HAVE_INET6 && NGX_HAVE_IPV6_RECVPKTINFO) + u_char msg_control6[CMSG_SPACE(sizeof(struct in6_pktinfo))]; #endif - default: /* AF_INET */ - sin = (struct sockaddr_in *) c->sockaddr; - if ((sin->sin_addr.s_addr & cidr[i].u.in.mask) - != cidr[i].u.in.addr) - { - goto next; - } - break; +#endif + + if (ev->timedout) { + if (ngx_enable_accept_events((ngx_cycle_t *) ngx_cycle) != NGX_OK) { + return; + } + + ev->timedout = 0; + } + + ecf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_event_core_module); + + if (!(ngx_event_flags & NGX_USE_KQUEUE_EVENT)) { + ev->available = ecf->multi_accept; + } + + lc = ev->data; + ls = lc->listening; + ev->ready = 0; + + ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ev->log, 0, + "recvmsg on %V, ready: %d", &ls->addr_text, ev->available); + + do { + ngx_memzero(&msg, sizeof(struct msghdr)); + + iov[0].iov_base = (void *) buffer; + iov[0].iov_len = sizeof(buffer); + + msg.msg_name = &sa; + msg.msg_namelen = sizeof(sa); + msg.msg_iov = iov; + msg.msg_iovlen = 1; + +#if (NGX_HAVE_MSGHDR_MSG_CONTROL) + + if (ls->wildcard) { + +#if (NGX_HAVE_IP_RECVDSTADDR || NGX_HAVE_IP_PKTINFO) + if (ls->sockaddr->sa_family == AF_INET) { + msg.msg_control = &msg_control; + msg.msg_controllen = sizeof(msg_control); } +#endif - log->log_level = NGX_LOG_DEBUG_CONNECTION|NGX_LOG_DEBUG_ALL; - break; +#if (NGX_HAVE_INET6 && NGX_HAVE_IPV6_RECVPKTINFO) + if (ls->sockaddr->sa_family == AF_INET6) { + msg.msg_control = &msg_control6; + msg.msg_controllen = sizeof(msg_control6); + } +#endif + } + +#endif + + n = recvmsg(lc->fd, &msg, 0); + + if (n == -1) { + err = ngx_socket_errno; + + if (err == NGX_EAGAIN) { + ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ev->log, err, + "recvmsg() not ready"); + return; + } + + ngx_log_error(NGX_LOG_ALERT, ev->log, err, "recvmsg() failed"); + + return; + } + +#if (NGX_STAT_STUB) + (void) ngx_atomic_fetch_add(ngx_stat_accepted, 1); +#endif - next: +#if (NGX_HAVE_MSGHDR_MSG_CONTROL) + if (msg.msg_flags & (MSG_TRUNC|MSG_CTRUNC)) { + ngx_log_error(NGX_LOG_ALERT, ev->log, 0, + "recvmsg() truncated data"); continue; } +#endif - if (log->log_level & NGX_LOG_DEBUG_EVENT) { - addr.data = text; - addr.len = ngx_sock_ntop(c->sockaddr, c->socklen, text, - NGX_SOCKADDR_STRLEN, 1); + ngx_accept_disabled = ngx_cycle->connection_n / 8 + - ngx_cycle->free_connection_n; - ngx_log_debug3(NGX_LOG_DEBUG_EVENT, log, 0, - "*%uA accept: %V fd:%d", c->number, &addr, s); + c = ngx_get_connection(lc->fd, ev->log); + if (c == NULL) { + return; + } + + c->shared = 1; + c->type = SOCK_DGRAM; + c->socklen = msg.msg_namelen; + +#if (NGX_STAT_STUB) + (void) ngx_atomic_fetch_add(ngx_stat_active, 1); +#endif + + c->pool = ngx_create_pool(ls->pool_size, ev->log); + if (c->pool == NULL) { + ngx_close_accepted_connection(c); + return; } + c->sockaddr = ngx_palloc(c->pool, c->socklen); + if (c->sockaddr == NULL) { + ngx_close_accepted_connection(c); + return; } + + ngx_memcpy(c->sockaddr, msg.msg_name, c->socklen); + + log = ngx_palloc(c->pool, sizeof(ngx_log_t)); + if (log == NULL) { + ngx_close_accepted_connection(c); + return; + } + + *log = ls->log; + + c->send = ngx_udp_send; + + c->log = log; + c->pool->log = log; + + c->listening = ls; + c->local_sockaddr = ls->sockaddr; + c->local_socklen = ls->socklen; + +#if (NGX_HAVE_MSGHDR_MSG_CONTROL) + + if (ls->wildcard) { + struct cmsghdr *cmsg; + struct sockaddr *sockaddr; + + sockaddr = ngx_palloc(c->pool, c->local_socklen); + if (sockaddr == NULL) { + ngx_close_accepted_connection(c); + return; + } + + ngx_memcpy(sockaddr, c->local_sockaddr, c->local_socklen); + c->local_sockaddr = sockaddr; + + for (cmsg = CMSG_FIRSTHDR(&msg); + cmsg != NULL; + cmsg = CMSG_NXTHDR(&msg, cmsg)) + { + +#if (NGX_HAVE_IP_RECVDSTADDR) + + if (cmsg->cmsg_level == IPPROTO_IP + && cmsg->cmsg_type == IP_RECVDSTADDR + && sockaddr->sa_family == AF_INET) + { + struct in_addr *addr; + struct sockaddr_in *sin; + + addr = (struct in_addr *) CMSG_DATA(cmsg); + sin = (struct sockaddr_in *) sockaddr; + sin->sin_addr = *addr; + + break; + } + +#elif (NGX_HAVE_IP_PKTINFO) + + if (cmsg->cmsg_level == IPPROTO_IP + && cmsg->cmsg_type == IP_PKTINFO + && sockaddr->sa_family == AF_INET) + { + struct in_pktinfo *pkt; + struct sockaddr_in *sin; + + pkt = (struct in_pktinfo *) CMSG_DATA(cmsg); + sin = (struct sockaddr_in *) sockaddr; + sin->sin_addr = pkt->ipi_addr; + + break; + } + #endif - if (ngx_add_conn && (ngx_event_flags & NGX_USE_EPOLL_EVENT) == 0) { - if (ngx_add_conn(c) == NGX_ERROR) { +#if (NGX_HAVE_INET6 && NGX_HAVE_IPV6_RECVPKTINFO) + + if (cmsg->cmsg_level == IPPROTO_IPV6 + && cmsg->cmsg_type == IPV6_PKTINFO + && sockaddr->sa_family == AF_INET6) + { + struct in6_pktinfo *pkt6; + struct sockaddr_in6 *sin6; + + pkt6 = (struct in6_pktinfo *) CMSG_DATA(cmsg); + sin6 = (struct sockaddr_in6 *) sockaddr; + sin6->sin6_addr = pkt6->ipi6_addr; + + break; + } + +#endif + + } + } + +#endif + + c->buffer = ngx_create_temp_buf(c->pool, n); + if (c->buffer == NULL) { + ngx_close_accepted_connection(c); + return; + } + + c->buffer->last = ngx_cpymem(c->buffer->last, buffer, n); + + rev = c->read; + wev = c->write; + + wev->ready = 1; + + rev->log = log; + wev->log = log; + + /* + * TODO: MT: - ngx_atomic_fetch_add() + * or protection by critical section or light mutex + * + * TODO: MP: - allocated in a shared memory + * - ngx_atomic_fetch_add() + * or protection by critical section or light mutex + */ + + c->number = ngx_atomic_fetch_add(ngx_connection_counter, 1); + +#if (NGX_STAT_STUB) + (void) ngx_atomic_fetch_add(ngx_stat_handled, 1); +#endif + + if (ls->addr_ntop) { + c->addr_text.data = ngx_pnalloc(c->pool, ls->addr_text_max_len); + if (c->addr_text.data == NULL) { ngx_close_accepted_connection(c); return; } + + c->addr_text.len = ngx_sock_ntop(c->sockaddr, c->socklen, + c->addr_text.data, + ls->addr_text_max_len, 0); + if (c->addr_text.len == 0) { + ngx_close_accepted_connection(c); + return; + } + } + +#if (NGX_DEBUG) + { + ngx_str_t addr; + u_char text[NGX_SOCKADDR_STRLEN]; + + ngx_debug_accepted_connection(ecf, c); + + if (log->log_level & NGX_LOG_DEBUG_EVENT) { + addr.data = text; + addr.len = ngx_sock_ntop(c->sockaddr, c->socklen, text, + NGX_SOCKADDR_STRLEN, 1); + + ngx_log_debug4(NGX_LOG_DEBUG_EVENT, log, 0, + "*%uA recvmsg: %V fd:%d n:%z", + c->number, &addr, c->fd, n); + } + } +#endif log->data = NULL; log->handler = NULL; @@ -356,12 +628,14 @@ ngx_event_accept(ngx_event_t *ev) ls->handler(c); if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { - ev->available--; + ev->available -= n; } } while (ev->available); } +#endif + ngx_int_t ngx_trylock_accept_mutex(ngx_cycle_t *cycle) @@ -476,7 +750,7 @@ ngx_close_accepted_connection(ngx_connection_t *c) fd = c->fd; c->fd = (ngx_socket_t) -1; - if (ngx_close_socket(fd) == -1) { + if (!c->shared && ngx_close_socket(fd) == -1) { ngx_log_error(NGX_LOG_ALERT, c->log, ngx_socket_errno, ngx_close_socket_n " failed"); } @@ -497,3 +771,64 @@ ngx_accept_log_error(ngx_log_t *log, u_char *buf, size_t len) return ngx_snprintf(buf, len, " while accepting new connection on %V", log->data); } + + +#if (NGX_DEBUG) + +static void +ngx_debug_accepted_connection(ngx_event_conf_t *ecf, ngx_connection_t *c) +{ + struct sockaddr_in *sin; + ngx_cidr_t *cidr; + ngx_uint_t i; +#if (NGX_HAVE_INET6) + struct sockaddr_in6 *sin6; + ngx_uint_t n; +#endif + + cidr = ecf->debug_connection.elts; + for (i = 0; i < ecf->debug_connection.nelts; i++) { + if (cidr[i].family != (ngx_uint_t) c->sockaddr->sa_family) { + goto next; + } + + switch (cidr[i].family) { + +#if (NGX_HAVE_INET6) + case AF_INET6: + sin6 = (struct sockaddr_in6 *) c->sockaddr; + for (n = 0; n < 16; n++) { + if ((sin6->sin6_addr.s6_addr[n] + & cidr[i].u.in6.mask.s6_addr[n]) + != cidr[i].u.in6.addr.s6_addr[n]) + { + goto next; + } + } + break; +#endif + +#if (NGX_HAVE_UNIX_DOMAIN) + case AF_UNIX: + break; +#endif + + default: /* AF_INET */ + sin = (struct sockaddr_in *) c->sockaddr; + if ((sin->sin_addr.s_addr & cidr[i].u.in.mask) + != cidr[i].u.in.addr) + { + goto next; + } + break; + } + + c->log->log_level = NGX_LOG_DEBUG_CONNECTION|NGX_LOG_DEBUG_ALL; + break; + + next: + continue; + } +} + +#endif Renamed: vendor/nginx-1.9.15/src/event/ngx_event_acceptex.c (+1 -1) 98% =================================================================== --- vendor/nginx-1.9.12/src/event/ngx_event_acceptex.c 2016-04-20 22:22:29 +0900 (ac511ef) +++ vendor/nginx-1.9.15/src/event/ngx_event_acceptex.c 2016-04-21 23:49:50 +0900 (1dbfd6c) @@ -189,7 +189,7 @@ ngx_event_post_acceptex(ngx_listening_t *ls, ngx_uint_t n) err = ngx_socket_errno; if (err != WSA_IO_PENDING) { ngx_log_error(NGX_LOG_ALERT, &ls->log, err, - "AcceptEx() %V falied", &ls->addr_text); + "AcceptEx() %V failed", &ls->addr_text); ngx_close_posted_connection(c); return NGX_ERROR; Renamed: vendor/nginx-1.9.15/src/event/ngx_event_connect.c (+26 -15) 85% =================================================================== --- vendor/nginx-1.9.12/src/event/ngx_event_connect.c 2016-04-20 22:22:29 +0900 (1186958) +++ vendor/nginx-1.9.15/src/event/ngx_event_connect.c 2016-04-21 23:49:50 +0900 (8aca862) @@ -14,7 +14,7 @@ ngx_int_t ngx_event_connect_peer(ngx_peer_connection_t *pc) { - int rc; + int rc, type; ngx_int_t event; ngx_err_t err; ngx_uint_t level; @@ -27,9 +27,12 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc) return rc; } - s = ngx_socket(pc->sockaddr->sa_family, SOCK_STREAM, 0); + type = (pc->type ? pc->type : SOCK_STREAM); - ngx_log_debug1(NGX_LOG_DEBUG_EVENT, pc->log, 0, "socket %d", s); + s = ngx_socket(pc->sockaddr->sa_family, type, 0); + + ngx_log_debug2(NGX_LOG_DEBUG_EVENT, pc->log, 0, "%s socket %d", + (type == SOCK_STREAM) ? "stream" : "dgram", s); if (s == (ngx_socket_t) -1) { ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno, @@ -49,6 +52,8 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc) return NGX_ERROR; } + c->type = type; + if (pc->rcvbuf) { if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, (const void *) &pc->rcvbuf, sizeof(int)) == -1) @@ -75,25 +80,31 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc) } } - c->recv = ngx_recv; - c->send = ngx_send; - c->recv_chain = ngx_recv_chain; - c->send_chain = ngx_send_chain; + if (type == SOCK_STREAM) { + c->recv = ngx_recv; + c->send = ngx_send; + c->recv_chain = ngx_recv_chain; + c->send_chain = ngx_send_chain; - c->sendfile = 1; - - c->log_error = pc->log_error; + c->sendfile = 1; - if (pc->sockaddr->sa_family == AF_UNIX) { - c->tcp_nopush = NGX_TCP_NOPUSH_DISABLED; - c->tcp_nodelay = NGX_TCP_NODELAY_DISABLED; + if (pc->sockaddr->sa_family == AF_UNIX) { + c->tcp_nopush = NGX_TCP_NOPUSH_DISABLED; + c->tcp_nodelay = NGX_TCP_NODELAY_DISABLED; #if (NGX_SOLARIS) - /* Solaris's sendfilev() supports AF_NCA, AF_INET, and AF_INET6 */ - c->sendfile = 0; + /* Solaris's sendfilev() supports AF_NCA, AF_INET, and AF_INET6 */ + c->sendfile = 0; #endif + } + + } else { /* type == SOCK_DGRAM */ + c->recv = ngx_udp_recv; + c->send = ngx_send; } + c->log_error = pc->log_error; + rev = c->read; wev = c->write; Renamed: vendor/nginx-1.9.15/src/event/ngx_event_connect.h (+1 -0) 97% =================================================================== --- vendor/nginx-1.9.12/src/event/ngx_event_connect.h 2016-04-20 22:22:29 +0900 (ed18db7) +++ vendor/nginx-1.9.15/src/event/ngx_event_connect.h 2016-04-21 23:49:50 +0900 (1bacf82) @@ -55,6 +55,7 @@ struct ngx_peer_connection_s { ngx_addr_t *local; + int type; int rcvbuf; ngx_log_t *log; Renamed: vendor/nginx-1.9.15/src/event/ngx_event_connectex.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/event/ngx_event_openssl.c (+47 -22) 98% =================================================================== --- vendor/nginx-1.9.12/src/event/ngx_event_openssl.c 2016-04-20 22:22:29 +0900 (de10d48) +++ vendor/nginx-1.9.15/src/event/ngx_event_openssl.c 2016-04-21 23:49:50 +0900 (de10296) @@ -39,6 +39,9 @@ ngx_int_t ngx_ssl_session_cache_init(ngx_shm_zone_t *shm_zone, void *data); static int ngx_ssl_new_session(ngx_ssl_conn_t *ssl_conn, ngx_ssl_session_t *sess); static ngx_ssl_session_t *ngx_ssl_get_cached_session(ngx_ssl_conn_t *ssl_conn, +#if OPENSSL_VERSION_NUMBER >= 0x10100003L + const +#endif u_char *id, int len, int *copy); static void ngx_ssl_remove_session(SSL_CTX *ssl, ngx_ssl_session_t *sess); static void ngx_ssl_expire_sessions(ngx_ssl_session_cache_t *cache, @@ -52,7 +55,7 @@ static int ngx_ssl_session_ticket_key_callback(ngx_ssl_conn_t *ssl_conn, HMAC_CTX *hctx, int enc); #endif -#if (OPENSSL_VERSION_NUMBER < 0x10002002L || defined LIBRESSL_VERSION_NUMBER) +#if OPENSSL_VERSION_NUMBER < 0x10002002L static ngx_int_t ngx_ssl_check_name(ngx_str_t *name, ASN1_STRING *str); #endif @@ -108,6 +111,12 @@ int ngx_ssl_stapling_index; ngx_int_t ngx_ssl_init(ngx_log_t *log) { +#if OPENSSL_VERSION_NUMBER >= 0x10100003L + + OPENSSL_init_ssl(OPENSSL_INIT_LOAD_CONFIG, NULL); + +#else + #ifndef OPENSSL_IS_BORINGSSL OPENSSL_config(NULL); #endif @@ -117,6 +126,8 @@ ngx_ssl_init(ngx_log_t *log) OpenSSL_add_all_algorithms(); +#endif + #if OPENSSL_VERSION_NUMBER >= 0x0090800fL #ifndef SSL_OP_NO_COMPRESSION { @@ -747,7 +758,7 @@ ngx_ssl_rsa512_key_callback(ngx_ssl_conn_t *ssl_conn, int is_export, return NULL; } -#ifndef OPENSSL_NO_DEPRECATED +#if (OPENSSL_VERSION_NUMBER < 0x10100003L && !defined OPENSSL_NO_DEPRECATED) if (key == NULL) { key = RSA_generate_key(512, RSA_F4, NULL, NULL); @@ -1596,7 +1607,7 @@ ngx_ssl_send_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) } ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, - "SSL buf copy: %d", size); + "SSL buf copy: %z", size); ngx_memcpy(buf->last, in->buf->pos, size); @@ -1668,7 +1679,7 @@ ngx_ssl_write(ngx_connection_t *c, u_char *data, size_t size) ngx_ssl_clear_error(c->log); - ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "SSL to write: %d", size); + ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0, "SSL to write: %uz", size); n = SSL_write(c->ssl->connection, data, size); @@ -1956,6 +1967,7 @@ ngx_ssl_connection_error(ngx_connection_t *c, int sslerr, ngx_err_t err, || n == SSL_R_INAPPROPRIATE_FALLBACK /* 373 */ #endif || n == 1000 /* SSL_R_SSLV3_ALERT_CLOSE_NOTIFY */ +#ifdef SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE || n == SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE /* 1010 */ || n == SSL_R_SSLV3_ALERT_BAD_RECORD_MAC /* 1020 */ || n == SSL_R_TLSV1_ALERT_DECRYPTION_FAILED /* 1021 */ @@ -1978,7 +1990,9 @@ ngx_ssl_connection_error(ngx_connection_t *c, int sslerr, ngx_err_t err, || n == SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY /* 1071 */ || n == SSL_R_TLSV1_ALERT_INTERNAL_ERROR /* 1080 */ || n == SSL_R_TLSV1_ALERT_USER_CANCELLED /* 1090 */ - || n == SSL_R_TLSV1_ALERT_NO_RENEGOTIATION) /* 1100 */ + || n == SSL_R_TLSV1_ALERT_NO_RENEGOTIATION /* 1100 */ +#endif + ) { switch (c->log_error) { @@ -2143,7 +2157,7 @@ ngx_ssl_session_id_context(ngx_ssl_t *ssl, ngx_str_t *sess_ctx) int n, i; X509 *cert; X509_NAME *name; - EVP_MD_CTX md; + EVP_MD_CTX *md; unsigned int len; STACK_OF(X509_NAME) *list; u_char buf[EVP_MAX_MD_SIZE]; @@ -2153,15 +2167,18 @@ ngx_ssl_session_id_context(ngx_ssl_t *ssl, ngx_str_t *sess_ctx) * the server certificate, and the client CA list. */ - EVP_MD_CTX_init(&md); + md = EVP_MD_CTX_create(); + if (md == NULL) { + return NGX_ERROR; + } - if (EVP_DigestInit_ex(&md, EVP_sha1(), NULL) == 0) { + if (EVP_DigestInit_ex(md, EVP_sha1(), NULL) == 0) { ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, "EVP_DigestInit_ex() failed"); goto failed; } - if (EVP_DigestUpdate(&md, sess_ctx->data, sess_ctx->len) == 0) { + if (EVP_DigestUpdate(md, sess_ctx->data, sess_ctx->len) == 0) { ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, "EVP_DigestUpdate() failed"); goto failed; @@ -2175,7 +2192,7 @@ ngx_ssl_session_id_context(ngx_ssl_t *ssl, ngx_str_t *sess_ctx) goto failed; } - if (EVP_DigestUpdate(&md, buf, len) == 0) { + if (EVP_DigestUpdate(md, buf, len) == 0) { ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, "EVP_DigestUpdate() failed"); goto failed; @@ -2195,7 +2212,7 @@ ngx_ssl_session_id_context(ngx_ssl_t *ssl, ngx_str_t *sess_ctx) goto failed; } - if (EVP_DigestUpdate(&md, buf, len) == 0) { + if (EVP_DigestUpdate(md, buf, len) == 0) { ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, "EVP_DigestUpdate() failed"); goto failed; @@ -2203,13 +2220,13 @@ ngx_ssl_session_id_context(ngx_ssl_t *ssl, ngx_str_t *sess_ctx) } } - if (EVP_DigestFinal_ex(&md, buf, &len) == 0) { + if (EVP_DigestFinal_ex(md, buf, &len) == 0) { ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, "EVP_DigestUpdate() failed"); goto failed; } - EVP_MD_CTX_cleanup(&md); + EVP_MD_CTX_destroy(md); if (SSL_CTX_set_session_id_context(ssl->ctx, buf, len) == 0) { ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, @@ -2221,7 +2238,7 @@ ngx_ssl_session_id_context(ngx_ssl_t *ssl, ngx_str_t *sess_ctx) failed: - EVP_MD_CTX_cleanup(&md); + EVP_MD_CTX_destroy(md); return NGX_ERROR; } @@ -2442,8 +2459,11 @@ failed: static ngx_ssl_session_t * -ngx_ssl_get_cached_session(ngx_ssl_conn_t *ssl_conn, u_char *id, int len, - int *copy) +ngx_ssl_get_cached_session(ngx_ssl_conn_t *ssl_conn, +#if OPENSSL_VERSION_NUMBER >= 0x10100003L + const +#endif + u_char *id, int len, int *copy) { #if OPENSSL_VERSION_NUMBER >= 0x0090707fL const @@ -2460,7 +2480,7 @@ ngx_ssl_get_cached_session(ngx_ssl_conn_t *ssl_conn, u_char *id, int len, u_char buf[NGX_SSL_MAX_SESSION_SIZE]; ngx_connection_t *c; - hash = ngx_crc32_short(id, (size_t) len); + hash = ngx_crc32_short((u_char *) (uintptr_t) id, (size_t) len); *copy = 0; c = ngx_ssl_get_connection(ssl_conn); @@ -2498,7 +2518,8 @@ ngx_ssl_get_cached_session(ngx_ssl_conn_t *ssl_conn, u_char *id, int len, sess_id = (ngx_ssl_sess_id_t *) node; - rc = ngx_memn2cmp(id, sess_id->id, (size_t) len, (size_t) node->data); + rc = ngx_memn2cmp((u_char *) (uintptr_t) id, sess_id->id, + (size_t) len, (size_t) node->data); if (rc == 0) { @@ -2542,9 +2563,9 @@ done: void ngx_ssl_remove_cached_session(SSL_CTX *ssl, ngx_ssl_session_t *sess) { - SSL_CTX_remove_session(ssl, sess); + SSL_CTX_remove_session(ssl, sess); - ngx_ssl_remove_session(ssl, sess); + ngx_ssl_remove_session(ssl, sess); } @@ -2944,7 +2965,7 @@ ngx_ssl_check_host(ngx_connection_t *c, ngx_str_t *name) return NGX_ERROR; } -#if (OPENSSL_VERSION_NUMBER >= 0x10002002L && !defined LIBRESSL_VERSION_NUMBER) +#if OPENSSL_VERSION_NUMBER >= 0x10002002L /* X509_check_host() is only available in OpenSSL 1.0.2+ */ @@ -3061,7 +3082,7 @@ found: } -#if (OPENSSL_VERSION_NUMBER < 0x10002002L || defined LIBRESSL_VERSION_NUMBER) +#if OPENSSL_VERSION_NUMBER < 0x10002002L static ngx_int_t ngx_ssl_check_name(ngx_str_t *name, ASN1_STRING *pattern) @@ -3538,8 +3559,12 @@ ngx_openssl_engine(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) static void ngx_openssl_exit(ngx_cycle_t *cycle) { +#if OPENSSL_VERSION_NUMBER < 0x10100003L + EVP_cleanup(); #ifndef OPENSSL_NO_ENGINE ENGINE_cleanup(); #endif + +#endif } Renamed: vendor/nginx-1.9.15/src/event/ngx_event_openssl.h (+17 -0) 95% =================================================================== --- vendor/nginx-1.9.12/src/event/ngx_event_openssl.h 2016-04-20 22:22:29 +0900 (c86be2a) +++ vendor/nginx-1.9.15/src/event/ngx_event_openssl.h 2016-04-21 23:49:50 +0900 (09654db) @@ -33,6 +33,23 @@ #define NGX_SSL_NAME "OpenSSL" +#if (defined LIBRESSL_VERSION_NUMBER && OPENSSL_VERSION_NUMBER == 0x20000000L) +#undef OPENSSL_VERSION_NUMBER +#define OPENSSL_VERSION_NUMBER 0x1000107fL +#endif + + +#if (OPENSSL_VERSION_NUMBER >= 0x10100001L) + +#define ngx_ssl_version() OpenSSL_version(OPENSSL_VERSION) + +#else + +#define ngx_ssl_version() SSLeay_version(SSLEAY_VERSION) + +#endif + + #define ngx_ssl_session_t SSL_SESSION #define ngx_ssl_conn_t SSL Renamed: vendor/nginx-1.9.15/src/event/ngx_event_openssl_stapling.c (+5 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/event/ngx_event_openssl_stapling.c 2016-04-20 22:22:29 +0900 (fa77678) +++ vendor/nginx-1.9.15/src/event/ngx_event_openssl_stapling.c 2016-04-21 23:49:50 +0900 (5322b1b) @@ -285,7 +285,11 @@ ngx_ssl_stapling_issuer(ngx_conf_t *cf, ngx_ssl_t *ssl) for (i = 0; i < n; i++) { issuer = sk_X509_value(chain, i); if (X509_check_issued(issuer, cert) == X509_V_OK) { +#if OPENSSL_VERSION_NUMBER >= 0x10100001L + X509_up_ref(issuer); +#else CRYPTO_add(&issuer->references, 1, CRYPTO_LOCK_X509); +#endif ngx_log_debug1(NGX_LOG_DEBUG_EVENT, ssl->log, 0, "SSL get issuer: found %p in extra certs", issuer); @@ -1219,7 +1223,7 @@ ngx_ssl_ocsp_create_request(ngx_ssl_ocsp_ctx_t *ctx) ngx_log_debug2(NGX_LOG_DEBUG_EVENT, ctx->log, 0, "ssl ocsp request length %z, escape %d", - base64.len, escape); + base64.len, (int) escape); len = sizeof("GET ") - 1 + ctx->uri.len + sizeof("/") - 1 + base64.len + 2 * escape + sizeof(" HTTP/1.0" CRLF) - 1 Renamed: vendor/nginx-1.9.15/src/event/ngx_event_pipe.c (+84 -26) 93% =================================================================== --- vendor/nginx-1.9.12/src/event/ngx_event_pipe.c 2016-04-20 22:22:29 +0900 (2d0e7d3) +++ vendor/nginx-1.9.15/src/event/ngx_event_pipe.c 2016-04-21 23:49:50 +0900 (5ce59ae) @@ -112,6 +112,14 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p) return NGX_OK; } +#if (NGX_THREADS) + if (p->aio) { + ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, + "pipe read upstream: aio"); + return NGX_AGAIN; + } +#endif + ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "pipe read upstream: %d", p->upstream->read->ready); @@ -258,19 +266,6 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p) break; } - if (rc == NGX_AGAIN) { - if (ngx_event_flags & NGX_USE_LEVEL_EVENT - && p->upstream->read->active - && p->upstream->read->ready) - { - if (ngx_del_event(p->upstream->read, NGX_READ_EVENT, 0) - == NGX_ERROR) - { - return NGX_ABORT; - } - } - } - if (rc != NGX_OK) { return rc; } @@ -439,7 +434,7 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p) /* STUB */ cl->buf->num = p->num++; if (p->input_filter(p, cl->buf) == NGX_ERROR) { - return NGX_ABORT; + return NGX_ABORT; } ngx_free_chain(p->pool, cl); @@ -475,8 +470,10 @@ ngx_event_pipe_read_upstream(ngx_event_pipe_t *p) ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, "pipe write chain"); - if (ngx_event_pipe_write_chain_to_temp_file(p) == NGX_ABORT) { - return NGX_ABORT; + rc = ngx_event_pipe_write_chain_to_temp_file(p); + + if (rc != NGX_OK) { + return rc; } } @@ -499,6 +496,18 @@ ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p) ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "pipe write downstream: %d", downstream->write->ready); +#if (NGX_THREADS) + + if (p->writing) { + rc = ngx_event_pipe_write_chain_to_temp_file(p); + + if (rc == NGX_ABORT) { + return NGX_ABORT; + } + } + +#endif + flushed = 0; for ( ;; ) { @@ -532,6 +541,10 @@ ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p) p->out = NULL; } + if (p->writing) { + break; + } + if (p->in) { ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, "pipe write downstream flush in"); @@ -608,7 +621,7 @@ ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p) p->out = p->out->next; - } else if (!p->cacheable && p->in) { + } else if (!p->cacheable && !p->writing && p->in) { cl = p->in; ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, @@ -647,7 +660,7 @@ ngx_event_pipe_write_to_downstream(ngx_event_pipe_t *p) flush: ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0, - "pipe write: out:%p, f:%d", out, flush); + "pipe write: out:%p, f:%ui", out, flush); if (out == NULL) { @@ -710,12 +723,38 @@ ngx_event_pipe_write_chain_to_temp_file(ngx_event_pipe_t *p) ssize_t size, bsize, n; ngx_buf_t *b; ngx_uint_t prev_last_shadow; - ngx_chain_t *cl, *tl, *next, *out, **ll, **last_out, **last_free, fl; + ngx_chain_t *cl, *tl, *next, *out, **ll, **last_out, **last_free; + +#if (NGX_THREADS) + + if (p->writing) { + + if (p->aio) { + return NGX_AGAIN; + } + + out = p->writing; + p->writing = NULL; + + n = ngx_write_chain_to_temp_file(p->temp_file, NULL); + + if (n == NGX_ERROR) { + return NGX_ABORT; + } + + goto done; + } + +#endif if (p->buf_to_file) { - fl.buf = p->buf_to_file; - fl.next = p->in; - out = &fl; + out = ngx_alloc_chain_link(p->pool); + if (out == NULL) { + return NGX_ABORT; + } + + out->buf = p->buf_to_file; + out->next = p->in; } else { out = p->in; @@ -762,12 +801,12 @@ ngx_event_pipe_write_chain_to_temp_file(ngx_event_pipe_t *p) } if (cl) { - p->in = cl; - *ll = NULL; + p->in = cl; + *ll = NULL; } else { - p->in = NULL; - p->last_in = &p->in; + p->in = NULL; + p->last_in = &p->in; } } else { @@ -775,12 +814,31 @@ ngx_event_pipe_write_chain_to_temp_file(ngx_event_pipe_t *p) p->last_in = &p->in; } +#if (NGX_THREADS) + p->temp_file->thread_write = p->thread_handler ? 1 : 0; + p->temp_file->file.thread_task = p->thread_task; + p->temp_file->file.thread_handler = p->thread_handler; + p->temp_file->file.thread_ctx = p->thread_ctx; +#endif + n = ngx_write_chain_to_temp_file(p->temp_file, out); if (n == NGX_ERROR) { return NGX_ABORT; } +#if (NGX_THREADS) + + if (n == NGX_AGAIN) { + p->writing = out; + p->thread_task = p->temp_file->file.thread_task; + return NGX_AGAIN; + } + +done: + +#endif + if (p->buf_to_file) { p->temp_file->offset = p->buf_to_file->last - p->buf_to_file->pos; n -= p->buf_to_file->last - p->buf_to_file->pos; Renamed: vendor/nginx-1.9.15/src/event/ngx_event_pipe.h (+10 -0) 88% =================================================================== --- vendor/nginx-1.9.12/src/event/ngx_event_pipe.h 2016-04-20 22:22:29 +0900 (451fc4c) +++ vendor/nginx-1.9.15/src/event/ngx_event_pipe.h 2016-04-21 23:49:50 +0900 (ef2e7a0) @@ -30,6 +30,8 @@ struct ngx_event_pipe_s { ngx_chain_t *in; ngx_chain_t **last_in; + ngx_chain_t *writing; + ngx_chain_t *out; ngx_chain_t *free; ngx_chain_t *busy; @@ -45,6 +47,13 @@ struct ngx_event_pipe_s { ngx_event_pipe_output_filter_pt output_filter; void *output_ctx; +#if (NGX_THREADS) + ngx_int_t (*thread_handler)(ngx_thread_task_t *task, + ngx_file_t *file); + void *thread_ctx; + ngx_thread_task_t *thread_task; +#endif + unsigned read:1; unsigned cacheable:1; unsigned single_buf:1; @@ -56,6 +65,7 @@ struct ngx_event_pipe_s { unsigned downstream_done:1; unsigned downstream_error:1; unsigned cyclic_temp_file:1; + unsigned aio:1; ngx_int_t allocated; ngx_bufs_t bufs; Renamed: vendor/nginx-1.9.15/src/event/ngx_event_posted.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/event/ngx_event_posted.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/event/ngx_event_timer.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/event/ngx_event_timer.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_access_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_addition_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_auth_basic_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_auth_basic_module.c 2016-04-20 22:22:29 +0900 (8ec5329) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_auth_basic_module.c 2016-04-21 23:49:50 +0900 (1e7a0c2) @@ -298,7 +298,7 @@ ngx_http_auth_basic_crypt_handler(ngx_http_request_t *r, &encrypted); ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "rc: %d user: \"%V\" salt: \"%s\"", + "rc: %i user: \"%V\" salt: \"%s\"", rc, &r->headers_in.user, passwd->data); if (rc == NGX_OK) { Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_auth_request_module.c (+2 -2) 98% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_auth_request_module.c 2016-04-20 22:22:29 +0900 (b4307be) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_auth_request_module.c 2016-04-21 23:49:50 +0900 (bab79e4) @@ -168,7 +168,7 @@ ngx_http_auth_request_handler(ngx_http_request_t *r) } ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "auth request unexpected status: %d", ctx->status); + "auth request unexpected status: %ui", ctx->status); return NGX_HTTP_INTERNAL_SERVER_ERROR; } @@ -219,7 +219,7 @@ ngx_http_auth_request_done(ngx_http_request_t *r, void *data, ngx_int_t rc) ngx_http_auth_request_ctx_t *ctx = data; ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "auth request done s:%d", r->headers_out.status); + "auth request done s:%ui", r->headers_out.status); ctx->done = 1; ctx->status = r->headers_out.status; Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_autoindex_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_browser_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_charset_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_chunked_filter_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_chunked_filter_module.c 2016-04-20 22:22:29 +0900 (0059a98) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_chunked_filter_module.c 2016-04-21 23:49:50 +0900 (ac2e3e8) @@ -121,7 +121,7 @@ ngx_http_chunked_body_filter(ngx_http_request_t *r, ngx_chain_t *in) for ( ;; ) { ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http chunk: %d", ngx_buf_size(cl->buf)); + "http chunk: %O", ngx_buf_size(cl->buf)); size += ngx_buf_size(cl->buf); Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_dav_module.c (+5 -5) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_dav_module.c 2016-04-20 22:22:29 +0900 (b9fadd0) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_dav_module.c 2016-04-21 23:49:50 +0900 (3600265) @@ -621,11 +621,11 @@ destination_done: if ((r->uri.data[r->uri.len - 1] == '/' && *(last - 1) != '/') || (r->uri.data[r->uri.len - 1] != '/' && *(last - 1) == '/')) { - ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "both URI \"%V\" and \"Destination\" URI \"%V\" " - "should be either collections or non-collections", - &r->uri, &dest->value); - return NGX_HTTP_CONFLICT; + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "both URI \"%V\" and \"Destination\" URI \"%V\" " + "should be either collections or non-collections", + &r->uri, &dest->value); + return NGX_HTTP_CONFLICT; } depth = ngx_http_dav_depth(r, NGX_HTTP_DAV_INFINITY_DEPTH); Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_degradation_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_empty_gif_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_fastcgi_module.c (+14 -8) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_fastcgi_module.c 2016-04-20 22:22:29 +0900 (dbd7767) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_fastcgi_module.c 2016-04-21 23:49:50 +0900 (2d288ce) @@ -206,6 +206,7 @@ static ngx_conf_bitmask_t ngx_http_fastcgi_next_upstream_masks[] = { { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR }, { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT }, { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER }, + { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT }, { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 }, { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 }, { ngx_string("http_403"), NGX_HTTP_UPSTREAM_FT_HTTP_403 }, @@ -750,7 +751,7 @@ ngx_http_fastcgi_eval(ngx_http_request_t *r, ngx_http_fastcgi_loc_conf_t *flcf) url.no_resolve = 1; if (ngx_parse_url(r->pool, &url) != NGX_OK) { - if (url.err) { + if (url.err) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "%s in upstream \"%V\"", url.err, &url.url); } @@ -1176,6 +1177,11 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r) while (body) { + if (ngx_buf_special(body->buf)) { + body = body->next; + continue; + } + if (body->buf->in_file) { file_pos = body->buf->file_pos; @@ -1652,7 +1658,7 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r) && f->type != NGX_HTTP_FASTCGI_STDERR) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "upstream sent unexpected FastCGI record: %d", + "upstream sent unexpected FastCGI record: %ui", f->type); return NGX_HTTP_UPSTREAM_INVALID_HEADER; @@ -1799,7 +1805,7 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r) } else { r->cache->header_start += u->buffer.pos - start - - sizeof(ngx_http_fastcgi_header_t); + - sizeof(ngx_http_fastcgi_header_t); } f->large_stderr = 0; @@ -1833,7 +1839,7 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r) rc = ngx_http_parse_header_line(r, &u->buffer, 1); ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http fastcgi parser: %d", rc); + "http fastcgi parser: %i", rc); if (rc == NGX_AGAIN) { break; @@ -2504,7 +2510,7 @@ ngx_http_fastcgi_non_buffered_filter(void *data, ssize_t bytes) for (cl = u->out_bufs; cl; cl = cl->next) { ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http fastcgi in memory %p-%p %uz", + "http fastcgi in memory %p-%p %O", cl->buf->pos, cl->buf->last, ngx_buf_size(cl->buf)); if (buf->last == cl->buf->pos) { @@ -2557,8 +2563,8 @@ ngx_http_fastcgi_process_record(ngx_http_request_t *r, case NGX_HTTP_FASTCGI_STDOUT: case NGX_HTTP_FASTCGI_STDERR: case NGX_HTTP_FASTCGI_END_REQUEST: - f->type = (ngx_uint_t) ch; - break; + f->type = (ngx_uint_t) ch; + break; default: ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "upstream sent invalid FastCGI " @@ -2653,7 +2659,7 @@ ngx_http_fastcgi_finalize_request(ngx_http_request_t *r, ngx_int_t rc) static ngx_int_t ngx_http_fastcgi_add_variables(ngx_conf_t *cf) { - ngx_http_variable_t *var, *v; + ngx_http_variable_t *var, *v; for (v = ngx_http_fastcgi_vars; v->name.len; v++) { var = ngx_http_add_variable(cf, &v->name, v->flags); Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_flv_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_geo_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_geoip_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_gunzip_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_gzip_filter_module.c (+2 -2) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_gzip_filter_module.c 2016-04-20 22:22:29 +0900 (f941e63) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_gzip_filter_module.c 2016-04-21 23:49:50 +0900 (536fdf8) @@ -1009,14 +1009,14 @@ ngx_http_gzip_filter_alloc(void *opaque, u_int items, u_int size) ctx->allocated -= alloc; ngx_log_debug4(NGX_LOG_DEBUG_HTTP, ctx->request->connection->log, 0, - "gzip alloc: n:%ud s:%ud a:%ud p:%p", + "gzip alloc: n:%ud s:%ud a:%ui p:%p", items, size, alloc, p); return p; } ngx_log_error(NGX_LOG_ALERT, ctx->request->connection->log, 0, - "gzip filter failed to use preallocated memory: %ud of %ud", + "gzip filter failed to use preallocated memory: %ud of %ui", items * size, ctx->allocated); p = ngx_palloc(ctx->request->pool, items * size); Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_gzip_static_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_headers_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_image_filter_module.c (+2 -2) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_image_filter_module.c 2016-04-20 22:22:29 +0900 (bd7a309) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_image_filter_module.c 2016-04-21 23:49:50 +0900 (b608de1) @@ -144,7 +144,7 @@ static ngx_command_t ngx_http_image_filter_commands[] = { offsetof(ngx_http_image_filter_conf_t, transparency), NULL }, - { ngx_string("image_filter_interlace"), + { ngx_string("image_filter_interlace"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, ngx_conf_set_flag_slot, NGX_HTTP_LOC_CONF_OFFSET, @@ -737,7 +737,7 @@ ngx_http_image_size(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx) } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "image size: %d x %d", width, height); + "image size: %d x %d", (int) width, (int) height); ctx->width = width; ctx->height = height; Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_index_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_limit_conn_module.c (+2 -2) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_limit_conn_module.c 2016-04-20 22:22:29 +0900 (4379311) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_limit_conn_module.c 2016-04-21 23:49:50 +0900 (913d599) @@ -232,7 +232,7 @@ ngx_http_limit_conn_handler(ngx_http_request_t *r) } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "limit conn: %08XD %d", node->key, lc->conn); + "limit conn: %08Xi %d", node->key, lc->conn); ngx_shmtx_unlock(&shpool->mutex); @@ -351,7 +351,7 @@ ngx_http_limit_conn_cleanup(void *data) ngx_shmtx_lock(&shpool->mutex); ngx_log_debug2(NGX_LOG_DEBUG_HTTP, lccln->shm_zone->shm.log, 0, - "limit conn cleanup: %08XD %d", node->key, lc->conn); + "limit conn cleanup: %08Xi %d", node->key, lc->conn); lc->conn--; Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_limit_req_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_log_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_map_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_map_module.c 2016-04-20 22:22:29 +0900 (2b80d0f) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_map_module.c 2016-04-21 23:49:50 +0900 (091ff09) @@ -141,7 +141,7 @@ ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, *v = *value; ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http map: \"%v\" \"%v\"", &val, v); + "http map: \"%V\" \"%v\"", &val, v); return NGX_OK; } Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_memcached_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_memcached_module.c 2016-04-20 22:22:29 +0900 (8341b92) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_memcached_module.c 2016-04-21 23:49:50 +0900 (d31996a) @@ -523,7 +523,7 @@ ngx_http_memcached_filter(void *data, ssize_t bytes) cl->buf->tag = u->output.tag; ngx_log_debug4(NGX_LOG_DEBUG_HTTP, ctx->request->connection->log, 0, - "memcached filter bytes:%z size:%z length:%z rest:%z", + "memcached filter bytes:%z size:%z length:%O rest:%z", bytes, b->last - b->pos, u->length, ctx->rest); if (bytes <= (ssize_t) (u->length - NGX_HTTP_MEMCACHED_END)) { Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_mp4_module.c (+13 -13) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_mp4_module.c 2016-04-20 22:22:29 +0900 (980bf57) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_mp4_module.c 2016-04-21 23:49:50 +0900 (16ef83c) @@ -913,7 +913,7 @@ ngx_http_mp4_read_atom(ngx_http_mp4_file_t *mp4, ngx_log_debug4(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0, "mp4 atom: %*s @%O:%uL", - 4, atom_name, mp4->offset, atom_size); + (size_t) 4, atom_name, mp4->offset, atom_size); if (atom_size > (uint64_t) (NGX_MAX_OFF_T_VALUE - mp4->offset) || mp4->offset + (off_t) atom_size > end) @@ -1433,10 +1433,10 @@ typedef struct { u_char layer[2]; u_char group[2]; u_char volume[2]; - u_char reverved3[2]; + u_char reserved3[2]; u_char matrix[36]; u_char width[4]; - u_char heigth[4]; + u_char height[4]; } ngx_mp4_tkhd_atom_t; typedef struct { @@ -1453,10 +1453,10 @@ typedef struct { u_char layer[2]; u_char group[2]; u_char volume[2]; - u_char reverved3[2]; + u_char reserved3[2]; u_char matrix[36]; u_char width[4]; - u_char heigth[4]; + u_char height[4]; } ngx_mp4_tkhd64_atom_t; @@ -1958,7 +1958,7 @@ ngx_http_mp4_read_stsd_atom(ngx_http_mp4_file_t *mp4, uint64_t atom_data_size) ngx_log_debug3(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0, "stsd entries:%uD, media:%*s", ngx_mp4_get_32value(stsd_atom->entries), - 4, stsd_atom->media_name); + (size_t) 4, stsd_atom->media_name); trak = ngx_mp4_last_trak(mp4); @@ -2555,14 +2555,14 @@ ngx_http_mp4_crop_ctts_data(ngx_http_mp4_file_t *mp4, "sample:%uD, count:%uD, offset:%uD", start_sample, count, ngx_mp4_get_32value(entry->offset)); - if (start_sample <= count) { - rest = start_sample - 1; - goto found; - } + if (start_sample <= count) { + rest = start_sample - 1; + goto found; + } - start_sample -= count; - entries--; - entry++; + start_sample -= count; + entries--; + entry++; } if (start) { Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_not_modified_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_proxy_module.c (+5 -4) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_proxy_module.c 2016-04-20 22:22:29 +0900 (a869e74) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_proxy_module.c 2016-04-21 23:49:50 +0900 (c24ef17) @@ -213,6 +213,7 @@ static ngx_conf_bitmask_t ngx_http_proxy_next_upstream_masks[] = { { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR }, { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT }, { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER }, + { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT }, { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 }, { ngx_string("http_502"), NGX_HTTP_UPSTREAM_FT_HTTP_502 }, { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 }, @@ -1558,7 +1559,7 @@ ngx_http_proxy_body_output_filter(void *data, ngx_chain_t *in) for ( ;; ) { ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "proxy output chunk: %d", ngx_buf_size(cl->buf)); + "proxy output chunk: %O", ngx_buf_size(cl->buf)); size += ngx_buf_size(cl->buf); @@ -1916,7 +1917,7 @@ ngx_http_proxy_input_filter_init(void *data) } ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http proxy filter init s:%d h:%d c:%d l:%O", + "http proxy filter init s:%ui h:%d c:%d l:%O", u->headers_in.status_n, ctx->head, u->headers_in.chunked, u->headers_in.content_length_n); @@ -2124,7 +2125,7 @@ ngx_http_proxy_chunked_filter(ngx_event_pipe_t *p, ngx_buf_t *buf) } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http proxy chunked state %d, length %d", + "http proxy chunked state %ui, length %O", ctx->chunked.state, p->length); if (b) { @@ -2298,7 +2299,7 @@ ngx_http_proxy_non_buffered_chunked_filter(void *data, ssize_t bytes) for (cl = u->out_bufs; cl; cl = cl->next) { ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http proxy in memory %p-%p %uz", + "http proxy in memory %p-%p %O", cl->buf->pos, cl->buf->last, ngx_buf_size(cl->buf)); if (buf->last == cl->buf->pos) { Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_random_index_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_random_index_module.c 2016-04-20 22:22:29 +0900 (b0f0e08) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_random_index_module.c 2016-04-21 23:49:50 +0900 (b47ee4f) @@ -230,7 +230,7 @@ ngx_http_random_index_handler(ngx_http_request_t *r) if (ngx_close_dir(&dir) == NGX_ERROR) { ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno, - ngx_close_dir_n " \"%s\" failed", &path); + ngx_close_dir_n " \"%V\" failed", &path); } n = names.nelts; Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_range_filter_module.c (+2 -2) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_range_filter_module.c 2016-04-20 22:22:29 +0900 (b07b2e2) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_range_filter_module.c 2016-04-21 23:49:50 +0900 (57065e1) @@ -207,7 +207,7 @@ ngx_http_range_header_filter(ngx_http_request_t *r) if_range_time = ngx_parse_http_time(if_range->data, if_range->len); ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http ir:%d lm:%d", + "http ir:%T lm:%T", if_range_time, r->headers_out.last_modified_time); if (if_range_time != r->headers_out.last_modified_time) { @@ -665,7 +665,7 @@ ngx_http_range_test_overlapped(ngx_http_request_t *r, range = ctx->ranges.elts; for (i = 0; i < ctx->ranges.nelts; i++) { if (start > range[i].start || last < range[i].end) { - goto overlapped; + goto overlapped; } } } Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_realip_module.c (+2 -2) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_realip_module.c 2016-04-20 22:22:29 +0900 (c3d7ebe) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_realip_module.c 2016-04-21 23:49:50 +0900 (b7befe6) @@ -328,8 +328,8 @@ ngx_http_realip_from(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) #if (NGX_HAVE_UNIX_DOMAIN) if (ngx_strcmp(value[1].data, "unix:") == 0) { - cidr->family = AF_UNIX; - return NGX_CONF_OK; + cidr->family = AF_UNIX; + return NGX_CONF_OK; } #endif Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_referer_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_referer_module.c 2016-04-20 22:22:29 +0900 (b417eb2) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_referer_module.c 2016-04-21 23:49:50 +0900 (3f0f78e) @@ -109,7 +109,7 @@ ngx_module_t ngx_http_referer_module = { static ngx_int_t ngx_http_referer_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, - uintptr_t data) + uintptr_t data) { u_char *p, *ref, *last; size_t len; Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_rewrite_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_rewrite_module.c 2016-04-20 22:22:29 +0900 (2ec7f5d) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_rewrite_module.c 2016-04-21 23:49:50 +0900 (6b2444c) @@ -571,7 +571,7 @@ ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) mconf = module->create_loc_conf(cf); if (mconf == NULL) { - return NGX_CONF_ERROR; + return NGX_CONF_ERROR; } ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf; Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_scgi_module.c (+2 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_scgi_module.c 2016-04-20 22:22:29 +0900 (76c7786) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_scgi_module.c 2016-04-21 23:49:50 +0900 (f09617e) @@ -77,6 +77,7 @@ static ngx_conf_bitmask_t ngx_http_scgi_next_upstream_masks[] = { { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR }, { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT }, { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER }, + { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT }, { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 }, { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 }, { ngx_string("http_403"), NGX_HTTP_UPSTREAM_FT_HTTP_403 }, @@ -875,7 +876,7 @@ ngx_http_scgi_create_request(ngx_http_request_t *r) next: continue; - } + } } *b->last++ = (u_char) ','; Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_secure_link_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_slice_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_split_clients_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_ssi_filter_module.c (+7 -7) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_ssi_filter_module.c 2016-04-20 22:22:29 +0900 (8236320) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_ssi_filter_module.c 2016-04-21 23:49:50 +0900 (fc6e65b) @@ -468,12 +468,12 @@ ngx_http_ssi_body_filter(ngx_http_request_t *r, ngx_chain_t *in) while (ctx->pos < ctx->buf->last) { ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "saved: %d state: %d", ctx->saved, ctx->state); + "saved: %uz state: %ui", ctx->saved, ctx->state); rc = ngx_http_ssi_parse(r, ctx); ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "parse: %d, looked: %d %p-%p", + "parse: %i, looked: %uz %p-%p", rc, ctx->looked, ctx->copy_start, ctx->copy_end); if (rc == NGX_ERROR) { @@ -485,7 +485,7 @@ ngx_http_ssi_body_filter(ngx_http_request_t *r, ngx_chain_t *in) if (ctx->output) { ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "saved: %d", ctx->saved); + "saved: %uz", ctx->saved); if (ctx->saved) { @@ -1911,7 +1911,7 @@ ngx_http_ssi_regex_match(ngx_http_request_t *r, ngx_str_t *pattern, if (rc < NGX_REGEX_NO_MATCHED) { ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, - ngx_regex_exec_n " failed: %i on \"%V\" using \"%V\"", + ngx_regex_exec_n " failed: %d on \"%V\" using \"%V\"", rc, str, pattern); return NGX_HTTP_SSI_ERROR; } @@ -2005,7 +2005,7 @@ ngx_http_ssi_include(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, if (uri && file) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, - "inlcusion may be either virtual=\"%V\" or file=\"%V\"", + "inclusion may be either virtual=\"%V\" or file=\"%V\"", uri, file); return NGX_HTTP_SSI_ERROR; } @@ -2525,7 +2525,7 @@ ngx_http_ssi_if(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, } ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "evaluted left: \"%V\"", &left); + "evaluated left: \"%V\"", &left); if (p == last) { if (left.len) { @@ -2589,7 +2589,7 @@ ngx_http_ssi_if(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, } ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "evaluted right: \"%V\"", &right); + "evaluated right: \"%V\"", &right); if (noregex) { if (left.len != right.len) { Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_ssi_filter_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_ssl_module.c (+5 -4) 98% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_ssl_module.c 2016-04-20 22:22:29 +0900 (7b051ea) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_ssl_module.c 2016-04-21 23:49:50 +0900 (6a4108c) @@ -337,8 +337,9 @@ ngx_http_ssl_alpn_select(ngx_ssl_conn_t *ssl_conn, const unsigned char **out, #if (NGX_DEBUG) for (i = 0; i < inlen; i += in[i] + 1) { - ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, - "SSL ALPN supported by client: %*s", in[i], &in[i + 1]); + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, + "SSL ALPN supported by client: %*s", + (size_t) in[i], &in[i + 1]); } #endif @@ -365,7 +366,7 @@ ngx_http_ssl_alpn_select(ngx_ssl_conn_t *ssl_conn, const unsigned char **out, } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, - "SSL ALPN selected: %*s", *outlen, *out); + "SSL ALPN selected: %*s", (size_t) *outlen, *out); return SSL_TLSEXT_ERR_OK; } @@ -717,7 +718,7 @@ ngx_http_ssl_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) SSL_CTX_set_options(conf->ssl.ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); } -#ifndef LIBRESSL_VERSION_NUMBER +#if (OPENSSL_VERSION_NUMBER < 0x10100001L && !defined LIBRESSL_VERSION_NUMBER) /* a temporary 512-bit RSA key is required for export versions of MSIE */ SSL_CTX_set_tmp_rsa_callback(conf->ssl.ctx, ngx_ssl_rsa512_key_callback); #endif Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_ssl_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_static_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_stub_status_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_sub_filter_module.c (+5 -5) 98% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_sub_filter_module.c 2016-04-20 22:22:29 +0900 (8ba75ed) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_sub_filter_module.c 2016-04-21 23:49:50 +0900 (bb1c50b) @@ -229,7 +229,7 @@ ngx_http_sub_header_filter(ngx_http_request_t *r) return ngx_http_next_header_filter(r); } - ctx->matches = ngx_pnalloc(r->pool, sizeof(ngx_array_t)); + ctx->matches = ngx_palloc(r->pool, sizeof(ngx_array_t)); if (ctx->matches == NULL) { return NGX_ERROR; } @@ -237,7 +237,7 @@ ngx_http_sub_header_filter(ngx_http_request_t *r) ctx->matches->elts = matches; ctx->matches->nelts = j; - ctx->tables = ngx_pnalloc(r->pool, sizeof(ngx_http_sub_tables_t)); + ctx->tables = ngx_palloc(r->pool, sizeof(ngx_http_sub_tables_t)); if (ctx->tables == NULL) { return NGX_ERROR; } @@ -341,7 +341,7 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in) rc = ngx_http_sub_parse(r, ctx); ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "parse: %d, looked: \"%V\" %p-%p", + "parse: %i, looked: \"%V\" %p-%p", rc, &ctx->looked, ctx->copy_start, ctx->copy_end); if (rc == NGX_ERROR) { @@ -859,7 +859,7 @@ ngx_http_sub_merge_conf(ngx_conf_t *cf, void *parent, void *child) pairs = conf->pairs->elts; n = conf->pairs->nelts; - matches = ngx_pnalloc(cf->pool, sizeof(ngx_http_sub_match_t) * n); + matches = ngx_palloc(cf->pool, sizeof(ngx_http_sub_match_t) * n); if (matches == NULL) { return NGX_CONF_ERROR; } @@ -869,7 +869,7 @@ ngx_http_sub_merge_conf(ngx_conf_t *cf, void *parent, void *child) matches[i].value = &pairs[i].value; } - conf->matches = ngx_pnalloc(cf->pool, sizeof(ngx_array_t)); + conf->matches = ngx_palloc(cf->pool, sizeof(ngx_array_t)); if (conf->matches == NULL) { return NGX_CONF_ERROR; } Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_hash_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_ip_hash_module.c (+1 -1) 98% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_upstream_ip_hash_module.c 2016-04-20 22:22:29 +0900 (401b58e) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_ip_hash_module.c 2016-04-21 23:49:50 +0900 (8a5f0fa) @@ -199,7 +199,7 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data) } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0, - "get ip hash peer, hash: %ui %04XA", p, m); + "get ip hash peer, hash: %ui %04XL", p, (uint64_t) m); if (peer->down) { goto next; Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_keepalive_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_least_conn_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_upstream_least_conn_module.c 2016-04-20 22:22:29 +0900 (92951bd) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_least_conn_module.c 2016-04-21 23:49:50 +0900 (8a300c1) @@ -259,7 +259,7 @@ failed: / (8 * sizeof(uintptr_t)); for (i = 0; i < n; i++) { - rrp->tried[i] = 0; + rrp->tried[i] = 0; } ngx_http_upstream_rr_peers_unlock(peers); Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_upstream_zone_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_userid_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_uwsgi_module.c (+1 -0) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/modules/ngx_http_uwsgi_module.c 2016-04-20 22:22:29 +0900 (0313dfa) +++ vendor/nginx-1.9.15/src/http/modules/ngx_http_uwsgi_module.c 2016-04-21 23:49:50 +0900 (fef2c46) @@ -109,6 +109,7 @@ static ngx_conf_bitmask_t ngx_http_uwsgi_next_upstream_masks[] = { { ngx_string("error"), NGX_HTTP_UPSTREAM_FT_ERROR }, { ngx_string("timeout"), NGX_HTTP_UPSTREAM_FT_TIMEOUT }, { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER }, + { ngx_string("non_idempotent"), NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT }, { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 }, { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 }, { ngx_string("http_403"), NGX_HTTP_UPSTREAM_FT_HTTP_403 }, Renamed: vendor/nginx-1.9.15/src/http/modules/ngx_http_xslt_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/perl/Makefile.PL (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/perl/nginx.pm (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/perl/nginx.xs (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/perl/ngx_http_perl_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/perl/ngx_http_perl_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/modules/perl/typemap (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/ngx_http.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/ngx_http.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/ngx_http_cache.h (+4 -0) 97% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_cache.h 2016-04-20 22:22:29 +0900 (d36fa77) +++ vendor/nginx-1.9.15/src/http/ngx_http_cache.h 2016-04-21 23:49:50 +0900 (2667cbb) @@ -138,6 +138,8 @@ typedef struct { ngx_atomic_t cold; ngx_atomic_t loading; off_t size; + ngx_uint_t count; + ngx_uint_t watermark; } ngx_http_file_cache_sh_t; @@ -153,6 +155,8 @@ struct ngx_http_file_cache_s { time_t inactive; + time_t fail_time; + ngx_uint_t files; ngx_uint_t loader_files; ngx_msec_t last; Renamed: vendor/nginx-1.9.15/src/http/ngx_http_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/ngx_http_copy_filter_module.c (+12 -4) 95% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_copy_filter_module.c 2016-04-20 22:22:29 +0900 (c6d03ee) +++ vendor/nginx-1.9.15/src/http/ngx_http_copy_filter_module.c 2016-04-21 23:49:50 +0900 (c696fb6) @@ -204,10 +204,11 @@ ngx_http_copy_aio_event_handler(ngx_event_t *ev) static ssize_t ngx_http_copy_aio_sendfile_preload(ngx_buf_t *file) { - ssize_t n; - static u_char buf[1]; - ngx_event_aio_t *aio; - ngx_http_request_t *r; + ssize_t n; + static u_char buf[1]; + ngx_event_aio_t *aio; + ngx_http_request_t *r; + ngx_output_chain_ctx_t *ctx; n = ngx_file_aio_read(file->file, buf, 1, file->file_pos, NULL); @@ -218,6 +219,9 @@ ngx_http_copy_aio_sendfile_preload(ngx_buf_t *file) r = aio->data; r->main->blocked++; r->aio = 1; + + ctx = ngx_http_get_module_ctx(r, ngx_http_copy_filter_module); + ctx->aio = 1; } return n; @@ -252,6 +256,7 @@ ngx_http_copy_thread_handler(ngx_thread_task_t *task, ngx_file_t *file) ngx_str_t name; ngx_thread_pool_t *tp; ngx_http_request_t *r; + ngx_output_chain_ctx_t *ctx; ngx_http_core_loc_conf_t *clcf; r = file->thread_ctx; @@ -285,6 +290,9 @@ ngx_http_copy_thread_handler(ngx_thread_task_t *task, ngx_file_t *file) r->main->blocked++; r->aio = 1; + ctx = ngx_http_get_module_ctx(r, ngx_http_copy_filter_module); + ctx->aio = 1; + return NGX_OK; } Renamed: vendor/nginx-1.9.15/src/http/ngx_http_core_module.c (+29 -19) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_core_module.c 2016-04-20 22:22:29 +0900 (df7e8d4) +++ vendor/nginx-1.9.15/src/http/ngx_http_core_module.c 2016-04-21 23:49:50 +0900 (bd36aec) @@ -400,6 +400,13 @@ static ngx_command_t ngx_http_core_commands[] = { 0, NULL }, + { ngx_string("aio_write"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_core_loc_conf_t, aio_write), + NULL }, + { ngx_string("read_ahead"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, ngx_conf_set_size_slot, @@ -1215,7 +1222,7 @@ ngx_http_core_try_files_phase(ngx_http_request_t *r, } name = path.data + root; - } + } if (tf->values == NULL) { @@ -1590,7 +1597,8 @@ ngx_http_core_find_static_location(ngx_http_request_t *r, } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "test location: \"%*s\"", node->len, node->name); + "test location: \"%*s\"", + (size_t) node->len, node->name); n = (len <= (size_t) node->len) ? len : node->len; @@ -3097,7 +3105,7 @@ ngx_http_core_location(ngx_conf_t *cf, ngx_command_t *cmd, void *dummy) ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = module->create_loc_conf(cf); if (ctx->loc_conf[cf->cycle->modules[i]->ctx_index] == NULL) { - return NGX_CONF_ERROR; + return NGX_CONF_ERROR; } } } @@ -3606,6 +3614,7 @@ ngx_http_core_create_loc_conf(ngx_conf_t *cf) clcf->sendfile = NGX_CONF_UNSET; clcf->sendfile_max_chunk = NGX_CONF_UNSET_SIZE; clcf->aio = NGX_CONF_UNSET; + clcf->aio_write = NGX_CONF_UNSET; #if (NGX_THREADS) clcf->thread_pool = NGX_CONF_UNSET_PTR; clcf->thread_pool_value = NGX_CONF_UNSET_PTR; @@ -3827,6 +3836,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) prev->sendfile_max_chunk, 0); #if (NGX_HAVE_FILE_AIO || NGX_THREADS) ngx_conf_merge_value(conf->aio, prev->aio, NGX_HTTP_AIO_OFF); + ngx_conf_merge_value(conf->aio_write, prev->aio_write, 0); #endif #if (NGX_THREADS) ngx_conf_merge_ptr_value(conf->thread_pool, prev->thread_pool, NULL); @@ -4531,21 +4541,21 @@ ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) static ngx_http_method_name_t ngx_methods_names[] = { - { (u_char *) "GET", (uint32_t) ~NGX_HTTP_GET }, - { (u_char *) "HEAD", (uint32_t) ~NGX_HTTP_HEAD }, - { (u_char *) "POST", (uint32_t) ~NGX_HTTP_POST }, - { (u_char *) "PUT", (uint32_t) ~NGX_HTTP_PUT }, - { (u_char *) "DELETE", (uint32_t) ~NGX_HTTP_DELETE }, - { (u_char *) "MKCOL", (uint32_t) ~NGX_HTTP_MKCOL }, - { (u_char *) "COPY", (uint32_t) ~NGX_HTTP_COPY }, - { (u_char *) "MOVE", (uint32_t) ~NGX_HTTP_MOVE }, - { (u_char *) "OPTIONS", (uint32_t) ~NGX_HTTP_OPTIONS }, - { (u_char *) "PROPFIND", (uint32_t) ~NGX_HTTP_PROPFIND }, - { (u_char *) "PROPPATCH", (uint32_t) ~NGX_HTTP_PROPPATCH }, - { (u_char *) "LOCK", (uint32_t) ~NGX_HTTP_LOCK }, - { (u_char *) "UNLOCK", (uint32_t) ~NGX_HTTP_UNLOCK }, - { (u_char *) "PATCH", (uint32_t) ~NGX_HTTP_PATCH }, - { NULL, 0 } + { (u_char *) "GET", (uint32_t) ~NGX_HTTP_GET }, + { (u_char *) "HEAD", (uint32_t) ~NGX_HTTP_HEAD }, + { (u_char *) "POST", (uint32_t) ~NGX_HTTP_POST }, + { (u_char *) "PUT", (uint32_t) ~NGX_HTTP_PUT }, + { (u_char *) "DELETE", (uint32_t) ~NGX_HTTP_DELETE }, + { (u_char *) "MKCOL", (uint32_t) ~NGX_HTTP_MKCOL }, + { (u_char *) "COPY", (uint32_t) ~NGX_HTTP_COPY }, + { (u_char *) "MOVE", (uint32_t) ~NGX_HTTP_MOVE }, + { (u_char *) "OPTIONS", (uint32_t) ~NGX_HTTP_OPTIONS }, + { (u_char *) "PROPFIND", (uint32_t) ~NGX_HTTP_PROPFIND }, + { (u_char *) "PROPPATCH", (uint32_t) ~NGX_HTTP_PROPPATCH }, + { (u_char *) "LOCK", (uint32_t) ~NGX_HTTP_LOCK }, + { (u_char *) "UNLOCK", (uint32_t) ~NGX_HTTP_UNLOCK }, + { (u_char *) "PATCH", (uint32_t) ~NGX_HTTP_PATCH }, + { NULL, 0 } }; @@ -4618,7 +4628,7 @@ ngx_http_core_limit_except(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) mconf = module->create_loc_conf(cf); if (mconf == NULL) { - return NGX_CONF_ERROR; + return NGX_CONF_ERROR; } ctx->loc_conf[cf->cycle->modules[i]->ctx_index] = mconf; Renamed: vendor/nginx-1.9.15/src/http/ngx_http_core_module.h (+5 -4) 98% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_core_module.h 2016-04-20 22:22:29 +0900 (7dec9e1) +++ vendor/nginx-1.9.15/src/http/ngx_http_core_module.h 2016-04-21 23:49:50 +0900 (6c446a0) @@ -232,10 +232,10 @@ typedef struct { typedef struct { - ngx_hash_combined_t names; + ngx_hash_combined_t names; - ngx_uint_t nregex; - ngx_http_server_name_t *regex; + ngx_uint_t nregex; + ngx_http_server_name_t *regex; } ngx_http_virtual_names_t; @@ -404,6 +404,7 @@ struct ngx_http_core_loc_conf_s { ngx_flag_t internal; /* internal */ ngx_flag_t sendfile; /* sendfile */ ngx_flag_t aio; /* aio */ + ngx_flag_t aio_write; /* aio_write */ ngx_flag_t tcp_nopush; /* tcp_nopush */ ngx_flag_t tcp_nodelay; /* tcp_nodelay */ ngx_flag_t reset_timedout_connection; /* reset_timedout_connection */ @@ -543,7 +544,7 @@ typedef ngx_int_t (*ngx_http_request_body_filter_pt) ngx_int_t ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *chain); ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *chain); ngx_int_t ngx_http_request_body_save_filter(ngx_http_request_t *r, - ngx_chain_t *chain); + ngx_chain_t *chain); ngx_int_t ngx_http_set_disable_symlinks(ngx_http_request_t *r, Renamed: vendor/nginx-1.9.15/src/http/ngx_http_file_cache.c (+42 -8) 97% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_file_cache.c 2016-04-20 22:22:29 +0900 (6633918) +++ vendor/nginx-1.9.15/src/http/ngx_http_file_cache.c 2016-04-21 23:49:50 +0900 (37cd377) @@ -62,6 +62,7 @@ static ngx_int_t ngx_http_file_cache_add(ngx_http_file_cache_t *cache, ngx_http_cache_t *c); static ngx_int_t ngx_http_file_cache_delete_file(ngx_tree_ctx_t *ctx, ngx_str_t *path); +static void ngx_http_file_cache_set_watermark(ngx_http_file_cache_t *cache); ngx_str_t ngx_http_cache_status[] = { @@ -147,6 +148,8 @@ ngx_http_file_cache_init(ngx_shm_zone_t *shm_zone, void *data) cache->sh->cold = 1; cache->sh->loading = 0; cache->sh->size = 0; + cache->sh->count = 0; + cache->sh->watermark = (ngx_uint_t) -1; cache->bsize = ngx_fs_bsize(cache->path->name.data); @@ -691,12 +694,13 @@ ngx_http_file_cache_aio_read(ngx_http_request_t *r, ngx_http_cache_t *c) #if (NGX_THREADS) if (clcf->aio == NGX_HTTP_AIO_THREADS) { + c->file.thread_task = c->thread_task; c->file.thread_handler = ngx_http_cache_thread_handler; c->file.thread_ctx = r; - n = ngx_thread_read(&c->thread_task, &c->file, c->buf->pos, - c->body_start, 0, r->pool); + n = ngx_thread_read(&c->file, c->buf->pos, c->body_start, 0, r->pool); + c->thread_task = c->file.thread_task; c->reading = (n == NGX_AGAIN); return n; @@ -860,6 +864,8 @@ ngx_http_file_cache_exists(ngx_http_file_cache_t *cache, ngx_http_cache_t *c) fcn = ngx_slab_calloc_locked(cache->shpool, sizeof(ngx_http_file_cache_node_t)); if (fcn == NULL) { + ngx_http_file_cache_set_watermark(cache); + ngx_shmtx_unlock(&cache->shpool->mutex); (void) ngx_http_file_cache_forced_expire(cache); @@ -876,6 +882,8 @@ ngx_http_file_cache_exists(ngx_http_file_cache_t *cache, ngx_http_cache_t *c) } } + cache->sh->count++; + ngx_memcpy((u_char *) &fcn->node.key, c->key, sizeof(ngx_rbtree_key_t)); ngx_memcpy(fcn->key, &c->key[sizeof(ngx_rbtree_key_t)], @@ -1630,6 +1638,7 @@ ngx_http_file_cache_free(ngx_http_cache_t *c, ngx_temp_file_t *tf) ngx_queue_remove(&fcn->queue); ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node); ngx_slab_free_locked(cache->shpool, fcn); + cache->sh->count--; c->node = NULL; } @@ -1825,7 +1834,7 @@ ngx_http_file_cache_expire(ngx_http_file_cache_t *cache) ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0, "ignore long locked inactive cache entry %*s, count:%d", - 2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count); + (size_t) 2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count); } ngx_shmtx_unlock(&cache->shpool->mutex); @@ -1882,6 +1891,7 @@ ngx_http_file_cache_delete(ngx_http_file_cache_t *cache, ngx_queue_t *q, ngx_queue_remove(q); ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node); ngx_slab_free_locked(cache->shpool, fcn); + cache->sh->count--; } } @@ -1891,8 +1901,9 @@ ngx_http_file_cache_manager(void *data) { ngx_http_file_cache_t *cache = data; - off_t size; - time_t next, wait; + off_t size; + time_t next, wait; + ngx_uint_t count, watermark; next = ngx_http_file_cache_expire(cache); @@ -1903,13 +1914,16 @@ ngx_http_file_cache_manager(void *data) ngx_shmtx_lock(&cache->shpool->mutex); size = cache->sh->size; + count = cache->sh->count; + watermark = cache->sh->watermark; ngx_shmtx_unlock(&cache->shpool->mutex); - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, - "http file cache size: %O", size); + ngx_log_debug3(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, + "http file cache size: %O c:%ui w:%i", + size, count, (ngx_int_t) watermark); - if (size < cache->max_size) { + if (size < cache->max_size && count < watermark) { return next; } @@ -2093,10 +2107,20 @@ ngx_http_file_cache_add(ngx_http_file_cache_t *cache, ngx_http_cache_t *c) fcn = ngx_slab_calloc_locked(cache->shpool, sizeof(ngx_http_file_cache_node_t)); if (fcn == NULL) { + ngx_http_file_cache_set_watermark(cache); + + if (cache->fail_time != ngx_time()) { + cache->fail_time = ngx_time(); + ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0, + "could not allocate node%s", cache->shpool->log_ctx); + } + ngx_shmtx_unlock(&cache->shpool->mutex); return NGX_ERROR; } + cache->sh->count++; + ngx_memcpy((u_char *) &fcn->node.key, c->key, sizeof(ngx_rbtree_key_t)); ngx_memcpy(fcn->key, &c->key[sizeof(ngx_rbtree_key_t)], @@ -2139,6 +2163,16 @@ ngx_http_file_cache_delete_file(ngx_tree_ctx_t *ctx, ngx_str_t *path) } +static void +ngx_http_file_cache_set_watermark(ngx_http_file_cache_t *cache) +{ + cache->sh->watermark = cache->sh->count - cache->sh->count / 8; + + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, + "http file cache watermark: %ui", cache->sh->watermark); +} + + time_t ngx_http_file_cache_valid(ngx_array_t *cache_valid, ngx_uint_t status) { Renamed: vendor/nginx-1.9.15/src/http/ngx_http_header_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/ngx_http_parse.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/ngx_http_postpone_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/ngx_http_request.c (+6 -6) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_request.c 2016-04-20 22:22:29 +0900 (fd790e1) +++ vendor/nginx-1.9.15/src/http/ngx_http_request.c 2016-04-21 23:49:50 +0900 (7d6cada) @@ -648,7 +648,7 @@ ngx_http_ssl_handshake(ngx_event_t *rev) err = ngx_socket_errno; - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http recv(): %d", n); + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http recv(): %z", n); if (n == -1) { if (err == NGX_EAGAIN) { @@ -1500,7 +1500,7 @@ ngx_http_alloc_large_header_buffer(ngx_http_request_t *r, } ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http large header copy: %d", r->header_in->pos - old); + "http large header copy: %uz", r->header_in->pos - old); new = b->start; @@ -2264,7 +2264,7 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) c = r->connection; ngx_log_debug5(NGX_LOG_DEBUG_HTTP, c->log, 0, - "http finalize request: %d, \"%V?%V\" a:%d, c:%d", + "http finalize request: %i, \"%V?%V\" a:%d, c:%d", rc, &r->uri, &r->args, r == c->data, r->main->count); if (rc == NGX_DONE) { @@ -2956,7 +2956,7 @@ ngx_http_set_keepalive(ngx_http_request_t *r) b->last = b->start; } - ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc free: %p %d", + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc free: %p %i", hc->free, hc->nfree); if (hc->free) { @@ -2968,7 +2968,7 @@ ngx_http_set_keepalive(ngx_http_request_t *r) hc->nfree = 0; } - ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc busy: %p %d", + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc busy: %p %i", hc->busy, hc->nbusy); if (hc->busy) { @@ -3259,7 +3259,7 @@ ngx_http_lingering_close_handler(ngx_event_t *rev) do { n = c->recv(c, buffer, NGX_HTTP_LINGERING_BUFFER_SIZE); - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "lingering read: %d", n); + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "lingering read: %z", n); if (n == NGX_ERROR || n == 0) { ngx_http_close_request(r, 0); Renamed: vendor/nginx-1.9.15/src/http/ngx_http_request.h (+3 -0) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_request.h 2016-04-20 22:22:29 +0900 (8b88139) +++ vendor/nginx-1.9.15/src/http/ngx_http_request.h 2016-04-21 23:49:50 +0900 (cfde7dc) @@ -284,6 +284,9 @@ typedef struct { ngx_chain_t *bufs; ngx_buf_t *buf; off_t rest; +#if (NGX_HTTP_V2) + off_t received; +#endif ngx_chain_t *free; ngx_chain_t *busy; ngx_http_chunked_t *chunked; Renamed: vendor/nginx-1.9.15/src/http/ngx_http_request_body.c (+64 -82) 95% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_request_body.c 2016-04-20 22:22:29 +0900 (e9562c0) +++ vendor/nginx-1.9.15/src/http/ngx_http_request_body.c 2016-04-21 23:49:50 +0900 (0641329) @@ -34,33 +34,28 @@ ngx_http_read_client_request_body(ngx_http_request_t *r, ssize_t size; ngx_int_t rc; ngx_buf_t *b; - ngx_chain_t out, *cl; + ngx_chain_t out; ngx_http_request_body_t *rb; ngx_http_core_loc_conf_t *clcf; r->main->count++; -#if (NGX_HTTP_V2) - if (r->stream && r == r->main) { - r->request_body_no_buffering = 0; - rc = ngx_http_v2_read_request_body(r, post_handler); - goto done; - } -#endif - if (r != r->main || r->request_body || r->discard_body) { r->request_body_no_buffering = 0; post_handler(r); return NGX_OK; } - if (ngx_http_test_expect(r) != NGX_OK) { - rc = NGX_HTTP_INTERNAL_SERVER_ERROR; +#if (NGX_HTTP_V2) + if (r->stream) { + rc = ngx_http_v2_read_request_body(r, post_handler); goto done; } +#endif - if (r->request_body_no_buffering) { - r->request_body_in_file_only = 0; + if (ngx_http_test_expect(r) != NGX_OK) { + rc = NGX_HTTP_INTERNAL_SERVER_ERROR; + goto done; } rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t)); @@ -148,37 +143,8 @@ ngx_http_read_client_request_body(ngx_http_request_t *r, if (rb->rest == 0) { /* the whole request body was pre-read */ - - if (r->request_body_in_file_only) { - if (ngx_http_write_request_body(r) != NGX_OK) { - rc = NGX_HTTP_INTERNAL_SERVER_ERROR; - goto done; - } - - if (rb->temp_file->file.offset != 0) { - - cl = ngx_chain_get_free_buf(r->pool, &rb->free); - if (cl == NULL) { - rc = NGX_HTTP_INTERNAL_SERVER_ERROR; - goto done; - } - - b = cl->buf; - - ngx_memzero(b, sizeof(ngx_buf_t)); - - b->in_file = 1; - b->file_last = rb->temp_file->file.offset; - b->file = &rb->temp_file->file; - - rb->bufs = cl; - } - } - r->request_body_no_buffering = 0; - post_handler(r); - return NGX_OK; } @@ -248,6 +214,18 @@ ngx_http_read_unbuffered_request_body(ngx_http_request_t *r) { ngx_int_t rc; +#if (NGX_HTTP_V2) + if (r->stream) { + rc = ngx_http_v2_read_unbuffered_request_body(r); + + if (rc == NGX_OK) { + r->reading_body = 0; + } + + return rc; + } +#endif + if (r->connection->read->timedout) { r->connection->timedout = 1; return NGX_HTTP_REQUEST_TIME_OUT; @@ -289,8 +267,7 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r) size_t size; ssize_t n; ngx_int_t rc; - ngx_buf_t *b; - ngx_chain_t *cl, out; + ngx_chain_t out; ngx_connection_t *c; ngx_http_request_body_t *rb; ngx_http_core_loc_conf_t *clcf; @@ -439,33 +416,6 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r) ngx_del_timer(c->read); } - if (rb->temp_file || r->request_body_in_file_only) { - - /* save the last part */ - - if (ngx_http_write_request_body(r) != NGX_OK) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - - if (rb->temp_file->file.offset != 0) { - - cl = ngx_chain_get_free_buf(r->pool, &rb->free); - if (cl == NULL) { - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } - - b = cl->buf; - - ngx_memzero(b, sizeof(ngx_buf_t)); - - b->in_file = 1; - b->file_last = rb->temp_file->file.offset; - b->file = &rb->temp_file->file; - - rb->bufs = cl; - } - } - if (!r->request_body_no_buffering) { r->read_event_handler = ngx_http_block_reading; rb->post_handler(r); @@ -564,16 +514,16 @@ ngx_http_discard_request_body(ngx_http_request_t *r) ngx_int_t rc; ngx_event_t *rev; -#if (NGX_HTTP_V2) - if (r->stream && r == r->main) { - r->stream->skip_data = NGX_HTTP_V2_DATA_DISCARD; + if (r != r->main || r->discard_body || r->request_body) { return NGX_OK; } -#endif - if (r != r->main || r->discard_body || r->request_body) { +#if (NGX_HTTP_V2) + if (r->stream) { + r->stream->skip_data = 1; return NGX_OK; } +#endif if (ngx_http_test_expect(r) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; @@ -1127,9 +1077,8 @@ ngx_http_request_body_chunked_filter(ngx_http_request_t *r, ngx_chain_t *in) ngx_int_t ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in) { -#if (NGX_DEBUG) + ngx_buf_t *b; ngx_chain_t *cl; -#endif ngx_http_request_body_t *rb; rb = r->request_body; @@ -1166,13 +1115,46 @@ ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in) return NGX_HTTP_INTERNAL_SERVER_ERROR; } - if (rb->rest > 0 - && rb->buf && rb->buf->last == rb->buf->end - && !r->request_body_no_buffering) - { + if (r->request_body_no_buffering) { + return NGX_OK; + } + + if (rb->rest > 0) { + + if (rb->buf && rb->buf->last == rb->buf->end + && ngx_http_write_request_body(r) != NGX_OK) + { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + return NGX_OK; + } + + /* rb->rest == 0 */ + + if (rb->temp_file || r->request_body_in_file_only) { + if (ngx_http_write_request_body(r) != NGX_OK) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } + + if (rb->temp_file->file.offset != 0) { + + cl = ngx_chain_get_free_buf(r->pool, &rb->free); + if (cl == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + b = cl->buf; + + ngx_memzero(b, sizeof(ngx_buf_t)); + + b->in_file = 1; + b->file_last = rb->temp_file->file.offset; + b->file = &rb->temp_file->file; + + rb->bufs = cl; + } } return NGX_OK; Renamed: vendor/nginx-1.9.15/src/http/ngx_http_script.c (+3 -3) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_script.c 2016-04-20 22:22:29 +0900 (02e2be3) +++ vendor/nginx-1.9.15/src/http/ngx_http_script.c 2016-04-21 23:49:50 +0900 (bff9525) @@ -19,10 +19,10 @@ static ngx_int_t ngx_http_script_add_var_code(ngx_http_script_compile_t *sc, static ngx_int_t ngx_http_script_add_args_code(ngx_http_script_compile_t *sc); #if (NGX_PCRE) static ngx_int_t ngx_http_script_add_capture_code(ngx_http_script_compile_t *sc, - ngx_uint_t n); + ngx_uint_t n); #endif static ngx_int_t - ngx_http_script_add_full_name_code(ngx_http_script_compile_t *sc); + ngx_http_script_add_full_name_code(ngx_http_script_compile_t *sc); static size_t ngx_http_script_full_name_len_code(ngx_http_script_engine_t *e); static void ngx_http_script_full_name_code(ngx_http_script_engine_t *e); @@ -1488,7 +1488,7 @@ ngx_http_script_file_code(ngx_http_script_engine_t *e) r = e->request; ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http script file op %p \"%V\"", code->op, &path); + "http script file op %p \"%V\"", (void *) code->op, &path); clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); Renamed: vendor/nginx-1.9.15/src/http/ngx_http_script.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/ngx_http_special_response.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/ngx_http_upstream.c (+187 -67) 96% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_upstream.c 2016-04-20 22:22:29 +0900 (dbaa956) +++ vendor/nginx-1.9.15/src/http/ngx_http_upstream.c 2016-04-21 23:49:50 +0900 (1386bdb) @@ -76,6 +76,13 @@ static void static ngx_int_t ngx_http_upstream_non_buffered_filter_init(void *data); static ngx_int_t ngx_http_upstream_non_buffered_filter(void *data, ssize_t bytes); +#if (NGX_THREADS) +static ngx_int_t ngx_http_upstream_thread_handler(ngx_thread_task_t *task, + ngx_file_t *file); +static void ngx_http_upstream_thread_event_handler(ngx_event_t *ev); +#endif +static ngx_int_t ngx_http_upstream_output_filter(void *data, + ngx_chain_t *chain); static void ngx_http_upstream_process_downstream(ngx_http_request_t *r); static void ngx_http_upstream_process_upstream(ngx_http_request_t *r, ngx_http_upstream_t *u); @@ -416,10 +423,10 @@ static ngx_http_upstream_next_t ngx_http_upstream_next_errors[] = { ngx_conf_bitmask_t ngx_http_upstream_cache_method_mask[] = { - { ngx_string("GET"), NGX_HTTP_GET}, - { ngx_string("HEAD"), NGX_HTTP_HEAD }, - { ngx_string("POST"), NGX_HTTP_POST }, - { ngx_null_string, 0 } + { ngx_string("GET"), NGX_HTTP_GET }, + { ngx_string("HEAD"), NGX_HTTP_HEAD }, + { ngx_string("POST"), NGX_HTTP_POST }, + { ngx_null_string, 0 } }; @@ -1876,17 +1883,17 @@ ngx_http_upstream_send_request_body(ngx_http_request_t *r, if (!r->request_body_no_buffering) { - /* buffered request body */ + /* buffered request body */ - if (!u->request_sent) { - u->request_sent = 1; - out = u->request_bufs; + if (!u->request_sent) { + u->request_sent = 1; + out = u->request_bufs; - } else { - out = NULL; - } + } else { + out = NULL; + } - return ngx_output_chain(&u->output, out); + return ngx_output_chain(&u->output, out); } if (!u->request_sent) { @@ -2861,11 +2868,16 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u) ngx_http_file_cache_free(r->cache, u->pipe->temp_file); } + if (r->header_only && !u->cacheable && !u->store) { + ngx_http_upstream_finalize_request(r, u, 0); + return; + } + #endif p = u->pipe; - p->output_filter = (ngx_event_pipe_output_filter_pt) ngx_http_output_filter; + p->output_filter = ngx_http_upstream_output_filter; p->output_ctx = r; p->tag = u->output.tag; p->bufs = u->conf->bufs; @@ -2908,6 +2920,13 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u) p->max_temp_file_size = u->conf->max_temp_file_size; p->temp_file_write_size = u->conf->temp_file_write_size; +#if (NGX_THREADS) + if (clcf->aio == NGX_HTTP_AIO_THREADS && clcf->aio_write) { + p->thread_handler = ngx_http_upstream_thread_handler; + p->thread_ctx = r; + } +#endif + p->preread_bufs = ngx_alloc_chain_link(r->pool); if (p->preread_bufs == NULL) { ngx_http_upstream_finalize_request(r, u, NGX_ERROR); @@ -3482,6 +3501,97 @@ ngx_http_upstream_non_buffered_filter(void *data, ssize_t bytes) } +#if (NGX_THREADS) + +static ngx_int_t +ngx_http_upstream_thread_handler(ngx_thread_task_t *task, ngx_file_t *file) +{ + ngx_str_t name; + ngx_event_pipe_t *p; + ngx_thread_pool_t *tp; + ngx_http_request_t *r; + ngx_http_core_loc_conf_t *clcf; + + r = file->thread_ctx; + p = r->upstream->pipe; + + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + tp = clcf->thread_pool; + + if (tp == NULL) { + if (ngx_http_complex_value(r, clcf->thread_pool_value, &name) + != NGX_OK) + { + return NGX_ERROR; + } + + tp = ngx_thread_pool_get((ngx_cycle_t *) ngx_cycle, &name); + + if (tp == NULL) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "thread pool \"%V\" not found", &name); + return NGX_ERROR; + } + } + + task->event.data = r; + task->event.handler = ngx_http_upstream_thread_event_handler; + + if (ngx_thread_task_post(tp, task) != NGX_OK) { + return NGX_ERROR; + } + + r->main->blocked++; + r->aio = 1; + p->aio = 1; + + return NGX_OK; +} + + +static void +ngx_http_upstream_thread_event_handler(ngx_event_t *ev) +{ + ngx_connection_t *c; + ngx_http_request_t *r; + + r = ev->data; + c = r->connection; + + ngx_http_set_log_request(c->log, r); + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, + "http upstream thread: \"%V?%V\"", &r->uri, &r->args); + + r->main->blocked--; + r->aio = 0; + + r->write_event_handler(r); + + ngx_http_run_posted_requests(c); +} + +#endif + + +static ngx_int_t +ngx_http_upstream_output_filter(void *data, ngx_chain_t *chain) +{ + ngx_int_t rc; + ngx_event_pipe_t *p; + ngx_http_request_t *r; + + r = data; + p = r->upstream->pipe; + + rc = ngx_http_output_filter(r, chain); + + p->aio = r->aio; + + return rc; +} + + static void ngx_http_upstream_process_downstream(ngx_http_request_t *r) { @@ -3500,6 +3610,10 @@ ngx_http_upstream_process_downstream(ngx_http_request_t *r) c->log->action = "sending to client"; +#if (NGX_THREADS) + p->aio = r->aio; +#endif + if (wev->timedout) { if (wev->delayed) { @@ -3629,6 +3743,12 @@ ngx_http_upstream_process_request(ngx_http_request_t *r, p = u->pipe; +#if (NGX_THREADS) + if (p->writing) { + return; + } +#endif + if (u->peer.connection) { if (u->store) { @@ -3827,42 +3947,36 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u, "upstream timed out"); } - if (u->peer.cached && ft_type == NGX_HTTP_UPSTREAM_FT_ERROR - && (!u->request_sent || !r->request_body_no_buffering)) - { - status = 0; - + if (u->peer.cached && ft_type == NGX_HTTP_UPSTREAM_FT_ERROR) { /* TODO: inform balancer instead */ - u->peer.tries++; + } - } else { - switch (ft_type) { + switch (ft_type) { - case NGX_HTTP_UPSTREAM_FT_TIMEOUT: - status = NGX_HTTP_GATEWAY_TIME_OUT; - break; + case NGX_HTTP_UPSTREAM_FT_TIMEOUT: + status = NGX_HTTP_GATEWAY_TIME_OUT; + break; - case NGX_HTTP_UPSTREAM_FT_HTTP_500: - status = NGX_HTTP_INTERNAL_SERVER_ERROR; - break; + case NGX_HTTP_UPSTREAM_FT_HTTP_500: + status = NGX_HTTP_INTERNAL_SERVER_ERROR; + break; - case NGX_HTTP_UPSTREAM_FT_HTTP_403: - status = NGX_HTTP_FORBIDDEN; - break; + case NGX_HTTP_UPSTREAM_FT_HTTP_403: + status = NGX_HTTP_FORBIDDEN; + break; - case NGX_HTTP_UPSTREAM_FT_HTTP_404: - status = NGX_HTTP_NOT_FOUND; - break; + case NGX_HTTP_UPSTREAM_FT_HTTP_404: + status = NGX_HTTP_NOT_FOUND; + break; - /* - * NGX_HTTP_UPSTREAM_FT_BUSY_LOCK and NGX_HTTP_UPSTREAM_FT_MAX_WAITING - * never reach here - */ + /* + * NGX_HTTP_UPSTREAM_FT_BUSY_LOCK and NGX_HTTP_UPSTREAM_FT_MAX_WAITING + * never reach here + */ - default: - status = NGX_HTTP_BAD_GATEWAY; - } + default: + status = NGX_HTTP_BAD_GATEWAY; } if (r->connection->error) { @@ -3871,37 +3985,42 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u, return; } - if (status) { - u->state->status = status; - timeout = u->conf->next_upstream_timeout; + u->state->status = status; - if (u->peer.tries == 0 - || !(u->conf->next_upstream & ft_type) - || (u->request_sent && r->request_body_no_buffering) - || (timeout && ngx_current_msec - u->peer.start_time >= timeout)) - { -#if (NGX_HTTP_CACHE) + timeout = u->conf->next_upstream_timeout; - if (u->cache_status == NGX_HTTP_CACHE_EXPIRED - && (u->conf->cache_use_stale & ft_type)) - { - ngx_int_t rc; + if (u->request_sent + && (r->method & (NGX_HTTP_POST|NGX_HTTP_LOCK|NGX_HTTP_PATCH))) + { + ft_type |= NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT; + } - rc = u->reinit_request(r); + if (u->peer.tries == 0 + || ((u->conf->next_upstream & ft_type) != ft_type) + || (u->request_sent && r->request_body_no_buffering) + || (timeout && ngx_current_msec - u->peer.start_time >= timeout)) + { +#if (NGX_HTTP_CACHE) - if (rc == NGX_OK) { - u->cache_status = NGX_HTTP_CACHE_STALE; - rc = ngx_http_upstream_cache_send(r, u); - } + if (u->cache_status == NGX_HTTP_CACHE_EXPIRED + && (u->conf->cache_use_stale & ft_type)) + { + ngx_int_t rc; - ngx_http_upstream_finalize_request(r, u, rc); - return; + rc = u->reinit_request(r); + + if (rc == NGX_OK) { + u->cache_status = NGX_HTTP_CACHE_STALE; + rc = ngx_http_upstream_cache_send(r, u); } -#endif - ngx_http_upstream_finalize_request(r, u, status); + ngx_http_upstream_finalize_request(r, u, rc); return; } +#endif + + ngx_http_upstream_finalize_request(r, u, status); + return; } if (u->peer.connection) { @@ -4068,7 +4187,8 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r, if (!u->header_sent || rc == NGX_HTTP_REQUEST_TIME_OUT - || rc == NGX_HTTP_CLIENT_CLOSED_REQUEST) + || rc == NGX_HTTP_CLIENT_CLOSED_REQUEST + || (u->pipe && u->pipe->downstream_error)) { ngx_http_finalize_request(r, rc); return; @@ -4207,10 +4327,10 @@ ngx_http_upstream_process_cache_control(ngx_http_request_t *r, pa = &u->headers_in.cache_control; if (pa->elts == NULL) { - if (ngx_array_init(pa, r->pool, 2, sizeof(ngx_table_elt_t *)) != NGX_OK) - { - return NGX_ERROR; - } + if (ngx_array_init(pa, r->pool, 2, sizeof(ngx_table_elt_t *)) != NGX_OK) + { + return NGX_ERROR; + } } ph = ngx_array_push(pa); Renamed: vendor/nginx-1.9.15/src/http/ngx_http_upstream.h (+2 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_upstream.h 2016-04-20 22:22:29 +0900 (4246c8a) +++ vendor/nginx-1.9.15/src/http/ngx_http_upstream.h 2016-04-21 23:49:50 +0900 (7595dcf) @@ -29,6 +29,7 @@ #define NGX_HTTP_UPSTREAM_FT_UPDATING 0x00000400 #define NGX_HTTP_UPSTREAM_FT_BUSY_LOCK 0x00000800 #define NGX_HTTP_UPSTREAM_FT_MAX_WAITING 0x00001000 +#define NGX_HTTP_UPSTREAM_FT_NON_IDEMPOTENT 0x00002000 #define NGX_HTTP_UPSTREAM_FT_NOLIVE 0x40000000 #define NGX_HTTP_UPSTREAM_FT_OFF 0x80000000 @@ -281,7 +282,7 @@ typedef struct { ngx_uint_t no_port; /* unsigned no_port:1 */ ngx_uint_t naddrs; - ngx_addr_t *addrs; + ngx_resolver_addr_t *addrs; struct sockaddr *sockaddr; socklen_t socklen; Renamed: vendor/nginx-1.9.15/src/http/ngx_http_upstream_round_robin.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_upstream_round_robin.c 2016-04-20 22:22:29 +0900 (d6ae33b) +++ vendor/nginx-1.9.15/src/http/ngx_http_upstream_round_robin.c 2016-04-21 23:49:50 +0900 (8342dc8) @@ -480,7 +480,7 @@ failed: / (8 * sizeof(uintptr_t)); for (i = 0; i < n; i++) { - rrp->tried[i] = 0; + rrp->tried[i] = 0; } ngx_http_upstream_rr_peers_unlock(peers); Renamed: vendor/nginx-1.9.15/src/http/ngx_http_upstream_round_robin.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/ngx_http_variables.c (+2 -3) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_variables.c 2016-04-20 22:22:29 +0900 (eaf294a) +++ vendor/nginx-1.9.15/src/http/ngx_http_variables.c 2016-04-21 23:49:50 +0900 (f8271ab) @@ -2428,9 +2428,8 @@ ngx_http_regex_exec(ngx_http_request_t *r, ngx_http_regex_t *re, ngx_str_t *s) v = cmcf->variables.elts; - ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http regex set $%V to \"%*s\"", - &v[index].name, vv->len, vv->data); + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http regex set $%V to \"%v\"", &v[index].name, vv); } #endif } Renamed: vendor/nginx-1.9.15/src/http/ngx_http_variables.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/ngx_http_write_filter_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/ngx_http_write_filter_module.c 2016-04-20 22:22:29 +0900 (c164440) +++ vendor/nginx-1.9.15/src/http/ngx_http_write_filter_module.c 2016-04-21 23:49:50 +0900 (0036231) @@ -174,7 +174,7 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in) *ll = NULL; ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0, - "http write filter: l:%d f:%d s:%O", last, flush, size); + "http write filter: l:%ui f:%ui s:%O", last, flush, size); clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); Renamed: vendor/nginx-1.9.15/src/http/v2/ngx_http_v2.c (+438 -274) 90% =================================================================== --- vendor/nginx-1.9.12/src/http/v2/ngx_http_v2.c 2016-04-20 22:22:29 +0900 (4c4a4e7) +++ vendor/nginx-1.9.15/src/http/v2/ngx_http_v2.c 2016-04-21 23:49:50 +0900 (278c9ab) @@ -51,6 +51,8 @@ #define NGX_HTTP_V2_MAX_WINDOW ((1U << 31) - 1) #define NGX_HTTP_V2_DEFAULT_WINDOW 65535 +#define NGX_HTTP_V2_INITIAL_WINDOW 0 + #define NGX_HTTP_V2_ROOT (void *) -1 @@ -163,7 +165,9 @@ static ngx_int_t ngx_http_v2_cookie(ngx_http_request_t *r, ngx_http_v2_header_t *header); static ngx_int_t ngx_http_v2_construct_cookie_header(ngx_http_request_t *r); static void ngx_http_v2_run_request(ngx_http_request_t *r); -static ngx_int_t ngx_http_v2_init_request_body(ngx_http_request_t *r); +static ngx_int_t ngx_http_v2_process_request_body(ngx_http_request_t *r, + u_char *pos, size_t size, ngx_uint_t last); +static ngx_int_t ngx_http_v2_filter_request_body(ngx_http_request_t *r); static void ngx_http_v2_read_client_request_body_handler(ngx_http_request_t *r); static ngx_int_t ngx_http_v2_terminate_stream(ngx_http_v2_connection_t *h2c, @@ -762,8 +766,7 @@ ngx_http_v2_state_data(ngx_http_v2_connection_t *h2c, u_char *pos, u_char *end) if (h2c->state.length == 0) { ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, "client sent padded DATA frame " - "with incorrect length: %uz", - h2c->state.length); + "with incorrect length: 0"); return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_SIZE_ERROR); } @@ -845,8 +848,9 @@ ngx_http_v2_state_data(ngx_http_v2_connection_t *h2c, u_char *pos, u_char *end) stream->recv_window -= h2c->state.length; - if (stream->recv_window < NGX_HTTP_V2_MAX_WINDOW / 4) { - + if (stream->no_flow_control + && stream->recv_window < NGX_HTTP_V2_MAX_WINDOW / 4) + { if (ngx_http_v2_send_window_update(h2c, node->id, NGX_HTTP_V2_MAX_WINDOW - stream->recv_window) @@ -875,6 +879,8 @@ ngx_http_v2_state_data(ngx_http_v2_connection_t *h2c, u_char *pos, u_char *end) return ngx_http_v2_state_skip_padded(h2c, pos, end); } + stream->in_closed = h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG; + h2c->state.stream = stream; return ngx_http_v2_state_read_data(h2c, pos, end); @@ -885,16 +891,10 @@ static u_char * ngx_http_v2_state_read_data(ngx_http_v2_connection_t *h2c, u_char *pos, u_char *end) { - size_t size; - ssize_t n; - ngx_buf_t *buf; - ngx_int_t rc; - ngx_temp_file_t *tf; - ngx_connection_t *fc; - ngx_http_request_t *r; - ngx_http_v2_stream_t *stream; - ngx_http_request_body_t *rb; - ngx_http_core_loc_conf_t *clcf; + size_t size; + ngx_int_t rc; + ngx_uint_t last; + ngx_http_v2_stream_t *stream; stream = h2c->state.stream; @@ -903,168 +903,42 @@ ngx_http_v2_state_read_data(ngx_http_v2_connection_t *h2c, u_char *pos, } if (stream->skip_data) { - stream->in_closed = h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG; - - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, - "skipping http2 DATA frame, reason: %d", - stream->skip_data); + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, + "skipping http2 DATA frame"); return ngx_http_v2_state_skip_padded(h2c, pos, end); } size = end - pos; - if (size > h2c->state.length) { + if (size >= h2c->state.length) { size = h2c->state.length; - } - - r = stream->request; + last = stream->in_closed; - if (r->request_body == NULL - && ngx_http_v2_init_request_body(r) != NGX_OK) - { - stream->skip_data = NGX_HTTP_V2_DATA_INTERNAL_ERROR; - return ngx_http_v2_state_skip_padded(h2c, pos, end); + } else { + last = 0; } - fc = r->connection; - rb = r->request_body; - tf = rb->temp_file; - buf = rb->buf; - - if (size) { - rb->rest += size; - - if (r->headers_in.content_length_n != -1 - && r->headers_in.content_length_n < rb->rest) - { - ngx_log_error(NGX_LOG_INFO, fc->log, 0, - "client intended to send body data " - "larger than declared"); - - stream->skip_data = NGX_HTTP_V2_DATA_ERROR; - goto error; - - } else { - clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - - if (clcf->client_max_body_size - && clcf->client_max_body_size < rb->rest) - { - ngx_log_error(NGX_LOG_ERR, fc->log, 0, - "client intended to send " - "too large chunked body: %O bytes", rb->rest); - - stream->skip_data = NGX_HTTP_V2_DATA_ERROR; - goto error; - } - } - - h2c->state.length -= size; - - if (tf) { - buf->start = pos; - buf->pos = pos; - - pos += size; - - buf->end = pos; - buf->last = pos; + rc = ngx_http_v2_process_request_body(stream->request, pos, size, last); - n = ngx_write_chain_to_temp_file(tf, rb->bufs); - - /* TODO: n == 0 or not complete and level event */ - - if (n == NGX_ERROR) { - stream->skip_data = NGX_HTTP_V2_DATA_INTERNAL_ERROR; - goto error; - } - - tf->offset += n; - - } else { - buf->last = ngx_cpymem(buf->last, pos, size); - pos += size; - } - - r->request_length += size; + if (rc != NGX_OK) { + stream->skip_data = 1; + ngx_http_finalize_request(stream->request, rc); } - if (h2c->state.length) { - if (rb->post_handler) { - clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - ngx_add_timer(fc->read, clcf->client_body_timeout); - } + pos += size; + h2c->state.length -= size; + if (h2c->state.length) { return ngx_http_v2_state_save(h2c, pos, end, ngx_http_v2_state_read_data); } - if (h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG) { - stream->in_closed = 1; - - if (r->headers_in.content_length_n < 0) { - r->headers_in.content_length_n = rb->rest; - - } else if (r->headers_in.content_length_n != rb->rest) { - ngx_log_error(NGX_LOG_INFO, fc->log, 0, - "client prematurely closed stream: " - "only %O out of %O bytes of request body received", - rb->rest, r->headers_in.content_length_n); - - stream->skip_data = NGX_HTTP_V2_DATA_ERROR; - goto error; - } - - if (tf) { - ngx_memzero(buf, sizeof(ngx_buf_t)); - - buf->in_file = 1; - buf->file_last = tf->file.offset; - buf->file = &tf->file; - - rb->buf = NULL; - } - - if (rb->post_handler) { - if (fc->read->timer_set) { - ngx_del_timer(fc->read); - } - - r->read_event_handler = ngx_http_block_reading; - rb->post_handler(r); - } - - } else if (rb->post_handler) { - clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - ngx_add_timer(fc->read, clcf->client_body_timeout); - } - if (h2c->state.padding) { return ngx_http_v2_state_skip_padded(h2c, pos, end); } return ngx_http_v2_state_complete(h2c, pos, end); - -error: - - if (rb->post_handler) { - if (fc->read->timer_set) { - ngx_del_timer(fc->read); - } - - if (stream->skip_data == NGX_HTTP_V2_DATA_ERROR) { - rc = (r->headers_in.content_length_n == -1) - ? NGX_HTTP_REQUEST_ENTITY_TOO_LARGE : NGX_HTTP_BAD_REQUEST; - - } else { - rc = NGX_HTTP_INTERNAL_SERVER_ERROR; - } - - ngx_http_finalize_request(r, rc); - } - - return ngx_http_v2_state_skip_padded(h2c, pos, end); } @@ -1074,6 +948,7 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos, { size_t size; ngx_uint_t padded, priority, depend, dependency, excl, weight; + ngx_uint_t status; ngx_http_v2_node_t *node; ngx_http_v2_stream_t *stream; ngx_http_v2_srv_conf_t *h2scf; @@ -1166,15 +1041,8 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos, "client sent HEADERS frame for stream %ui " "with incorrect dependency", h2c->state.sid); - if (ngx_http_v2_send_rst_stream(h2c, h2c->state.sid, - NGX_HTTP_V2_PROTOCOL_ERROR) - != NGX_OK) - { - return ngx_http_v2_connection_error(h2c, - NGX_HTTP_V2_INTERNAL_ERROR); - } - - return ngx_http_v2_state_header_block(h2c, pos, end); + status = NGX_HTTP_V2_PROTOCOL_ERROR; + goto rst_stream; } h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx, @@ -1186,15 +1054,18 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos, ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, "concurrent streams exceeded %ui", h2c->processing); - if (ngx_http_v2_send_rst_stream(h2c, h2c->state.sid, - NGX_HTTP_V2_REFUSED_STREAM) - != NGX_OK) - { - return ngx_http_v2_connection_error(h2c, - NGX_HTTP_V2_INTERNAL_ERROR); - } + status = NGX_HTTP_V2_REFUSED_STREAM; + goto rst_stream; + } + + if (!h2c->settings_ack && !(h2c->state.flags & NGX_HTTP_V2_END_STREAM_FLAG)) + { + ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0, + "client sent stream with data " + "before settings were acknowledged"); - return ngx_http_v2_state_header_block(h2c, pos, end); + status = NGX_HTTP_V2_REFUSED_STREAM; + goto rst_stream; } node = ngx_http_v2_get_node_by_id(h2c, h2c->state.sid, 1); @@ -1231,6 +1102,14 @@ ngx_http_v2_state_headers(ngx_http_v2_connection_t *h2c, u_char *pos, } return ngx_http_v2_state_header_block(h2c, pos, end); + +rst_stream: + + if (ngx_http_v2_send_rst_stream(h2c, h2c->state.sid, status) != NGX_OK) { + return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_INTERNAL_ERROR); + } + + return ngx_http_v2_state_header_block(h2c, pos, end); } @@ -2009,7 +1888,7 @@ ngx_http_v2_state_settings(ngx_http_v2_connection_t *h2c, u_char *pos, return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_SIZE_ERROR); } - /* TODO settings acknowledged */ + h2c->settings_ack = 1; return ngx_http_v2_state_complete(h2c, pos, end); } @@ -2124,7 +2003,7 @@ ngx_http_v2_state_ping(ngx_http_v2_connection_t *h2c, u_char *pos, u_char *end) } ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, - "http2 PING frame, flags: %ui", h2c->state.flags); + "http2 PING frame, flags: %ud", h2c->state.flags); if (h2c->state.flags & NGX_HTTP_V2_ACK_FLAG) { return ngx_http_v2_state_skip(h2c, pos, end); @@ -2503,8 +2382,8 @@ ngx_http_v2_send_settings(ngx_http_v2_connection_t *h2c, ngx_uint_t ack) ngx_http_v2_srv_conf_t *h2scf; ngx_http_v2_out_frame_t *frame; - ngx_log_debug0(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, - "http2 send SETTINGS frame"); + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, + "http2 send SETTINGS frame ack:%ui", ack); frame = ngx_palloc(h2c->pool, sizeof(ngx_http_v2_out_frame_t)); if (frame == NULL) { @@ -2556,7 +2435,7 @@ ngx_http_v2_send_settings(ngx_http_v2_connection_t *h2c, ngx_uint_t ack) buf->last = ngx_http_v2_write_uint16(buf->last, NGX_HTTP_V2_INIT_WINDOW_SIZE_SETTING); buf->last = ngx_http_v2_write_uint32(buf->last, - NGX_HTTP_V2_MAX_WINDOW); + NGX_HTTP_V2_INITIAL_WINDOW); buf->last = ngx_http_v2_write_uint16(buf->last, NGX_HTTP_V2_MAX_FRAME_SIZE_SETTING); @@ -2595,6 +2474,10 @@ ngx_http_v2_send_window_update(ngx_http_v2_connection_t *h2c, ngx_uint_t sid, ngx_buf_t *buf; ngx_http_v2_out_frame_t *frame; + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, + "http2 send WINDOW_UPDATE frame sid:%ui, window:%uz", + sid, window); + frame = ngx_http_v2_get_frame(h2c, NGX_HTTP_V2_WINDOW_UPDATE_SIZE, NGX_HTTP_V2_WINDOW_UPDATE_FRAME, NGX_HTTP_V2_NO_FLAG, sid); @@ -2619,6 +2502,10 @@ ngx_http_v2_send_rst_stream(ngx_http_v2_connection_t *h2c, ngx_uint_t sid, ngx_buf_t *buf; ngx_http_v2_out_frame_t *frame; + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, + "http2 send RST_STREAM frame sid:%ui, status:%uz", + sid, status); + frame = ngx_http_v2_get_frame(h2c, NGX_HTTP_V2_RST_STREAM_SIZE, NGX_HTTP_V2_RST_STREAM_FRAME, NGX_HTTP_V2_NO_FLAG, sid); @@ -2642,6 +2529,9 @@ ngx_http_v2_send_goaway(ngx_http_v2_connection_t *h2c, ngx_uint_t status) ngx_buf_t *buf; ngx_http_v2_out_frame_t *frame; + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0, + "http2 send GOAWAY frame, status:%uz", status); + frame = ngx_http_v2_get_frame(h2c, NGX_HTTP_V2_GOAWAY_SIZE, NGX_HTTP_V2_GOAWAY_FRAME, NGX_HTTP_V2_NO_FLAG, 0); @@ -2867,7 +2757,7 @@ ngx_http_v2_create_stream(ngx_http_v2_connection_t *h2c) stream->connection = h2c; stream->send_window = h2c->init_window; - stream->recv_window = NGX_HTTP_V2_MAX_WINDOW; + stream->recv_window = NGX_HTTP_V2_INITIAL_WINDOW; h2c->processing++; @@ -3504,152 +3394,309 @@ ngx_http_v2_run_request(ngx_http_request_t *r) ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, "client prematurely closed stream"); - r->stream->skip_data = NGX_HTTP_V2_DATA_ERROR; + r->stream->skip_data = 1; ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); return; } + r->headers_in.chunked = (r->headers_in.content_length_n == -1); + ngx_http_process_request(r); } -static ngx_int_t -ngx_http_v2_init_request_body(ngx_http_request_t *r) +ngx_int_t +ngx_http_v2_read_request_body(ngx_http_request_t *r, + ngx_http_client_body_handler_pt post_handler) { - ngx_buf_t *buf; - ngx_temp_file_t *tf; + off_t len; + ngx_http_v2_stream_t *stream; ngx_http_request_body_t *rb; ngx_http_core_loc_conf_t *clcf; + ngx_http_v2_connection_t *h2c; + + stream = r->stream; + + if (stream->skip_data) { + r->request_body_no_buffering = 0; + post_handler(r); + return NGX_OK; + } rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t)); if (rb == NULL) { - return NGX_ERROR; + return NGX_HTTP_INTERNAL_SERVER_ERROR; } - r->request_body = rb; + /* + * set by ngx_pcalloc(): + * + * rb->bufs = NULL; + * rb->buf = NULL; + * rb->received = 0; + * rb->free = NULL; + * rb->busy = NULL; + */ - if (r->stream->in_closed) { - return NGX_OK; - } + rb->rest = 1; + rb->post_handler = post_handler; - rb->rest = r->headers_in.content_length_n; + r->request_body = rb; clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - if (r->request_body_in_file_only - || rb->rest > (off_t) clcf->client_body_buffer_size - || rb->rest < 0) - { - tf = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)); - if (tf == NULL) { - return NGX_ERROR; + len = r->headers_in.content_length_n; + + if (r->request_body_no_buffering && !stream->in_closed) { + r->request_body_in_file_only = 0; + + if (len < 0 || len > (off_t) clcf->client_body_buffer_size) { + len = clcf->client_body_buffer_size; } - tf->file.fd = NGX_INVALID_FILE; - tf->file.log = r->connection->log; - tf->path = clcf->client_body_temp_path; - tf->pool = r->pool; - tf->warn = "a client request body is buffered to a temporary file"; - tf->log_level = r->request_body_file_log_level; - tf->persistent = r->request_body_in_persistent_file; - tf->clean = r->request_body_in_clean_file; - - if (r->request_body_file_group_access) { - tf->access = 0660; + if (len > NGX_HTTP_V2_MAX_WINDOW) { + len = NGX_HTTP_V2_MAX_WINDOW; } + } + + if (len >= 0 && len <= (off_t) clcf->client_body_buffer_size + && !r->request_body_in_file_only) + { + rb->buf = ngx_create_temp_buf(r->pool, (size_t) len); + + } else { + rb->buf = ngx_calloc_buf(r->pool); + + if (rb->buf != NULL) { + rb->buf->sync = 1; + } + } + + if (rb->buf == NULL) { + stream->skip_data = 1; + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } - rb->temp_file = tf; + if (stream->in_closed) { + r->request_body_no_buffering = 0; + return ngx_http_v2_process_request_body(r, NULL, 0, 1); + } + + if (len) { + if (r->request_body_no_buffering) { + stream->recv_window = (size_t) len; + + } else { + stream->no_flow_control = 1; + stream->recv_window = NGX_HTTP_V2_MAX_WINDOW; + } - if (r->stream->in_closed - && ngx_create_temp_file(&tf->file, tf->path, tf->pool, - tf->persistent, tf->clean, tf->access) - != NGX_OK) + if (ngx_http_v2_send_window_update(stream->connection, stream->node->id, + stream->recv_window) + == NGX_ERROR) { - return NGX_ERROR; + stream->skip_data = 1; + return NGX_HTTP_INTERNAL_SERVER_ERROR; } - buf = ngx_calloc_buf(r->pool); - if (buf == NULL) { - return NGX_ERROR; + h2c = stream->connection; + + if (!h2c->blocked) { + if (ngx_http_v2_send_output_queue(h2c) == NGX_ERROR) { + stream->skip_data = 1; + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } } + } - } else { + ngx_add_timer(r->connection->read, clcf->client_body_timeout); + + r->read_event_handler = ngx_http_v2_read_client_request_body_handler; + r->write_event_handler = ngx_http_request_empty_handler; - if (rb->rest == 0) { + return NGX_AGAIN; +} + + +static ngx_int_t +ngx_http_v2_process_request_body(ngx_http_request_t *r, u_char *pos, + size_t size, ngx_uint_t last) +{ + ngx_buf_t *buf; + ngx_int_t rc; + ngx_connection_t *fc; + ngx_http_request_body_t *rb; + ngx_http_core_loc_conf_t *clcf; + + rb = r->request_body; + + if (rb == NULL) { + return NGX_OK; + } + + fc = r->connection; + buf = rb->buf; + + if (size) { + if (buf->sync) { + buf->pos = buf->start = pos; + buf->last = buf->end = pos + size; + + } else { + if (size > (size_t) (buf->end - buf->last)) { + ngx_log_error(NGX_LOG_INFO, fc->log, 0, + "client intended to send body data " + "larger than declared"); + + return NGX_HTTP_BAD_REQUEST; + } + + buf->last = ngx_cpymem(buf->last, pos, size); + } + } + + if (last) { + rb->rest = 0; + + if (fc->read->timer_set) { + ngx_del_timer(fc->read); + } + + if (r->request_body_no_buffering) { + ngx_post_event(fc->read, &ngx_posted_events); return NGX_OK; } - buf = ngx_create_temp_buf(r->pool, (size_t) rb->rest); - if (buf == NULL) { - return NGX_ERROR; + rc = ngx_http_v2_filter_request_body(r); + + if (rc != NGX_OK) { + return rc; } - } - rb->buf = buf; + if (buf->sync) { + /* prevent reusing this buffer in the upstream module */ + rb->buf = NULL; + } - rb->bufs = ngx_alloc_chain_link(r->pool); - if (rb->bufs == NULL) { - return NGX_ERROR; + if (r->headers_in.content_length_n == -1) { + r->headers_in.content_length_n = rb->received; + } + + r->read_event_handler = ngx_http_block_reading; + rb->post_handler(r); + + return NGX_OK; + } + + if (size == 0) { + return NGX_OK; } - rb->bufs->buf = buf; - rb->bufs->next = NULL; + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + ngx_add_timer(fc->read, clcf->client_body_timeout); + + if (r->request_body_no_buffering) { + ngx_post_event(fc->read, &ngx_posted_events); + return NGX_OK; + } - rb->rest = 0; + if (buf->sync) { + return ngx_http_v2_filter_request_body(r); + } return NGX_OK; } -ngx_int_t -ngx_http_v2_read_request_body(ngx_http_request_t *r, - ngx_http_client_body_handler_pt post_handler) +static ngx_int_t +ngx_http_v2_filter_request_body(ngx_http_request_t *r) { - ngx_http_v2_stream_t *stream; + ngx_buf_t *b, *buf; + ngx_int_t rc; + ngx_chain_t *cl; + ngx_http_request_body_t *rb; ngx_http_core_loc_conf_t *clcf; - ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http2 read request body"); + rb = r->request_body; + buf = rb->buf; - stream = r->stream; + if (buf->pos == buf->last && rb->rest) { + cl = NULL; + goto update; + } - switch (stream->skip_data) { + cl = ngx_chain_get_free_buf(r->pool, &rb->free); + if (cl == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } - case NGX_HTTP_V2_DATA_DISCARD: - post_handler(r); - return NGX_OK; + b = cl->buf; + + ngx_memzero(b, sizeof(ngx_buf_t)); + + if (buf->pos != buf->last) { + r->request_length += buf->last - buf->pos; + rb->received += buf->last - buf->pos; + + if (r->headers_in.content_length_n != -1) { + if (rb->received > r->headers_in.content_length_n) { + ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, + "client intended to send body data " + "larger than declared"); + + return NGX_HTTP_BAD_REQUEST; + } - case NGX_HTTP_V2_DATA_ERROR: - if (r->headers_in.content_length_n == -1) { - return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE; } else { - return NGX_HTTP_BAD_REQUEST; + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + + if (clcf->client_max_body_size + && rb->received > clcf->client_max_body_size) + { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "client intended to send too large chunked body: " + "%O bytes", rb->received); + + return NGX_HTTP_REQUEST_ENTITY_TOO_LARGE; + } } - case NGX_HTTP_V2_DATA_INTERNAL_ERROR: - return NGX_HTTP_INTERNAL_SERVER_ERROR; - } + b->temporary = 1; + b->pos = buf->pos; + b->last = buf->last; + b->start = b->pos; + b->end = b->last; - if (!r->request_body && ngx_http_v2_init_request_body(r) != NGX_OK) { - stream->skip_data = NGX_HTTP_V2_DATA_INTERNAL_ERROR; - return NGX_HTTP_INTERNAL_SERVER_ERROR; + buf->pos = buf->last; } - if (stream->in_closed) { - post_handler(r); - return NGX_OK; + if (!rb->rest) { + if (r->headers_in.content_length_n != -1 + && r->headers_in.content_length_n != rb->received) + { + ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, + "client prematurely closed stream: " + "only %O out of %O bytes of request body received", + rb->received, r->headers_in.content_length_n); + + return NGX_HTTP_BAD_REQUEST; + } + + b->last_buf = 1; } - r->request_body->post_handler = post_handler; + b->tag = (ngx_buf_tag_t) &ngx_http_v2_filter_request_body; + b->flush = r->request_body_no_buffering; - r->read_event_handler = ngx_http_v2_read_client_request_body_handler; - r->write_event_handler = ngx_http_request_empty_handler; +update: - clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); - ngx_add_timer(r->connection->read, clcf->client_body_timeout); + rc = ngx_http_top_request_body_filter(r, cl); - return NGX_AGAIN; + ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &cl, + (ngx_buf_tag_t) &ngx_http_v2_filter_request_body); + + return rc; } @@ -3667,7 +3714,7 @@ ngx_http_v2_read_client_request_body_handler(ngx_http_request_t *r) ngx_log_error(NGX_LOG_INFO, fc->log, NGX_ETIMEDOUT, "client timed out"); fc->timedout = 1; - r->stream->skip_data = NGX_HTTP_V2_DATA_DISCARD; + r->stream->skip_data = 1; ngx_http_finalize_request(r, NGX_HTTP_REQUEST_TIME_OUT); return; @@ -3677,7 +3724,7 @@ ngx_http_v2_read_client_request_body_handler(ngx_http_request_t *r) ngx_log_error(NGX_LOG_INFO, fc->log, 0, "client prematurely closed stream"); - r->stream->skip_data = NGX_HTTP_V2_DATA_DISCARD; + r->stream->skip_data = 1; ngx_http_finalize_request(r, NGX_HTTP_CLIENT_CLOSED_REQUEST); return; @@ -3685,6 +3732,91 @@ ngx_http_v2_read_client_request_body_handler(ngx_http_request_t *r) } +ngx_int_t +ngx_http_v2_read_unbuffered_request_body(ngx_http_request_t *r) +{ + size_t window; + ngx_buf_t *buf; + ngx_int_t rc; + ngx_connection_t *fc; + ngx_http_v2_stream_t *stream; + ngx_http_v2_connection_t *h2c; + ngx_http_core_loc_conf_t *clcf; + + stream = r->stream; + fc = r->connection; + + if (fc->read->timedout) { + if (stream->recv_window) { + stream->skip_data = 1; + fc->timedout = 1; + + return NGX_HTTP_REQUEST_TIME_OUT; + } + + fc->read->timedout = 0; + } + + if (fc->error) { + stream->skip_data = 1; + return NGX_HTTP_BAD_REQUEST; + } + + rc = ngx_http_v2_filter_request_body(r); + + if (rc != NGX_OK) { + stream->skip_data = 1; + return rc; + } + + if (!r->request_body->rest) { + return NGX_OK; + } + + if (r->request_body->busy != NULL) { + return NGX_AGAIN; + } + + buf = r->request_body->buf; + + buf->pos = buf->start; + buf->last = buf->start; + + window = buf->end - buf->start; + h2c = stream->connection; + + if (h2c->state.stream == stream) { + window -= h2c->state.length; + } + + if (window == stream->recv_window) { + return NGX_AGAIN; + } + + if (ngx_http_v2_send_window_update(h2c, stream->node->id, + window - stream->recv_window) + == NGX_ERROR) + { + stream->skip_data = 1; + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + if (ngx_http_v2_send_output_queue(h2c) == NGX_ERROR) { + stream->skip_data = 1; + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + if (stream->recv_window == 0) { + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + ngx_add_timer(fc->read, clcf->client_body_timeout); + } + + stream->recv_window = window; + + return NGX_AGAIN; +} + + static ngx_int_t ngx_http_v2_terminate_stream(ngx_http_v2_connection_t *h2c, ngx_http_v2_stream_t *stream, ngx_uint_t status) @@ -3698,7 +3830,7 @@ ngx_http_v2_terminate_stream(ngx_http_v2_connection_t *h2c, return NGX_ERROR; } - stream->out_closed = 1; + stream->rst_sent = 1; fc = stream->request->connection; fc->error = 1; @@ -3733,13 +3865,45 @@ ngx_http_v2_close_stream(ngx_http_v2_stream_t *stream, ngx_int_t rc) return; } - if (!stream->out_closed) { - if (ngx_http_v2_send_rst_stream(h2c, node->id, - fc->timedout ? NGX_HTTP_V2_PROTOCOL_ERROR - : NGX_HTTP_V2_INTERNAL_ERROR) - != NGX_OK) - { - h2c->connection->error = 1; + if (!stream->rst_sent && !h2c->connection->error) { + + if (!stream->out_closed) { + if (ngx_http_v2_send_rst_stream(h2c, node->id, + fc->timedout ? NGX_HTTP_V2_PROTOCOL_ERROR + : NGX_HTTP_V2_INTERNAL_ERROR) + != NGX_OK) + { + h2c->connection->error = 1; + } + + } else if (!stream->in_closed) { +#if 0 + if (ngx_http_v2_send_rst_stream(h2c, node->id, NGX_HTTP_V2_NO_ERROR) + != NGX_OK) + { + h2c->connection->error = 1; + } +#else + /* + * At the time of writing at least the latest versions of Chrome + * do not properly handle RST_STREAM with NO_ERROR status. + * + * See: https://bugs.chromium.org/p/chromium/issues/detail?id=603182 + * + * As a workaround, the stream window is maximized before closing + * the stream. This allows a client to send up to 2 GB of data + * before getting blocked on flow control. + */ + + if (stream->recv_window < NGX_HTTP_V2_MAX_WINDOW + && ngx_http_v2_send_window_update(h2c, node->id, + NGX_HTTP_V2_MAX_WINDOW + - stream->recv_window) + != NGX_OK) + { + h2c->connection->error = 1; + } +#endif } } @@ -3931,23 +4095,23 @@ ngx_http_v2_finalize_connection(ngx_http_v2_connection_t *h2c, c = h2c->connection; - if (h2c->state.stream) { - h2c->state.stream->out_closed = 1; - ngx_http_v2_close_stream(h2c->state.stream, NGX_HTTP_BAD_REQUEST); - } - h2c->blocked = 1; if (!c->error && ngx_http_v2_send_goaway(h2c, status) != NGX_ERROR) { (void) ngx_http_v2_send_output_queue(h2c); } + c->error = 1; + + if (h2c->state.stream) { + ngx_http_v2_close_stream(h2c->state.stream, NGX_HTTP_BAD_REQUEST); + } + if (!h2c->processing) { ngx_http_close_connection(c); return; } - c->error = 1; c->read->handler = ngx_http_empty_handler; c->write->handler = ngx_http_empty_handler; Renamed: vendor/nginx-1.9.15/src/http/v2/ngx_http_v2.h (+5 -5) 97% =================================================================== --- vendor/nginx-1.9.12/src/http/v2/ngx_http_v2.h 2016-04-20 22:22:29 +0900 (5a791e6) +++ vendor/nginx-1.9.15/src/http/v2/ngx_http_v2.h 2016-04-21 23:49:50 +0900 (1adf8de) @@ -24,10 +24,6 @@ #define NGX_HTTP_V2_MAX_FIELD \ (127 + (1 << (NGX_HTTP_V2_INT_OCTETS - 1) * 7) - 1) -#define NGX_HTTP_V2_DATA_DISCARD 1 -#define NGX_HTTP_V2_DATA_ERROR 2 -#define NGX_HTTP_V2_DATA_INTERNAL_ERROR 3 - #define NGX_HTTP_V2_FRAME_HEADER_SIZE 9 /* frame types */ @@ -145,6 +141,7 @@ struct ngx_http_v2_connection_s { ngx_uint_t last_sid; unsigned closed_nodes:8; + unsigned settings_ack:1; unsigned blocked:1; }; @@ -194,7 +191,9 @@ struct ngx_http_v2_stream_s { unsigned exhausted:1; unsigned in_closed:1; unsigned out_closed:1; - unsigned skip_data:2; + unsigned rst_sent:1; + unsigned no_flow_control:1; + unsigned skip_data:1; }; @@ -262,6 +261,7 @@ void ngx_http_v2_request_headers_init(void); ngx_int_t ngx_http_v2_read_request_body(ngx_http_request_t *r, ngx_http_client_body_handler_pt post_handler); +ngx_int_t ngx_http_v2_read_unbuffered_request_body(ngx_http_request_t *r); void ngx_http_v2_close_stream(ngx_http_v2_stream_t *stream, ngx_int_t rc); Renamed: vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_huff_decode.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_huff_encode.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/http/v2/ngx_http_v2_module.c 2016-04-20 22:22:29 +0900 (d99ac30) +++ vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_module.c 2016-04-21 23:49:50 +0900 (5a4561c) @@ -215,7 +215,7 @@ static ngx_http_variable_t ngx_http_v2_vars[] = { static ngx_int_t ngx_http_v2_add_variables(ngx_conf_t *cf) { - ngx_http_variable_t *var, *v; + ngx_http_variable_t *var, *v; for (v = ngx_http_v2_vars; v->name.len; v++) { var = ngx_http_add_variable(cf, &v->name, v->flags); Renamed: vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/http/v2/ngx_http_v2_table.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail.h (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/mail/ngx_mail.h 2016-04-20 22:22:29 +0900 (07d0cb6) +++ vendor/nginx-1.9.15/src/mail/ngx_mail.h 2016-04-21 23:49:50 +0900 (bfbf768) @@ -342,7 +342,7 @@ typedef struct { void *(*create_srv_conf)(ngx_conf_t *cf); char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, - void *conf); + void *conf); } ngx_mail_module_t; Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_auth_http_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/mail/ngx_mail_auth_http_module.c 2016-04-20 22:22:29 +0900 (d93e946) +++ vendor/nginx-1.9.15/src/mail/ngx_mail_auth_http_module.c 2016-04-21 23:49:50 +0900 (39f9b17) @@ -431,7 +431,7 @@ ngx_mail_auth_http_ignore_status_line(ngx_mail_session_t *s, } ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, - "auth http server &V sent invalid response", + "auth http server %V sent invalid response", ctx->peer.name); ngx_close_connection(ctx->peer.connection); ngx_destroy_pool(ctx->pool); Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_core_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_handler.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_imap_handler.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_imap_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_imap_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_parse.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_pop3_handler.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_pop3_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_pop3_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_proxy_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/mail/ngx_mail_proxy_module.c 2016-04-20 22:22:29 +0900 (3802c3e) +++ vendor/nginx-1.9.15/src/mail/ngx_mail_proxy_module.c 2016-04-21 23:49:50 +0900 (007284b) @@ -935,7 +935,7 @@ ngx_mail_proxy_handler(ngx_event_t *ev) do_write = ev->write ? 1 : 0; ngx_log_debug3(NGX_LOG_DEBUG_MAIL, ev->log, 0, - "mail proxy handler: %d, #%d > #%d", + "mail proxy handler: %ui, #%d > #%d", do_write, src->fd, dst->fd); for ( ;; ) { Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_smtp_handler.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/mail/ngx_mail_smtp_handler.c 2016-04-20 22:22:29 +0900 (46d703e) +++ vendor/nginx-1.9.15/src/mail/ngx_mail_smtp_handler.c 2016-04-21 23:49:50 +0900 (81cc75f) @@ -42,7 +42,7 @@ static u_char smtp_username[] = "334 VXNlcm5hbWU6" CRLF; static u_char smtp_password[] = "334 UGFzc3dvcmQ6" CRLF; static u_char smtp_invalid_command[] = "500 5.5.1 Invalid command" CRLF; static u_char smtp_invalid_pipelining[] = - "503 5.5.0 Improper use of SMTP command pipelining" CRLF; + "503 5.5.0 Improper use of SMTP command pipelining" CRLF; static u_char smtp_invalid_argument[] = "501 5.5.4 Invalid argument" CRLF; static u_char smtp_auth_required[] = "530 5.7.1 Authentication required" CRLF; static u_char smtp_bad_sequence[] = "503 5.5.1 Bad sequence of commands" CRLF; Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_smtp_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_smtp_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_ssl_module.c (+4 -4) 99% =================================================================== --- vendor/nginx-1.9.12/src/mail/ngx_mail_ssl_module.c 2016-04-20 22:22:29 +0900 (1075410) +++ vendor/nginx-1.9.15/src/mail/ngx_mail_ssl_module.c 2016-04-21 23:49:50 +0900 (ff5c141) @@ -312,13 +312,13 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child) conf->ssl.log = cf->log; if (conf->enable) { - mode = "ssl"; + mode = "ssl"; } else if (conf->starttls != NGX_MAIL_STARTTLS_OFF) { - mode = "starttls"; + mode = "starttls"; } else { - mode = ""; + mode = ""; } if (conf->file == NULL) { @@ -421,7 +421,7 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child) SSL_CTX_set_options(conf->ssl.ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); } -#ifndef LIBRESSL_VERSION_NUMBER +#if (OPENSSL_VERSION_NUMBER < 0x10100001L && !defined LIBRESSL_VERSION_NUMBER) SSL_CTX_set_tmp_rsa_callback(conf->ssl.ctx, ngx_ssl_rsa512_key_callback); #endif Renamed: vendor/nginx-1.9.15/src/mail/ngx_mail_ssl_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/misc/ngx_cpp_test_module.cpp (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/misc/ngx_google_perftools_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_alloc.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_alloc.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_atomic.h (+10 -10) 97% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_atomic.h 2016-04-20 22:22:29 +0900 (417cd86) +++ vendor/nginx-1.9.15/src/os/unix/ngx_atomic.h 2016-04-21 23:49:50 +0900 (74b8b7f) @@ -276,26 +276,26 @@ typedef volatile ngx_atomic_uint_t ngx_atomic_t; static ngx_inline ngx_atomic_uint_t ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old, - ngx_atomic_uint_t set) + ngx_atomic_uint_t set) { - if (*lock == old) { - *lock = set; - return 1; - } + if (*lock == old) { + *lock = set; + return 1; + } - return 0; + return 0; } static ngx_inline ngx_atomic_int_t ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add) { - ngx_atomic_int_t old; + ngx_atomic_int_t old; - old = *value; - *value += add; + old = *value; + *value += add; - return old; + return old; } #define ngx_memory_barrier() Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_channel.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_channel.h (+4 -4) 87% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_channel.h 2016-04-20 22:22:29 +0900 (d7a9f6b) +++ vendor/nginx-1.9.15/src/os/unix/ngx_channel.h 2016-04-21 23:49:50 +0900 (362cc64) @@ -15,10 +15,10 @@ typedef struct { - ngx_uint_t command; - ngx_pid_t pid; - ngx_int_t slot; - ngx_fd_t fd; + ngx_uint_t command; + ngx_pid_t pid; + ngx_int_t slot; + ngx_fd_t fd; } ngx_channel_t; Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_daemon.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_darwin.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_darwin_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_darwin_init.c (+1 -0) 99% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_darwin_init.c 2016-04-20 22:22:29 +0900 (1bc7520) +++ vendor/nginx-1.9.15/src/os/unix/ngx_darwin_init.c 2016-04-21 23:49:50 +0900 (a9d12a8) @@ -23,6 +23,7 @@ static ngx_os_io_t ngx_darwin_io = { ngx_readv_chain, ngx_udp_unix_recv, ngx_unix_send, + ngx_udp_unix_send, #if (NGX_HAVE_SENDFILE) ngx_darwin_sendfile_chain, NGX_IO_SENDFILE Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_darwin_sendfile_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_dlopen.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_dlopen.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_errno.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_errno.h (+1 -0) 98% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_errno.h 2016-04-20 22:22:29 +0900 (16cafda) +++ vendor/nginx-1.9.15/src/os/unix/ngx_errno.h 2016-04-21 23:49:50 +0900 (7d6ca76) @@ -25,6 +25,7 @@ typedef int ngx_err_t; #define NGX_EACCES EACCES #define NGX_EBUSY EBUSY #define NGX_EEXIST EEXIST +#define NGX_EEXIST_FILE EEXIST #define NGX_EXDEV EXDEV #define NGX_ENOTDIR ENOTDIR #define NGX_EISDIR EISDIR Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_file_aio_read.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_file_aio_read.c 2016-04-20 22:22:29 +0900 (b11cf8a) +++ vendor/nginx-1.9.15/src/os/unix/ngx_file_aio_read.c 2016-04-21 23:49:50 +0900 (aedc3c9) @@ -84,7 +84,7 @@ ngx_file_aio_read(ngx_file_t *file, u_char *buf, size_t size, off_t offset, } ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0, - "aio complete:%d @%O:%z %V", + "aio complete:%d @%O:%uz %V", ev->complete, offset, size, &file->name); if (ev->complete) { Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_files.c (+217 -69) 70% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_files.c 2016-04-20 22:22:29 +0900 (00a6a49) +++ vendor/nginx-1.9.15/src/os/unix/ngx_files.c 2016-04-21 23:49:50 +0900 (65c79a2) @@ -12,9 +12,11 @@ #if (NGX_THREADS) #include <ngx_thread_pool.h> static void ngx_thread_read_handler(void *data, ngx_log_t *log); +static void ngx_thread_write_chain_to_file_handler(void *data, ngx_log_t *log); #endif -static ssize_t ngx_writev_file(ngx_file_t *file, ngx_array_t *vec, size_t size, +static ngx_chain_t *ngx_chain_to_iovec(ngx_iovec_t *vec, ngx_chain_t *cl); +static ssize_t ngx_writev_file(ngx_file_t *file, ngx_iovec_t *vec, off_t offset); @@ -76,38 +78,39 @@ ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset) #if (NGX_THREADS) typedef struct { - ngx_fd_t fd; - u_char *buf; - size_t size; - off_t offset; + ngx_fd_t fd; + ngx_uint_t write; /* unsigned write:1; */ - size_t read; - ngx_err_t err; -} ngx_thread_read_ctx_t; + u_char *buf; + size_t size; + ngx_chain_t *chain; + off_t offset; + + size_t nbytes; + ngx_err_t err; +} ngx_thread_file_ctx_t; ssize_t -ngx_thread_read(ngx_thread_task_t **taskp, ngx_file_t *file, u_char *buf, - size_t size, off_t offset, ngx_pool_t *pool) +ngx_thread_read(ngx_file_t *file, u_char *buf, size_t size, off_t offset, + ngx_pool_t *pool) { ngx_thread_task_t *task; - ngx_thread_read_ctx_t *ctx; + ngx_thread_file_ctx_t *ctx; ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0, "thread read: %d, %p, %uz, %O", file->fd, buf, size, offset); - task = *taskp; + task = file->thread_task; if (task == NULL) { - task = ngx_thread_task_alloc(pool, sizeof(ngx_thread_read_ctx_t)); + task = ngx_thread_task_alloc(pool, sizeof(ngx_thread_file_ctx_t)); if (task == NULL) { return NGX_ERROR; } - task->handler = ngx_thread_read_handler; - - *taskp = task; + file->thread_task = task; } ctx = task->ctx; @@ -115,15 +118,25 @@ ngx_thread_read(ngx_thread_task_t **taskp, ngx_file_t *file, u_char *buf, if (task->event.complete) { task->event.complete = 0; + if (ctx->write) { + ngx_log_error(NGX_LOG_ALERT, file->log, 0, + "invalid thread call, read instead of write"); + return NGX_ERROR; + } + if (ctx->err) { ngx_log_error(NGX_LOG_CRIT, file->log, ctx->err, "pread() \"%s\" failed", file->name.data); return NGX_ERROR; } - return ctx->read; + return ctx->nbytes; } + task->handler = ngx_thread_read_handler; + + ctx->write = 0; + ctx->fd = file->fd; ctx->buf = buf; ctx->size = size; @@ -142,7 +155,7 @@ ngx_thread_read(ngx_thread_task_t **taskp, ngx_file_t *file, u_char *buf, static void ngx_thread_read_handler(void *data, ngx_log_t *log) { - ngx_thread_read_ctx_t *ctx = data; + ngx_thread_file_ctx_t *ctx = data; ssize_t n; @@ -154,7 +167,7 @@ ngx_thread_read_handler(void *data, ngx_log_t *log) ctx->err = ngx_errno; } else { - ctx->read = n; + ctx->nbytes = n; ctx->err = 0; } @@ -163,7 +176,7 @@ ngx_thread_read_handler(void *data, ngx_log_t *log) #endif ngx_log_debug4(NGX_LOG_DEBUG_CORE, log, 0, - "pread: %z (err: %i) of %uz @%O", + "pread: %z (err: %d) of %uz @%O", n, ctx->err, ctx->size, ctx->offset); } @@ -276,17 +289,13 @@ ngx_open_tempfile(u_char *name, ngx_uint_t persistent, ngx_uint_t access) } -#define NGX_IOVS 8 - ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset, ngx_pool_t *pool) { - u_char *prev; - size_t size; ssize_t total, n; - ngx_array_t vec; - struct iovec *iov, iovs[NGX_IOVS]; + ngx_iovec_t vec; + struct iovec iovs[NGX_IOVS_PREALLOCATE]; /* use pwrite() if there is the only buf in a chain */ @@ -298,46 +307,18 @@ ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset, total = 0; - vec.elts = iovs; - vec.size = sizeof(struct iovec); - vec.nalloc = NGX_IOVS; - vec.pool = pool; + vec.iovs = iovs; + vec.nalloc = NGX_IOVS_PREALLOCATE; do { - prev = NULL; - iov = NULL; - size = 0; - - vec.nelts = 0; - /* create the iovec and coalesce the neighbouring bufs */ - - while (cl && vec.nelts < IOV_MAX) { - if (prev == cl->buf->pos) { - iov->iov_len += cl->buf->last - cl->buf->pos; - - } else { - iov = ngx_array_push(&vec); - if (iov == NULL) { - return NGX_ERROR; - } - - iov->iov_base = (void *) cl->buf->pos; - iov->iov_len = cl->buf->last - cl->buf->pos; - } - - size += cl->buf->last - cl->buf->pos; - prev = cl->buf->last; - cl = cl->next; - } + cl = ngx_chain_to_iovec(&vec, cl); /* use pwrite() if there is the only iovec buffer */ - if (vec.nelts == 1) { - iov = vec.elts; - - n = ngx_write_file(file, (u_char *) iov[0].iov_base, - iov[0].iov_len, offset); + if (vec.count == 1) { + n = ngx_write_file(file, (u_char *) iovs[0].iov_base, + iovs[0].iov_len, offset); if (n == NGX_ERROR) { return n; @@ -346,7 +327,7 @@ ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset, return total + n; } - n = ngx_writev_file(file, &vec, size, offset); + n = ngx_writev_file(file, &vec, offset); if (n == NGX_ERROR) { return n; @@ -361,20 +342,61 @@ ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset, } +static ngx_chain_t * +ngx_chain_to_iovec(ngx_iovec_t *vec, ngx_chain_t *cl) +{ + size_t total, size; + u_char *prev; + ngx_uint_t n; + struct iovec *iov; + + iov = NULL; + prev = NULL; + total = 0; + n = 0; + + for ( /* void */ ; cl; cl = cl->next) { + size = cl->buf->last - cl->buf->pos; + + if (prev == cl->buf->pos) { + iov->iov_len += size; + + } else { + if (n == vec->nalloc) { + break; + } + + iov = &vec->iovs[n++]; + + iov->iov_base = (void *) cl->buf->pos; + iov->iov_len = size; + } + + prev = cl->buf->pos + size; + total += size; + } + + vec->count = n; + vec->size = total; + + return cl; +} + + static ssize_t -ngx_writev_file(ngx_file_t *file, ngx_array_t *vec, size_t size, off_t offset) +ngx_writev_file(ngx_file_t *file, ngx_iovec_t *vec, off_t offset) { ssize_t n; ngx_err_t err; ngx_log_debug3(NGX_LOG_DEBUG_CORE, file->log, 0, - "writev: %d, %uz, %O", file->fd, size, offset); + "writev: %d, %uz, %O", file->fd, vec->size, offset); #if (NGX_HAVE_PWRITEV) eintr: - n = pwritev(file->fd, vec->elts, vec->nelts, offset); + n = pwritev(file->fd, vec->iovs, vec->count, offset); if (n == -1) { err = ngx_errno; @@ -390,10 +412,10 @@ eintr: return NGX_ERROR; } - if ((size_t) n != size) { + if ((size_t) n != vec->size) { ngx_log_error(NGX_LOG_CRIT, file->log, 0, "pwritev() \"%s\" has written only %z of %uz", - file->name.data, n, size); + file->name.data, n, vec->size); return NGX_ERROR; } @@ -411,7 +433,7 @@ eintr: eintr: - n = writev(file->fd, vec->elts, vec->nelts); + n = writev(file->fd, vec->iovs, vec->count); if (n == -1) { err = ngx_errno; @@ -427,10 +449,10 @@ eintr: return NGX_ERROR; } - if ((size_t) n != size) { + if ((size_t) n != vec->size) { ngx_log_error(NGX_LOG_CRIT, file->log, 0, "writev() \"%s\" has written only %z of %uz", - file->name.data, n, size); + file->name.data, n, vec->size); return NGX_ERROR; } @@ -444,6 +466,132 @@ eintr: } +#if (NGX_THREADS) + +ssize_t +ngx_thread_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset, + ngx_pool_t *pool) +{ + ngx_thread_task_t *task; + ngx_thread_file_ctx_t *ctx; + + ngx_log_debug3(NGX_LOG_DEBUG_CORE, file->log, 0, + "thread write chain: %d, %p, %O", + file->fd, cl, offset); + + task = file->thread_task; + + if (task == NULL) { + task = ngx_thread_task_alloc(pool, + sizeof(ngx_thread_file_ctx_t)); + if (task == NULL) { + return NGX_ERROR; + } + + file->thread_task = task; + } + + ctx = task->ctx; + + if (task->event.complete) { + task->event.complete = 0; + + if (!ctx->write) { + ngx_log_error(NGX_LOG_ALERT, file->log, 0, + "invalid thread call, write instead of read"); + return NGX_ERROR; + } + + if (ctx->err || ctx->nbytes == 0) { + ngx_log_error(NGX_LOG_CRIT, file->log, ctx->err, + "pwritev() \"%s\" failed", file->name.data); + return NGX_ERROR; + } + + file->offset += ctx->nbytes; + return ctx->nbytes; + } + + task->handler = ngx_thread_write_chain_to_file_handler; + + ctx->write = 1; + + ctx->fd = file->fd; + ctx->chain = cl; + ctx->offset = offset; + + if (file->thread_handler(task, file) != NGX_OK) { + return NGX_ERROR; + } + + return NGX_AGAIN; +} + + +static void +ngx_thread_write_chain_to_file_handler(void *data, ngx_log_t *log) +{ + ngx_thread_file_ctx_t *ctx = data; + +#if (NGX_HAVE_PWRITEV) + + off_t offset; + ssize_t n; + ngx_err_t err; + ngx_chain_t *cl; + ngx_iovec_t vec; + struct iovec iovs[NGX_IOVS_PREALLOCATE]; + + vec.iovs = iovs; + vec.nalloc = NGX_IOVS_PREALLOCATE; + + cl = ctx->chain; + offset = ctx->offset; + + ctx->nbytes = 0; + ctx->err = 0; + + do { + /* create the iovec and coalesce the neighbouring bufs */ + cl = ngx_chain_to_iovec(&vec, cl); + +eintr: + + n = pwritev(ctx->fd, iovs, vec.count, offset); + + if (n == -1) { + err = ngx_errno; + + if (err == NGX_EINTR) { + ngx_log_debug0(NGX_LOG_DEBUG_CORE, log, err, + "pwritev() was interrupted"); + goto eintr; + } + + ctx->err = err; + return; + } + + if ((size_t) n != vec.size) { + ctx->nbytes = 0; + return; + } + + ctx->nbytes += n; + offset += n; + } while (cl); + +#else + + ctx->err = NGX_ENOSYS; + return; + +#endif +} + +#endif /* NGX_THREADS */ + + ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s) { Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_files.h (+4 -2) 97% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_files.h 2016-04-20 22:22:29 +0900 (6081b00) +++ vendor/nginx-1.9.15/src/os/unix/ngx_files.h 2016-04-21 23:49:50 +0900 (07872b1) @@ -385,8 +385,10 @@ extern ngx_uint_t ngx_file_aio; #endif #if (NGX_THREADS) -ssize_t ngx_thread_read(ngx_thread_task_t **taskp, ngx_file_t *file, - u_char *buf, size_t size, off_t offset, ngx_pool_t *pool); +ssize_t ngx_thread_read(ngx_file_t *file, u_char *buf, size_t size, + off_t offset, ngx_pool_t *pool); +ssize_t ngx_thread_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, + off_t offset, ngx_pool_t *pool); #endif Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_freebsd.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_freebsd_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_freebsd_init.c (+1 -0) 99% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_freebsd_init.c 2016-04-20 22:22:29 +0900 (c4c12dd) +++ vendor/nginx-1.9.15/src/os/unix/ngx_freebsd_init.c 2016-04-21 23:49:50 +0900 (71672c7) @@ -32,6 +32,7 @@ static ngx_os_io_t ngx_freebsd_io = { ngx_readv_chain, ngx_udp_unix_recv, ngx_unix_send, + ngx_udp_unix_send, #if (NGX_HAVE_SENDFILE) ngx_freebsd_sendfile_chain, NGX_IO_SENDFILE Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_freebsd_sendfile_chain.c (+13 -0) 96% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_freebsd_sendfile_chain.c 2016-04-20 22:22:29 +0900 (3f17dc6) +++ vendor/nginx-1.9.15/src/os/unix/ngx_freebsd_sendfile_chain.c 2016-04-21 23:49:50 +0900 (d0299f5) @@ -247,6 +247,19 @@ ngx_freebsd_sendfile_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) #if (NGX_HAVE_AIO_SENDFILE) if (ebusy) { + if (aio->event.active) { + /* + * tolerate duplicate calls; they can happen due to subrequests + * or multiple calls of the next body filter from a filter + */ + + if (sent) { + c->busy_count = 0; + } + + return in; + } + if (sent == 0) { c->busy_count++; Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_gcc_atomic_amd64.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_gcc_atomic_ppc.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_gcc_atomic_sparc64.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_gcc_atomic_x86.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_linux.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_linux_aio_read.c (+1 -1) 98% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_linux_aio_read.c 2016-04-20 22:22:29 +0900 (b0a9236) +++ vendor/nginx-1.9.15/src/os/unix/ngx_linux_aio_read.c 2016-04-21 23:49:50 +0900 (9f0a6c1) @@ -73,7 +73,7 @@ ngx_file_aio_read(ngx_file_t *file, u_char *buf, size_t size, off_t offset, } ngx_log_debug4(NGX_LOG_DEBUG_CORE, file->log, 0, - "aio complete:%d @%O:%z %V", + "aio complete:%d @%O:%uz %V", ev->complete, offset, size, &file->name); if (ev->complete) { Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_linux_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_linux_init.c (+1 -0) 97% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_linux_init.c 2016-04-20 22:22:29 +0900 (b306cda) +++ vendor/nginx-1.9.15/src/os/unix/ngx_linux_init.c 2016-04-21 23:49:50 +0900 (a1372e9) @@ -18,6 +18,7 @@ static ngx_os_io_t ngx_linux_io = { ngx_readv_chain, ngx_udp_unix_recv, ngx_unix_send, + ngx_udp_unix_send, #if (NGX_HAVE_SENDFILE) ngx_linux_sendfile_chain, NGX_IO_SENDFILE Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_linux_sendfile_chain.c (+55 -12) 87% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_linux_sendfile_chain.c 2016-04-20 22:22:29 +0900 (97f741d) +++ vendor/nginx-1.9.15/src/os/unix/ngx_linux_sendfile_chain.c 2016-04-21 23:49:50 +0900 (3c0696a) @@ -292,6 +292,19 @@ eintr: } } + if (n == 0) { + /* + * if sendfile returns zero, then someone has truncated the file, + * so the offset became beyond the end of the file + */ + + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "sendfile() reported that \"%s\" was truncated at %O", + file->file->name.data, file->file_pos); + + return NGX_ERROR; + } + ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, "sendfile: %z of %uz @%O", n, size, file->file_pos); @@ -315,7 +328,6 @@ static ngx_int_t ngx_linux_sendfile_thread(ngx_connection_t *c, ngx_buf_t *file, size_t size, size_t *sent) { - ngx_uint_t flags; ngx_event_t *wev; ngx_thread_task_t *task; ngx_linux_sendfile_ctx_t *ctx; @@ -343,29 +355,60 @@ ngx_linux_sendfile_thread(ngx_connection_t *c, ngx_buf_t *file, size_t size, if (task->event.complete) { task->event.complete = 0; - if (ctx->err && ctx->err != NGX_EAGAIN) { + if (ctx->err == NGX_EAGAIN) { + *sent = 0; + + if (wev->complete) { + return NGX_DONE; + } + + return NGX_AGAIN; + } + + if (ctx->err) { wev->error = 1; ngx_connection_error(c, ctx->err, "sendfile() failed"); return NGX_ERROR; } + if (ctx->sent == 0) { + /* + * if sendfile returns zero, then someone has truncated the file, + * so the offset became beyond the end of the file + */ + + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "sendfile() reported that \"%s\" was truncated at %O", + file->file->name.data, file->file_pos); + + return NGX_ERROR; + } + *sent = ctx->sent; - return (ctx->sent == ctx->size) ? NGX_DONE : NGX_AGAIN; + if (ctx->sent == ctx->size || wev->complete) { + return NGX_DONE; + } + + return NGX_AGAIN; + } + + if (task->event.active && ctx->file == file) { + /* + * tolerate duplicate calls; they can happen due to subrequests + * or multiple calls of the next body filter from a filter + */ + + *sent = 0; + + return NGX_OK; } ctx->file = file; ctx->socket = c->fd; ctx->size = size; - if (wev->active) { - flags = (ngx_event_flags & NGX_USE_CLEAR_EVENT) ? NGX_CLEAR_EVENT - : NGX_LEVEL_EVENT; - - if (ngx_del_event(wev, NGX_WRITE_EVENT, flags) == NGX_ERROR) { - return NGX_ERROR; - } - } + wev->complete = 0; if (file->file->thread_handler(task, file->file) != NGX_OK) { return NGX_ERROR; @@ -408,7 +451,7 @@ again: #endif ngx_log_debug4(NGX_LOG_DEBUG_EVENT, log, 0, - "sendfile: %z (err: %i) of %uz @%O", + "sendfile: %z (err: %d) of %uz @%O", n, ctx->err, ctx->size, file->file_pos); if (ctx->err == NGX_EINTR) { Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_os.h (+3 -1) 94% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_os.h 2016-04-20 22:22:29 +0900 (d8bcb01) +++ vendor/nginx-1.9.15/src/os/unix/ngx_os.h 2016-04-21 23:49:50 +0900 (e22f07c) @@ -28,6 +28,7 @@ typedef struct { ngx_recv_chain_pt recv_chain; ngx_recv_pt udp_recv; ngx_send_pt send; + ngx_send_pt udp_send; ngx_send_chain_pt send_chain; ngx_uint_t flags; } ngx_os_io_t; @@ -38,7 +39,7 @@ void ngx_os_status(ngx_log_t *log); ngx_int_t ngx_os_specific_init(ngx_log_t *log); void ngx_os_specific_status(ngx_log_t *log); ngx_int_t ngx_daemon(ngx_log_t *log); -ngx_int_t ngx_os_signal_process(ngx_cycle_t *cycle, char *sig, ngx_int_t pid); +ngx_int_t ngx_os_signal_process(ngx_cycle_t *cycle, char *sig, ngx_pid_t pid); ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size); @@ -47,6 +48,7 @@ ssize_t ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size); ssize_t ngx_unix_send(ngx_connection_t *c, u_char *buf, size_t size); ngx_chain_t *ngx_writev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit); +ssize_t ngx_udp_unix_send(ngx_connection_t *c, u_char *buf, size_t size); #if (IOV_MAX > 64) Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_posix_config.h (+1 -1) 98% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_posix_config.h 2016-04-20 22:22:29 +0900 (bf75997) +++ vendor/nginx-1.9.15/src/os/unix/ngx_posix_config.h 2016-04-21 23:49:50 +0900 (5d1358e) @@ -128,7 +128,7 @@ #endif -#if (NGX_HAVE_DEVPOLL) +#if (NGX_HAVE_DEVPOLL) && !(NGX_TEST_BUILD_DEVPOLL) #include <sys/ioctl.h> #include <sys/devpoll.h> #endif Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_posix_init.c (+1 -0) 99% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_posix_init.c 2016-04-20 22:22:29 +0900 (61cc8ca) +++ vendor/nginx-1.9.15/src/os/unix/ngx_posix_init.c 2016-04-21 23:49:50 +0900 (76ed94e) @@ -24,6 +24,7 @@ ngx_os_io_t ngx_os_io = { ngx_readv_chain, ngx_udp_unix_recv, ngx_unix_send, + ngx_udp_unix_send, ngx_writev_chain, 0 }; Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_process.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_process.c 2016-04-20 22:22:29 +0900 (6f3f385) +++ vendor/nginx-1.9.15/src/os/unix/ngx_process.c 2016-04-21 23:49:50 +0900 (24a63fb) @@ -611,7 +611,7 @@ ngx_debug_point(void) ngx_int_t -ngx_os_signal_process(ngx_cycle_t *cycle, char *name, ngx_int_t pid) +ngx_os_signal_process(ngx_cycle_t *cycle, char *name, ngx_pid_t pid) { ngx_signal_t *sig; Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_process.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_process_cycle.c (+5 -5) 99% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_process_cycle.c 2016-04-20 22:22:29 +0900 (9be6376) +++ vendor/nginx-1.9.15/src/os/unix/ngx_process_cycle.c 2016-04-21 23:49:50 +0900 (7cee1c5) @@ -145,7 +145,7 @@ ngx_master_process_cycle(ngx_cycle_t *cycle) } ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, - "termination cycle: %d", delay); + "termination cycle: %M", delay); itv.it_interval.tv_sec = 0; itv.it_interval.tv_usec = 0; @@ -438,7 +438,7 @@ ngx_pass_open_channel(ngx_cycle_t *cycle, ngx_channel_t *ch) } ngx_log_debug6(NGX_LOG_DEBUG_CORE, cycle->log, 0, - "pass channel s:%d pid:%P fd:%d to s:%i pid:%P fd:%d", + "pass channel s:%i pid:%P fd:%d to s:%i pid:%P fd:%d", ch->slot, ch->pid, ch->fd, i, ngx_processes[i].pid, ngx_processes[i].channel[0]); @@ -492,7 +492,7 @@ ngx_signal_worker_processes(ngx_cycle_t *cycle, int signo) for (i = 0; i < ngx_last_process; i++) { ngx_log_debug7(NGX_LOG_DEBUG_EVENT, cycle->log, 0, - "child: %d %P e:%d t:%d d:%d r:%d j:%d", + "child: %i %P e:%d t:%d d:%d r:%d j:%d", i, ngx_processes[i].pid, ngx_processes[i].exiting, @@ -570,7 +570,7 @@ ngx_reap_children(ngx_cycle_t *cycle) for (i = 0; i < ngx_last_process; i++) { ngx_log_debug7(NGX_LOG_DEBUG_EVENT, cycle->log, 0, - "child: %d %P e:%d t:%d d:%d r:%d j:%d", + "child: %i %P e:%d t:%d d:%d r:%d j:%d", i, ngx_processes[i].pid, ngx_processes[i].exiting, @@ -1047,7 +1047,7 @@ ngx_channel_handler(ngx_event_t *ev) } ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0, - "channel command: %d", ch.command); + "channel command: %ui", ch.command); switch (ch.command) { Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_process_cycle.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_readv_chain.c (+24 -28) 81% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_readv_chain.c 2016-04-20 22:22:29 +0900 (3544b4b) +++ vendor/nginx-1.9.15/src/os/unix/ngx_readv_chain.c 2016-04-21 23:49:50 +0900 (d23508e) @@ -101,12 +101,32 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain, off_t limit) } ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, - "readv: %d, last:%d", vec.nelts, iov->iov_len); + "readv: %ui, last:%uz", vec.nelts, iov->iov_len); do { n = readv(c->fd, (struct iovec *) vec.elts, vec.nelts); - if (n >= 0) { + if (n == 0) { + rev->ready = 0; + rev->eof = 1; + +#if (NGX_HAVE_KQUEUE) + + /* + * on FreeBSD readv() may return 0 on closed socket + * even if kqueue reported about available data + */ + + if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { + rev->available = 0; + } + +#endif + + return 0; + } + + if (n > 0) { #if (NGX_HAVE_KQUEUE) @@ -115,7 +135,7 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain, off_t limit) /* * rev->available may be negative here because some additional - * bytes may be received between kevent() and recv() + * bytes may be received between kevent() and readv() */ if (rev->available <= 0) { @@ -123,42 +143,18 @@ ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain, off_t limit) rev->ready = 0; } - if (rev->available < 0) { - rev->available = 0; - } - } - - if (n == 0) { - - /* - * on FreeBSD recv() may return 0 on closed socket - * even if kqueue reported about available data - */ - -#if 0 - ngx_log_error(NGX_LOG_ALERT, c->log, 0, - "readv() returned 0 while kevent() reported " - "%d available bytes", rev->available); -#endif - - rev->ready = 0; - rev->eof = 1; rev->available = 0; } return n; } -#endif /* NGX_HAVE_KQUEUE */ +#endif if (n < size && !(ngx_event_flags & NGX_USE_GREEDY_EVENT)) { rev->ready = 0; } - if (n == 0) { - rev->eof = 1; - } - return n; } Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_recv.c (+30 -79) 60% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_recv.c 2016-04-20 22:22:29 +0900 (86675df) +++ vendor/nginx-1.9.15/src/os/unix/ngx_recv.c 2016-04-21 23:49:50 +0900 (5013ae3) @@ -10,8 +10,6 @@ #include <ngx_event.h> -#if (NGX_HAVE_KQUEUE) - ssize_t ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) { @@ -21,6 +19,8 @@ ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) rev = c->read; +#if (NGX_HAVE_KQUEUE) + if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, "recv: eof:%d, avail:%d, err:%d", @@ -48,13 +48,38 @@ ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) } } +#endif + do { n = recv(c->fd, buf, size, 0); ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, - "recv: fd:%d %d of %d", c->fd, n, size); + "recv: fd:%d %z of %uz", c->fd, n, size); + + if (n == 0) { + rev->ready = 0; + rev->eof = 1; + +#if (NGX_HAVE_KQUEUE) + + /* + * on FreeBSD recv() may return 0 on closed socket + * even if kqueue reported about available data + */ + + if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { + rev->available = 0; + } + +#endif + + return 0; + } + + if (n > 0) { + +#if (NGX_HAVE_KQUEUE) - if (n >= 0) { if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { rev->available -= n; @@ -68,85 +93,13 @@ ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) rev->ready = 0; } - if (rev->available < 0) { - rev->available = 0; - } - } - - if (n == 0) { - - /* - * on FreeBSD recv() may return 0 on closed socket - * even if kqueue reported about available data - */ - - rev->ready = 0; - rev->eof = 1; rev->available = 0; } return n; } - if ((size_t) n < size - && !(ngx_event_flags & NGX_USE_GREEDY_EVENT)) - { - rev->ready = 0; - } - - if (n == 0) { - rev->eof = 1; - } - - return n; - } - - err = ngx_socket_errno; - - if (err == NGX_EAGAIN || err == NGX_EINTR) { - ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err, - "recv() not ready"); - n = NGX_AGAIN; - - } else { - n = ngx_connection_error(c, err, "recv() failed"); - break; - } - - } while (err == NGX_EINTR); - - rev->ready = 0; - - if (n == NGX_ERROR) { - rev->error = 1; - } - - return n; -} - -#else /* ! NGX_HAVE_KQUEUE */ - -ssize_t -ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) -{ - ssize_t n; - ngx_err_t err; - ngx_event_t *rev; - - rev = c->read; - - do { - n = recv(c->fd, buf, size, 0); - - ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, - "recv: fd:%d %d of %d", c->fd, n, size); - - if (n == 0) { - rev->ready = 0; - rev->eof = 1; - return n; - - } else if (n > 0) { +#endif if ((size_t) n < size && !(ngx_event_flags & NGX_USE_GREEDY_EVENT)) @@ -179,5 +132,3 @@ ngx_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) return n; } - -#endif /* NGX_HAVE_KQUEUE */ Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_send.c (+1 -1) 95% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_send.c 2016-04-20 22:22:29 +0900 (80995ab) +++ vendor/nginx-1.9.15/src/os/unix/ngx_send.c 2016-04-21 23:49:50 +0900 (61ea202) @@ -34,7 +34,7 @@ ngx_unix_send(ngx_connection_t *c, u_char *buf, size_t size) n = send(c->fd, buf, size, 0); ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, - "send: fd:%d %d of %d", c->fd, n, size); + "send: fd:%d %z of %uz", c->fd, n, size); if (n > 0) { if (n < (ssize_t) size) { Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_setaffinity.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_setaffinity.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_setproctitle.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_setproctitle.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_shmem.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_shmem.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_socket.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_socket.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_solaris.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_solaris_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_solaris_init.c (+1 -0) 98% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_solaris_init.c 2016-04-20 22:22:29 +0900 (f2f3600) +++ vendor/nginx-1.9.15/src/os/unix/ngx_solaris_init.c 2016-04-21 23:49:50 +0900 (83acae1) @@ -19,6 +19,7 @@ static ngx_os_io_t ngx_solaris_io = { ngx_readv_chain, ngx_udp_unix_recv, ngx_unix_send, + ngx_udp_unix_send, #if (NGX_HAVE_SENDFILE) ngx_solaris_sendfilev_chain, NGX_IO_SENDFILE Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_solaris_sendfilev_chain.c (+23 -0) 86% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_solaris_sendfilev_chain.c 2016-04-20 22:22:29 +0900 (7504239) +++ vendor/nginx-1.9.15/src/os/unix/ngx_solaris_sendfilev_chain.c 2016-04-21 23:49:50 +0900 (39bcafa) @@ -48,6 +48,7 @@ ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) ssize_t n; ngx_int_t eintr; ngx_err_t err; + ngx_buf_t *file; ngx_uint_t nsfv; sendfilevec_t *sfv, sfvs[NGX_SENDFILEVECS]; ngx_event_t *wev; @@ -77,6 +78,7 @@ ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) fd = SFV_FD_SELF; prev = NULL; fprev = 0; + file = NULL; sfv = NULL; eintr = 0; sent = 0; @@ -153,6 +155,7 @@ ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) sfv->sfv_len = (size_t) size; } + file = cl->buf; fprev = cl->buf->file_pos + size; send += size; } @@ -179,6 +182,26 @@ ngx_solaris_sendfilev_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, err, "sendfilev() sent only %uz bytes", sent); + + } else if (n == 0 && sent == 0) { + + /* + * sendfilev() is documented to return -1 with errno + * set to EINVAL if svf_len is greater than the file size, + * but at least Solaris 11 returns 0 instead + */ + + if (file) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "sendfilev() reported that \"%s\" was truncated at %O", + file->file->name.data, file->file_pos); + + } else { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, + "sendfilev() returned 0 with memory buffers"); + } + + return NGX_CHAIN_ERROR; } ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_sunpro_amd64.il (+3 -3) 94% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_sunpro_amd64.il 2016-04-20 22:22:29 +0900 (dc454b2) +++ vendor/nginx-1.9.15/src/os/unix/ngx_sunpro_amd64.il 2016-04-21 23:49:50 +0900 (07f3210) @@ -38,6 +38,6 @@ / / ld.so.1: nginx: fatal: hardware capability unsupported: 0x2000 [ PAUSE ] - .inline ngx_cpu_pause,0 - rep; nop - .end + .inline ngx_cpu_pause,0 + rep; nop + .end Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_sunpro_atomic_sparc64.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_sunpro_sparc64.il (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_sunpro_x86.il (+3 -3) 94% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_sunpro_x86.il 2016-04-20 22:22:29 +0900 (fd1cc00) +++ vendor/nginx-1.9.15/src/os/unix/ngx_sunpro_x86.il 2016-04-21 23:49:50 +0900 (d7e127c) @@ -39,6 +39,6 @@ / / ld.so.1: nginx: fatal: hardware capability unsupported: 0x2000 [ PAUSE ] - .inline ngx_cpu_pause,0 - rep; nop - .end + .inline ngx_cpu_pause,0 + rep; nop + .end Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_thread.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_thread_cond.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_thread_id.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_thread_mutex.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_time.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_time.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_udp_recv.c (+5 -48) 58% =================================================================== --- vendor/nginx-1.9.12/src/os/unix/ngx_udp_recv.c 2016-04-20 22:22:29 +0900 (1c807a0) +++ vendor/nginx-1.9.15/src/os/unix/ngx_udp_recv.c 2016-04-21 23:49:50 +0900 (6d544c2) @@ -10,8 +10,6 @@ #include <ngx_event.h> -#if (NGX_HAVE_KQUEUE) - ssize_t ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) { @@ -25,9 +23,12 @@ ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) n = recv(c->fd, buf, size, 0); ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, - "recv: fd:%d %d of %d", c->fd, n, size); + "recv: fd:%d %z of %uz", c->fd, n, size); if (n >= 0) { + +#if (NGX_HAVE_KQUEUE) + if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { rev->available -= n; @@ -42,50 +43,8 @@ ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) } } - return n; - } - - err = ngx_socket_errno; - - if (err == NGX_EAGAIN || err == NGX_EINTR) { - ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err, - "recv() not ready"); - n = NGX_AGAIN; - - } else { - n = ngx_connection_error(c, err, "recv() failed"); - break; - } - - } while (err == NGX_EINTR); - - rev->ready = 0; +#endif - if (n == NGX_ERROR) { - rev->error = 1; - } - - return n; -} - -#else /* ! NGX_HAVE_KQUEUE */ - -ssize_t -ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) -{ - ssize_t n; - ngx_err_t err; - ngx_event_t *rev; - - rev = c->read; - - do { - n = recv(c->fd, buf, size, 0); - - ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, - "recv: fd:%d %d of %d", c->fd, n, size); - - if (n >= 0) { return n; } @@ -111,5 +70,3 @@ ngx_udp_unix_recv(ngx_connection_t *c, u_char *buf, size_t size) return n; } - -#endif /* NGX_HAVE_KQUEUE */ Added: vendor/nginx-1.9.15/src/os/unix/ngx_udp_send.c (+56 -0) 100644 =================================================================== --- /dev/null +++ vendor/nginx-1.9.15/src/os/unix/ngx_udp_send.c 2016-04-21 23:49:50 +0900 (aabbc8e) @@ -0,0 +1,56 @@ + +/* + * Copyright (C) Igor Sysoev + * Copyright (C) Nginx, Inc. + */ + + +#include <ngx_config.h> +#include <ngx_core.h> +#include <ngx_event.h> + + +ssize_t +ngx_udp_unix_send(ngx_connection_t *c, u_char *buf, size_t size) +{ + ssize_t n; + ngx_err_t err; + ngx_event_t *wev; + + wev = c->write; + + for ( ;; ) { + n = sendto(c->fd, buf, size, 0, c->sockaddr, c->socklen); + + ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0, + "sendto: fd:%d %z of %uz to \"%V\"", + c->fd, n, size, &c->addr_text); + + if (n >= 0) { + if ((size_t) n != size) { + wev->error = 1; + (void) ngx_connection_error(c, 0, "sendto() incomplete"); + return NGX_ERROR; + } + + c->sent += n; + + return n; + } + + err = ngx_socket_errno; + + if (err == NGX_EAGAIN) { + wev->ready = 0; + ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, NGX_EAGAIN, + "sendto() not ready"); + return NGX_AGAIN; + } + + if (err != NGX_EINTR) { + wev->error = 1; + (void) ngx_connection_error(c, err, "sendto() failed"); + return NGX_ERROR; + } + } +} Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_user.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_user.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/unix/ngx_writev_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/nginx.ico (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/nginx.rc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/nginx_icon16.xpm (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/nginx_icon32.xpm (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/nginx_icon48.xpm (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_alloc.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_alloc.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_atomic.h (+4 -4) 86% =================================================================== --- vendor/nginx-1.9.12/src/os/win32/ngx_atomic.h 2016-04-20 22:22:29 +0900 (d89a0d3) +++ vendor/nginx-1.9.15/src/os/win32/ngx_atomic.h 2016-04-21 23:49:50 +0900 (113f561) @@ -27,16 +27,16 @@ typedef volatile ngx_atomic_uint_t ngx_atomic_t; /* the new SDK headers */ #define ngx_atomic_cmp_set(lock, old, set) \ - ((ngx_atomic_uint_t) InterlockedCompareExchange((long *) lock, set, old) \ - == old) + ((ngx_atomic_uint_t) InterlockedCompareExchange((long *) lock, set, old) \ + == old) #else /* the old MS VC6.0SP2 SDK headers */ #define ngx_atomic_cmp_set(lock, old, set) \ - (InterlockedCompareExchange((void **) lock, (void *) set, (void *) old) \ - == (void *) old) + (InterlockedCompareExchange((void **) lock, (void *) set, (void *) old) \ + == (void *) old) #endif Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_dlopen.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_dlopen.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_errno.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_errno.h (+7 -5) 88% =================================================================== --- vendor/nginx-1.9.12/src/os/win32/ngx_errno.h 2016-04-20 22:22:29 +0900 (fd32145) +++ vendor/nginx-1.9.15/src/os/win32/ngx_errno.h 2016-04-21 23:49:50 +0900 (255a39d) @@ -25,13 +25,15 @@ typedef DWORD ngx_err_t; #define NGX_ENOPATH ERROR_PATH_NOT_FOUND #define NGX_ENOMEM ERROR_NOT_ENOUGH_MEMORY #define NGX_EACCES ERROR_ACCESS_DENIED -/* it's seems that ERROR_FILE_EXISTS is not appropriate error code */ -#define NGX_EEXIST ERROR_ALREADY_EXISTS /* - * could not found cross volume directory move error code, - * so use ERROR_WRONG_DISK as stub one + * there are two EEXIST error codes: + * ERROR_FILE_EXISTS used by CreateFile(CREATE_NEW), + * and ERROR_ALREADY_EXISTS used by CreateDirectory(); + * MoveFile() uses both */ -#define NGX_EXDEV ERROR_WRONG_DISK +#define NGX_EEXIST ERROR_ALREADY_EXISTS +#define NGX_EEXIST_FILE ERROR_FILE_EXISTS +#define NGX_EXDEV ERROR_NOT_SAME_DEVICE #define NGX_ENOTDIR ERROR_PATH_NOT_FOUND #define NGX_EISDIR ERROR_CANNOT_MAKE #define NGX_ENOSPC ERROR_DISK_FULL Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_event_log.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_files.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_files.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_os.h (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/os/win32/ngx_os.h 2016-04-20 22:22:29 +0900 (8bce9a2) +++ vendor/nginx-1.9.15/src/os/win32/ngx_os.h 2016-04-21 23:49:50 +0900 (98210a1) @@ -35,7 +35,7 @@ typedef struct { ngx_int_t ngx_os_init(ngx_log_t *log); void ngx_os_status(ngx_log_t *log); -ngx_int_t ngx_os_signal_process(ngx_cycle_t *cycle, char *sig, ngx_int_t pid); +ngx_int_t ngx_os_signal_process(ngx_cycle_t *cycle, char *sig, ngx_pid_t pid); ssize_t ngx_wsarecv(ngx_connection_t *c, u_char *buf, size_t size); ssize_t ngx_overlapped_wsarecv(ngx_connection_t *c, u_char *buf, size_t size); Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_process.c (+4 -4) 95% =================================================================== --- vendor/nginx-1.9.12/src/os/win32/ngx_process.c 2016-04-20 22:22:29 +0900 (67c6b12) +++ vendor/nginx-1.9.15/src/os/win32/ngx_process.c 2016-04-21 23:49:50 +0900 (57b1ae9) @@ -76,9 +76,9 @@ ngx_spawn_process(ngx_cycle_t *cycle, char *name, ngx_int_t respawn) ngx_processes[s].pid = pid; ngx_processes[s].name = name; - ngx_sprintf(ngx_processes[s].term_event, "ngx_%s_term_%ul%Z", name, pid); - ngx_sprintf(ngx_processes[s].quit_event, "ngx_%s_quit_%ul%Z", name, pid); - ngx_sprintf(ngx_processes[s].reopen_event, "ngx_%s_reopen_%ul%Z", + ngx_sprintf(ngx_processes[s].term_event, "ngx_%s_term_%P%Z", name, pid); + ngx_sprintf(ngx_processes[s].quit_event, "ngx_%s_quit_%P%Z", name, pid); + ngx_sprintf(ngx_processes[s].reopen_event, "ngx_%s_reopen_%P%Z", name, pid); events[0] = ngx_master_process_event; @@ -138,7 +138,7 @@ ngx_spawn_process(ngx_cycle_t *cycle, char *name, ngx_int_t respawn) } ngx_log_error(NGX_LOG_ALERT, cycle->log, 0, - "%s process %P exited with code %Xul", + "%s process %P exited with code %Xl", name, pid, code); goto failed; Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_process.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_process_cycle.c (+6 -6) 98% =================================================================== --- vendor/nginx-1.9.12/src/os/win32/ngx_process_cycle.c 2016-04-20 22:22:29 +0900 (1f64551) +++ vendor/nginx-1.9.15/src/os/win32/ngx_process_cycle.c 2016-04-21 23:49:50 +0900 (795e41e) @@ -484,7 +484,7 @@ ngx_reap_worker(ngx_cycle_t *cycle, HANDLE h) } ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, - "%s process %P exited with code %Xul", + "%s process %P exited with code %Xl", ngx_processes[n].name, ngx_processes[n].pid, code); ngx_close_handle(ngx_processes[n].reopen); @@ -581,7 +581,7 @@ ngx_worker_process_cycle(ngx_cycle_t *cycle, char *mevn) ngx_log_debug0(NGX_LOG_DEBUG_CORE, log, 0, "worker started"); - ngx_sprintf((u_char *) wtevn, "ngx_worker_term_%ul%Z", ngx_pid); + ngx_sprintf((u_char *) wtevn, "ngx_worker_term_%P%Z", ngx_pid); events[0] = CreateEvent(NULL, 1, 0, wtevn); if (events[0] == NULL) { ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, @@ -589,7 +589,7 @@ ngx_worker_process_cycle(ngx_cycle_t *cycle, char *mevn) goto failed; } - ngx_sprintf((u_char *) wqevn, "ngx_worker_quit_%ul%Z", ngx_pid); + ngx_sprintf((u_char *) wqevn, "ngx_worker_quit_%P%Z", ngx_pid); events[1] = CreateEvent(NULL, 1, 0, wqevn); if (events[1] == NULL) { ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, @@ -597,7 +597,7 @@ ngx_worker_process_cycle(ngx_cycle_t *cycle, char *mevn) goto failed; } - ngx_sprintf((u_char *) wroevn, "ngx_worker_reopen_%ul%Z", ngx_pid); + ngx_sprintf((u_char *) wroevn, "ngx_worker_reopen_%P%Z", ngx_pid); events[2] = CreateEvent(NULL, 1, 0, wroevn); if (events[2] == NULL) { ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, @@ -1001,13 +1001,13 @@ ngx_single_process_cycle(ngx_cycle_t *cycle) ngx_int_t -ngx_os_signal_process(ngx_cycle_t *cycle, char *sig, ngx_int_t pid) +ngx_os_signal_process(ngx_cycle_t *cycle, char *sig, ngx_pid_t pid) { HANDLE ev; ngx_int_t rc; char evn[NGX_PROCESS_SYNC_NAME]; - ngx_sprintf((u_char *) evn, "Global\\ngx_%s_%ul%Z", sig, pid); + ngx_sprintf((u_char *) evn, "Global\\ngx_%s_%P%Z", sig, pid); ev = OpenEvent(EVENT_MODIFY_STATE, 0, evn); if (ev == NULL) { Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_process_cycle.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_service.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_shmem.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_shmem.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_socket.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_socket.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_stat.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_thread.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_thread.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_time.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_time.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_udp_wsarecv.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_user.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_user.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_win32_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_win32_init.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/os/win32/ngx_win32_init.c 2016-04-20 22:22:29 +0900 (9e77a78) +++ vendor/nginx-1.9.15/src/os/win32/ngx_win32_init.c 2016-04-21 23:49:50 +0900 (9b26db5) @@ -152,7 +152,7 @@ ngx_os_init(ngx_log_t *log) s = ngx_socket(AF_INET, SOCK_STREAM, IPPROTO_IP); if (s == (ngx_socket_t) -1) { ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno, - ngx_socket_n " falied"); + ngx_socket_n " failed"); return NGX_ERROR; } Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_wsarecv.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_wsarecv_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_wsasend.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/os/win32/ngx_wsasend_chain.c (+5 -5) 96% =================================================================== --- vendor/nginx-1.9.12/src/os/win32/ngx_wsasend_chain.c 2016-04-20 22:22:29 +0900 (0815627) +++ vendor/nginx-1.9.15/src/os/win32/ngx_wsasend_chain.c 2016-04-21 23:49:50 +0900 (e2dde22) @@ -233,11 +233,11 @@ ngx_overlapped_wsasend_chain(ngx_connection_t *c, ngx_chain_t *in, off_t limit) } else if (ngx_event_flags & NGX_USE_IOCP_EVENT) { - /* - * if a socket was bound with I/O completion port then - * GetQueuedCompletionStatus() would anyway return its status - * despite that WSASend() was already complete - */ + /* + * if a socket was bound with I/O completion port then + * GetQueuedCompletionStatus() would anyway return its status + * despite that WSASend() was already complete + */ wev->active = 1; return in; Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream.c (+8 -1) 98% =================================================================== --- vendor/nginx-1.9.12/src/stream/ngx_stream.c 2016-04-20 22:22:29 +0900 (caaf38a) +++ vendor/nginx-1.9.15/src/stream/ngx_stream.c 2016-04-21 23:49:50 +0900 (3bd8f6d) @@ -275,8 +275,11 @@ ngx_stream_add_ports(ngx_conf_t *cf, ngx_array_t *ports, port = ports->elts; for (i = 0; i < ports->nelts; i++) { - if (p == port[i].port && sa->sa_family == port[i].family) { + if (p == port[i].port + && listen->type == port[i].type + && sa->sa_family == port[i].family) + { /* a port is already in the port list */ port = &port[i]; @@ -292,6 +295,7 @@ ngx_stream_add_ports(ngx_conf_t *cf, ngx_array_t *ports, } port->family = sa->sa_family; + port->type = listen->type; port->port = p; if (ngx_array_init(&port->addrs, cf->temp_pool, 2, @@ -364,6 +368,7 @@ ngx_stream_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports) ls->addr_ntop = 1; ls->handler = ngx_stream_init_connection; ls->pool_size = 256; + ls->type = addr[i].opt.type; cscf = addr->opt.ctx->srv_conf[ngx_stream_core_module.ctx_index]; @@ -373,6 +378,8 @@ ngx_stream_optimize_servers(ngx_conf_t *cf, ngx_array_t *ports) ls->backlog = addr[i].opt.backlog; + ls->wildcard = addr[i].opt.wildcard; + ls->keepalive = addr[i].opt.so_keepalive; #if (NGX_HAVE_KEEPALIVE_TUNABLE) ls->keepidle = addr[i].opt.tcp_keepidle; Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream.h (+2 -0) 98% =================================================================== --- vendor/nginx-1.9.12/src/stream/ngx_stream.h 2016-04-20 22:22:29 +0900 (21953e9) +++ vendor/nginx-1.9.15/src/stream/ngx_stream.h 2016-04-21 23:49:50 +0900 (49efa45) @@ -66,6 +66,7 @@ typedef struct { int tcp_keepcnt; #endif int backlog; + int type; } ngx_stream_listen_t; @@ -102,6 +103,7 @@ typedef struct { typedef struct { int family; + int type; in_port_t port; ngx_array_t addrs; /* array of ngx_stream_conf_addr_t */ } ngx_stream_conf_port_t; Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_access_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_core_module.c (+29 -1) 95% =================================================================== --- vendor/nginx-1.9.12/src/stream/ngx_stream_core_module.c 2016-04-20 22:22:29 +0900 (0ecc448) +++ vendor/nginx-1.9.15/src/stream/ngx_stream_core_module.c 2016-04-21 23:49:50 +0900 (ebc2b1c) @@ -252,7 +252,7 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) in_port_t port; ngx_str_t *value; ngx_url_t u; - ngx_uint_t i; + ngx_uint_t i, backlog; struct sockaddr *sa; struct sockaddr_in *sin; ngx_stream_listen_t *ls; @@ -343,6 +343,7 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ls->socklen = u.socklen; ls->backlog = NGX_LISTEN_BACKLOG; + ls->type = SOCK_STREAM; ls->wildcard = u.wildcard; ls->ctx = cf->ctx; @@ -350,8 +351,17 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ls->ipv6only = 1; #endif + backlog = 0; + for (i = 2; i < cf->args->nelts; i++) { +#if !(NGX_WIN32) + if (ngx_strcmp(value[i].data, "udp") == 0) { + ls->type = SOCK_DGRAM; + continue; + } +#endif + if (ngx_strcmp(value[i].data, "bind") == 0) { ls->bind = 1; continue; @@ -367,6 +377,8 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } + backlog = 1; + continue; } @@ -530,5 +542,21 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } + if (ls->type == SOCK_DGRAM) { + if (backlog) { + return "\"backlog\" parameter is incompatible with \"udp\""; + } + +#if (NGX_STREAM_SSL) + if (ls->ssl) { + return "\"ssl\" parameter is incompatible with \"udp\""; + } +#endif + + if (ls->so_keepalive) { + return "\"so_keepalive\" parameter is incompatible with \"udp\""; + } + } + return NGX_CONF_OK; } Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_handler.c (+10 -5) 93% =================================================================== --- vendor/nginx-1.9.12/src/stream/ngx_stream_handler.c 2016-04-20 22:22:29 +0900 (b3edb68) +++ vendor/nginx-1.9.15/src/stream/ngx_stream_handler.c 2016-04-21 23:49:50 +0900 (aa69e44) @@ -52,7 +52,7 @@ ngx_stream_init_connection(ngx_connection_t *c) * is the "*:port" wildcard so getsockname() is needed to determine * the server address. * - * AcceptEx() already gave this address. + * AcceptEx() and recvmsg() already gave this address. */ if (ngx_connection_local_sockaddr(c, NULL, 0) != NGX_OK) { @@ -137,8 +137,9 @@ ngx_stream_init_connection(ngx_connection_t *c) len = ngx_sock_ntop(c->sockaddr, c->socklen, text, NGX_SOCKADDR_STRLEN, 1); - ngx_log_error(NGX_LOG_INFO, c->log, 0, "*%uA client %*s connected to %V", - c->number, len, text, &addr_conf->addr_text); + ngx_log_error(NGX_LOG_INFO, c->log, 0, "*%uA %sclient %*s connected to %V", + c->number, c->type == SOCK_DGRAM ? "udp " : "", + len, text, &addr_conf->addr_text); c->log->connection = c->number; c->log->handler = ngx_stream_log_error; @@ -166,7 +167,10 @@ ngx_stream_init_connection(ngx_connection_t *c) } } - if (cscf->tcp_nodelay && c->tcp_nodelay == NGX_TCP_NODELAY_UNSET) { + if (c->type == SOCK_STREAM + && cscf->tcp_nodelay + && c->tcp_nodelay == NGX_TCP_NODELAY_UNSET) + { ngx_log_debug0(NGX_LOG_DEBUG_STREAM, c->log, 0, "tcp_nodelay"); tcp_nodelay = 1; @@ -325,7 +329,8 @@ ngx_stream_log_error(ngx_log_t *log, u_char *buf, size_t len) s = log->data; - p = ngx_snprintf(buf, len, ", client: %V, server: %V", + p = ngx_snprintf(buf, len, ", %sclient: %V, server: %V", + s->connection->type == SOCK_DGRAM ? "udp " : "", &s->connection->addr_text, &s->connection->listening->addr_text); len -= p - buf; Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_limit_conn_module.c (+2 -2) 99% =================================================================== --- vendor/nginx-1.9.12/src/stream/ngx_stream_limit_conn_module.c 2016-04-20 22:22:29 +0900 (732b089) +++ vendor/nginx-1.9.15/src/stream/ngx_stream_limit_conn_module.c 2016-04-21 23:49:50 +0900 (f1d8a37) @@ -220,7 +220,7 @@ ngx_stream_limit_conn_handler(ngx_stream_session_t *s) } ngx_log_debug2(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, - "limit conn: %08XD %d", node->key, lc->conn); + "limit conn: %08Xi %d", node->key, lc->conn); ngx_shmtx_unlock(&shpool->mutex); @@ -340,7 +340,7 @@ ngx_stream_limit_conn_cleanup(void *data) ngx_shmtx_lock(&shpool->mutex); ngx_log_debug2(NGX_LOG_DEBUG_STREAM, lccln->shm_zone->shm.log, 0, - "limit conn cleanup: %08XD %d", node->key, lc->conn); + "limit conn cleanup: %08Xi %d", node->key, lc->conn); lc->conn--; Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_proxy_module.c (+128 -39) 91% =================================================================== --- vendor/nginx-1.9.12/src/stream/ngx_stream_proxy_module.c 2016-04-20 22:22:29 +0900 (b969fea) +++ vendor/nginx-1.9.15/src/stream/ngx_stream_proxy_module.c 2016-04-21 23:49:50 +0900 (6c535fd) @@ -17,6 +17,7 @@ typedef struct { size_t buffer_size; size_t upload_rate; size_t download_rate; + ngx_uint_t responses; ngx_uint_t next_upstream_tries; ngx_flag_t next_upstream; ngx_flag_t proxy_protocol; @@ -54,7 +55,7 @@ static void ngx_stream_proxy_process_connection(ngx_event_t *ev, ngx_uint_t from_upstream); static void ngx_stream_proxy_connect_handler(ngx_event_t *ev); static ngx_int_t ngx_stream_proxy_test_connect(ngx_connection_t *c); -static ngx_int_t ngx_stream_proxy_process(ngx_stream_session_t *s, +static void ngx_stream_proxy_process(ngx_stream_session_t *s, ngx_uint_t from_upstream, ngx_uint_t do_write); static void ngx_stream_proxy_next_upstream(ngx_stream_session_t *s); static void ngx_stream_proxy_finalize(ngx_stream_session_t *s, ngx_int_t rc); @@ -167,6 +168,13 @@ static ngx_command_t ngx_stream_proxy_commands[] = { offsetof(ngx_stream_proxy_srv_conf_t, download_rate), NULL }, + { ngx_string("proxy_responses"), + NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + NGX_STREAM_SRV_CONF_OFFSET, + offsetof(ngx_stream_proxy_srv_conf_t, responses), + NULL }, + { ngx_string("proxy_next_upstream"), NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_FLAG, ngx_conf_set_flag_slot, @@ -351,6 +359,7 @@ ngx_stream_proxy_handler(ngx_stream_session_t *s) u->peer.log_error = NGX_ERROR_ERR; u->peer.local = pscf->local; + u->peer.type = c->type; uscf = pscf->upstream; @@ -370,6 +379,14 @@ ngx_stream_proxy_handler(ngx_stream_session_t *s) u->proxy_protocol = pscf->proxy_protocol; u->start_sec = ngx_time(); + c->write->handler = ngx_stream_proxy_downstream_handler; + c->read->handler = ngx_stream_proxy_downstream_handler; + + if (c->type == SOCK_DGRAM) { + ngx_stream_proxy_connect(s); + return; + } + p = ngx_pnalloc(c->pool, pscf->buffer_size); if (p == NULL) { ngx_stream_proxy_finalize(s, NGX_ERROR); @@ -381,9 +398,6 @@ ngx_stream_proxy_handler(ngx_stream_session_t *s) u->downstream_buf.pos = p; u->downstream_buf.last = p; - c->write->handler = ngx_stream_proxy_downstream_handler; - c->read->handler = ngx_stream_proxy_downstream_handler; - if (u->proxy_protocol #if (NGX_STREAM_SSL) && pscf->ssl == NULL @@ -406,8 +420,8 @@ ngx_stream_proxy_handler(ngx_stream_session_t *s) u->proxy_protocol = 0; } - if (ngx_stream_proxy_process(s, 0, 0) != NGX_OK) { - return; + if (c->read->ready) { + ngx_post_event(c->read, &ngx_posted_events); } ngx_stream_proxy_connect(s); @@ -488,7 +502,10 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s) cscf = ngx_stream_get_module_srv_conf(s, ngx_stream_core_module); - if (cscf->tcp_nodelay && pc->tcp_nodelay == NGX_TCP_NODELAY_UNSET) { + if (pc->type == SOCK_STREAM + && cscf->tcp_nodelay + && pc->tcp_nodelay == NGX_TCP_NODELAY_UNSET) + { ngx_log_debug0(NGX_LOG_DEBUG_STREAM, pc->log, 0, "tcp_nodelay"); tcp_nodelay = 1; @@ -516,7 +533,7 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s) pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module); #if (NGX_STREAM_SSL) - if (pscf->ssl && pc->ssl == NULL) { + if (pc->type == SOCK_STREAM && pscf->ssl && pc->ssl == NULL) { ngx_stream_proxy_ssl_init_connection(s); return; } @@ -535,7 +552,9 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s) handler = c->log->handler; c->log->handler = NULL; - ngx_log_error(NGX_LOG_INFO, c->log, 0, "proxy %V connected to %V", + ngx_log_error(NGX_LOG_INFO, c->log, 0, + "%sproxy %V connected to %V", + pc->type == SOCK_DGRAM ? "udp " : "", &str, u->peer.name); c->log->handler = handler; @@ -544,24 +563,36 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s) c->log->action = "proxying connection"; - p = ngx_pnalloc(c->pool, pscf->buffer_size); - if (p == NULL) { - ngx_stream_proxy_finalize(s, NGX_ERROR); - return; + if (u->upstream_buf.start == NULL) { + p = ngx_pnalloc(c->pool, pscf->buffer_size); + if (p == NULL) { + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + + u->upstream_buf.start = p; + u->upstream_buf.end = p + pscf->buffer_size; + u->upstream_buf.pos = p; + u->upstream_buf.last = p; } - u->upstream_buf.start = p; - u->upstream_buf.end = p + pscf->buffer_size; - u->upstream_buf.pos = p; - u->upstream_buf.last = p; + if (c->type == SOCK_DGRAM) { + s->received = c->buffer->last - c->buffer->pos; + u->downstream_buf = *c->buffer; + + if (pscf->responses == 0) { + pc->read->ready = 0; + pc->read->eof = 1; + } + } u->connected = 1; pc->read->handler = ngx_stream_proxy_upstream_handler; pc->write->handler = ngx_stream_proxy_upstream_handler; - if (ngx_stream_proxy_process(s, 1, 0) != NGX_OK) { - return; + if (pc->read->ready || pc->read->eof) { + ngx_post_event(pc->read, &ngx_posted_events); } ngx_stream_proxy_process(s, 0, 1); @@ -894,11 +925,15 @@ ngx_stream_proxy_process_connection(ngx_event_t *ev, ngx_uint_t from_upstream) s = c->data; u = s->upstream; + c = s->connection; + pc = u->peer.connection; + + pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module); + if (ev->timedout) { + ev->timedout = 0; if (ev->delayed) { - - ev->timedout = 0; ev->delayed = 0; if (!ev->ready) { @@ -907,20 +942,35 @@ ngx_stream_proxy_process_connection(ngx_event_t *ev, ngx_uint_t from_upstream) return; } - if (u->connected) { - pc = u->peer.connection; - - if (!c->read->delayed && !pc->read->delayed) { - pscf = ngx_stream_get_module_srv_conf(s, - ngx_stream_proxy_module); - ngx_add_timer(c->write, pscf->timeout); - } + if (u->connected && !c->read->delayed && !pc->read->delayed) { + ngx_add_timer(c->write, pscf->timeout); } return; } } else { + if (s->connection->type == SOCK_DGRAM) { + if (pscf->responses == NGX_MAX_INT32_VALUE) { + + /* + * successfully terminate timed out UDP session + * with unspecified number of responses + */ + + pc->read->ready = 0; + pc->read->eof = 1; + + ngx_stream_proxy_process(s, 1, 0); + return; + } + + if (u->received == 0) { + ngx_stream_proxy_next_upstream(s); + return; + } + } + ngx_connection_error(c, NGX_ETIMEDOUT, "connection timed out"); ngx_stream_proxy_finalize(s, NGX_DECLINED); return; @@ -1019,7 +1069,7 @@ ngx_stream_proxy_test_connect(ngx_connection_t *c) } -static ngx_int_t +static void ngx_stream_proxy_process(ngx_stream_session_t *s, ngx_uint_t from_upstream, ngx_uint_t do_write) { @@ -1039,6 +1089,21 @@ ngx_stream_proxy_process(ngx_stream_session_t *s, ngx_uint_t from_upstream, c = s->connection; pc = u->connected ? u->peer.connection : NULL; + if (c->type == SOCK_DGRAM && (ngx_terminate || ngx_exiting)) { + + /* socket is already closed on worker shutdown */ + + handler = c->log->handler; + c->log->handler = NULL; + + ngx_log_error(NGX_LOG_INFO, c->log, 0, "disconnected on shutdown"); + + c->log->handler = handler; + + ngx_stream_proxy_finalize(s, NGX_OK); + return; + } + pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module); if (from_upstream) { @@ -1066,9 +1131,19 @@ ngx_stream_proxy_process(ngx_stream_session_t *s, ngx_uint_t from_upstream, n = dst->send(dst, b->pos, size); + if (n == NGX_AGAIN && dst->shared) { + /* cannot wait on a shared socket */ + n = NGX_ERROR; + } + if (n == NGX_ERROR) { + if (c->type == SOCK_DGRAM && !from_upstream) { + ngx_stream_proxy_next_upstream(s); + return; + } + ngx_stream_proxy_finalize(s, NGX_DECLINED); - return NGX_ERROR; + return; } if (n > 0) { @@ -1118,6 +1193,12 @@ ngx_stream_proxy_process(ngx_stream_session_t *s, ngx_uint_t from_upstream, } } + if (c->type == SOCK_DGRAM && ++u->responses == pscf->responses) + { + src->read->ready = 0; + src->read->eof = 1; + } + *received += n; b->last += n; do_write = 1; @@ -1126,6 +1207,11 @@ ngx_stream_proxy_process(ngx_stream_session_t *s, ngx_uint_t from_upstream, } if (n == NGX_ERROR) { + if (c->type == SOCK_DGRAM && u->received == 0) { + ngx_stream_proxy_next_upstream(s); + return; + } + src->read->eof = 1; } } @@ -1138,29 +1224,30 @@ ngx_stream_proxy_process(ngx_stream_session_t *s, ngx_uint_t from_upstream, c->log->handler = NULL; ngx_log_error(NGX_LOG_INFO, c->log, 0, - "%s disconnected" + "%s%s disconnected" ", bytes from/to client:%O/%O" ", bytes from/to upstream:%O/%O", + src->type == SOCK_DGRAM ? "udp " : "", from_upstream ? "upstream" : "client", s->received, c->sent, u->received, pc ? pc->sent : 0); c->log->handler = handler; ngx_stream_proxy_finalize(s, NGX_OK); - return NGX_DONE; + return; } flags = src->read->eof ? NGX_CLOSE_EVENT : 0; - if (ngx_handle_read_event(src->read, flags) != NGX_OK) { + if (!src->shared && ngx_handle_read_event(src->read, flags) != NGX_OK) { ngx_stream_proxy_finalize(s, NGX_ERROR); - return NGX_ERROR; + return; } if (dst) { - if (ngx_handle_write_event(dst->write, 0) != NGX_OK) { + if (!dst->shared && ngx_handle_write_event(dst->write, 0) != NGX_OK) { ngx_stream_proxy_finalize(s, NGX_ERROR); - return NGX_ERROR; + return; } if (!c->read->delayed && !pc->read->delayed) { @@ -1170,8 +1257,6 @@ ngx_stream_proxy_process(ngx_stream_session_t *s, ngx_uint_t from_upstream, ngx_del_timer(c->write); } } - - return NGX_OK; } @@ -1333,6 +1418,7 @@ ngx_stream_proxy_create_srv_conf(ngx_conf_t *cf) conf->buffer_size = NGX_CONF_UNSET_SIZE; conf->upload_rate = NGX_CONF_UNSET_SIZE; conf->download_rate = NGX_CONF_UNSET_SIZE; + conf->responses = NGX_CONF_UNSET_UINT; conf->next_upstream_tries = NGX_CONF_UNSET_UINT; conf->next_upstream = NGX_CONF_UNSET; conf->proxy_protocol = NGX_CONF_UNSET; @@ -1375,6 +1461,9 @@ ngx_stream_proxy_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) ngx_conf_merge_size_value(conf->download_rate, prev->download_rate, 0); + ngx_conf_merge_uint_value(conf->responses, + prev->responses, NGX_MAX_INT32_VALUE); + ngx_conf_merge_uint_value(conf->next_upstream_tries, prev->next_upstream_tries, 0); Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_ssl_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/stream/ngx_stream_ssl_module.c 2016-04-20 22:22:29 +0900 (7abd9e1) +++ vendor/nginx-1.9.15/src/stream/ngx_stream_ssl_module.c 2016-04-21 23:49:50 +0900 (e12da1b) @@ -276,7 +276,7 @@ ngx_stream_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child) SSL_CTX_set_options(conf->ssl.ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); } -#ifndef LIBRESSL_VERSION_NUMBER +#if (OPENSSL_VERSION_NUMBER < 0x10100001L && !defined LIBRESSL_VERSION_NUMBER) SSL_CTX_set_tmp_rsa_callback(conf->ssl.ctx, ngx_ssl_rsa512_key_callback); #endif Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_ssl_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_upstream.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/stream/ngx_stream_upstream.c 2016-04-20 22:22:29 +0900 (805ee70) +++ vendor/nginx-1.9.15/src/stream/ngx_stream_upstream.c 2016-04-21 23:49:50 +0900 (69dddc5) @@ -388,7 +388,7 @@ ngx_stream_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags) uscf->port = u->port; uscf->no_port = u->no_port; - if (u->naddrs == 1) { + if (u->naddrs == 1 && (u->port || u->family == AF_UNIX)) { uscf->servers = ngx_array_create(cf->pool, 1, sizeof(ngx_stream_upstream_server_t)); if (uscf->servers == NULL) { Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_upstream.h (+1 -0) 98% =================================================================== --- vendor/nginx-1.9.12/src/stream/ngx_stream_upstream.h 2016-04-20 22:22:29 +0900 (80520c2) +++ vendor/nginx-1.9.15/src/stream/ngx_stream_upstream.h 2016-04-21 23:49:50 +0900 (1f4810c) @@ -84,6 +84,7 @@ typedef struct { ngx_buf_t upstream_buf; off_t received; time_t start_sec; + ngx_uint_t responses; #if (NGX_STREAM_SSL) ngx_str_t ssl_name; #endif Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_hash_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_least_conn_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/stream/ngx_stream_upstream_least_conn_module.c 2016-04-20 22:22:29 +0900 (677da45) +++ vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_least_conn_module.c 2016-04-21 23:49:50 +0900 (c9719f9) @@ -254,7 +254,7 @@ failed: / (8 * sizeof(uintptr_t)); for (i = 0; i < n; i++) { - rrp->tried[i] = 0; + rrp->tried[i] = 0; } ngx_stream_upstream_rr_peers_unlock(peers); Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_round_robin.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.9.12/src/stream/ngx_stream_upstream_round_robin.c 2016-04-20 22:22:29 +0900 (efedb28) +++ vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_round_robin.c 2016-04-21 23:49:50 +0900 (e1ab592) @@ -356,7 +356,7 @@ failed: / (8 * sizeof(uintptr_t)); for (i = 0; i < n; i++) { - rrp->tried[i] = 0; + rrp->tried[i] = 0; } ngx_stream_upstream_rr_peers_unlock(peers); Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_round_robin.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.9.15/src/stream/ngx_stream_upstream_zone_module.c (+0 -0) 100% ===================================================================