Kentaro Hayashi
null+****@clear*****
Wed Jul 27 13:06:13 JST 2016
Kentaro Hayashi 2016-07-27 13:06:13 +0900 (Wed, 27 Jul 2016) New Revision: 90f11995d31f6c46b98f6bd068a02d427c3bc366 https://github.com/groonga/groonga/commit/90f11995d31f6c46b98f6bd068a02d427c3bc366 Message: nginx: update to latest version % ./update_nginx.sh 1.11.3 Added files: vendor/nginx-1.11.3/src/core/ngx_sha1.c vendor/nginx-1.11.3/src/core/ngx_sha1.h vendor/nginx-1.11.3/src/stream/ngx_stream.h vendor/nginx-1.11.3/src/stream/ngx_stream_return_module.c vendor/nginx-1.11.3/src/stream/ngx_stream_script.c vendor/nginx-1.11.3/src/stream/ngx_stream_script.h vendor/nginx-1.11.3/src/stream/ngx_stream_variables.c vendor/nginx-1.11.3/src/stream/ngx_stream_variables.h Copied files: vendor/nginx-1.11.3/src/http/modules/ngx_http_geo_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_geo_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_geoip_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_geoip_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_map_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_map_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_split_clients_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_split_clients_module.c) Removed files: vendor/nginx-1.11.1/auto/lib/md5/conf vendor/nginx-1.11.1/auto/lib/md5/make vendor/nginx-1.11.1/auto/lib/md5/makefile.bcc vendor/nginx-1.11.1/auto/lib/md5/makefile.msvc vendor/nginx-1.11.1/auto/lib/md5/makefile.owc vendor/nginx-1.11.1/auto/lib/sha1/conf vendor/nginx-1.11.1/auto/lib/sha1/make vendor/nginx-1.11.1/auto/lib/sha1/makefile.bcc vendor/nginx-1.11.1/auto/lib/sha1/makefile.msvc vendor/nginx-1.11.1/auto/lib/sha1/makefile.owc vendor/nginx-1.11.1/auto/lib/test vendor/nginx-1.11.1/src/core/ngx_sha1.h vendor/nginx-1.11.1/src/stream/ngx_stream.h Modified files: nginx_version Renamed files: vendor/nginx-1.11.3/auto/cc/acc (from vendor/nginx-1.11.1/auto/cc/acc) vendor/nginx-1.11.3/auto/cc/bcc (from vendor/nginx-1.11.1/auto/cc/bcc) vendor/nginx-1.11.3/auto/cc/ccc (from vendor/nginx-1.11.1/auto/cc/ccc) vendor/nginx-1.11.3/auto/cc/clang (from vendor/nginx-1.11.1/auto/cc/clang) vendor/nginx-1.11.3/auto/cc/conf (from vendor/nginx-1.11.1/auto/cc/conf) vendor/nginx-1.11.3/auto/cc/gcc (from vendor/nginx-1.11.1/auto/cc/gcc) vendor/nginx-1.11.3/auto/cc/icc (from vendor/nginx-1.11.1/auto/cc/icc) vendor/nginx-1.11.3/auto/cc/msvc (from vendor/nginx-1.11.1/auto/cc/msvc) vendor/nginx-1.11.3/auto/cc/name (from vendor/nginx-1.11.1/auto/cc/name) vendor/nginx-1.11.3/auto/cc/owc (from vendor/nginx-1.11.1/auto/cc/owc) vendor/nginx-1.11.3/auto/cc/sunc (from vendor/nginx-1.11.1/auto/cc/sunc) vendor/nginx-1.11.3/auto/configure (from vendor/nginx-1.11.1/auto/configure) vendor/nginx-1.11.3/auto/define (from vendor/nginx-1.11.1/auto/define) vendor/nginx-1.11.3/auto/endianness (from vendor/nginx-1.11.1/auto/endianness) vendor/nginx-1.11.3/auto/feature (from vendor/nginx-1.11.1/auto/feature) vendor/nginx-1.11.3/auto/have (from vendor/nginx-1.11.1/auto/have) vendor/nginx-1.11.3/auto/have_headers (from vendor/nginx-1.11.1/auto/have_headers) vendor/nginx-1.11.3/auto/headers (from vendor/nginx-1.11.1/auto/headers) vendor/nginx-1.11.3/auto/include (from vendor/nginx-1.11.1/auto/include) vendor/nginx-1.11.3/auto/init (from vendor/nginx-1.11.1/auto/init) vendor/nginx-1.11.3/auto/install (from vendor/nginx-1.11.1/auto/install) vendor/nginx-1.11.3/auto/lib/conf (from vendor/nginx-1.11.1/auto/lib/conf) vendor/nginx-1.11.3/auto/lib/geoip/conf (from vendor/nginx-1.11.1/auto/lib/geoip/conf) vendor/nginx-1.11.3/auto/lib/google-perftools/conf (from vendor/nginx-1.11.1/auto/lib/google-perftools/conf) vendor/nginx-1.11.3/auto/lib/libatomic/conf (from vendor/nginx-1.11.1/auto/lib/libatomic/conf) vendor/nginx-1.11.3/auto/lib/libatomic/make (from vendor/nginx-1.11.1/auto/lib/libatomic/make) vendor/nginx-1.11.3/auto/lib/libgd/conf (from vendor/nginx-1.11.1/auto/lib/libgd/conf) vendor/nginx-1.11.3/auto/lib/libxslt/conf (from vendor/nginx-1.11.1/auto/lib/libxslt/conf) vendor/nginx-1.11.3/auto/lib/make (from vendor/nginx-1.11.1/auto/lib/make) vendor/nginx-1.11.3/auto/lib/openssl/conf (from vendor/nginx-1.11.1/auto/lib/openssl/conf) vendor/nginx-1.11.3/auto/lib/openssl/make (from vendor/nginx-1.11.1/auto/lib/openssl/make) vendor/nginx-1.11.3/auto/lib/openssl/makefile.bcc (from vendor/nginx-1.11.1/auto/lib/openssl/makefile.bcc) vendor/nginx-1.11.3/auto/lib/openssl/makefile.msvc (from vendor/nginx-1.11.1/auto/lib/openssl/makefile.msvc) vendor/nginx-1.11.3/auto/lib/pcre/conf (from vendor/nginx-1.11.1/auto/lib/pcre/conf) vendor/nginx-1.11.3/auto/lib/pcre/make (from vendor/nginx-1.11.1/auto/lib/pcre/make) vendor/nginx-1.11.3/auto/lib/pcre/makefile.bcc (from vendor/nginx-1.11.1/auto/lib/pcre/makefile.bcc) vendor/nginx-1.11.3/auto/lib/pcre/makefile.msvc (from vendor/nginx-1.11.1/auto/lib/pcre/makefile.msvc) vendor/nginx-1.11.3/auto/lib/pcre/makefile.owc (from vendor/nginx-1.11.1/auto/lib/pcre/makefile.owc) vendor/nginx-1.11.3/auto/lib/perl/conf (from vendor/nginx-1.11.1/auto/lib/perl/conf) vendor/nginx-1.11.3/auto/lib/perl/make (from vendor/nginx-1.11.1/auto/lib/perl/make) vendor/nginx-1.11.3/auto/lib/zlib/conf (from vendor/nginx-1.11.1/auto/lib/zlib/conf) vendor/nginx-1.11.3/auto/lib/zlib/make (from vendor/nginx-1.11.1/auto/lib/zlib/make) vendor/nginx-1.11.3/auto/lib/zlib/makefile.bcc (from vendor/nginx-1.11.1/auto/lib/zlib/makefile.bcc) vendor/nginx-1.11.3/auto/lib/zlib/makefile.msvc (from vendor/nginx-1.11.1/auto/lib/zlib/makefile.msvc) vendor/nginx-1.11.3/auto/lib/zlib/makefile.owc (from vendor/nginx-1.11.1/auto/lib/zlib/makefile.owc) vendor/nginx-1.11.3/auto/make (from vendor/nginx-1.11.1/auto/make) vendor/nginx-1.11.3/auto/module (from vendor/nginx-1.11.1/auto/module) vendor/nginx-1.11.3/auto/modules (from vendor/nginx-1.11.1/auto/modules) vendor/nginx-1.11.3/auto/nohave (from vendor/nginx-1.11.1/auto/nohave) vendor/nginx-1.11.3/auto/options (from vendor/nginx-1.11.1/auto/options) vendor/nginx-1.11.3/auto/os/conf (from vendor/nginx-1.11.1/auto/os/conf) vendor/nginx-1.11.3/auto/os/darwin (from vendor/nginx-1.11.1/auto/os/darwin) vendor/nginx-1.11.3/auto/os/freebsd (from vendor/nginx-1.11.1/auto/os/freebsd) vendor/nginx-1.11.3/auto/os/linux (from vendor/nginx-1.11.1/auto/os/linux) vendor/nginx-1.11.3/auto/os/solaris (from vendor/nginx-1.11.1/auto/os/solaris) vendor/nginx-1.11.3/auto/os/win32 (from vendor/nginx-1.11.1/auto/os/win32) vendor/nginx-1.11.3/auto/sources (from vendor/nginx-1.11.1/auto/sources) vendor/nginx-1.11.3/auto/stubs (from vendor/nginx-1.11.1/auto/stubs) vendor/nginx-1.11.3/auto/summary (from vendor/nginx-1.11.1/auto/summary) vendor/nginx-1.11.3/auto/threads (from vendor/nginx-1.11.1/auto/threads) vendor/nginx-1.11.3/auto/types/sizeof (from vendor/nginx-1.11.1/auto/types/sizeof) vendor/nginx-1.11.3/auto/types/typedef (from vendor/nginx-1.11.1/auto/types/typedef) vendor/nginx-1.11.3/auto/types/uintptr_t (from vendor/nginx-1.11.1/auto/types/uintptr_t) vendor/nginx-1.11.3/auto/types/value (from vendor/nginx-1.11.1/auto/types/value) vendor/nginx-1.11.3/auto/unix (from vendor/nginx-1.11.1/auto/unix) vendor/nginx-1.11.3/conf/fastcgi.conf (from vendor/nginx-1.11.1/conf/fastcgi.conf) vendor/nginx-1.11.3/conf/fastcgi_params (from vendor/nginx-1.11.1/conf/fastcgi_params) vendor/nginx-1.11.3/conf/koi-utf (from vendor/nginx-1.11.1/conf/koi-utf) vendor/nginx-1.11.3/conf/koi-win (from vendor/nginx-1.11.1/conf/koi-win) vendor/nginx-1.11.3/conf/mime.types (from vendor/nginx-1.11.1/conf/mime.types) vendor/nginx-1.11.3/conf/nginx.conf (from vendor/nginx-1.11.1/conf/nginx.conf) vendor/nginx-1.11.3/conf/scgi_params (from vendor/nginx-1.11.1/conf/scgi_params) vendor/nginx-1.11.3/conf/uwsgi_params (from vendor/nginx-1.11.1/conf/uwsgi_params) vendor/nginx-1.11.3/conf/win-utf (from vendor/nginx-1.11.1/conf/win-utf) vendor/nginx-1.11.3/contrib/README (from vendor/nginx-1.11.1/contrib/README) vendor/nginx-1.11.3/contrib/geo2nginx.pl (from vendor/nginx-1.11.1/contrib/geo2nginx.pl) vendor/nginx-1.11.3/contrib/unicode2nginx/koi-utf (from vendor/nginx-1.11.1/contrib/unicode2nginx/koi-utf) vendor/nginx-1.11.3/contrib/unicode2nginx/unicode-to-nginx.pl (from vendor/nginx-1.11.1/contrib/unicode2nginx/unicode-to-nginx.pl) vendor/nginx-1.11.3/contrib/unicode2nginx/win-utf (from vendor/nginx-1.11.1/contrib/unicode2nginx/win-utf) vendor/nginx-1.11.3/contrib/vim/ftdetect/nginx.vim (from vendor/nginx-1.11.1/contrib/vim/ftdetect/nginx.vim) vendor/nginx-1.11.3/contrib/vim/indent/nginx.vim (from vendor/nginx-1.11.1/contrib/vim/indent/nginx.vim) vendor/nginx-1.11.3/contrib/vim/syntax/nginx.vim (from vendor/nginx-1.11.1/contrib/vim/syntax/nginx.vim) vendor/nginx-1.11.3/docs/GNUmakefile (from vendor/nginx-1.11.1/docs/GNUmakefile) vendor/nginx-1.11.3/docs/dtd/change_log_conf.dtd (from vendor/nginx-1.11.1/docs/dtd/change_log_conf.dtd) vendor/nginx-1.11.3/docs/dtd/changes.dtd (from vendor/nginx-1.11.1/docs/dtd/changes.dtd) vendor/nginx-1.11.3/docs/html/50x.html (from vendor/nginx-1.11.1/docs/html/50x.html) vendor/nginx-1.11.3/docs/html/index.html (from vendor/nginx-1.11.1/docs/html/index.html) vendor/nginx-1.11.3/docs/man/nginx.8 (from vendor/nginx-1.11.1/docs/man/nginx.8) vendor/nginx-1.11.3/docs/text/LICENSE (from vendor/nginx-1.11.1/docs/text/LICENSE) vendor/nginx-1.11.3/docs/text/README (from vendor/nginx-1.11.1/docs/text/README) vendor/nginx-1.11.3/docs/xml/change_log_conf.xml (from vendor/nginx-1.11.1/docs/xml/change_log_conf.xml) vendor/nginx-1.11.3/docs/xml/nginx/changes.xml (from vendor/nginx-1.11.1/docs/xml/nginx/changes.xml) vendor/nginx-1.11.3/docs/xsls/changes.xsls (from vendor/nginx-1.11.1/docs/xsls/changes.xsls) vendor/nginx-1.11.3/docs/xslt/changes.xslt (from vendor/nginx-1.11.1/docs/xslt/changes.xslt) vendor/nginx-1.11.3/misc/GNUmakefile (from vendor/nginx-1.11.1/misc/GNUmakefile) vendor/nginx-1.11.3/misc/README (from vendor/nginx-1.11.1/misc/README) vendor/nginx-1.11.3/src/core/nginx.c (from vendor/nginx-1.11.1/src/core/nginx.c) vendor/nginx-1.11.3/src/core/nginx.h (from vendor/nginx-1.11.1/src/core/nginx.h) vendor/nginx-1.11.3/src/core/ngx_array.c (from vendor/nginx-1.11.1/src/core/ngx_array.c) vendor/nginx-1.11.3/src/core/ngx_array.h (from vendor/nginx-1.11.1/src/core/ngx_array.h) vendor/nginx-1.11.3/src/core/ngx_buf.c (from vendor/nginx-1.11.1/src/core/ngx_buf.c) vendor/nginx-1.11.3/src/core/ngx_buf.h (from vendor/nginx-1.11.1/src/core/ngx_buf.h) vendor/nginx-1.11.3/src/core/ngx_conf_file.c (from vendor/nginx-1.11.1/src/core/ngx_conf_file.c) vendor/nginx-1.11.3/src/core/ngx_conf_file.h (from vendor/nginx-1.11.1/src/core/ngx_conf_file.h) vendor/nginx-1.11.3/src/core/ngx_config.h (from vendor/nginx-1.11.1/src/core/ngx_config.h) vendor/nginx-1.11.3/src/core/ngx_connection.c (from vendor/nginx-1.11.1/src/core/ngx_connection.c) vendor/nginx-1.11.3/src/core/ngx_connection.h (from vendor/nginx-1.11.1/src/core/ngx_connection.h) vendor/nginx-1.11.3/src/core/ngx_core.h (from vendor/nginx-1.11.1/src/core/ngx_core.h) vendor/nginx-1.11.3/src/core/ngx_cpuinfo.c (from vendor/nginx-1.11.1/src/core/ngx_cpuinfo.c) vendor/nginx-1.11.3/src/core/ngx_crc.h (from vendor/nginx-1.11.1/src/core/ngx_crc.h) vendor/nginx-1.11.3/src/core/ngx_crc32.c (from vendor/nginx-1.11.1/src/core/ngx_crc32.c) vendor/nginx-1.11.3/src/core/ngx_crc32.h (from vendor/nginx-1.11.1/src/core/ngx_crc32.h) vendor/nginx-1.11.3/src/core/ngx_crypt.c (from vendor/nginx-1.11.1/src/core/ngx_crypt.c) vendor/nginx-1.11.3/src/core/ngx_crypt.h (from vendor/nginx-1.11.1/src/core/ngx_crypt.h) vendor/nginx-1.11.3/src/core/ngx_cycle.c (from vendor/nginx-1.11.1/src/core/ngx_cycle.c) vendor/nginx-1.11.3/src/core/ngx_cycle.h (from vendor/nginx-1.11.1/src/core/ngx_cycle.h) vendor/nginx-1.11.3/src/core/ngx_file.c (from vendor/nginx-1.11.1/src/core/ngx_file.c) vendor/nginx-1.11.3/src/core/ngx_file.h (from vendor/nginx-1.11.1/src/core/ngx_file.h) vendor/nginx-1.11.3/src/core/ngx_hash.c (from vendor/nginx-1.11.1/src/core/ngx_hash.c) vendor/nginx-1.11.3/src/core/ngx_hash.h (from vendor/nginx-1.11.1/src/core/ngx_hash.h) vendor/nginx-1.11.3/src/core/ngx_inet.c (from vendor/nginx-1.11.1/src/core/ngx_inet.c) vendor/nginx-1.11.3/src/core/ngx_inet.h (from vendor/nginx-1.11.1/src/core/ngx_inet.h) vendor/nginx-1.11.3/src/core/ngx_list.c (from vendor/nginx-1.11.1/src/core/ngx_list.c) vendor/nginx-1.11.3/src/core/ngx_list.h (from vendor/nginx-1.11.1/src/core/ngx_list.h) vendor/nginx-1.11.3/src/core/ngx_log.c (from vendor/nginx-1.11.1/src/core/ngx_log.c) vendor/nginx-1.11.3/src/core/ngx_log.h (from vendor/nginx-1.11.1/src/core/ngx_log.h) vendor/nginx-1.11.3/src/core/ngx_md5.c (from vendor/nginx-1.11.1/src/core/ngx_md5.c) vendor/nginx-1.11.3/src/core/ngx_md5.h (from vendor/nginx-1.11.1/src/core/ngx_md5.h) vendor/nginx-1.11.3/src/core/ngx_module.c (from vendor/nginx-1.11.1/src/core/ngx_module.c) vendor/nginx-1.11.3/src/core/ngx_module.h (from vendor/nginx-1.11.1/src/core/ngx_module.h) vendor/nginx-1.11.3/src/core/ngx_murmurhash.c (from vendor/nginx-1.11.1/src/core/ngx_murmurhash.c) vendor/nginx-1.11.3/src/core/ngx_murmurhash.h (from vendor/nginx-1.11.1/src/core/ngx_murmurhash.h) vendor/nginx-1.11.3/src/core/ngx_open_file_cache.c (from vendor/nginx-1.11.1/src/core/ngx_open_file_cache.c) vendor/nginx-1.11.3/src/core/ngx_open_file_cache.h (from vendor/nginx-1.11.1/src/core/ngx_open_file_cache.h) vendor/nginx-1.11.3/src/core/ngx_output_chain.c (from vendor/nginx-1.11.1/src/core/ngx_output_chain.c) vendor/nginx-1.11.3/src/core/ngx_palloc.c (from vendor/nginx-1.11.1/src/core/ngx_palloc.c) vendor/nginx-1.11.3/src/core/ngx_palloc.h (from vendor/nginx-1.11.1/src/core/ngx_palloc.h) vendor/nginx-1.11.3/src/core/ngx_parse.c (from vendor/nginx-1.11.1/src/core/ngx_parse.c) vendor/nginx-1.11.3/src/core/ngx_parse.h (from vendor/nginx-1.11.1/src/core/ngx_parse.h) vendor/nginx-1.11.3/src/core/ngx_parse_time.c (from vendor/nginx-1.11.1/src/core/ngx_parse_time.c) vendor/nginx-1.11.3/src/core/ngx_parse_time.h (from vendor/nginx-1.11.1/src/core/ngx_parse_time.h) vendor/nginx-1.11.3/src/core/ngx_proxy_protocol.c (from vendor/nginx-1.11.1/src/core/ngx_proxy_protocol.c) vendor/nginx-1.11.3/src/core/ngx_proxy_protocol.h (from vendor/nginx-1.11.1/src/core/ngx_proxy_protocol.h) vendor/nginx-1.11.3/src/core/ngx_queue.c (from vendor/nginx-1.11.1/src/core/ngx_queue.c) vendor/nginx-1.11.3/src/core/ngx_queue.h (from vendor/nginx-1.11.1/src/core/ngx_queue.h) vendor/nginx-1.11.3/src/core/ngx_radix_tree.c (from vendor/nginx-1.11.1/src/core/ngx_radix_tree.c) vendor/nginx-1.11.3/src/core/ngx_radix_tree.h (from vendor/nginx-1.11.1/src/core/ngx_radix_tree.h) vendor/nginx-1.11.3/src/core/ngx_rbtree.c (from vendor/nginx-1.11.1/src/core/ngx_rbtree.c) vendor/nginx-1.11.3/src/core/ngx_rbtree.h (from vendor/nginx-1.11.1/src/core/ngx_rbtree.h) vendor/nginx-1.11.3/src/core/ngx_regex.c (from vendor/nginx-1.11.1/src/core/ngx_regex.c) vendor/nginx-1.11.3/src/core/ngx_regex.h (from vendor/nginx-1.11.1/src/core/ngx_regex.h) vendor/nginx-1.11.3/src/core/ngx_resolver.c (from vendor/nginx-1.11.1/src/core/ngx_resolver.c) vendor/nginx-1.11.3/src/core/ngx_resolver.h (from vendor/nginx-1.11.1/src/core/ngx_resolver.h) vendor/nginx-1.11.3/src/core/ngx_rwlock.c (from vendor/nginx-1.11.1/src/core/ngx_rwlock.c) vendor/nginx-1.11.3/src/core/ngx_rwlock.h (from vendor/nginx-1.11.1/src/core/ngx_rwlock.h) vendor/nginx-1.11.3/src/core/ngx_shmtx.c (from vendor/nginx-1.11.1/src/core/ngx_shmtx.c) vendor/nginx-1.11.3/src/core/ngx_shmtx.h (from vendor/nginx-1.11.1/src/core/ngx_shmtx.h) vendor/nginx-1.11.3/src/core/ngx_slab.c (from vendor/nginx-1.11.1/src/core/ngx_slab.c) vendor/nginx-1.11.3/src/core/ngx_slab.h (from vendor/nginx-1.11.1/src/core/ngx_slab.h) vendor/nginx-1.11.3/src/core/ngx_spinlock.c (from vendor/nginx-1.11.1/src/core/ngx_spinlock.c) vendor/nginx-1.11.3/src/core/ngx_string.c (from vendor/nginx-1.11.1/src/core/ngx_string.c) vendor/nginx-1.11.3/src/core/ngx_string.h (from vendor/nginx-1.11.1/src/core/ngx_string.h) vendor/nginx-1.11.3/src/core/ngx_syslog.c (from vendor/nginx-1.11.1/src/core/ngx_syslog.c) vendor/nginx-1.11.3/src/core/ngx_syslog.h (from vendor/nginx-1.11.1/src/core/ngx_syslog.h) vendor/nginx-1.11.3/src/core/ngx_thread_pool.c (from vendor/nginx-1.11.1/src/core/ngx_thread_pool.c) vendor/nginx-1.11.3/src/core/ngx_thread_pool.h (from vendor/nginx-1.11.1/src/core/ngx_thread_pool.h) vendor/nginx-1.11.3/src/core/ngx_times.c (from vendor/nginx-1.11.1/src/core/ngx_times.c) vendor/nginx-1.11.3/src/core/ngx_times.h (from vendor/nginx-1.11.1/src/core/ngx_times.h) vendor/nginx-1.11.3/src/event/modules/ngx_devpoll_module.c (from vendor/nginx-1.11.1/src/event/modules/ngx_devpoll_module.c) vendor/nginx-1.11.3/src/event/modules/ngx_epoll_module.c (from vendor/nginx-1.11.1/src/event/modules/ngx_epoll_module.c) vendor/nginx-1.11.3/src/event/modules/ngx_eventport_module.c (from vendor/nginx-1.11.1/src/event/modules/ngx_eventport_module.c) vendor/nginx-1.11.3/src/event/modules/ngx_iocp_module.c (from vendor/nginx-1.11.1/src/event/modules/ngx_iocp_module.c) vendor/nginx-1.11.3/src/event/modules/ngx_iocp_module.h (from vendor/nginx-1.11.1/src/event/modules/ngx_iocp_module.h) vendor/nginx-1.11.3/src/event/modules/ngx_kqueue_module.c (from vendor/nginx-1.11.1/src/event/modules/ngx_kqueue_module.c) vendor/nginx-1.11.3/src/event/modules/ngx_poll_module.c (from vendor/nginx-1.11.1/src/event/modules/ngx_poll_module.c) vendor/nginx-1.11.3/src/event/modules/ngx_select_module.c (from vendor/nginx-1.11.1/src/event/modules/ngx_select_module.c) vendor/nginx-1.11.3/src/event/modules/ngx_win32_select_module.c (from vendor/nginx-1.11.1/src/event/modules/ngx_win32_select_module.c) vendor/nginx-1.11.3/src/event/ngx_event.c (from vendor/nginx-1.11.1/src/event/ngx_event.c) vendor/nginx-1.11.3/src/event/ngx_event.h (from vendor/nginx-1.11.1/src/event/ngx_event.h) vendor/nginx-1.11.3/src/event/ngx_event_accept.c (from vendor/nginx-1.11.1/src/event/ngx_event_accept.c) vendor/nginx-1.11.3/src/event/ngx_event_acceptex.c (from vendor/nginx-1.11.1/src/event/ngx_event_acceptex.c) vendor/nginx-1.11.3/src/event/ngx_event_connect.c (from vendor/nginx-1.11.1/src/event/ngx_event_connect.c) vendor/nginx-1.11.3/src/event/ngx_event_connect.h (from vendor/nginx-1.11.1/src/event/ngx_event_connect.h) vendor/nginx-1.11.3/src/event/ngx_event_connectex.c (from vendor/nginx-1.11.1/src/event/ngx_event_connectex.c) vendor/nginx-1.11.3/src/event/ngx_event_openssl.c (from vendor/nginx-1.11.1/src/event/ngx_event_openssl.c) vendor/nginx-1.11.3/src/event/ngx_event_openssl.h (from vendor/nginx-1.11.1/src/event/ngx_event_openssl.h) vendor/nginx-1.11.3/src/event/ngx_event_openssl_stapling.c (from vendor/nginx-1.11.1/src/event/ngx_event_openssl_stapling.c) vendor/nginx-1.11.3/src/event/ngx_event_pipe.c (from vendor/nginx-1.11.1/src/event/ngx_event_pipe.c) vendor/nginx-1.11.3/src/event/ngx_event_pipe.h (from vendor/nginx-1.11.1/src/event/ngx_event_pipe.h) vendor/nginx-1.11.3/src/event/ngx_event_posted.c (from vendor/nginx-1.11.1/src/event/ngx_event_posted.c) vendor/nginx-1.11.3/src/event/ngx_event_posted.h (from vendor/nginx-1.11.1/src/event/ngx_event_posted.h) vendor/nginx-1.11.3/src/event/ngx_event_timer.c (from vendor/nginx-1.11.1/src/event/ngx_event_timer.c) vendor/nginx-1.11.3/src/event/ngx_event_timer.h (from vendor/nginx-1.11.1/src/event/ngx_event_timer.h) vendor/nginx-1.11.3/src/http/modules/ngx_http_access_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_access_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_addition_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_addition_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_auth_basic_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_auth_basic_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_auth_request_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_auth_request_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_autoindex_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_autoindex_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_browser_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_browser_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_charset_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_charset_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_chunked_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_chunked_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_dav_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_dav_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_degradation_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_degradation_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_empty_gif_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_empty_gif_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_fastcgi_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_fastcgi_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_flv_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_flv_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_gunzip_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_gunzip_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_gzip_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_gzip_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_gzip_static_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_gzip_static_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_headers_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_headers_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_image_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_image_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_index_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_index_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_limit_conn_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_limit_conn_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_limit_req_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_limit_req_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_log_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_log_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_memcached_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_memcached_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_mp4_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_mp4_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_not_modified_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_not_modified_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_proxy_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_proxy_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_random_index_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_random_index_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_range_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_range_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_realip_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_realip_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_referer_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_referer_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_rewrite_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_rewrite_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_scgi_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_scgi_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_secure_link_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_secure_link_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_slice_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_slice_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_ssi_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_ssi_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_ssi_filter_module.h (from vendor/nginx-1.11.1/src/http/modules/ngx_http_ssi_filter_module.h) vendor/nginx-1.11.3/src/http/modules/ngx_http_ssl_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_ssl_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_ssl_module.h (from vendor/nginx-1.11.1/src/http/modules/ngx_http_ssl_module.h) vendor/nginx-1.11.3/src/http/modules/ngx_http_static_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_static_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_stub_status_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_stub_status_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_sub_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_sub_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_upstream_hash_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_upstream_hash_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_upstream_ip_hash_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_upstream_ip_hash_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_upstream_keepalive_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_upstream_keepalive_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_upstream_least_conn_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_upstream_least_conn_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_upstream_zone_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_upstream_zone_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_userid_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_userid_filter_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_uwsgi_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_uwsgi_module.c) vendor/nginx-1.11.3/src/http/modules/ngx_http_xslt_filter_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_xslt_filter_module.c) vendor/nginx-1.11.3/src/http/modules/perl/Makefile.PL (from vendor/nginx-1.11.1/src/http/modules/perl/Makefile.PL) vendor/nginx-1.11.3/src/http/modules/perl/nginx.pm (from vendor/nginx-1.11.1/src/http/modules/perl/nginx.pm) vendor/nginx-1.11.3/src/http/modules/perl/nginx.xs (from vendor/nginx-1.11.1/src/http/modules/perl/nginx.xs) vendor/nginx-1.11.3/src/http/modules/perl/ngx_http_perl_module.c (from vendor/nginx-1.11.1/src/http/modules/perl/ngx_http_perl_module.c) vendor/nginx-1.11.3/src/http/modules/perl/ngx_http_perl_module.h (from vendor/nginx-1.11.1/src/http/modules/perl/ngx_http_perl_module.h) vendor/nginx-1.11.3/src/http/modules/perl/typemap (from vendor/nginx-1.11.1/src/http/modules/perl/typemap) vendor/nginx-1.11.3/src/http/ngx_http.c (from vendor/nginx-1.11.1/src/http/ngx_http.c) vendor/nginx-1.11.3/src/http/ngx_http.h (from vendor/nginx-1.11.1/src/http/ngx_http.h) vendor/nginx-1.11.3/src/http/ngx_http_cache.h (from vendor/nginx-1.11.1/src/http/ngx_http_cache.h) vendor/nginx-1.11.3/src/http/ngx_http_config.h (from vendor/nginx-1.11.1/src/http/ngx_http_config.h) vendor/nginx-1.11.3/src/http/ngx_http_copy_filter_module.c (from vendor/nginx-1.11.1/src/http/ngx_http_copy_filter_module.c) vendor/nginx-1.11.3/src/http/ngx_http_core_module.c (from vendor/nginx-1.11.1/src/http/ngx_http_core_module.c) vendor/nginx-1.11.3/src/http/ngx_http_core_module.h (from vendor/nginx-1.11.1/src/http/ngx_http_core_module.h) vendor/nginx-1.11.3/src/http/ngx_http_file_cache.c (from vendor/nginx-1.11.1/src/http/ngx_http_file_cache.c) vendor/nginx-1.11.3/src/http/ngx_http_header_filter_module.c (from vendor/nginx-1.11.1/src/http/ngx_http_header_filter_module.c) vendor/nginx-1.11.3/src/http/ngx_http_parse.c (from vendor/nginx-1.11.1/src/http/ngx_http_parse.c) vendor/nginx-1.11.3/src/http/ngx_http_postpone_filter_module.c (from vendor/nginx-1.11.1/src/http/ngx_http_postpone_filter_module.c) vendor/nginx-1.11.3/src/http/ngx_http_request.c (from vendor/nginx-1.11.1/src/http/ngx_http_request.c) vendor/nginx-1.11.3/src/http/ngx_http_request.h (from vendor/nginx-1.11.1/src/http/ngx_http_request.h) vendor/nginx-1.11.3/src/http/ngx_http_request_body.c (from vendor/nginx-1.11.1/src/http/ngx_http_request_body.c) vendor/nginx-1.11.3/src/http/ngx_http_script.c (from vendor/nginx-1.11.1/src/http/ngx_http_script.c) vendor/nginx-1.11.3/src/http/ngx_http_script.h (from vendor/nginx-1.11.1/src/http/ngx_http_script.h) vendor/nginx-1.11.3/src/http/ngx_http_special_response.c (from vendor/nginx-1.11.1/src/http/ngx_http_special_response.c) vendor/nginx-1.11.3/src/http/ngx_http_upstream.c (from vendor/nginx-1.11.1/src/http/ngx_http_upstream.c) vendor/nginx-1.11.3/src/http/ngx_http_upstream.h (from vendor/nginx-1.11.1/src/http/ngx_http_upstream.h) vendor/nginx-1.11.3/src/http/ngx_http_upstream_round_robin.c (from vendor/nginx-1.11.1/src/http/ngx_http_upstream_round_robin.c) vendor/nginx-1.11.3/src/http/ngx_http_upstream_round_robin.h (from vendor/nginx-1.11.1/src/http/ngx_http_upstream_round_robin.h) vendor/nginx-1.11.3/src/http/ngx_http_variables.c (from vendor/nginx-1.11.1/src/http/ngx_http_variables.c) vendor/nginx-1.11.3/src/http/ngx_http_variables.h (from vendor/nginx-1.11.1/src/http/ngx_http_variables.h) vendor/nginx-1.11.3/src/http/ngx_http_write_filter_module.c (from vendor/nginx-1.11.1/src/http/ngx_http_write_filter_module.c) vendor/nginx-1.11.3/src/http/v2/ngx_http_v2.c (from vendor/nginx-1.11.1/src/http/v2/ngx_http_v2.c) vendor/nginx-1.11.3/src/http/v2/ngx_http_v2.h (from vendor/nginx-1.11.1/src/http/v2/ngx_http_v2.h) vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_filter_module.c (from vendor/nginx-1.11.1/src/http/v2/ngx_http_v2_filter_module.c) vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_huff_decode.c (from vendor/nginx-1.11.1/src/http/v2/ngx_http_v2_huff_decode.c) vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_huff_encode.c (from vendor/nginx-1.11.1/src/http/v2/ngx_http_v2_huff_encode.c) vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_module.c (from vendor/nginx-1.11.1/src/http/v2/ngx_http_v2_module.c) vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_module.h (from vendor/nginx-1.11.1/src/http/v2/ngx_http_v2_module.h) vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_table.c (from vendor/nginx-1.11.1/src/http/v2/ngx_http_v2_table.c) vendor/nginx-1.11.3/src/mail/ngx_mail.c (from vendor/nginx-1.11.1/src/mail/ngx_mail.c) vendor/nginx-1.11.3/src/mail/ngx_mail.h (from vendor/nginx-1.11.1/src/mail/ngx_mail.h) vendor/nginx-1.11.3/src/mail/ngx_mail_auth_http_module.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_auth_http_module.c) vendor/nginx-1.11.3/src/mail/ngx_mail_core_module.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_core_module.c) vendor/nginx-1.11.3/src/mail/ngx_mail_handler.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_handler.c) vendor/nginx-1.11.3/src/mail/ngx_mail_imap_handler.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_imap_handler.c) vendor/nginx-1.11.3/src/mail/ngx_mail_imap_module.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_imap_module.c) vendor/nginx-1.11.3/src/mail/ngx_mail_imap_module.h (from vendor/nginx-1.11.1/src/mail/ngx_mail_imap_module.h) vendor/nginx-1.11.3/src/mail/ngx_mail_parse.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_parse.c) vendor/nginx-1.11.3/src/mail/ngx_mail_pop3_handler.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_pop3_handler.c) vendor/nginx-1.11.3/src/mail/ngx_mail_pop3_module.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_pop3_module.c) vendor/nginx-1.11.3/src/mail/ngx_mail_pop3_module.h (from vendor/nginx-1.11.1/src/mail/ngx_mail_pop3_module.h) vendor/nginx-1.11.3/src/mail/ngx_mail_proxy_module.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_proxy_module.c) vendor/nginx-1.11.3/src/mail/ngx_mail_smtp_handler.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_smtp_handler.c) vendor/nginx-1.11.3/src/mail/ngx_mail_smtp_module.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_smtp_module.c) vendor/nginx-1.11.3/src/mail/ngx_mail_smtp_module.h (from vendor/nginx-1.11.1/src/mail/ngx_mail_smtp_module.h) vendor/nginx-1.11.3/src/mail/ngx_mail_ssl_module.c (from vendor/nginx-1.11.1/src/mail/ngx_mail_ssl_module.c) vendor/nginx-1.11.3/src/mail/ngx_mail_ssl_module.h (from vendor/nginx-1.11.1/src/mail/ngx_mail_ssl_module.h) vendor/nginx-1.11.3/src/misc/ngx_cpp_test_module.cpp (from vendor/nginx-1.11.1/src/misc/ngx_cpp_test_module.cpp) vendor/nginx-1.11.3/src/misc/ngx_google_perftools_module.c (from vendor/nginx-1.11.1/src/misc/ngx_google_perftools_module.c) vendor/nginx-1.11.3/src/os/unix/ngx_alloc.c (from vendor/nginx-1.11.1/src/os/unix/ngx_alloc.c) vendor/nginx-1.11.3/src/os/unix/ngx_alloc.h (from vendor/nginx-1.11.1/src/os/unix/ngx_alloc.h) vendor/nginx-1.11.3/src/os/unix/ngx_atomic.h (from vendor/nginx-1.11.1/src/os/unix/ngx_atomic.h) vendor/nginx-1.11.3/src/os/unix/ngx_channel.c (from vendor/nginx-1.11.1/src/os/unix/ngx_channel.c) vendor/nginx-1.11.3/src/os/unix/ngx_channel.h (from vendor/nginx-1.11.1/src/os/unix/ngx_channel.h) vendor/nginx-1.11.3/src/os/unix/ngx_daemon.c (from vendor/nginx-1.11.1/src/os/unix/ngx_daemon.c) vendor/nginx-1.11.3/src/os/unix/ngx_darwin.h (from vendor/nginx-1.11.1/src/os/unix/ngx_darwin.h) vendor/nginx-1.11.3/src/os/unix/ngx_darwin_config.h (from vendor/nginx-1.11.1/src/os/unix/ngx_darwin_config.h) vendor/nginx-1.11.3/src/os/unix/ngx_darwin_init.c (from vendor/nginx-1.11.1/src/os/unix/ngx_darwin_init.c) vendor/nginx-1.11.3/src/os/unix/ngx_darwin_sendfile_chain.c (from vendor/nginx-1.11.1/src/os/unix/ngx_darwin_sendfile_chain.c) vendor/nginx-1.11.3/src/os/unix/ngx_dlopen.c (from vendor/nginx-1.11.1/src/os/unix/ngx_dlopen.c) vendor/nginx-1.11.3/src/os/unix/ngx_dlopen.h (from vendor/nginx-1.11.1/src/os/unix/ngx_dlopen.h) vendor/nginx-1.11.3/src/os/unix/ngx_errno.c (from vendor/nginx-1.11.1/src/os/unix/ngx_errno.c) vendor/nginx-1.11.3/src/os/unix/ngx_errno.h (from vendor/nginx-1.11.1/src/os/unix/ngx_errno.h) vendor/nginx-1.11.3/src/os/unix/ngx_file_aio_read.c (from vendor/nginx-1.11.1/src/os/unix/ngx_file_aio_read.c) vendor/nginx-1.11.3/src/os/unix/ngx_files.c (from vendor/nginx-1.11.1/src/os/unix/ngx_files.c) vendor/nginx-1.11.3/src/os/unix/ngx_files.h (from vendor/nginx-1.11.1/src/os/unix/ngx_files.h) vendor/nginx-1.11.3/src/os/unix/ngx_freebsd.h (from vendor/nginx-1.11.1/src/os/unix/ngx_freebsd.h) vendor/nginx-1.11.3/src/os/unix/ngx_freebsd_config.h (from vendor/nginx-1.11.1/src/os/unix/ngx_freebsd_config.h) vendor/nginx-1.11.3/src/os/unix/ngx_freebsd_init.c (from vendor/nginx-1.11.1/src/os/unix/ngx_freebsd_init.c) vendor/nginx-1.11.3/src/os/unix/ngx_freebsd_sendfile_chain.c (from vendor/nginx-1.11.1/src/os/unix/ngx_freebsd_sendfile_chain.c) vendor/nginx-1.11.3/src/os/unix/ngx_gcc_atomic_amd64.h (from vendor/nginx-1.11.1/src/os/unix/ngx_gcc_atomic_amd64.h) vendor/nginx-1.11.3/src/os/unix/ngx_gcc_atomic_ppc.h (from vendor/nginx-1.11.1/src/os/unix/ngx_gcc_atomic_ppc.h) vendor/nginx-1.11.3/src/os/unix/ngx_gcc_atomic_sparc64.h (from vendor/nginx-1.11.1/src/os/unix/ngx_gcc_atomic_sparc64.h) vendor/nginx-1.11.3/src/os/unix/ngx_gcc_atomic_x86.h (from vendor/nginx-1.11.1/src/os/unix/ngx_gcc_atomic_x86.h) vendor/nginx-1.11.3/src/os/unix/ngx_linux.h (from vendor/nginx-1.11.1/src/os/unix/ngx_linux.h) vendor/nginx-1.11.3/src/os/unix/ngx_linux_aio_read.c (from vendor/nginx-1.11.1/src/os/unix/ngx_linux_aio_read.c) vendor/nginx-1.11.3/src/os/unix/ngx_linux_config.h (from vendor/nginx-1.11.1/src/os/unix/ngx_linux_config.h) vendor/nginx-1.11.3/src/os/unix/ngx_linux_init.c (from vendor/nginx-1.11.1/src/os/unix/ngx_linux_init.c) vendor/nginx-1.11.3/src/os/unix/ngx_linux_sendfile_chain.c (from vendor/nginx-1.11.1/src/os/unix/ngx_linux_sendfile_chain.c) vendor/nginx-1.11.3/src/os/unix/ngx_os.h (from vendor/nginx-1.11.1/src/os/unix/ngx_os.h) vendor/nginx-1.11.3/src/os/unix/ngx_posix_config.h (from vendor/nginx-1.11.1/src/os/unix/ngx_posix_config.h) vendor/nginx-1.11.3/src/os/unix/ngx_posix_init.c (from vendor/nginx-1.11.1/src/os/unix/ngx_posix_init.c) vendor/nginx-1.11.3/src/os/unix/ngx_process.c (from vendor/nginx-1.11.1/src/os/unix/ngx_process.c) vendor/nginx-1.11.3/src/os/unix/ngx_process.h (from vendor/nginx-1.11.1/src/os/unix/ngx_process.h) vendor/nginx-1.11.3/src/os/unix/ngx_process_cycle.c (from vendor/nginx-1.11.1/src/os/unix/ngx_process_cycle.c) vendor/nginx-1.11.3/src/os/unix/ngx_process_cycle.h (from vendor/nginx-1.11.1/src/os/unix/ngx_process_cycle.h) vendor/nginx-1.11.3/src/os/unix/ngx_readv_chain.c (from vendor/nginx-1.11.1/src/os/unix/ngx_readv_chain.c) vendor/nginx-1.11.3/src/os/unix/ngx_recv.c (from vendor/nginx-1.11.1/src/os/unix/ngx_recv.c) vendor/nginx-1.11.3/src/os/unix/ngx_send.c (from vendor/nginx-1.11.1/src/os/unix/ngx_send.c) vendor/nginx-1.11.3/src/os/unix/ngx_setaffinity.c (from vendor/nginx-1.11.1/src/os/unix/ngx_setaffinity.c) vendor/nginx-1.11.3/src/os/unix/ngx_setaffinity.h (from vendor/nginx-1.11.1/src/os/unix/ngx_setaffinity.h) vendor/nginx-1.11.3/src/os/unix/ngx_setproctitle.c (from vendor/nginx-1.11.1/src/os/unix/ngx_setproctitle.c) vendor/nginx-1.11.3/src/os/unix/ngx_setproctitle.h (from vendor/nginx-1.11.1/src/os/unix/ngx_setproctitle.h) vendor/nginx-1.11.3/src/os/unix/ngx_shmem.c (from vendor/nginx-1.11.1/src/os/unix/ngx_shmem.c) vendor/nginx-1.11.3/src/os/unix/ngx_shmem.h (from vendor/nginx-1.11.1/src/os/unix/ngx_shmem.h) vendor/nginx-1.11.3/src/os/unix/ngx_socket.c (from vendor/nginx-1.11.1/src/os/unix/ngx_socket.c) vendor/nginx-1.11.3/src/os/unix/ngx_socket.h (from vendor/nginx-1.11.1/src/os/unix/ngx_socket.h) vendor/nginx-1.11.3/src/os/unix/ngx_solaris.h (from vendor/nginx-1.11.1/src/os/unix/ngx_solaris.h) vendor/nginx-1.11.3/src/os/unix/ngx_solaris_config.h (from vendor/nginx-1.11.1/src/os/unix/ngx_solaris_config.h) vendor/nginx-1.11.3/src/os/unix/ngx_solaris_init.c (from vendor/nginx-1.11.1/src/os/unix/ngx_solaris_init.c) vendor/nginx-1.11.3/src/os/unix/ngx_solaris_sendfilev_chain.c (from vendor/nginx-1.11.1/src/os/unix/ngx_solaris_sendfilev_chain.c) vendor/nginx-1.11.3/src/os/unix/ngx_sunpro_amd64.il (from vendor/nginx-1.11.1/src/os/unix/ngx_sunpro_amd64.il) vendor/nginx-1.11.3/src/os/unix/ngx_sunpro_atomic_sparc64.h (from vendor/nginx-1.11.1/src/os/unix/ngx_sunpro_atomic_sparc64.h) vendor/nginx-1.11.3/src/os/unix/ngx_sunpro_sparc64.il (from vendor/nginx-1.11.1/src/os/unix/ngx_sunpro_sparc64.il) vendor/nginx-1.11.3/src/os/unix/ngx_sunpro_x86.il (from vendor/nginx-1.11.1/src/os/unix/ngx_sunpro_x86.il) vendor/nginx-1.11.3/src/os/unix/ngx_thread.h (from vendor/nginx-1.11.1/src/os/unix/ngx_thread.h) vendor/nginx-1.11.3/src/os/unix/ngx_thread_cond.c (from vendor/nginx-1.11.1/src/os/unix/ngx_thread_cond.c) vendor/nginx-1.11.3/src/os/unix/ngx_thread_id.c (from vendor/nginx-1.11.1/src/os/unix/ngx_thread_id.c) vendor/nginx-1.11.3/src/os/unix/ngx_thread_mutex.c (from vendor/nginx-1.11.1/src/os/unix/ngx_thread_mutex.c) vendor/nginx-1.11.3/src/os/unix/ngx_time.c (from vendor/nginx-1.11.1/src/os/unix/ngx_time.c) vendor/nginx-1.11.3/src/os/unix/ngx_time.h (from vendor/nginx-1.11.1/src/os/unix/ngx_time.h) vendor/nginx-1.11.3/src/os/unix/ngx_udp_recv.c (from vendor/nginx-1.11.1/src/os/unix/ngx_udp_recv.c) vendor/nginx-1.11.3/src/os/unix/ngx_udp_send.c (from vendor/nginx-1.11.1/src/os/unix/ngx_udp_send.c) vendor/nginx-1.11.3/src/os/unix/ngx_user.c (from vendor/nginx-1.11.1/src/os/unix/ngx_user.c) vendor/nginx-1.11.3/src/os/unix/ngx_user.h (from vendor/nginx-1.11.1/src/os/unix/ngx_user.h) vendor/nginx-1.11.3/src/os/unix/ngx_writev_chain.c (from vendor/nginx-1.11.1/src/os/unix/ngx_writev_chain.c) vendor/nginx-1.11.3/src/os/win32/nginx.ico (from vendor/nginx-1.11.1/src/os/win32/nginx.ico) vendor/nginx-1.11.3/src/os/win32/nginx.rc (from vendor/nginx-1.11.1/src/os/win32/nginx.rc) vendor/nginx-1.11.3/src/os/win32/nginx_icon16.xpm (from vendor/nginx-1.11.1/src/os/win32/nginx_icon16.xpm) vendor/nginx-1.11.3/src/os/win32/nginx_icon32.xpm (from vendor/nginx-1.11.1/src/os/win32/nginx_icon32.xpm) vendor/nginx-1.11.3/src/os/win32/nginx_icon48.xpm (from vendor/nginx-1.11.1/src/os/win32/nginx_icon48.xpm) vendor/nginx-1.11.3/src/os/win32/ngx_alloc.c (from vendor/nginx-1.11.1/src/os/win32/ngx_alloc.c) vendor/nginx-1.11.3/src/os/win32/ngx_alloc.h (from vendor/nginx-1.11.1/src/os/win32/ngx_alloc.h) vendor/nginx-1.11.3/src/os/win32/ngx_atomic.h (from vendor/nginx-1.11.1/src/os/win32/ngx_atomic.h) vendor/nginx-1.11.3/src/os/win32/ngx_dlopen.c (from vendor/nginx-1.11.1/src/os/win32/ngx_dlopen.c) vendor/nginx-1.11.3/src/os/win32/ngx_dlopen.h (from vendor/nginx-1.11.1/src/os/win32/ngx_dlopen.h) vendor/nginx-1.11.3/src/os/win32/ngx_errno.c (from vendor/nginx-1.11.1/src/os/win32/ngx_errno.c) vendor/nginx-1.11.3/src/os/win32/ngx_errno.h (from vendor/nginx-1.11.1/src/os/win32/ngx_errno.h) vendor/nginx-1.11.3/src/os/win32/ngx_event_log.c (from vendor/nginx-1.11.1/src/os/win32/ngx_event_log.c) vendor/nginx-1.11.3/src/os/win32/ngx_files.c (from vendor/nginx-1.11.1/src/os/win32/ngx_files.c) vendor/nginx-1.11.3/src/os/win32/ngx_files.h (from vendor/nginx-1.11.1/src/os/win32/ngx_files.h) vendor/nginx-1.11.3/src/os/win32/ngx_os.h (from vendor/nginx-1.11.1/src/os/win32/ngx_os.h) vendor/nginx-1.11.3/src/os/win32/ngx_process.c (from vendor/nginx-1.11.1/src/os/win32/ngx_process.c) vendor/nginx-1.11.3/src/os/win32/ngx_process.h (from vendor/nginx-1.11.1/src/os/win32/ngx_process.h) vendor/nginx-1.11.3/src/os/win32/ngx_process_cycle.c (from vendor/nginx-1.11.1/src/os/win32/ngx_process_cycle.c) vendor/nginx-1.11.3/src/os/win32/ngx_process_cycle.h (from vendor/nginx-1.11.1/src/os/win32/ngx_process_cycle.h) vendor/nginx-1.11.3/src/os/win32/ngx_service.c (from vendor/nginx-1.11.1/src/os/win32/ngx_service.c) vendor/nginx-1.11.3/src/os/win32/ngx_shmem.c (from vendor/nginx-1.11.1/src/os/win32/ngx_shmem.c) vendor/nginx-1.11.3/src/os/win32/ngx_shmem.h (from vendor/nginx-1.11.1/src/os/win32/ngx_shmem.h) vendor/nginx-1.11.3/src/os/win32/ngx_socket.c (from vendor/nginx-1.11.1/src/os/win32/ngx_socket.c) vendor/nginx-1.11.3/src/os/win32/ngx_socket.h (from vendor/nginx-1.11.1/src/os/win32/ngx_socket.h) vendor/nginx-1.11.3/src/os/win32/ngx_stat.c (from vendor/nginx-1.11.1/src/os/win32/ngx_stat.c) vendor/nginx-1.11.3/src/os/win32/ngx_thread.c (from vendor/nginx-1.11.1/src/os/win32/ngx_thread.c) vendor/nginx-1.11.3/src/os/win32/ngx_thread.h (from vendor/nginx-1.11.1/src/os/win32/ngx_thread.h) vendor/nginx-1.11.3/src/os/win32/ngx_time.c (from vendor/nginx-1.11.1/src/os/win32/ngx_time.c) vendor/nginx-1.11.3/src/os/win32/ngx_time.h (from vendor/nginx-1.11.1/src/os/win32/ngx_time.h) vendor/nginx-1.11.3/src/os/win32/ngx_udp_wsarecv.c (from vendor/nginx-1.11.1/src/os/win32/ngx_udp_wsarecv.c) vendor/nginx-1.11.3/src/os/win32/ngx_user.c (from vendor/nginx-1.11.1/src/os/win32/ngx_user.c) vendor/nginx-1.11.3/src/os/win32/ngx_user.h (from vendor/nginx-1.11.1/src/os/win32/ngx_user.h) vendor/nginx-1.11.3/src/os/win32/ngx_win32_config.h (from vendor/nginx-1.11.1/src/os/win32/ngx_win32_config.h) vendor/nginx-1.11.3/src/os/win32/ngx_win32_init.c (from vendor/nginx-1.11.1/src/os/win32/ngx_win32_init.c) vendor/nginx-1.11.3/src/os/win32/ngx_wsarecv.c (from vendor/nginx-1.11.1/src/os/win32/ngx_wsarecv.c) vendor/nginx-1.11.3/src/os/win32/ngx_wsarecv_chain.c (from vendor/nginx-1.11.1/src/os/win32/ngx_wsarecv_chain.c) vendor/nginx-1.11.3/src/os/win32/ngx_wsasend.c (from vendor/nginx-1.11.1/src/os/win32/ngx_wsasend.c) vendor/nginx-1.11.3/src/os/win32/ngx_wsasend_chain.c (from vendor/nginx-1.11.1/src/os/win32/ngx_wsasend_chain.c) vendor/nginx-1.11.3/src/stream/ngx_stream.c (from vendor/nginx-1.11.1/src/stream/ngx_stream.c) vendor/nginx-1.11.3/src/stream/ngx_stream_access_module.c (from vendor/nginx-1.11.1/src/stream/ngx_stream_access_module.c) vendor/nginx-1.11.3/src/stream/ngx_stream_core_module.c (from vendor/nginx-1.11.1/src/stream/ngx_stream_core_module.c) vendor/nginx-1.11.3/src/stream/ngx_stream_geo_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_geo_module.c) vendor/nginx-1.11.3/src/stream/ngx_stream_geoip_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_geoip_module.c) vendor/nginx-1.11.3/src/stream/ngx_stream_handler.c (from vendor/nginx-1.11.1/src/stream/ngx_stream_handler.c) vendor/nginx-1.11.3/src/stream/ngx_stream_limit_conn_module.c (from vendor/nginx-1.11.1/src/stream/ngx_stream_limit_conn_module.c) vendor/nginx-1.11.3/src/stream/ngx_stream_map_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_map_module.c) vendor/nginx-1.11.3/src/stream/ngx_stream_proxy_module.c (from vendor/nginx-1.11.1/src/stream/ngx_stream_proxy_module.c) vendor/nginx-1.11.3/src/stream/ngx_stream_split_clients_module.c (from vendor/nginx-1.11.1/src/http/modules/ngx_http_split_clients_module.c) vendor/nginx-1.11.3/src/stream/ngx_stream_ssl_module.c (from vendor/nginx-1.11.1/src/stream/ngx_stream_ssl_module.c) vendor/nginx-1.11.3/src/stream/ngx_stream_ssl_module.h (from vendor/nginx-1.11.1/src/stream/ngx_stream_ssl_module.h) vendor/nginx-1.11.3/src/stream/ngx_stream_upstream.c (from vendor/nginx-1.11.1/src/stream/ngx_stream_upstream.c) vendor/nginx-1.11.3/src/stream/ngx_stream_upstream.h (from vendor/nginx-1.11.1/src/stream/ngx_stream_upstream.h) vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_hash_module.c (from vendor/nginx-1.11.1/src/stream/ngx_stream_upstream_hash_module.c) vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_least_conn_module.c (from vendor/nginx-1.11.1/src/stream/ngx_stream_upstream_least_conn_module.c) vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_round_robin.c (from vendor/nginx-1.11.1/src/stream/ngx_stream_upstream_round_robin.c) vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_round_robin.h (from vendor/nginx-1.11.1/src/stream/ngx_stream_upstream_round_robin.h) vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_zone_module.c (from vendor/nginx-1.11.1/src/stream/ngx_stream_upstream_zone_module.c) Modified: nginx_version (+1 -1) =================================================================== --- nginx_version 2016-07-27 12:58:24 +0900 (720c738) +++ nginx_version 2016-07-27 13:06:13 +0900 (0a5af26) @@ -1 +1 @@ -1.11.1 +1.11.3 Deleted: vendor/nginx-1.11.1/auto/lib/md5/conf (+0 -103) 100644 =================================================================== --- vendor/nginx-1.11.1/auto/lib/md5/conf 2016-07-27 12:58:24 +0900 (49c0ddf) +++ /dev/null @@ -1,103 +0,0 @@ - -# Copyright (C) Igor Sysoev -# Copyright (C) Nginx, Inc. - - -if [ $MD5 != NONE ]; then - - if grep MD5_Init $MD5/md5.h 2>&1 >/dev/null; then - # OpenSSL md5 - OPENSSL_MD5=YES - have=NGX_HAVE_OPENSSL_MD5 . auto/have - have=NGX_OPENSSL_MD5 . auto/have - else - # rsaref md5 - OPENSSL_MD5=NO - fi - - have=NGX_HAVE_MD5 . auto/have - CORE_INCS="$CORE_INCS $MD5" - - case "$NGX_CC_NAME" in - - msvc | owc | bcc) - LINK_DEPS="$LINK_DEPS $MD5/md5.lib" - CORE_LIBS="$CORE_LIBS $MD5/md5.lib" - ;; - - icc) - LINK_DEPS="$LINK_DEPS $MD5/libmd5.a" - - # to allow -ipo optimization we link with the *.o but not library - CORE_LIBS="$CORE_LIBS $MD5/md5_dgst.o" - - if [ $MD5_ASM = YES ]; then - CORE_LIBS="$CORE_LIBS $MD5/asm/mx86-elf.o" - fi - ;; - - *) - LINK_DEPS="$LINK_DEPS $MD5/libmd5.a" - CORE_LIBS="$CORE_LIBS $MD5/libmd5.a" - #CORE_LIBS="$CORE_LIBS -L $MD5 -lmd5" - ;; - - esac - -else - - if [ "$NGX_PLATFORM" != win32 ]; then - - MD5=NO - - # FreeBSD, Solaris 10 - - ngx_feature="md5 in system md library" - ngx_feature_name=NGX_HAVE_MD5 - ngx_feature_run=no - ngx_feature_incs="#include <md5.h>" - ngx_feature_path= - ngx_feature_libs="-lmd" - ngx_feature_test="MD5_CTX md5; MD5Init(&md5)" - . auto/feature - - ngx_md5_lib="system md" - - if [ $ngx_found = no ]; then - - # Solaris 8/9 - - ngx_feature="md5 in system md5 library" - ngx_feature_libs="-lmd5" - . auto/feature - - ngx_md5_lib="system md5" - fi - - if [ $ngx_found = no ]; then - - # OpenSSL crypto library - - ngx_feature="md5 in system OpenSSL crypto library" - ngx_feature_name="NGX_OPENSSL_MD5" - ngx_feature_incs="#include <openssl/md5.h>" - ngx_feature_libs="-lcrypto" - ngx_feature_test="MD5_CTX md5; MD5_Init(&md5)" - . auto/feature - - ngx_md5_lib="system crypto" - - if [ $ngx_found = yes ]; then - have=NGX_HAVE_OPENSSL_MD5_H . auto/have - have=NGX_HAVE_MD5 . auto/have - fi - fi - - if [ $ngx_found = yes ]; then - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - MD5=YES - MD5_LIB=$ngx_md5_lib - fi - fi - -fi Deleted: vendor/nginx-1.11.1/auto/lib/md5/make (+0 -96) 100644 =================================================================== --- vendor/nginx-1.11.1/auto/lib/md5/make 2016-07-27 12:58:24 +0900 (7000b20) +++ /dev/null @@ -1,96 +0,0 @@ - -# Copyright (C) Igor Sysoev -# Copyright (C) Nginx, Inc. - - -case "$NGX_CC_NAME" in - - msvc) - ngx_makefile=makefile.msvc - ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC MD5_ASM=$MD5_ASM" - ngx_md5="MD5=\"$MD5\"" - ;; - - owc) - ngx_makefile=makefile.owc - ngx_opt="CPU_OPT=\"$CPU_OPT\"" - ngx_md5=`echo MD5=\"$MD5\" | sed -e "s/\//$ngx_regex_dirsep/g"` - ;; - - bcc) - ngx_makefile=makefile.bcc - ngx_opt="-DCPU_OPT=\"$CPU_OPT\" -DMD5_ASM=$MD5_ASM" - ngx_md5=`echo \-DMD5=\"$MD5\" | sed -e "s/\//$ngx_regex_dirsep/g"` - ;; - -esac - - -done=NO - - -case "$NGX_PLATFORM" in - - win32) - cat << END >> $NGX_MAKEFILE - -`echo "$MD5/md5.lib: $NGX_MAKEFILE" | sed -e "s/\//$ngx_regex_dirsep/g"` - \$(MAKE) -f auto/lib/md5/$ngx_makefile $ngx_opt $ngx_md5 - -END - - done=YES - ;; - - SunOS:*:i86pc) - if [ $MD5_ASM = YES ]; then - - cat << END >> $NGX_MAKEFILE - -$MD5/libmd5.a: $NGX_MAKEFILE - cd $MD5 \\ - && \$(MAKE) CFLAGS="$MD5_OPT -DSOL -DMD5_ASM -DL_ENDIAN" \\ - CC="\$(CC)" CPP="\$(CPP)" \\ - MD5_ASM_OBJ=asm/mx86-sol.o clean libmd5.a - -END - - done=YES - fi - ;; - - # FreeBSD: i386 - # Linux: i686 - - *:i386 | *:i686) - if [ $MD5_ASM = YES ]; then - - cat << END >> $NGX_MAKEFILE - -$MD5/libmd5.a: $NGX_MAKEFILE - cd $MD5 \\ - && \$(MAKE) CFLAGS="$MD5_OPT -DELF -DMD5_ASM -DL_ENDIAN" \\ - CC="\$(CC)" CPP="\$(CPP)" \\ - MD5_ASM_OBJ=asm/mx86-elf.o clean libmd5.a - -END - - done=YES - fi - ;; - -esac - - -if [ $done = NO ]; then - - cat << END >> $NGX_MAKEFILE - -$MD5/libmd5.a: $NGX_MAKEFILE - cd $MD5 \\ - && \$(MAKE) CFLAGS="$MD5_OPT" \\ - CC="\$(CC)" MD5_ASM_OBJ= clean libmd5.a - -END - -fi Deleted: vendor/nginx-1.11.1/auto/lib/md5/makefile.bcc (+0 -22) 100644 =================================================================== --- vendor/nginx-1.11.1/auto/lib/md5/makefile.bcc 2016-07-27 12:58:24 +0900 (eb6fb62) +++ /dev/null @@ -1,22 +0,0 @@ - -# Copyright (C) Igor Sysoev -# Copyright (C) Nginx, Inc. - - -CFLAGS = -q -O2 -tWM $(CPU_OPT) -DL_ENDIAN - -!if "$(MD5_ASM)" == "YES" - -md5.lib: - cd $(MD5) - bcc32 -c $(CFLAGS) -DMD5_ASM md5_dgst.c - tlib md5.lib +md5_dgst.obj +"asm\m-win32.obj" - -!else - -md5.lib: - cd $(MD5) - bcc32 -c $(CFLAGS) md5_dgst.c - tlib md5.lib +md5_dgst.obj - -!endif Deleted: vendor/nginx-1.11.1/auto/lib/md5/makefile.msvc (+0 -22) 100644 =================================================================== --- vendor/nginx-1.11.1/auto/lib/md5/makefile.msvc 2016-07-27 12:58:24 +0900 (90d62fa) +++ /dev/null @@ -1,22 +0,0 @@ - -# Copyright (C) Igor Sysoev -# Copyright (C) Nginx, Inc. - - -CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN - -!IF "$(MD5_ASM)" == "YES" - -md5.lib: - cd $(MD5) - cl -c $(CFLAGS) -D MD5_ASM md5_dgst.c - link -lib -out:md5.lib md5_dgst.obj asm/m-win32.obj - -!ELSE - -md5.lib: - cd $(MD5) - cl -c $(CFLAGS) md5_dgst.c - link -lib -out:md5.lib md5_dgst.obj - -!ENDIF Deleted: vendor/nginx-1.11.1/auto/lib/md5/makefile.owc (+0 -11) 100644 =================================================================== --- vendor/nginx-1.11.1/auto/lib/md5/makefile.owc 2016-07-27 12:58:24 +0900 (78c1e61) +++ /dev/null @@ -1,11 +0,0 @@ - -# Copyright (C) Igor Sysoev -# Copyright (C) Nginx, Inc. - - -CFLAGS = -zq -bt=nt -bm -ot -op -oi -oe -s $(CPU_OPT) - -md5.lib: - cd $(MD5) - wcl386 -c $(CFLAGS) -dL_ENDIAN md5_dgst.c - wlib -n md5.lib md5_dgst.obj Deleted: vendor/nginx-1.11.1/auto/lib/sha1/conf (+0 -79) 100644 =================================================================== --- vendor/nginx-1.11.1/auto/lib/sha1/conf 2016-07-27 12:58:24 +0900 (78f9efd) +++ /dev/null @@ -1,79 +0,0 @@ - -# Copyright (C) Igor Sysoev -# Copyright (C) Nginx, Inc. - - -if [ $SHA1 != NONE ]; then - - have=NGX_HAVE_SHA1 . auto/have - CORE_INCS="$CORE_INCS $SHA1" - - case "$NGX_CC_NAME" in - - msvc | owc | bcc) - LINK_DEPS="$LINK_DEPS $SHA1/sha1.lib" - CORE_LIBS="$CORE_LIBS $SHA1/sha1.lib" - ;; - - icc) - LINK_DEPS="$LINK_DEPS $SHA1/libsha.a" - - # to allow -ipo optimization we link with the *.o but not library - CORE_LIBS="$CORE_LIBS $SHA1/sha1_dgst.o" - - if [ $SHA1_ASM = YES ]; then - CORE_LIBS="$CORE_LIBS $SHA1/asm/sx86-elf.o" - fi - ;; - - *) - LINK_DEPS="$LINK_DEPS $SHA1/libsha.a" - CORE_LIBS="$CORE_LIBS $SHA1/libsha.a" - #CORE_LIBS="$CORE_LIBS -L $SHA1 -lsha" - ;; - - esac - -else - - if [ "$NGX_PLATFORM" != win32 ]; then - - SHA1=NO - - # FreeBSD - - ngx_feature="sha1 in system md library" - ngx_feature_name=NGX_HAVE_SHA1 - ngx_feature_run=no - ngx_feature_incs="#include <sha.h>" - ngx_feature_path= - ngx_feature_libs="-lmd" - ngx_feature_test="SHA_CTX sha1; SHA1_Init(&sha1)" - . auto/feature - - ngx_sha1_lib="system md" - - if [ $ngx_found = no ]; then - - # OpenSSL crypto library - - ngx_feature="sha1 in system OpenSSL crypto library" - ngx_feature_incs="#include <openssl/sha.h>" - ngx_feature_libs="-lcrypto" - . auto/feature - - ngx_sha1_lib="system crypto" - - if [ $ngx_found = yes ]; then - have=NGX_HAVE_OPENSSL_SHA1_H . auto/have - fi - fi - - if [ $ngx_found = yes ]; then - CORE_LIBS="$CORE_LIBS $ngx_feature_libs" - SHA1=YES - SHA1_LIB=$ngx_sha1_lib - fi - fi - -fi Deleted: vendor/nginx-1.11.1/auto/lib/sha1/make (+0 -96) 100644 =================================================================== --- vendor/nginx-1.11.1/auto/lib/sha1/make 2016-07-27 12:58:24 +0900 (fc3b340) +++ /dev/null @@ -1,96 +0,0 @@ - -# Copyright (C) Igor Sysoev -# Copyright (C) Nginx, Inc. - - -case "$NGX_CC_NAME" in - - msvc) - ngx_makefile=makefile.msvc - ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC SHA1_ASM=$SHA1_ASM" - ngx_sha1="SHA1=\"$SHA1\"" - ;; - - owc) - ngx_makefile=makefile.owc - ngx_opt="CPU_OPT=\"$CPU_OPT\"" - ngx_sha1=`echo SHA1=\"$SHA1\" | sed -e "s/\//$ngx_regex_dirsep/g"` - ;; - - bcc) - ngx_makefile=makefile.bcc - ngx_opt="-DCPU_OPT=\"$CPU_OPT\" -DSHA1_ASM=$SHA1_ASM" - ngx_sha1=`echo \-DSHA1=\"$SHA1\" | sed -e "s/\//$ngx_regex_dirsep/g"` - ;; - -esac - - -done=NO - - -case "$NGX_PLATFORM" in - - win32) - cat << END >> $NGX_MAKEFILE - -`echo "$SHA1/sha1.lib: $NGX_MAKEFILE" | sed -e "s/\//$ngx_regex_dirsep/g"` - \$(MAKE) -f auto/lib/sha1/$ngx_makefile $ngx_opt $ngx_sha1 - -END - - done=YES - ;; - - SunOS:*:i86pc) - if [ $SHA1_ASM = YES ]; then - - cat << END >> $NGX_MAKEFILE - -$SHA1/libsha.a: $NGX_MAKEFILE - cd $SHA1 \\ - && \$(MAKE) CFLAGS="$SHA1_OPT -DSOL -DSHA1_ASM -DL_ENDIAN" \\ - CC="\$(CC)" CPP="\$(CPP)" \\ - SHA_ASM_OBJ=asm/sx86-sol.o clean libsha.a - -END - - done=YES - fi - ;; - - # FreeBSD: i386 - # Linux: i686 - - *:i386 | *:i686) - if [ $SHA1_ASM = YES ]; then - - cat << END >> $NGX_MAKEFILE - -$SHA1/libsha.a: $NGX_MAKEFILE - cd $SHA1 \\ - && \$(MAKE) CFLAGS="$SHA1_OPT -DELF -DSHA1_ASM -DL_ENDIAN" \\ - CC="\$(CC)" CPP="\$(CPP)" \\ - SHA_ASM_OBJ=asm/sx86-elf.o clean libsha.a - -END - - done=YES - fi - ;; - -esac - - -if [ $done = NO ]; then - - cat << END >> $NGX_MAKEFILE - -$SHA1/libsha.a: $NGX_MAKEFILE - cd $SHA1 \\ - && \$(MAKE) CFLAGS="$SHA1_OPT" \\ - CC="\$(CC)" SHA_ASM_OBJ= clean libsha.a - -END - -fi Deleted: vendor/nginx-1.11.1/auto/lib/sha1/makefile.bcc (+0 -22) 100644 =================================================================== --- vendor/nginx-1.11.1/auto/lib/sha1/makefile.bcc 2016-07-27 12:58:24 +0900 (b0685fa) +++ /dev/null @@ -1,22 +0,0 @@ - -# Copyright (C) Igor Sysoev -# Copyright (C) Nginx, Inc. - - -CFLAGS = -q -O2 -tWM $(CPU_OPT) -DL_ENDIAN - -!if "$(SHA1_ASM)" == "YES" - -sha1.lib: - cd $(SHA1) - bcc32 -c $(CFLAGS) -DSHA1_ASM sha1dgst.c - tlib sha1.lib +sha1dgst.obj +"asm\s-win32.obj" - -!else - -sha1.lib: - cd $(SHA1) - bcc32 -c $(CFLAGS) sha1dgst.c - tlib sha1.lib +sha1dgst.obj - -!endif Deleted: vendor/nginx-1.11.1/auto/lib/sha1/makefile.msvc (+0 -22) 100644 =================================================================== --- vendor/nginx-1.11.1/auto/lib/sha1/makefile.msvc 2016-07-27 12:58:24 +0900 (3cbd21b) +++ /dev/null @@ -1,22 +0,0 @@ - -# Copyright (C) Igor Sysoev -# Copyright (C) Nginx, Inc. - - -CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN - -!IF "$(SHA1_ASM)" == "YES" - -sha1.lib: - cd $(SHA1) - cl -c $(CFLAGS) -D SHA1_ASM sha1dgst.c - link -lib -out:sha1.lib sha1dgst.obj asm/s-win32.obj - -!ELSE - -sha1.lib: - cd $(SHA1) - cl -c $(CFLAGS) sha1dgst.c - link -lib -out:sha1.lib sha1dgst.obj - -!ENDIF Deleted: vendor/nginx-1.11.1/auto/lib/sha1/makefile.owc (+0 -11) 100644 =================================================================== --- vendor/nginx-1.11.1/auto/lib/sha1/makefile.owc 2016-07-27 12:58:24 +0900 (fc095cc) +++ /dev/null @@ -1,11 +0,0 @@ - -# Copyright (C) Igor Sysoev -# Copyright (C) Nginx, Inc. - - -CFLAGS = -zq -bt=nt -bm -ot -op -oi -oe -s $(CPU_OPT) - -sha1.lib: - cd $(SHA1) - wcl386 -c $(CFLAGS) -dL_ENDIAN sha1dgst.c - wlib -n sha1.lib sha1dgst.obj Deleted: vendor/nginx-1.11.1/auto/lib/test (+0 -40) 100644 =================================================================== --- vendor/nginx-1.11.1/auto/lib/test 2016-07-27 12:58:24 +0900 (ba943a2) +++ /dev/null @@ -1,40 +0,0 @@ - -# Copyright (C) Igor Sysoev -# Copyright (C) Nginx, Inc. - - -echo $ngx_n "checking for $ngx_lib ...$ngx_c" - -cat << END >> $NGX_AUTOCONF_ERR - ----------------------------------------- -checking for $ngx_lib - -END - -ngx_found=no - -cat << END > $NGX_AUTOTEST.c - -$ngx_lib_incs - -int main() { - $ngx_lib_test; - return 0; -} - - -eval "$CC $cc_test_flags $ngx_lib_cflags \ - -o $NGX_AUTOTEST $NGX_AUTOTEST.c $ngx_libs \ - >> $NGX_ERR 2>&1" - -if [ -x $NGX_AUTOTEST ]; then - echo " found" - - ngx_found=yes - -else - echo " not found" -fi - -rm -rf $NGX_AUTOTEST* Deleted: vendor/nginx-1.11.1/src/core/ngx_sha1.h (+0 -31) 100644 =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_sha1.h 2016-07-27 12:58:24 +0900 (81c909e) +++ /dev/null @@ -1,31 +0,0 @@ - -/* - * Copyright (C) Igor Sysoev - * Copyright (C) Nginx, Inc. - */ - - -#ifndef _NGX_SHA1_H_INCLUDED_ -#define _NGX_SHA1_H_INCLUDED_ - - -#include <ngx_config.h> -#include <ngx_core.h> - - -#if (NGX_HAVE_OPENSSL_SHA1_H) -#include <openssl/sha.h> -#else -#include <sha.h> -#endif - - -typedef SHA_CTX ngx_sha1_t; - - -#define ngx_sha1_init SHA1_Init -#define ngx_sha1_update SHA1_Update -#define ngx_sha1_final SHA1_Final - - -#endif /* _NGX_SHA1_H_INCLUDED_ */ Deleted: vendor/nginx-1.11.1/src/stream/ngx_stream.h (+0 -201) 100644 =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream.h 2016-07-27 12:58:24 +0900 (1c35173) +++ /dev/null @@ -1,201 +0,0 @@ - -/* - * Copyright (C) Roman Arutyunyan - * Copyright (C) Nginx, Inc. - */ - - -#ifndef _NGX_STREAM_H_INCLUDED_ -#define _NGX_STREAM_H_INCLUDED_ - - -#include <ngx_config.h> -#include <ngx_core.h> - -#if (NGX_STREAM_SSL) -#include <ngx_stream_ssl_module.h> -#endif - - -typedef struct ngx_stream_session_s ngx_stream_session_t; - - -#include <ngx_stream_upstream.h> -#include <ngx_stream_upstream_round_robin.h> - - -typedef struct { - void **main_conf; - void **srv_conf; -} ngx_stream_conf_ctx_t; - - -typedef struct { - ngx_sockaddr_t sockaddr; - socklen_t socklen; - - /* server ctx */ - ngx_stream_conf_ctx_t *ctx; - - unsigned bind:1; - unsigned wildcard:1; -#if (NGX_STREAM_SSL) - unsigned ssl:1; -#endif -#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) - unsigned ipv6only:1; -#endif -#if (NGX_HAVE_REUSEPORT) - unsigned reuseport:1; -#endif - unsigned so_keepalive:2; -#if (NGX_HAVE_KEEPALIVE_TUNABLE) - int tcp_keepidle; - int tcp_keepintvl; - int tcp_keepcnt; -#endif - int backlog; - int type; -} ngx_stream_listen_t; - - -typedef struct { - ngx_stream_conf_ctx_t *ctx; - ngx_str_t addr_text; -#if (NGX_STREAM_SSL) - ngx_uint_t ssl; /* unsigned ssl:1; */ -#endif -} ngx_stream_addr_conf_t; - -typedef struct { - in_addr_t addr; - ngx_stream_addr_conf_t conf; -} ngx_stream_in_addr_t; - - -#if (NGX_HAVE_INET6) - -typedef struct { - struct in6_addr addr6; - ngx_stream_addr_conf_t conf; -} ngx_stream_in6_addr_t; - -#endif - - -typedef struct { - /* ngx_stream_in_addr_t or ngx_stream_in6_addr_t */ - void *addrs; - ngx_uint_t naddrs; -} ngx_stream_port_t; - - -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; - - -typedef struct { - ngx_stream_listen_t opt; -} ngx_stream_conf_addr_t; - - -typedef ngx_int_t (*ngx_stream_access_pt)(ngx_stream_session_t *s); - - -typedef struct { - ngx_array_t servers; /* ngx_stream_core_srv_conf_t */ - ngx_array_t listen; /* ngx_stream_listen_t */ - ngx_stream_access_pt limit_conn_handler; - ngx_stream_access_pt access_handler; -} ngx_stream_core_main_conf_t; - - -typedef void (*ngx_stream_handler_pt)(ngx_stream_session_t *s); - - -typedef struct { - ngx_stream_handler_pt handler; - ngx_stream_conf_ctx_t *ctx; - u_char *file_name; - ngx_int_t line; - ngx_log_t *error_log; - ngx_flag_t tcp_nodelay; -} ngx_stream_core_srv_conf_t; - - -struct ngx_stream_session_s { - uint32_t signature; /* "STRM" */ - - ngx_connection_t *connection; - - off_t received; - - ngx_log_handler_pt log_handler; - - void **ctx; - void **main_conf; - void **srv_conf; - - ngx_stream_upstream_t *upstream; -}; - - -typedef struct { - ngx_int_t (*postconfiguration)(ngx_conf_t *cf); - - void *(*create_main_conf)(ngx_conf_t *cf); - char *(*init_main_conf)(ngx_conf_t *cf, void *conf); - - void *(*create_srv_conf)(ngx_conf_t *cf); - char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, - void *conf); -} ngx_stream_module_t; - - -#define NGX_STREAM_MODULE 0x4d525453 /* "STRM" */ - -#define NGX_STREAM_MAIN_CONF 0x02000000 -#define NGX_STREAM_SRV_CONF 0x04000000 -#define NGX_STREAM_UPS_CONF 0x08000000 - - -#define NGX_STREAM_MAIN_CONF_OFFSET offsetof(ngx_stream_conf_ctx_t, main_conf) -#define NGX_STREAM_SRV_CONF_OFFSET offsetof(ngx_stream_conf_ctx_t, srv_conf) - - -#define ngx_stream_get_module_ctx(s, module) (s)->ctx[module.ctx_index] -#define ngx_stream_set_ctx(s, c, module) s->ctx[module.ctx_index] = c; -#define ngx_stream_delete_ctx(s, module) s->ctx[module.ctx_index] = NULL; - - -#define ngx_stream_get_module_main_conf(s, module) \ - (s)->main_conf[module.ctx_index] -#define ngx_stream_get_module_srv_conf(s, module) \ - (s)->srv_conf[module.ctx_index] - -#define ngx_stream_conf_get_module_main_conf(cf, module) \ - ((ngx_stream_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index] -#define ngx_stream_conf_get_module_srv_conf(cf, module) \ - ((ngx_stream_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index] - -#define ngx_stream_cycle_get_module_main_conf(cycle, module) \ - (cycle->conf_ctx[ngx_stream_module.index] ? \ - ((ngx_stream_conf_ctx_t *) cycle->conf_ctx[ngx_stream_module.index]) \ - ->main_conf[module.ctx_index]: \ - NULL) - - -void ngx_stream_init_connection(ngx_connection_t *c); -void ngx_stream_close_connection(ngx_connection_t *c); - - -extern ngx_module_t ngx_stream_module; -extern ngx_uint_t ngx_stream_max_module; -extern ngx_module_t ngx_stream_core_module; - - -#endif /* _NGX_STREAM_H_INCLUDED_ */ Renamed: vendor/nginx-1.11.3/auto/cc/acc (+0 -1) 89% =================================================================== --- vendor/nginx-1.11.1/auto/cc/acc 2016-07-27 12:58:24 +0900 (6baee67) +++ vendor/nginx-1.11.3/auto/cc/acc 2016-07-27 13:06:13 +0900 (64fa671) @@ -12,4 +12,3 @@ CC_TEST_FLAGS="-Ae" PCRE_OPT="$PCRE_OPT -Ae" ZLIB_OPT="$ZLIB_OPT -Ae" -MD5_OPT="$MD5_OPT -Ae" Renamed: vendor/nginx-1.11.3/auto/cc/bcc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/cc/ccc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/cc/clang (+0 -6) 94% =================================================================== --- vendor/nginx-1.11.1/auto/cc/clang 2016-07-27 12:58:24 +0900 (25707b4) +++ vendor/nginx-1.11.3/auto/cc/clang 2016-07-27 13:06:13 +0900 (19bdaaa) @@ -66,12 +66,6 @@ else PCRE_OPT="$PCRE_OPT -pipe" fi -if [ ".$MD5_OPT" = "." ]; then - MD5_OPT="-O2 -pipe $CPU_OPT" -else - MD5_OPT="$MD5_OPT -pipe" -fi - if [ ".$ZLIB_OPT" = "." ]; then ZLIB_OPT="-O2 -pipe $CPU_OPT" else Renamed: vendor/nginx-1.11.3/auto/cc/conf (+1 -1) 98% =================================================================== --- vendor/nginx-1.11.1/auto/cc/conf 2016-07-27 12:58:24 +0900 (f2c25ed) +++ vendor/nginx-1.11.3/auto/cc/conf 2016-07-27 13:06:13 +0900 (b3b9f92) @@ -231,7 +231,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then ngx_feature_incs= ngx_feature_path= ngx_feature_libs= - ngx_feature_test="__builtin_bswap64(0)" + ngx_feature_test="if (__builtin_bswap64(0)) return 1" . auto/feature Renamed: vendor/nginx-1.11.3/auto/cc/gcc (+6 -13) 96% =================================================================== --- vendor/nginx-1.11.1/auto/cc/gcc 2016-07-27 12:58:24 +0900 (c9101fe) +++ vendor/nginx-1.11.3/auto/cc/gcc 2016-07-27 13:06:13 +0900 (a5c5c18) @@ -128,12 +128,6 @@ else PCRE_OPT="$PCRE_OPT $PIPE" fi -if [ ".$MD5_OPT" = "." ]; then - MD5_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" -else - MD5_OPT="$MD5_OPT $PIPE" -fi - if [ ".$ZLIB_OPT" = "." ]; then ZLIB_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT" else @@ -151,9 +145,13 @@ CFLAGS="$CFLAGS -Wall -Wpointer-arith" #CFLAGS="$CFLAGS -Winline" #CFLAGS="$CFLAGS -Wmissing-prototypes" - case "$NGX_GCC_VER" in - [3-5].*) + 2.*) + # we have a lot of the unused function arguments + CFLAGS="$CFLAGS -Wno-unused" + ;; + + *) # we have a lot of the unused function arguments CFLAGS="$CFLAGS -Wno-unused-parameter" # 4.2.1 shows the warning in wrong places @@ -164,11 +162,6 @@ case "$NGX_GCC_VER" in CFLAGS="$CFLAGS -Wno-deprecated-declarations" fi ;; - - *) - # we have a lot of the unused function arguments - CFLAGS="$CFLAGS -Wno-unused" - ;; esac Renamed: vendor/nginx-1.11.3/auto/cc/icc (+0 -4) 97% =================================================================== --- vendor/nginx-1.11.1/auto/cc/icc 2016-07-27 12:58:24 +0900 (1c0df1a) +++ vendor/nginx-1.11.3/auto/cc/icc 2016-07-27 13:06:13 +0900 (c47f6e4) @@ -43,10 +43,6 @@ if [ ".$PCRE_OPT" = "." ]; then PCRE_OPT="-O $CPU_OPT" fi -if [ ".$MD5_OPT" = "." ]; then - MD5_OPT="-O $CPU_OPT" -fi - if [ ".$ZLIB_OPT" = "." ]; then ZLIB_OPT="-O $CPU_OPT" fi Renamed: vendor/nginx-1.11.3/auto/cc/msvc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/cc/name (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/cc/owc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/cc/sunc (+4 -5) 96% =================================================================== --- vendor/nginx-1.11.1/auto/cc/sunc 2016-07-27 12:58:24 +0900 (8360c49) +++ vendor/nginx-1.11.3/auto/cc/sunc 2016-07-27 13:06:13 +0900 (806ccc4) @@ -20,7 +20,10 @@ have=NGX_COMPILER value="\"Sun C $NGX_SUNC_VER\"" . auto/define cat << END > $NGX_AUTOTEST.c -int main() { printf("%d", __SUNPRO_C); } +int main(void) { + printf("%d", __SUNPRO_C); + return 0; +} END @@ -145,10 +148,6 @@ if [ ".$PCRE_OPT" = "." ]; then PCRE_OPT="$ngx_fast $IPO $CPU_OPT" fi -if [ ".$MD5_OPT" = "." ]; then - MD5_OPT="$ngx_fast $IPO $CPU_OPT" -fi - if [ ".$ZLIB_OPT" = "." ]; then ZLIB_OPT="$ngx_fast $IPO $CPU_OPT" fi Renamed: vendor/nginx-1.11.3/auto/configure (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/define (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/endianness (+1 -1) 98% =================================================================== --- vendor/nginx-1.11.1/auto/endianness 2016-07-27 12:58:24 +0900 (70b0a10) +++ vendor/nginx-1.11.3/auto/endianness 2016-07-27 13:06:13 +0900 (1b552b6) @@ -15,7 +15,7 @@ END cat << END > $NGX_AUTOTEST.c -int main() { +int main(void) { int i = 0x11223344; char *p; Renamed: vendor/nginx-1.11.3/auto/feature (+1 -1) 99% =================================================================== --- vendor/nginx-1.11.1/auto/feature 2016-07-27 12:58:24 +0900 (1145f28) +++ vendor/nginx-1.11.3/auto/feature 2016-07-27 13:06:13 +0900 (3561f59) @@ -31,7 +31,7 @@ cat << END > $NGX_AUTOTEST.c $NGX_INCLUDE_UNISTD_H $ngx_feature_incs -int main() { +int main(void) { $ngx_feature_test; return 0; } Renamed: vendor/nginx-1.11.3/auto/have (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/have_headers (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/headers (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/include (+1 -4) 93% =================================================================== --- vendor/nginx-1.11.1/auto/include 2016-07-27 12:58:24 +0900 (e34dabd) +++ vendor/nginx-1.11.3/auto/include 2016-07-27 13:06:13 +0900 (c1bd364) @@ -20,7 +20,7 @@ cat << END > $NGX_AUTOTEST.c $NGX_INCLUDE_SYS_PARAM_H #include <$ngx_include> -int main() { +int main(void) { return 0; } @@ -45,9 +45,6 @@ if [ -x $NGX_AUTOTEST ]; then eval "NGX_INCLUDE_$ngx_name='#include <$ngx_include>'" - #STUB - eval "NGX_$ngx_name='#include <$ngx_include>'" - else echo " not found" Renamed: vendor/nginx-1.11.3/auto/init (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/install (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/conf (+0 -29) 63% =================================================================== --- vendor/nginx-1.11.1/auto/lib/conf 2016-07-27 12:58:24 +0900 (a6242e7) +++ vendor/nginx-1.11.3/auto/lib/conf 2016-07-27 13:06:13 +0900 (0b8545a) @@ -25,35 +25,6 @@ if [ $USE_OPENSSL = YES ]; then . auto/lib/openssl/conf fi -if [ $USE_MD5 = YES ]; then - - if [ $USE_OPENSSL = YES ]; then - have=NGX_HAVE_OPENSSL_MD5_H . auto/have - have=NGX_OPENSSL_MD5 . auto/have - have=NGX_HAVE_MD5 . auto/have - MD5=YES - MD5_LIB=OpenSSL - - else - . auto/lib/md5/conf - fi - -fi - -if [ $USE_SHA1 = YES ]; then - - if [ $USE_OPENSSL = YES ]; then - have=NGX_HAVE_OPENSSL_SHA1_H . auto/have - have=NGX_HAVE_SHA1 . auto/have - SHA1=YES - SHA1_LIB=OpenSSL - - else - . auto/lib/sha1/conf - fi - -fi - if [ $USE_ZLIB = YES ]; then . auto/lib/zlib/conf fi Renamed: vendor/nginx-1.11.3/auto/lib/geoip/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/google-perftools/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/libatomic/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/libatomic/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/libgd/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/libxslt/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/make (+0 -8) 73% =================================================================== --- vendor/nginx-1.11.1/auto/lib/make 2016-07-27 12:58:24 +0900 (6298b94) +++ vendor/nginx-1.11.3/auto/lib/make 2016-07-27 13:06:13 +0900 (b64e329) @@ -7,14 +7,6 @@ if [ $PCRE != NONE -a $PCRE != NO -a $PCRE != YES ]; then . auto/lib/pcre/make fi -if [ $MD5 != NONE -a $MD5 != NO -a $MD5 != YES ]; then - . auto/lib/md5/make -fi - -if [ $SHA1 != NONE -a $SHA1 != NO -a $SHA1 != YES ]; then - . auto/lib/sha1/make -fi - if [ $OPENSSL != NONE -a $OPENSSL != NO -a $OPENSSL != YES ]; then . auto/lib/openssl/make fi Renamed: vendor/nginx-1.11.3/auto/lib/openssl/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/openssl/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/openssl/makefile.bcc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/openssl/makefile.msvc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/pcre/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/pcre/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/pcre/makefile.bcc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/pcre/makefile.msvc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/pcre/makefile.owc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/perl/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/perl/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/zlib/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/zlib/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/zlib/makefile.bcc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/zlib/makefile.msvc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/lib/zlib/makefile.owc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/make (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/module (+15 -3) 87% =================================================================== --- vendor/nginx-1.11.1/auto/module 2016-07-27 12:58:24 +0900 (16a816f) +++ vendor/nginx-1.11.3/auto/module 2016-07-27 13:06:13 +0900 (3b00a07) @@ -48,10 +48,14 @@ if [ "$ngx_module_link" = DYNAMIC ]; then fi ;; - PCRE | OPENSSL | MD5 | SHA1 | ZLIB) + PCRE | OPENSSL | ZLIB) eval USE_${lib}=YES ;; + MD5 | SHA1) + # obsolete + ;; + *) libs="$libs $lib" ;; @@ -79,10 +83,14 @@ elif [ "$ngx_module_link" = YES ]; then do case $lib in - PCRE | OPENSSL | MD5 | SHA1 | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP) + PCRE | OPENSSL | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP) eval USE_${lib}=YES ;; + MD5 | SHA1) + # obsolete + ;; + *) CORE_LIBS="$CORE_LIBS $lib" ;; @@ -109,10 +117,14 @@ elif [ "$ngx_module_link" = ADDON ]; then do case $lib in - PCRE | OPENSSL | MD5 | SHA1 | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP) + PCRE | OPENSSL | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP) eval USE_${lib}=YES ;; + MD5 | SHA1) + # obsolete + ;; + *) CORE_LIBS="$CORE_LIBS $lib" ;; Renamed: vendor/nginx-1.11.3/auto/modules (+67 -8) 93% =================================================================== --- vendor/nginx-1.11.1/auto/modules 2016-07-27 12:58:24 +0900 (22ff6d9) +++ vendor/nginx-1.11.3/auto/modules 2016-07-27 13:06:13 +0900 (614037c) @@ -43,6 +43,7 @@ fi if [ $NGX_TEST_BUILD_EPOLL = YES ]; then have=NGX_HAVE_EPOLL . auto/have have=NGX_HAVE_EPOLLRDHUP . auto/have + have=NGX_HAVE_EPOLLEXCLUSIVE . auto/have have=NGX_HAVE_EVENTFD . auto/have have=NGX_TEST_BUILD_EPOLL . auto/have EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE" @@ -101,7 +102,6 @@ fi if [ $HTTP_CACHE = YES ]; then - USE_MD5=YES have=NGX_HTTP_CACHE . auto/have HTTP_SRCS="$HTTP_SRCS $HTTP_FILE_CACHE_SRCS" fi @@ -522,8 +522,6 @@ if [ $HTTP_AUTH_REQUEST = YES ]; then fi if [ $HTTP_AUTH_BASIC = YES ]; then - USE_MD5=YES - USE_SHA1=YES have=NGX_CRYPT . auto/have ngx_module_name=ngx_http_auth_basic_module @@ -682,7 +680,6 @@ fi if [ $HTTP_PROXY = YES ]; then have=NGX_HTTP_X_FORWARDED_FOR . auto/have - #USE_MD5=YES ngx_module_name=ngx_http_proxy_module ngx_module_incs= @@ -772,8 +769,6 @@ if [ $HTTP_BROWSER = YES ]; then fi if [ $HTTP_SECURE_LINK = YES ]; then - USE_MD5=YES - ngx_module_name=ngx_http_secure_link_module ngx_module_incs= ngx_module_deps= @@ -971,8 +966,6 @@ if [ $STREAM != NO ]; then STREAM_INCS= ngx_module_type=STREAM - ngx_module_libs= - ngx_module_link=YES ngx_module_order= @@ -982,9 +975,13 @@ if [ $STREAM != NO ]; then ngx_stream_upstream_module" ngx_module_incs="src/stream" ngx_module_deps="src/stream/ngx_stream.h \ + src/stream/ngx_stream_variables.h \ + src/stream/ngx_stream_script.h \ src/stream/ngx_stream_upstream.h \ src/stream/ngx_stream_upstream_round_robin.h" ngx_module_srcs="src/stream/ngx_stream.c \ + src/stream/ngx_stream_variables.c \ + src/stream/ngx_stream_script.c \ src/stream/ngx_stream_handler.c \ src/stream/ngx_stream_core_module.c \ src/stream/ngx_stream_proxy_module.c \ @@ -1002,6 +999,8 @@ if [ $STREAM != NO ]; then ngx_module_name=ngx_stream_ssl_module ngx_module_deps=src/stream/ngx_stream_ssl_module.h ngx_module_srcs=src/stream/ngx_stream_ssl_module.c + ngx_module_libs= + ngx_module_link=$STREAM_SSL . auto/module fi @@ -1010,6 +1009,8 @@ if [ $STREAM != NO ]; then ngx_module_name=ngx_stream_limit_conn_module ngx_module_deps= ngx_module_srcs=src/stream/ngx_stream_limit_conn_module.c + ngx_module_libs= + ngx_module_link=$STREAM_LIMIT_CONN . auto/module fi @@ -1018,6 +1019,58 @@ if [ $STREAM != NO ]; then ngx_module_name=ngx_stream_access_module ngx_module_deps= ngx_module_srcs=src/stream/ngx_stream_access_module.c + ngx_module_libs= + ngx_module_link=$STREAM_ACCESS + + . auto/module + fi + + if [ $STREAM_GEO = YES ]; then + ngx_module_name=ngx_stream_geo_module + ngx_module_deps= + ngx_module_srcs=src/stream/ngx_stream_geo_module.c + ngx_module_libs= + ngx_module_link=$STREAM_GEO + + . auto/module + fi + + if [ $STREAM_GEOIP != NO ]; then + ngx_module_name=ngx_stream_geoip_module + ngx_module_deps= + ngx_module_srcs=src/stream/ngx_stream_geoip_module.c + ngx_module_libs=GEOIP + ngx_module_link=$STREAM_GEOIP + + . auto/module + fi + + if [ $STREAM_MAP = YES ]; then + ngx_module_name=ngx_stream_map_module + ngx_module_deps= + ngx_module_srcs=src/stream/ngx_stream_map_module.c + ngx_module_libs= + ngx_module_link=$STREAM_MAP + + . auto/module + fi + + if [ $STREAM_SPLIT_CLIENTS = YES ]; then + ngx_module_name=ngx_stream_split_clients_module + ngx_module_deps= + ngx_module_srcs=src/stream/ngx_stream_split_clients_module.c + ngx_module_libs= + ngx_module_link=$STREAM_SPLIT_CLIENTS + + . auto/module + fi + + if [ $STREAM_RETURN = YES ]; then + ngx_module_name=ngx_stream_return_module + ngx_module_deps= + ngx_module_srcs=src/stream/ngx_stream_return_module.c + ngx_module_libs= + ngx_module_link=$STREAM_RETURN . auto/module fi @@ -1026,6 +1079,8 @@ if [ $STREAM != NO ]; then ngx_module_name=ngx_stream_upstream_hash_module ngx_module_deps= ngx_module_srcs=src/stream/ngx_stream_upstream_hash_module.c + ngx_module_libs= + ngx_module_link=$STREAM_UPSTREAM_HASH . auto/module fi @@ -1034,6 +1089,8 @@ if [ $STREAM != NO ]; then ngx_module_name=ngx_stream_upstream_least_conn_module ngx_module_deps= ngx_module_srcs=src/stream/ngx_stream_upstream_least_conn_module.c + ngx_module_libs= + ngx_module_link=$STREAM_UPSTREAM_LEAST_CONN . auto/module fi @@ -1044,6 +1101,8 @@ if [ $STREAM != NO ]; then ngx_module_name=ngx_stream_upstream_zone_module ngx_module_deps= ngx_module_srcs=src/stream/ngx_stream_upstream_zone_module.c + ngx_module_libs= + ngx_module_link=$STREAM_UPSTREAM_ZONE . auto/module fi Renamed: vendor/nginx-1.11.3/auto/nohave (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/options (+44 -24) 92% =================================================================== --- vendor/nginx-1.11.1/auto/options 2016-07-27 12:58:24 +0900 (ac8beb1) +++ vendor/nginx-1.11.3/auto/options 2016-07-27 13:06:13 +0900 (a8fce30) @@ -117,6 +117,11 @@ STREAM=NO STREAM_SSL=NO STREAM_LIMIT_CONN=YES STREAM_ACCESS=YES +STREAM_GEO=YES +STREAM_GEOIP=NO +STREAM_MAP=YES +STREAM_SPLIT_CLIENTS=YES +STREAM_RETURN=YES STREAM_UPSTREAM_HASH=YES STREAM_UPSTREAM_LEAST_CONN=YES STREAM_UPSTREAM_ZONE=YES @@ -136,16 +141,6 @@ PCRE_JIT=NO USE_OPENSSL=NO OPENSSL=NONE -USE_MD5=NO -MD5=NONE -MD5_OPT= -MD5_ASM=NO - -USE_SHA1=NO -SHA1=NONE -SHA1_OPT= -SHA1_ASM=NO - USE_ZLIB=NO ZLIB=NONE ZLIB_OPT= @@ -301,9 +296,17 @@ use the \"--with-mail_ssl_module\" option instead" --with-stream) STREAM=YES ;; --with-stream=dynamic) STREAM=DYNAMIC ;; --with-stream_ssl_module) STREAM_SSL=YES ;; + --with-stream_geoip_module) STREAM_GEOIP=YES ;; + --with-stream_geoip_module=dynamic) + STREAM_GEOIP=DYNAMIC ;; --without-stream_limit_conn_module) STREAM_LIMIT_CONN=NO ;; --without-stream_access_module) STREAM_ACCESS=NO ;; + --without-stream_geo_module) STREAM_GEO=NO ;; + --without-stream_map_module) STREAM_MAP=NO ;; + --without-stream_split_clients_module) + STREAM_SPLIT_CLIENTS=NO ;; + --without-stream_return_module) STREAM_RETURN=NO ;; --without-stream_upstream_hash_module) STREAM_UPSTREAM_HASH=NO ;; --without-stream_upstream_least_conn_module) @@ -333,13 +336,31 @@ use the \"--with-mail_ssl_module\" option instead" --with-openssl=*) OPENSSL="$value" ;; --with-openssl-opt=*) OPENSSL_OPT="$value" ;; - --with-md5=*) MD5="$value" ;; - --with-md5-opt=*) MD5_OPT="$value" ;; - --with-md5-asm) MD5_ASM=YES ;; + --with-md5=*) + NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG +$0: warning: the \"--with-md5\" option is deprecated" + ;; + --with-md5-opt=*) + NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG +$0: warning: the \"--with-md5-opt\" option is deprecated" + ;; + --with-md5-asm) + NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG +$0: warning: the \"--with-md5-asm\" option is deprecated" + ;; - --with-sha1=*) SHA1="$value" ;; - --with-sha1-opt=*) SHA1_OPT="$value" ;; - --with-sha1-asm) SHA1_ASM=YES ;; + --with-sha1=*) + NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG +$0: warning: the \"--with-sha1\" option is deprecated" + ;; + --with-sha1-opt=*) + NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG +$0: warning: the \"--with-sha1-opt\" option is deprecated" + ;; + --with-sha1-asm) + NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG +$0: warning: the \"--with-sha1-asm\" option is deprecated" + ;; --with-zlib=*) ZLIB="$value" ;; --with-zlib-opt=*) ZLIB_OPT="$value" ;; @@ -482,8 +503,15 @@ cat << END --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 + --with-stream_geoip_module enable ngx_stream_geoip_module + --with-stream_geoip_module=dynamic enable dynamic ngx_stream_geoip_module --without-stream_limit_conn_module disable ngx_stream_limit_conn_module --without-stream_access_module disable ngx_stream_access_module + --without-stream_geo_module disable ngx_stream_geo_module + --without-stream_map_module disable ngx_stream_map_module + --without-stream_split_clients_module + disable ngx_stream_split_clients_module + --without-stream_return_module disable ngx_stream_return_module --without-stream_upstream_hash_module disable ngx_stream_upstream_hash_module --without-stream_upstream_least_conn_module @@ -511,14 +539,6 @@ cat << END --with-pcre-opt=OPTIONS set additional build options for PCRE --with-pcre-jit build PCRE with JIT compilation support - --with-md5=DIR set path to md5 library sources - --with-md5-opt=OPTIONS set additional build options for md5 - --with-md5-asm use md5 assembler sources - - --with-sha1=DIR set path to sha1 library sources - --with-sha1-opt=OPTIONS set additional build options for sha1 - --with-sha1-asm use sha1 assembler sources - --with-zlib=DIR set path to zlib library sources --with-zlib-opt=OPTIONS set additional build options for zlib --with-zlib-asm=CPU use zlib assembler sources optimized Renamed: vendor/nginx-1.11.3/auto/os/conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/os/darwin (+2 -2) 96% =================================================================== --- vendor/nginx-1.11.1/auto/os/darwin 2016-07-27 12:58:24 +0900 (9b31b1f) +++ vendor/nginx-1.11.3/auto/os/darwin 2016-07-27 13:06:13 +0900 (b4b3ad3) @@ -113,6 +113,6 @@ ngx_feature_run=no ngx_feature_incs="#include <libkern/OSAtomic.h>" ngx_feature_path= ngx_feature_libs= -ngx_feature_test="int32_t lock, n; - n = OSAtomicCompareAndSwap32Barrier(0, 1, &lock)" +ngx_feature_test="int32_t lock = 0; + if (!OSAtomicCompareAndSwap32Barrier(0, 1, &lock)) return 1" . auto/feature Renamed: vendor/nginx-1.11.3/auto/os/freebsd (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/os/linux (+17 -0) 89% =================================================================== --- vendor/nginx-1.11.1/auto/os/linux 2016-07-27 12:58:24 +0900 (c932267) +++ vendor/nginx-1.11.3/auto/os/linux 2016-07-27 13:06:13 +0900 (fae8842) @@ -44,6 +44,7 @@ ngx_feature_test="int efd = 0; struct epoll_event ee; ee.events = EPOLLIN|EPOLLOUT|EPOLLET; ee.data.ptr = NULL; + (void) ee; efd = epoll_create(100); if (efd == -1) return 1;" . auto/feature @@ -69,6 +70,22 @@ if [ $ngx_found = yes ]; then ee.data.ptr = NULL; epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)" . auto/feature + + + # EPOLLEXCLUSIVE appeared in Linux 4.5, glibc 2.24 + + ngx_feature="EPOLLEXCLUSIVE" + ngx_feature_name="NGX_HAVE_EPOLLEXCLUSIVE" + ngx_feature_run=no + ngx_feature_incs="#include <sys/epoll.h>" + ngx_feature_path= + ngx_feature_libs= + ngx_feature_test="int efd = 0, fd = 0; + struct epoll_event ee; + ee.events = EPOLLIN|EPOLLEXCLUSIVE; + ee.data.ptr = NULL; + epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)" + . auto/feature fi Renamed: vendor/nginx-1.11.3/auto/os/solaris (+1 -1) 97% =================================================================== --- vendor/nginx-1.11.1/auto/os/solaris 2016-07-27 12:58:24 +0900 (d39df0b) +++ vendor/nginx-1.11.3/auto/os/solaris 2016-07-27 13:06:13 +0900 (1dcfe84) @@ -52,7 +52,7 @@ ngx_feature_run=no ngx_feature_incs="#include <port.h>" ngx_feature_path= ngx_feature_libs= -ngx_feature_test="int n = port_create()" +ngx_feature_test="(void) port_create()" . auto/feature if [ $ngx_found = yes ]; then Renamed: vendor/nginx-1.11.3/auto/os/win32 (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/sources (+1 -0) 99% =================================================================== --- vendor/nginx-1.11.1/auto/sources 2016-07-27 12:58:24 +0900 (27849e6) +++ vendor/nginx-1.11.3/auto/sources 2016-07-27 13:06:13 +0900 (216e900) @@ -61,6 +61,7 @@ CORE_SRCS="src/core/nginx.c \ src/core/ngx_crc32.c \ src/core/ngx_murmurhash.c \ src/core/ngx_md5.c \ + src/core/ngx_sha1.c \ src/core/ngx_rbtree.c \ src/core/ngx_radix_tree.c \ src/core/ngx_slab.c \ Renamed: vendor/nginx-1.11.3/auto/stubs (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/summary (+0 -14) 81% =================================================================== --- vendor/nginx-1.11.1/auto/summary 2016-07-27 12:58:24 +0900 (dc8fe4f) +++ vendor/nginx-1.11.3/auto/summary 2016-07-27 13:06:13 +0900 (9aa776e) @@ -28,20 +28,6 @@ case $OPENSSL in *) echo " + using OpenSSL library: $OPENSSL" ;; esac -case $MD5 in - YES) echo " + md5: using $MD5_LIB library" ;; - NONE) echo " + md5 library is not used" ;; - NO) echo " + using builtin md5 code" ;; - *) echo " + using md5 library: $MD5" ;; -esac - -case $SHA1 in - YES) echo " + sha1: using $SHA1_LIB library" ;; - NONE) echo " + sha1 library is not used" ;; - NO) echo " + sha1 library is not found" ;; - *) echo " + using sha1 library: $SHA1" ;; -esac - case $ZLIB in YES) echo " + using system zlib library" ;; NONE) echo " + zlib library is not used" ;; Renamed: vendor/nginx-1.11.3/auto/threads (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/types/sizeof (+1 -1) 98% =================================================================== --- vendor/nginx-1.11.1/auto/types/sizeof 2016-07-27 12:58:24 +0900 (b5b71bb) +++ vendor/nginx-1.11.3/auto/types/sizeof 2016-07-27 13:06:13 +0900 (480d8cf) @@ -25,7 +25,7 @@ $NGX_INCLUDE_UNISTD_H $NGX_INCLUDE_INTTYPES_H $NGX_INCLUDE_AUTO_CONFIG_H -int main() { +int main(void) { printf("%d", (int) sizeof($ngx_type)); return 0; } Renamed: vendor/nginx-1.11.3/auto/types/typedef (+1 -1) 98% =================================================================== --- vendor/nginx-1.11.1/auto/types/typedef 2016-07-27 12:58:24 +0900 (b55237e) +++ vendor/nginx-1.11.3/auto/types/typedef 2016-07-27 13:06:13 +0900 (d54c289) @@ -27,7 +27,7 @@ do #include <netinet/in.h> $NGX_INCLUDE_INTTYPES_H -int main() { +int main(void) { $ngx_try i = 0; return (int) i; } Renamed: vendor/nginx-1.11.3/auto/types/uintptr_t (+2 -2) 95% =================================================================== --- vendor/nginx-1.11.1/auto/types/uintptr_t 2016-07-27 12:58:24 +0900 (2b7212e) +++ vendor/nginx-1.11.3/auto/types/uintptr_t 2016-07-27 13:06:13 +0900 (a33d6d0) @@ -17,9 +17,9 @@ found=no cat << END > $NGX_AUTOTEST.c #include <sys/types.h> -$NGX_INTTYPES_H +$NGX_INCLUDE_INTTYPES_H -int main() { +int main(void) { uintptr_t i = 0; return (int) i; } Renamed: vendor/nginx-1.11.3/auto/types/value (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/auto/unix (+29 -12) 96% =================================================================== --- vendor/nginx-1.11.1/auto/unix 2016-07-27 12:58:24 +0900 (e6396ef) +++ vendor/nginx-1.11.3/auto/unix 2016-07-27 13:06:13 +0900 (dbc0f0e) @@ -75,7 +75,7 @@ if test -z "$NGX_KQUEUE_CHECKED"; then ngx_feature_incs="#include <sys/event.h>" ngx_feature_path= ngx_feature_libs= - ngx_feature_test="int kq; kq = kqueue()" + ngx_feature_test="(void) kqueue()" . auto/feature if [ $ngx_found = yes ]; then @@ -92,7 +92,8 @@ if test -z "$NGX_KQUEUE_CHECKED"; then ngx_feature_path= ngx_feature_libs= ngx_feature_test="struct kevent kev; - kev.fflags = NOTE_LOWAT;" + kev.fflags = NOTE_LOWAT; + (void) kev" . auto/feature @@ -260,11 +261,11 @@ ngx_feature_run=no ngx_feature_incs="#include <dlfcn.h>" ngx_feature_path= ngx_feature_libs= -ngx_feature_test="dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); dlsym(NULL, NULL)" +ngx_feature_test="dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); dlsym(NULL, \"\")" . auto/feature -if [ $ngx_found != yes ]; then +if [ $ngx_found = no ]; then ngx_feature="dlopen() in libdl" ngx_feature_libs="-ldl" @@ -287,7 +288,7 @@ ngx_feature_test="sched_yield()" . auto/feature -if [ $ngx_found != yes ]; then +if [ $ngx_found = no ]; then ngx_feature="sched_yield() in librt" ngx_feature_libs="-lrt" @@ -341,6 +342,19 @@ ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_BINDANY, NULL, 0)" . auto/feature +# Linux IP_BIND_ADDRESS_NO_PORT + +ngx_feature="IP_BIND_ADDRESS_NO_PORT" +ngx_feature_name="NGX_HAVE_IP_BIND_ADDRESS_NO_PORT" +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_BIND_ADDRESS_NO_PORT, NULL, 0)" +. auto/feature + + # Linux transparent proxying ngx_feature="IP_TRANSPARENT" @@ -479,9 +493,9 @@ if [ $NGX_FILE_AIO = YES ]; then ngx_feature_incs="#include <aio.h>" ngx_feature_path= ngx_feature_libs= - ngx_feature_test="int n; struct aiocb iocb; + ngx_feature_test="struct aiocb iocb; iocb.aio_sigevent.sigev_notify = SIGEV_KEVENT; - n = aio_read(&iocb)" + (void) aio_read(&iocb)" . auto/feature if [ $ngx_found = yes ]; then @@ -501,6 +515,7 @@ if [ $NGX_FILE_AIO = YES ]; then iocb.aio_lio_opcode = IOCB_CMD_PREAD; iocb.aio_flags = IOCB_FLAG_RESFD; iocb.aio_resfd = -1; + (void) iocb; (void) eventfd(0, 0)" . auto/feature @@ -516,11 +531,12 @@ if [ $NGX_FILE_AIO = YES ]; then ngx_feature="Linux AIO support (SYS_eventfd)" ngx_feature_incs="#include <linux/aio_abi.h> #include <sys/syscall.h>" - ngx_feature_test="int n = SYS_eventfd; - struct iocb iocb; + ngx_feature_test="struct iocb iocb; iocb.aio_lio_opcode = IOCB_CMD_PREAD; iocb.aio_flags = IOCB_FLAG_RESFD; - iocb.aio_resfd = -1;" + iocb.aio_resfd = -1; + (void) iocb; + (void) SYS_eventfd" . auto/feature if [ $ngx_found = yes ]; then @@ -558,7 +574,7 @@ else ngx_feature="eventfd() (SYS_eventfd)" ngx_feature_incs="#include <sys/syscall.h>" - ngx_feature_test="int n = SYS_eventfd" + ngx_feature_test="(void) SYS_eventfd" . auto/feature fi fi @@ -631,7 +647,8 @@ if [ $NGX_IPV6 = YES ]; then ngx_feature_path= ngx_feature_libs= ngx_feature_test="struct sockaddr_in6 sin6; - sin6.sin6_family = AF_INET6;" + sin6.sin6_family = AF_INET6; + (void) sin6" . auto/feature fi Renamed: vendor/nginx-1.11.3/conf/fastcgi.conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/conf/fastcgi_params (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/conf/koi-utf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/conf/koi-win (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/conf/mime.types (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/conf/nginx.conf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/conf/scgi_params (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/conf/uwsgi_params (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/conf/win-utf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/contrib/README (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/contrib/geo2nginx.pl (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/contrib/unicode2nginx/koi-utf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/contrib/unicode2nginx/unicode-to-nginx.pl (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/contrib/unicode2nginx/win-utf (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/contrib/vim/ftdetect/nginx.vim (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/contrib/vim/indent/nginx.vim (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/contrib/vim/syntax/nginx.vim (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/docs/GNUmakefile (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/docs/dtd/change_log_conf.dtd (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/docs/dtd/changes.dtd (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/docs/html/50x.html (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/docs/html/index.html (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/docs/man/nginx.8 (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/docs/text/LICENSE (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/docs/text/README (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/docs/xml/change_log_conf.xml (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/docs/xml/nginx/changes.xml (+194 -0) 99% =================================================================== --- vendor/nginx-1.11.1/docs/xml/nginx/changes.xml 2016-07-27 12:58:24 +0900 (c921aa4) +++ vendor/nginx-1.11.3/docs/xml/nginx/changes.xml 2016-07-27 13:06:13 +0900 (a7e8f5d) @@ -5,6 +5,200 @@ <change_log title="nginx"> +<changes ver="1.11.3" date="26.07.2016"> + +<change type="change"> +<para lang="ru"> +теперь accept_mutex по умолчанию выключен. +</para> +<para lang="en"> +now the "accept_mutex" directive is turned off by default. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +теперь nginx использует EPOLLEXCLUSIVE на Linux. +</para> +<para lang="en"> +now nginx uses EPOLLEXCLUSIVE on Linux. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +модуль ngx_stream_geo_module. +</para> +<para lang="en"> +the ngx_stream_geo_module. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +модуль ngx_stream_geoip_module. +</para> +<para lang="en"> +the ngx_stream_geoip_module. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +модуль ngx_stream_split_clients_module. +</para> +<para lang="en"> +the ngx_stream_split_clients_module. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +директивы proxy_pass и proxy_ssl_name в модуле stream +поддерживают переменные. +</para> +<para lang="en"> +variables support +in the "proxy_pass" and "proxy_ssl_name" directives in the stream module. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +утечки сокетов при использовании HTTP/2. +</para> +<para lang="en"> +socket leak when using HTTP/2. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +в configure.<br/> +Спасибо Piotr Sikora. +</para> +<para lang="en"> +in configure tests.<br/> +Thanks to Piotr Sikora. +</para> +</change> + +</changes> + + +<changes ver="1.11.2" date="05.07.2016"> + +<change type="change"> +<para lang="ru"> +теперь nginx всегда использует внутренние реализации MD5 и SHA1; +параметры configure --with-md5 и --with-sha1 упразднены. +</para> +<para lang="en"> +now nginx always uses internal MD5 and SHA1 implementations; +the --with-md5 and --with-sha1 configure options were canceled. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +поддержка переменных в модуле stream. +</para> +<para lang="en"> +variables support in the stream module. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +модуль ngx_stream_map_module. +</para> +<para lang="en"> +the ngx_stream_map_module. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +модуль ngx_stream_return_module. +</para> +<para lang="en"> +the ngx_stream_return_module. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +в директивах proxy_bind, fastcgi_bind, memcached_bind, scgi_bind и uwsgi_bind +теперь можно указывать порт. +</para> +<para lang="en"> +a port can be specified in the "proxy_bind", "fastcgi_bind", +"memcached_bind", "scgi_bind", and "uwsgi_bind" directives. +</para> +</change> + +<change type="feature"> +<para lang="ru"> +теперь nginx использует опцию сокета IP_BIND_ADDRESS_NO_PORT, если она доступна. +</para> +<para lang="en"> +now nginx uses the IP_BIND_ADDRESS_NO_PORT socket option when available. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании HTTP/2 и директивы proxy_request_buffering +в рабочем процессе мог произойти segmentation fault. +</para> +<para lang="en"> +a segmentation fault might occur in a worker process +when using HTTP/2 and the "proxy_request_buffering" directive. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании HTTP/2 +к запросам, передаваемым на бэкенд, +всегда добавлялась строка заголовка "Content-Length", +даже если у запроса не было тела. +</para> +<para lang="en"> +the "Content-Length" request header line +was always added to requests passed to backends, +including requests without body, +when using HTTP/2. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании HTTP/2 +в логах могли появляться сообщения "http request count is zero". +</para> +<para lang="en"> +"http request count is zero" alerts might appear in logs +when using HTTP/2. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании директивы sub_filter +могло буферизироваться больше данных, чем это необходимо; +проблема появилась в 1.9.4. +</para> +<para lang="en"> +unnecessary buffering might occur +when using the "sub_filter" directive; +the issue had appeared in 1.9.4. +</para> +</change> + +</changes> + + <changes ver="1.11.1" date="31.05.2016"> <change type="security"> Renamed: vendor/nginx-1.11.3/docs/xsls/changes.xsls (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/docs/xslt/changes.xslt (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/misc/GNUmakefile (+1 -1) 99% =================================================================== --- vendor/nginx-1.11.1/misc/GNUmakefile 2016-07-27 12:58:24 +0900 (ff9bee6) +++ vendor/nginx-1.11.3/misc/GNUmakefile 2016-07-27 13:06:13 +0900 (0d1ad87) @@ -7,7 +7,7 @@ TEMP = tmp OBJS = objs.msvc8 OPENSSL = openssl-1.0.2h ZLIB = zlib-1.2.8 -PCRE = pcre-8.38 +PCRE = pcre-8.39 release: export Renamed: vendor/nginx-1.11.3/misc/README (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/nginx.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/nginx.h (+2 -2) 85% =================================================================== --- vendor/nginx-1.11.1/src/core/nginx.h 2016-07-27 12:58:24 +0900 (8eba7da) +++ vendor/nginx-1.11.3/src/core/nginx.h 2016-07-27 13:06:13 +0900 (e303e66) @@ -9,8 +9,8 @@ #define _NGINX_H_INCLUDED_ -#define nginx_version 1011001 -#define NGINX_VERSION "1.11.1" +#define nginx_version 1011003 +#define NGINX_VERSION "1.11.3" #define NGINX_VER "nginx/" NGINX_VERSION #ifdef NGX_BUILD Renamed: vendor/nginx-1.11.3/src/core/ngx_array.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_array.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_buf.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_buf.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_conf_file.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_conf_file.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_connection.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_connection.h (+0 -4) 98% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_connection.h 2016-07-27 12:58:24 +0900 (b11e92b) +++ vendor/nginx-1.11.3/src/core/ngx_connection.h 2016-07-27 13:06:13 +0900 (e484c81) @@ -186,10 +186,6 @@ struct ngx_connection_s { unsigned need_last_buf:1; -#if (NGX_HAVE_IOCP) - unsigned accept_context_updated:1; -#endif - #if (NGX_HAVE_AIO_SENDFILE) unsigned busy_count:2; #endif Renamed: vendor/nginx-1.11.3/src/core/ngx_core.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_cpuinfo.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_crc.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_crc32.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_crc32.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_crypt.c (+0 -13) 98% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_crypt.c 2016-07-27 12:58:24 +0900 (9db74f4) +++ vendor/nginx-1.11.3/src/core/ngx_crypt.c 2016-07-27 13:06:13 +0900 (868dc5d) @@ -8,9 +8,7 @@ #include <ngx_core.h> #include <ngx_crypt.h> #include <ngx_md5.h> -#if (NGX_HAVE_SHA1) #include <ngx_sha1.h> -#endif #if (NGX_CRYPT) @@ -19,16 +17,11 @@ static ngx_int_t ngx_crypt_apr1(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted); static ngx_int_t ngx_crypt_plain(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted); - -#if (NGX_HAVE_SHA1) - static ngx_int_t ngx_crypt_ssha(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted); static ngx_int_t ngx_crypt_sha(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted); -#endif - static u_char *ngx_crypt_to64(u_char *p, uint32_t v, size_t n); @@ -42,13 +35,11 @@ ngx_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted) } else if (ngx_strncmp(salt, "{PLAIN}", sizeof("{PLAIN}") - 1) == 0) { return ngx_crypt_plain(pool, key, salt, encrypted); -#if (NGX_HAVE_SHA1) } else if (ngx_strncmp(salt, "{SSHA}", sizeof("{SSHA}") - 1) == 0) { return ngx_crypt_ssha(pool, key, salt, encrypted); } else if (ngx_strncmp(salt, "{SHA}", sizeof("{SHA}") - 1) == 0) { return ngx_crypt_sha(pool, key, salt, encrypted); -#endif } /* fallback to libc crypt() */ @@ -193,8 +184,6 @@ ngx_crypt_plain(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted) } -#if (NGX_HAVE_SHA1) - static ngx_int_t ngx_crypt_ssha(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted) { @@ -278,6 +267,4 @@ ngx_crypt_sha(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted) return NGX_OK; } -#endif /* NGX_HAVE_SHA1 */ - #endif /* NGX_CRYPT */ Renamed: vendor/nginx-1.11.3/src/core/ngx_crypt.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_cycle.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_cycle.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_file.c (+9 -10) 98% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_file.c 2016-07-27 12:58:24 +0900 (fc2dfd3) +++ vendor/nginx-1.11.3/src/core/ngx_file.c 2016-07-27 13:06:13 +0900 (c1137cc) @@ -225,7 +225,7 @@ ngx_create_hashed_filename(ngx_path_t *path, u_char *file, size_t len) file[path->name.len + path->len] = '/'; - for (n = 0; n < 3; n++) { + for (n = 0; n < NGX_MAX_PATH_LEVEL; n++) { level = path->level[n]; if (level == 0) { @@ -249,7 +249,7 @@ ngx_create_path(ngx_file_t *file, ngx_path_t *path) pos = path->name.len; - for (i = 0; i < 3; i++) { + for (i = 0; i < NGX_MAX_PATH_LEVEL; i++) { if (path->level[i] == 0) { break; } @@ -399,6 +399,8 @@ char * ngx_conf_merge_path_value(ngx_conf_t *cf, ngx_path_t **path, ngx_path_t *prev, ngx_path_init_t *init) { + ngx_uint_t i; + if (*path) { return NGX_CONF_OK; } @@ -419,13 +421,10 @@ ngx_conf_merge_path_value(ngx_conf_t *cf, ngx_path_t **path, ngx_path_t *prev, return NGX_CONF_ERROR; } - (*path)->level[0] = init->level[0]; - (*path)->level[1] = init->level[1]; - (*path)->level[2] = init->level[2]; - - (*path)->len = init->level[0] + (init->level[0] ? 1 : 0) - + init->level[1] + (init->level[1] ? 1 : 0) - + init->level[2] + (init->level[2] ? 1 : 0); + for (i = 0; i < NGX_MAX_PATH_LEVEL; i++) { + (*path)->level[i] = init->level[i]; + (*path)->len += init->level[i] + (init->level[i] ? 1 : 0); + } if (ngx_add_path(cf, path) != NGX_OK) { return NGX_CONF_ERROR; @@ -518,7 +517,7 @@ ngx_add_path(ngx_conf_t *cf, ngx_path_t **slot) return NGX_ERROR; } - for (n = 0; n < 3; n++) { + for (n = 0; n < NGX_MAX_PATH_LEVEL; n++) { if (p[i]->level[n] != path->level[n]) { if (path->conf_file == NULL) { if (p[i]->conf_file == NULL) { Renamed: vendor/nginx-1.11.3/src/core/ngx_file.h (+2 -2) 97% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_file.h 2016-07-27 12:58:24 +0900 (5f8228b) +++ vendor/nginx-1.11.3/src/core/ngx_file.h 2016-07-27 13:06:13 +0900 (a723c3d) @@ -49,7 +49,7 @@ typedef void (*ngx_path_loader_pt) (void *data); typedef struct { ngx_str_t name; size_t len; - size_t level[3]; + size_t level[NGX_MAX_PATH_LEVEL]; ngx_path_manager_pt manager; ngx_path_loader_pt loader; @@ -62,7 +62,7 @@ typedef struct { typedef struct { ngx_str_t name; - size_t level[3]; + size_t level[NGX_MAX_PATH_LEVEL]; } ngx_path_init_t; Renamed: vendor/nginx-1.11.3/src/core/ngx_hash.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_hash.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_inet.c (+62 -21) 96% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_inet.c 2016-07-27 12:58:24 +0900 (873bf73) +++ vendor/nginx-1.11.3/src/core/ngx_inet.c 2016-07-27 13:06:13 +0900 (c4aaf3a) @@ -529,13 +529,9 @@ ngx_int_t ngx_parse_addr_port(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text, size_t len) { - u_char *p, *last; - size_t plen; - ngx_int_t rc, port; - struct sockaddr_in *sin; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif + u_char *p, *last; + size_t plen; + ngx_int_t rc, port; rc = ngx_parse_addr(pool, addr, text, len); @@ -585,20 +581,7 @@ ngx_parse_addr_port(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text, return rc; } - switch (addr->sockaddr->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = (struct sockaddr_in6 *) addr->sockaddr; - sin6->sin6_port = htons((in_port_t) port); - break; -#endif - - default: /* AF_INET */ - sin = (struct sockaddr_in *) addr->sockaddr; - sin->sin_port = htons((in_port_t) port); - break; - } + ngx_inet_set_port(addr->sockaddr, (in_port_t) port); return NGX_OK; } @@ -1356,3 +1339,61 @@ ngx_cmp_sockaddr(struct sockaddr *sa1, socklen_t slen1, return NGX_OK; } + + +in_port_t +ngx_inet_get_port(struct sockaddr *sa) +{ + struct sockaddr_in *sin; +#if (NGX_HAVE_INET6) + struct sockaddr_in6 *sin6; +#endif + + switch (sa->sa_family) { + +#if (NGX_HAVE_INET6) + case AF_INET6: + sin6 = (struct sockaddr_in6 *) sa; + return ntohs(sin6->sin6_port); +#endif + +#if (NGX_HAVE_UNIX_DOMAIN) + case AF_UNIX: + return 0; +#endif + + default: /* AF_INET */ + sin = (struct sockaddr_in *) sa; + return ntohs(sin->sin_port); + } +} + + +void +ngx_inet_set_port(struct sockaddr *sa, in_port_t port) +{ + struct sockaddr_in *sin; +#if (NGX_HAVE_INET6) + struct sockaddr_in6 *sin6; +#endif + + switch (sa->sa_family) { + +#if (NGX_HAVE_INET6) + case AF_INET6: + sin6 = (struct sockaddr_in6 *) sa; + sin6->sin6_port = htons(port); + break; +#endif + +#if (NGX_HAVE_UNIX_DOMAIN) + case AF_UNIX: + break; +#endif + + default: /* AF_INET */ + sin = (struct sockaddr_in *) sa; + sin->sin_port = htons(port); + break; + } +} Renamed: vendor/nginx-1.11.3/src/core/ngx_inet.h (+2 -0) 96% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_inet.h 2016-07-27 12:58:24 +0900 (531d264) +++ vendor/nginx-1.11.3/src/core/ngx_inet.h 2016-07-27 13:06:13 +0900 (97dc354) @@ -121,6 +121,8 @@ ngx_int_t ngx_parse_url(ngx_pool_t *pool, ngx_url_t *u); ngx_int_t ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u); ngx_int_t ngx_cmp_sockaddr(struct sockaddr *sa1, socklen_t slen1, struct sockaddr *sa2, socklen_t slen2, ngx_uint_t cmp_port); +in_port_t ngx_inet_get_port(struct sockaddr *sa); +void ngx_inet_set_port(struct sockaddr *sa, in_port_t port); #endif /* _NGX_INET_H_INCLUDED_ */ Renamed: vendor/nginx-1.11.3/src/core/ngx_list.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_list.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_log.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_log.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_md5.c (+0 -6) 98% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_md5.c 2016-07-27 12:58:24 +0900 (440c75b) +++ vendor/nginx-1.11.3/src/core/ngx_md5.c 2016-07-27 13:06:13 +0900 (c25d002) @@ -3,8 +3,6 @@ * An internal implementation, based on Alexander Peslyak's * public domain implementation: * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5 - * It is not expected to be optimal and is used only - * if no MD5 implementation was found in system. */ @@ -13,8 +11,6 @@ #include <ngx_md5.h> -#if !(NGX_HAVE_MD5) - static const u_char *ngx_md5_body(ngx_md5_t *ctx, const u_char *data, size_t size); @@ -285,5 +281,3 @@ ngx_md5_body(ngx_md5_t *ctx, const u_char *data, size_t size) return p; } - -#endif Renamed: vendor/nginx-1.11.3/src/core/ngx_md5.h (+0 -32) 53% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_md5.h 2016-07-27 12:58:24 +0900 (18d09d6) +++ vendor/nginx-1.11.3/src/core/ngx_md5.h 2016-07-27 13:06:13 +0900 (713b614) @@ -13,36 +13,6 @@ #include <ngx_core.h> -#if (NGX_HAVE_MD5) - -#if (NGX_HAVE_OPENSSL_MD5_H) -#include <openssl/md5.h> -#else -#include <md5.h> -#endif - - -typedef MD5_CTX ngx_md5_t; - - -#if (NGX_OPENSSL_MD5) - -#define ngx_md5_init MD5_Init -#define ngx_md5_update MD5_Update -#define ngx_md5_final MD5_Final - -#else - -#define ngx_md5_init MD5Init -#define ngx_md5_update MD5Update -#define ngx_md5_final MD5Final - -#endif - - -#else /* !NGX_HAVE_MD5 */ - - typedef struct { uint64_t bytes; uint32_t a, b, c, d; @@ -55,6 +25,4 @@ void ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size); void ngx_md5_final(u_char result[16], ngx_md5_t *ctx); -#endif - #endif /* _NGX_MD5_H_INCLUDED_ */ Renamed: vendor/nginx-1.11.3/src/core/ngx_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_module.h (+0 -9) 98% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_module.h 2016-07-27 12:58:24 +0900 (e911cb4) +++ vendor/nginx-1.11.3/src/core/ngx_module.h 2016-07-27 13:06:13 +0900 (a1a0d6c) @@ -119,17 +119,8 @@ #define NGX_MODULE_SIGNATURE_16 "0" #endif -#if (NGX_HAVE_MD5) -#define NGX_MODULE_SIGNATURE_17 "1" -#else #define NGX_MODULE_SIGNATURE_17 "0" -#endif - -#if (NGX_HAVE_SHA1) -#define NGX_MODULE_SIGNATURE_18 "1" -#else #define NGX_MODULE_SIGNATURE_18 "0" -#endif #if (NGX_HAVE_OPENAT) #define NGX_MODULE_SIGNATURE_19 "1" Renamed: vendor/nginx-1.11.3/src/core/ngx_murmurhash.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_murmurhash.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_open_file_cache.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_open_file_cache.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_output_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_palloc.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_palloc.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_parse.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_parse.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_parse_time.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_parse_time.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_proxy_protocol.c (+3 -8) 91% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_proxy_protocol.c 2016-07-27 12:58:24 +0900 (3e54d42) +++ vendor/nginx-1.11.3/src/core/ngx_proxy_protocol.c 2016-07-27 13:06:13 +0900 (523ec35) @@ -141,19 +141,11 @@ ngx_proxy_protocol_write(ngx_connection_t *c, u_char *buf, u_char *last) case AF_INET: buf = ngx_cpymem(buf, "PROXY TCP4 ", sizeof("PROXY TCP4 ") - 1); - - port = ntohs(((struct sockaddr_in *) c->sockaddr)->sin_port); - lport = ntohs(((struct sockaddr_in *) c->local_sockaddr)->sin_port); - break; #if (NGX_HAVE_INET6) case AF_INET6: buf = ngx_cpymem(buf, "PROXY TCP6 ", sizeof("PROXY TCP6 ") - 1); - - port = ntohs(((struct sockaddr_in6 *) c->sockaddr)->sin6_port); - lport = ntohs(((struct sockaddr_in6 *) c->local_sockaddr)->sin6_port); - break; #endif @@ -169,5 +161,8 @@ ngx_proxy_protocol_write(ngx_connection_t *c, u_char *buf, u_char *last) buf += ngx_sock_ntop(c->local_sockaddr, c->local_socklen, buf, last - buf, 0); + port = ngx_inet_get_port(c->sockaddr); + lport = ngx_inet_get_port(c->local_sockaddr); + return ngx_slprintf(buf, last, " %ui %ui" CRLF, port, lport); } Renamed: vendor/nginx-1.11.3/src/core/ngx_proxy_protocol.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_queue.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_queue.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_radix_tree.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_radix_tree.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_rbtree.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_rbtree.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_regex.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_regex.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_resolver.c (+1 -15) 99% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_resolver.c 2016-07-27 12:58:24 +0900 (e06c2f8) +++ vendor/nginx-1.11.3/src/core/ngx_resolver.c 2016-07-27 13:06:13 +0900 (53dae6b) @@ -2996,12 +2996,8 @@ ngx_resolver_srv_names_handler(ngx_resolver_ctx_t *cctx) ngx_addr_t *addrs; ngx_resolver_t *r; ngx_sockaddr_t *sockaddr; - 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; @@ -3045,17 +3041,7 @@ ngx_resolver_srv_names_handler(ngx_resolver_ctx_t *cctx) 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); - } + ngx_inet_set_port(addrs[i].sockaddr, srv->port); } srv->addrs = addrs; Renamed: vendor/nginx-1.11.3/src/core/ngx_resolver.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_rwlock.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_rwlock.h (+0 -0) 100% =================================================================== Added: vendor/nginx-1.11.3/src/core/ngx_sha1.c (+294 -0) 100644 =================================================================== --- /dev/null +++ vendor/nginx-1.11.3/src/core/ngx_sha1.c 2016-07-27 13:06:13 +0900 (f00dc52) @@ -0,0 +1,294 @@ + +/* + * Copyright (C) Maxim Dounin + * Copyright (C) Nginx, Inc. + * + * An internal SHA1 implementation. + */ + + +#include <ngx_config.h> +#include <ngx_core.h> +#include <ngx_sha1.h> + + +static const u_char *ngx_sha1_body(ngx_sha1_t *ctx, const u_char *data, + size_t size); + + +void +ngx_sha1_init(ngx_sha1_t *ctx) +{ + ctx->a = 0x67452301; + ctx->b = 0xefcdab89; + ctx->c = 0x98badcfe; + ctx->d = 0x10325476; + ctx->e = 0xc3d2e1f0; + + ctx->bytes = 0; +} + + +void +ngx_sha1_update(ngx_sha1_t *ctx, const void *data, size_t size) +{ + size_t used, free; + + used = (size_t) (ctx->bytes & 0x3f); + ctx->bytes += size; + + if (used) { + free = 64 - used; + + if (size < free) { + ngx_memcpy(&ctx->buffer[used], data, size); + return; + } + + ngx_memcpy(&ctx->buffer[used], data, free); + data = (u_char *) data + free; + size -= free; + (void) ngx_sha1_body(ctx, ctx->buffer, 64); + } + + if (size >= 64) { + data = ngx_sha1_body(ctx, data, size & ~(size_t) 0x3f); + size &= 0x3f; + } + + ngx_memcpy(ctx->buffer, data, size); +} + + +void +ngx_sha1_final(u_char result[20], ngx_sha1_t *ctx) +{ + size_t used, free; + + used = (size_t) (ctx->bytes & 0x3f); + + ctx->buffer[used++] = 0x80; + + free = 64 - used; + + if (free < 8) { + ngx_memzero(&ctx->buffer[used], free); + (void) ngx_sha1_body(ctx, ctx->buffer, 64); + used = 0; + free = 64; + } + + ngx_memzero(&ctx->buffer[used], free - 8); + + ctx->bytes <<= 3; + ctx->buffer[56] = (u_char) (ctx->bytes >> 56); + ctx->buffer[57] = (u_char) (ctx->bytes >> 48); + ctx->buffer[58] = (u_char) (ctx->bytes >> 40); + ctx->buffer[59] = (u_char) (ctx->bytes >> 32); + ctx->buffer[60] = (u_char) (ctx->bytes >> 24); + ctx->buffer[61] = (u_char) (ctx->bytes >> 16); + ctx->buffer[62] = (u_char) (ctx->bytes >> 8); + ctx->buffer[63] = (u_char) ctx->bytes; + + (void) ngx_sha1_body(ctx, ctx->buffer, 64); + + result[0] = (u_char) (ctx->a >> 24); + result[1] = (u_char) (ctx->a >> 16); + result[2] = (u_char) (ctx->a >> 8); + result[3] = (u_char) ctx->a; + result[4] = (u_char) (ctx->b >> 24); + result[5] = (u_char) (ctx->b >> 16); + result[6] = (u_char) (ctx->b >> 8); + result[7] = (u_char) ctx->b; + result[8] = (u_char) (ctx->c >> 24); + result[9] = (u_char) (ctx->c >> 16); + result[10] = (u_char) (ctx->c >> 8); + result[11] = (u_char) ctx->c; + result[12] = (u_char) (ctx->d >> 24); + result[13] = (u_char) (ctx->d >> 16); + result[14] = (u_char) (ctx->d >> 8); + result[15] = (u_char) ctx->d; + result[16] = (u_char) (ctx->e >> 24); + result[17] = (u_char) (ctx->e >> 16); + result[18] = (u_char) (ctx->e >> 8); + result[19] = (u_char) ctx->e; + + ngx_memzero(ctx, sizeof(*ctx)); +} + + +/* + * Helper functions. + */ + +#define ROTATE(bits, word) (((word) << (bits)) | ((word) >> (32 - (bits)))) + +#define F1(b, c, d) (((b) & (c)) | ((~(b)) & (d))) +#define F2(b, c, d) ((b) ^ (c) ^ (d)) +#define F3(b, c, d) (((b) & (c)) | ((b) & (d)) | ((c) & (d))) + +#define STEP(f, a, b, c, d, e, w, t) \ + temp = ROTATE(5, (a)) + f((b), (c), (d)) + (e) + (w) + (t); \ + (e) = (d); \ + (d) = (c); \ + (c) = ROTATE(30, (b)); \ + (b) = (a); \ + (a) = temp; + + +/* + * GET() reads 4 input bytes in big-endian byte order and returns + * them as uint32_t. + */ + +#define GET(n) \ + ((uint32_t) p[n * 4 + 3] | \ + ((uint32_t) p[n * 4 + 2] << 8) | \ + ((uint32_t) p[n * 4 + 1] << 16) | \ + ((uint32_t) p[n * 4] << 24)) + + +/* + * This processes one or more 64-byte data blocks, but does not update + * the bit counters. There are no alignment requirements. + */ + +static const u_char * +ngx_sha1_body(ngx_sha1_t *ctx, const u_char *data, size_t size) +{ + uint32_t a, b, c, d, e, temp; + uint32_t saved_a, saved_b, saved_c, saved_d, saved_e; + uint32_t words[80]; + ngx_uint_t i; + const u_char *p; + + p = data; + + a = ctx->a; + b = ctx->b; + c = ctx->c; + d = ctx->d; + e = ctx->e; + + do { + saved_a = a; + saved_b = b; + saved_c = c; + saved_d = d; + saved_e = e; + + /* Load data block into the words array */ + + for (i = 0; i < 16; i++) { + words[i] = GET(i); + } + + for (i = 16; i < 80; i++) { + words[i] = ROTATE(1, words[i - 3] ^ words[i - 8] ^ words[i - 14] + ^ words[i - 16]); + } + + /* Transformations */ + + STEP(F1, a, b, c, d, e, words[0], 0x5a827999); + STEP(F1, a, b, c, d, e, words[1], 0x5a827999); + STEP(F1, a, b, c, d, e, words[2], 0x5a827999); + STEP(F1, a, b, c, d, e, words[3], 0x5a827999); + STEP(F1, a, b, c, d, e, words[4], 0x5a827999); + STEP(F1, a, b, c, d, e, words[5], 0x5a827999); + STEP(F1, a, b, c, d, e, words[6], 0x5a827999); + STEP(F1, a, b, c, d, e, words[7], 0x5a827999); + STEP(F1, a, b, c, d, e, words[8], 0x5a827999); + STEP(F1, a, b, c, d, e, words[9], 0x5a827999); + STEP(F1, a, b, c, d, e, words[10], 0x5a827999); + STEP(F1, a, b, c, d, e, words[11], 0x5a827999); + STEP(F1, a, b, c, d, e, words[12], 0x5a827999); + STEP(F1, a, b, c, d, e, words[13], 0x5a827999); + STEP(F1, a, b, c, d, e, words[14], 0x5a827999); + STEP(F1, a, b, c, d, e, words[15], 0x5a827999); + STEP(F1, a, b, c, d, e, words[16], 0x5a827999); + STEP(F1, a, b, c, d, e, words[17], 0x5a827999); + STEP(F1, a, b, c, d, e, words[18], 0x5a827999); + STEP(F1, a, b, c, d, e, words[19], 0x5a827999); + + STEP(F2, a, b, c, d, e, words[20], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[21], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[22], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[23], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[24], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[25], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[26], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[27], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[28], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[29], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[30], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[31], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[32], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[33], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[34], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[35], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[36], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[37], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[38], 0x6ed9eba1); + STEP(F2, a, b, c, d, e, words[39], 0x6ed9eba1); + + STEP(F3, a, b, c, d, e, words[40], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[41], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[42], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[43], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[44], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[45], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[46], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[47], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[48], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[49], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[50], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[51], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[52], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[53], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[54], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[55], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[56], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[57], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[58], 0x8f1bbcdc); + STEP(F3, a, b, c, d, e, words[59], 0x8f1bbcdc); + + STEP(F2, a, b, c, d, e, words[60], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[61], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[62], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[63], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[64], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[65], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[66], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[67], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[68], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[69], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[70], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[71], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[72], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[73], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[74], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[75], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[76], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[77], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[78], 0xca62c1d6); + STEP(F2, a, b, c, d, e, words[79], 0xca62c1d6); + + a += saved_a; + b += saved_b; + c += saved_c; + d += saved_d; + e += saved_e; + + p += 64; + + } while (size -= 64); + + ctx->a = a; + ctx->b = b; + ctx->c = c; + ctx->d = d; + ctx->e = e; + + return p; +} Added: vendor/nginx-1.11.3/src/core/ngx_sha1.h (+28 -0) 100644 =================================================================== --- /dev/null +++ vendor/nginx-1.11.3/src/core/ngx_sha1.h 2016-07-27 13:06:13 +0900 (4a98f71) @@ -0,0 +1,28 @@ + +/* + * Copyright (C) Igor Sysoev + * Copyright (C) Nginx, Inc. + */ + + +#ifndef _NGX_SHA1_H_INCLUDED_ +#define _NGX_SHA1_H_INCLUDED_ + + +#include <ngx_config.h> +#include <ngx_core.h> + + +typedef struct { + uint64_t bytes; + uint32_t a, b, c, d, e, f; + u_char buffer[64]; +} ngx_sha1_t; + + +void ngx_sha1_init(ngx_sha1_t *ctx); +void ngx_sha1_update(ngx_sha1_t *ctx, const void *data, size_t size); +void ngx_sha1_final(u_char result[20], ngx_sha1_t *ctx); + + +#endif /* _NGX_SHA1_H_INCLUDED_ */ Renamed: vendor/nginx-1.11.3/src/core/ngx_shmtx.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_shmtx.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_slab.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_slab.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_spinlock.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_string.c (+2 -2) 99% =================================================================== --- vendor/nginx-1.11.1/src/core/ngx_string.c 2016-07-27 12:58:24 +0900 (cf665a4) +++ vendor/nginx-1.11.3/src/core/ngx_string.c 2016-07-27 13:06:13 +0900 (7a73ef5) @@ -1563,7 +1563,7 @@ ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type) n = 0; while (size) { - if (escape[*src >> 5] & (1 << (*src & 0x1f))) { + if (escape[*src >> 5] & (1U << (*src & 0x1f))) { n++; } src++; @@ -1574,7 +1574,7 @@ ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type) } while (size) { - if (escape[*src >> 5] & (1 << (*src & 0x1f))) { + if (escape[*src >> 5] & (1U << (*src & 0x1f))) { *dst++ = '%'; *dst++ = hex[*src >> 4]; *dst++ = hex[*src & 0xf]; Renamed: vendor/nginx-1.11.3/src/core/ngx_string.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_syslog.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_syslog.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_thread_pool.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_thread_pool.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_times.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/core/ngx_times.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/modules/ngx_devpoll_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/modules/ngx_epoll_module.c (+10 -3) 99% =================================================================== --- vendor/nginx-1.11.1/src/event/modules/ngx_epoll_module.c 2016-07-27 12:58:24 +0900 (de5a942) +++ vendor/nginx-1.11.3/src/event/modules/ngx_epoll_module.c 2016-07-27 13:06:13 +0900 (c267fd6) @@ -17,18 +17,19 @@ #define EPOLLIN 0x001 #define EPOLLPRI 0x002 #define EPOLLOUT 0x004 +#define EPOLLERR 0x008 +#define EPOLLHUP 0x010 #define EPOLLRDNORM 0x040 #define EPOLLRDBAND 0x080 #define EPOLLWRNORM 0x100 #define EPOLLWRBAND 0x200 #define EPOLLMSG 0x400 -#define EPOLLERR 0x008 -#define EPOLLHUP 0x010 #define EPOLLRDHUP 0x2000 -#define EPOLLET 0x80000000 +#define EPOLLEXCLUSIVE 0x10000000 #define EPOLLONESHOT 0x40000000 +#define EPOLLET 0x80000000 #define EPOLL_CTL_ADD 1 #define EPOLL_CTL_DEL 2 @@ -610,6 +611,12 @@ ngx_epoll_add_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags) op = EPOLL_CTL_ADD; } +#if (NGX_HAVE_EPOLLEXCLUSIVE && NGX_HAVE_EPOLLRDHUP) + if (flags & NGX_EXCLUSIVE_EVENT) { + events &= ~EPOLLRDHUP; + } +#endif + ee.events = events | (uint32_t) flags; ee.data.ptr = (void *) ((uintptr_t) c | ev->instance); Renamed: vendor/nginx-1.11.3/src/event/modules/ngx_eventport_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/modules/ngx_iocp_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/modules/ngx_iocp_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/modules/ngx_kqueue_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/modules/ngx_poll_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/modules/ngx_select_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/modules/ngx_win32_select_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/ngx_event.c (+27 -4) 98% =================================================================== --- vendor/nginx-1.11.1/src/event/ngx_event.c 2016-07-27 12:58:24 +0900 (c8ae5b2) +++ vendor/nginx-1.11.3/src/event/ngx_event.c 2016-07-27 13:06:13 +0900 (9d6c4c9) @@ -822,15 +822,38 @@ ngx_event_process_init(ngx_cycle_t *cycle) rev->handler = (c->type == SOCK_STREAM) ? ngx_event_accept : ngx_event_recvmsg; - if (ngx_use_accept_mutex #if (NGX_HAVE_REUSEPORT) - && !ls[i].reuseport + + if (ls[i].reuseport) { + if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) { + return NGX_ERROR; + } + + continue; + } + #endif - ) + + if (ngx_use_accept_mutex) { + continue; + } + +#if (NGX_HAVE_EPOLLEXCLUSIVE) + + if ((ngx_event_flags & NGX_USE_EPOLL_EVENT) + && ccf->worker_processes > 1) { + if (ngx_add_event(rev, NGX_READ_EVENT, NGX_EXCLUSIVE_EVENT) + == NGX_ERROR) + { + return NGX_ERROR; + } + continue; } +#endif + if (ngx_add_event(rev, NGX_READ_EVENT, 0) == NGX_ERROR) { return NGX_ERROR; } @@ -1261,7 +1284,7 @@ ngx_event_core_init_conf(ngx_cycle_t *cycle, void *conf) ngx_conf_init_ptr_value(ecf->name, event_module->name->data); ngx_conf_init_value(ecf->multi_accept, 0); - ngx_conf_init_value(ecf->accept_mutex, 1); + ngx_conf_init_value(ecf->accept_mutex, 0); ngx_conf_init_msec_value(ecf->accept_mutex_delay, 500); return NGX_CONF_OK; Renamed: vendor/nginx-1.11.3/src/event/ngx_event.h (+8 -5) 98% =================================================================== --- vendor/nginx-1.11.1/src/event/ngx_event.h 2016-07-27 12:58:24 +0900 (1c7c148) +++ vendor/nginx-1.11.3/src/event/ngx_event.h 2016-07-27 13:06:13 +0900 (27139ee) @@ -76,11 +76,6 @@ struct ngx_event_s { unsigned cancelable:1; -#if (NGX_WIN32) - /* setsockopt(SO_UPDATE_ACCEPT_CONTEXT) was successful */ - unsigned accept_context_updated:1; -#endif - #if (NGX_HAVE_KQUEUE) unsigned kq_vnode:1; @@ -372,6 +367,9 @@ extern ngx_uint_t ngx_use_epoll_rdhup; #define NGX_ONESHOT_EVENT EPOLLONESHOT #endif +#if (NGX_HAVE_EPOLLEXCLUSIVE) +#define NGX_EXCLUSIVE_EVENT EPOLLEXCLUSIVE +#endif #elif (NGX_HAVE_POLL) @@ -400,6 +398,11 @@ extern ngx_uint_t ngx_use_epoll_rdhup; #endif +#if (NGX_TEST_BUILD_EPOLL) +#define NGX_EXCLUSIVE_EVENT 0 +#endif + + #ifndef NGX_CLEAR_EVENT #define NGX_CLEAR_EVENT 0 /* dummy declaration */ #endif Renamed: vendor/nginx-1.11.3/src/event/ngx_event_accept.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/ngx_event_acceptex.c (+2 -2) 99% =================================================================== --- vendor/nginx-1.11.1/src/event/ngx_event_acceptex.c 2016-07-27 12:58:24 +0900 (e414fe4) +++ vendor/nginx-1.11.3/src/event/ngx_event_acceptex.c 2016-07-27 13:06:13 +0900 (1999faf) @@ -41,8 +41,8 @@ ngx_event_acceptex(ngx_event_t *rev) ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno, "setsockopt(SO_UPDATE_ACCEPT_CONTEXT) failed for %V", &c->addr_text); - } else { - c->accept_context_updated = 1; + /* TODO: close socket */ + return; } ngx_getacceptexsockaddrs(c->buffer->pos, Renamed: vendor/nginx-1.11.3/src/event/ngx_event_connect.c (+50 -0) 84% =================================================================== --- vendor/nginx-1.11.1/src/event/ngx_event_connect.c 2016-07-27 12:58:24 +0900 (5de991e) +++ vendor/nginx-1.11.3/src/event/ngx_event_connect.c 2016-07-27 13:06:13 +0900 (30cb59a) @@ -21,6 +21,9 @@ ngx_int_t ngx_event_connect_peer(ngx_peer_connection_t *pc) { int rc, type; +#if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT || NGX_LINUX) + in_port_t port; +#endif ngx_int_t event; ngx_err_t err; ngx_uint_t level; @@ -87,6 +90,53 @@ ngx_event_connect_peer(ngx_peer_connection_t *pc) } #endif +#if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT || NGX_LINUX) + port = ngx_inet_get_port(pc->sockaddr); +#endif + +#if (NGX_HAVE_IP_BIND_ADDRESS_NO_PORT) + + if (pc->sockaddr->sa_family != AF_UNIX && port == 0) { + static int bind_address_no_port = 1; + + if (bind_address_no_port) { + if (setsockopt(s, IPPROTO_IP, IP_BIND_ADDRESS_NO_PORT, + (const void *) &bind_address_no_port, + sizeof(int)) == -1) + { + err = ngx_socket_errno; + + if (err != NGX_EOPNOTSUPP && err != NGX_ENOPROTOOPT) { + ngx_log_error(NGX_LOG_ALERT, pc->log, err, + "setsockopt(IP_BIND_ADDRESS_NO_PORT) " + "failed, ignored"); + + } else { + bind_address_no_port = 0; + } + } + } + } + +#endif + +#if (NGX_LINUX) + + if (pc->type == SOCK_DGRAM && port != 0) { + int reuse_addr = 1; + + if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, + (const void *) &reuse_addr, sizeof(int)) + == -1) + { + ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno, + "setsockopt(SO_REUSEADDR) failed"); + goto failed; + } + } + +#endif + if (bind(s, pc->local->sockaddr, pc->local->socklen) == -1) { ngx_log_error(NGX_LOG_CRIT, pc->log, ngx_socket_errno, "bind(%V) failed", &pc->local->name); Renamed: vendor/nginx-1.11.3/src/event/ngx_event_connect.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/ngx_event_connectex.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/ngx_event_openssl.c (+24 -0) 99% =================================================================== --- vendor/nginx-1.11.1/src/event/ngx_event_openssl.c 2016-07-27 12:58:24 +0900 (810c469) +++ vendor/nginx-1.11.3/src/event/ngx_event_openssl.c 2016-07-27 13:06:13 +0900 (bb9a900) @@ -592,6 +592,30 @@ ngx_ssl_password_callback(char *buf, int size, int rwflag, void *userdata) ngx_int_t +ngx_ssl_ciphers(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *ciphers, + ngx_uint_t prefer_server_ciphers) +{ + if (SSL_CTX_set_cipher_list(ssl->ctx, (char *) ciphers->data) == 0) { + ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, + "SSL_CTX_set_cipher_list(\"%V\") failed", + ciphers); + return NGX_ERROR; + } + + if (prefer_server_ciphers) { + SSL_CTX_set_options(ssl->ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); + } + +#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(ssl->ctx, ngx_ssl_rsa512_key_callback); +#endif + + return NGX_OK; +} + + +ngx_int_t ngx_ssl_client_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *cert, ngx_int_t depth) { Renamed: vendor/nginx-1.11.3/src/event/ngx_event_openssl.h (+2 -0) 98% =================================================================== --- vendor/nginx-1.11.1/src/event/ngx_event_openssl.h 2016-07-27 12:58:24 +0900 (fc9ec05) +++ vendor/nginx-1.11.3/src/event/ngx_event_openssl.h 2016-07-27 13:06:13 +0900 (3367d10) @@ -144,6 +144,8 @@ ngx_int_t ngx_ssl_certificates(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_array_t *certs, ngx_array_t *keys, ngx_array_t *passwords); ngx_int_t ngx_ssl_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *cert, ngx_str_t *key, ngx_array_t *passwords); +ngx_int_t ngx_ssl_ciphers(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *ciphers, + ngx_uint_t prefer_server_ciphers); ngx_int_t ngx_ssl_client_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, ngx_str_t *cert, ngx_int_t depth); ngx_int_t ngx_ssl_trusted_certificate(ngx_conf_t *cf, ngx_ssl_t *ssl, Renamed: vendor/nginx-1.11.3/src/event/ngx_event_openssl_stapling.c (+1 -13) 99% =================================================================== --- vendor/nginx-1.11.1/src/event/ngx_event_openssl_stapling.c 2016-07-27 12:58:24 +0900 (49762eb) +++ vendor/nginx-1.11.3/src/event/ngx_event_openssl_stapling.c 2016-07-27 13:06:13 +0900 (cce8e9e) @@ -920,7 +920,6 @@ ngx_ssl_ocsp_resolve_handler(ngx_resolver_ctx_t *resolve) u_char *p; size_t len; - in_port_t port; socklen_t socklen; ngx_uint_t i; struct sockaddr *sockaddr; @@ -962,8 +961,6 @@ ngx_ssl_ocsp_resolve_handler(ngx_resolver_ctx_t *resolve) goto failed; } - port = htons(ctx->port); - for (i = 0; i < resolve->naddrs; i++) { socklen = resolve->addrs[i].socklen; @@ -974,16 +971,7 @@ ngx_ssl_ocsp_resolve_handler(ngx_resolver_ctx_t *resolve) } ngx_memcpy(sockaddr, resolve->addrs[i].sockaddr, socklen); - - switch (sockaddr->sa_family) { -#if (NGX_HAVE_INET6) - case AF_INET6: - ((struct sockaddr_in6 *) sockaddr)->sin6_port = port; - break; -#endif - default: /* AF_INET */ - ((struct sockaddr_in *) sockaddr)->sin_port = port; - } + ngx_inet_set_port(sockaddr, ctx->port); ctx->addrs[i].sockaddr = sockaddr; ctx->addrs[i].socklen = socklen; Renamed: vendor/nginx-1.11.3/src/event/ngx_event_pipe.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/ngx_event_pipe.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/ngx_event_posted.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/ngx_event_posted.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/ngx_event_timer.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/event/ngx_event_timer.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_access_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_addition_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_auth_basic_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_auth_request_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_autoindex_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_browser_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_charset_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_chunked_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_dav_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_degradation_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_empty_gif_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_fastcgi_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_flv_module.c (+0 -0) 100% =================================================================== Copied: vendor/nginx-1.11.3/src/http/modules/ngx_http_geo_module.c (+0 -0) 100% =================================================================== Copied: vendor/nginx-1.11.3/src/http/modules/ngx_http_geoip_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_gunzip_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_gzip_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_gzip_static_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_headers_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_image_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_index_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_limit_conn_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_limit_req_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_log_module.c (+2 -2) 99% =================================================================== --- vendor/nginx-1.11.1/src/http/modules/ngx_http_log_module.c 2016-07-27 12:58:24 +0900 (df9424f) +++ vendor/nginx-1.11.3/src/http/modules/ngx_http_log_module.c 2016-07-27 13:06:13 +0900 (c42fb08) @@ -1000,7 +1000,7 @@ ngx_http_log_escape(u_char *dst, u_char *src, size_t size) n = 0; while (size) { - if (escape[*src >> 5] & (1 << (*src & 0x1f))) { + if (escape[*src >> 5] & (1U << (*src & 0x1f))) { n++; } src++; @@ -1011,7 +1011,7 @@ ngx_http_log_escape(u_char *dst, u_char *src, size_t size) } while (size) { - if (escape[*src >> 5] & (1 << (*src & 0x1f))) { + if (escape[*src >> 5] & (1U << (*src & 0x1f))) { *dst++ = '\\'; *dst++ = 'x'; *dst++ = hex[*src >> 4]; Copied: vendor/nginx-1.11.3/src/http/modules/ngx_http_map_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_memcached_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_mp4_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_not_modified_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_proxy_module.c (+2 -6) 99% =================================================================== --- vendor/nginx-1.11.1/src/http/modules/ngx_http_proxy_module.c 2016-07-27 12:58:24 +0900 (5efee7b) +++ vendor/nginx-1.11.3/src/http/modules/ngx_http_proxy_module.c 2016-07-27 13:06:13 +0900 (4f49a52) @@ -4323,13 +4323,9 @@ ngx_http_proxy_set_ssl(ngx_conf_t *cf, ngx_http_proxy_loc_conf_t *plcf) } } - if (SSL_CTX_set_cipher_list(plcf->upstream.ssl->ctx, - (const char *) plcf->ssl_ciphers.data) - == 0) + if (ngx_ssl_ciphers(cf, plcf->upstream.ssl, &plcf->ssl_ciphers, 0) + != NGX_OK) { - ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0, - "SSL_CTX_set_cipher_list(\"%V\") failed", - &plcf->ssl_ciphers); return NGX_ERROR; } Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_random_index_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_range_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_realip_module.c (+2 -37) 93% =================================================================== --- vendor/nginx-1.11.1/src/http/modules/ngx_http_realip_module.c 2016-07-27 12:58:24 +0900 (fca81eb) +++ vendor/nginx-1.11.3/src/http/modules/ngx_http_realip_module.c 2016-07-27 13:06:13 +0900 (490a53d) @@ -138,10 +138,6 @@ ngx_http_realip_handler(ngx_http_request_t *r) ngx_list_part_t *part; ngx_table_elt_t *header; ngx_connection_t *c; - struct sockaddr_in *sin; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif ngx_http_realip_ctx_t *ctx; ngx_http_realip_loc_conf_t *rlcf; @@ -242,21 +238,7 @@ found: != NGX_DECLINED) { if (rlcf->type == NGX_HTTP_REALIP_PROXY) { - - switch (addr.sockaddr->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = (struct sockaddr_in6 *) addr.sockaddr; - sin6->sin6_port = htons(c->proxy_protocol_port); - break; -#endif - - default: /* AF_INET */ - sin = (struct sockaddr_in *) addr.sockaddr; - sin->sin_port = htons(c->proxy_protocol_port); - break; - } + ngx_inet_set_port(addr.sockaddr, c->proxy_protocol_port); } return ngx_http_realip_set_addr(r, &addr); @@ -578,24 +560,7 @@ ngx_http_realip_remote_port_variable(ngx_http_request_t *r, return NGX_ERROR; } - switch (sa->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - port = ntohs(((struct sockaddr_in6 *) sa)->sin6_port); - break; -#endif - -#if (NGX_HAVE_UNIX_DOMAIN) - case AF_UNIX: - port = 0; - break; -#endif - - default: /* AF_INET */ - port = ntohs(((struct sockaddr_in *) sa)->sin_port); - break; - } + port = ngx_inet_get_port(sa); if (port > 0 && port < 65536) { v->len = ngx_sprintf(v->data, "%ui", port) - v->data; Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_referer_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_rewrite_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_scgi_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_secure_link_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_slice_filter_module.c (+0 -0) 100% =================================================================== Copied: vendor/nginx-1.11.3/src/http/modules/ngx_http_split_clients_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_ssi_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_ssi_filter_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_ssl_module.c (+3 -15) 97% =================================================================== --- vendor/nginx-1.11.1/src/http/modules/ngx_http_ssl_module.c 2016-07-27 12:58:24 +0900 (7f23c86) +++ vendor/nginx-1.11.3/src/http/modules/ngx_http_ssl_module.c 2016-07-27 13:06:13 +0900 (d685ae9) @@ -689,13 +689,10 @@ ngx_http_ssl_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) return NGX_CONF_ERROR; } - if (SSL_CTX_set_cipher_list(conf->ssl.ctx, - (const char *) conf->ciphers.data) - == 0) + if (ngx_ssl_ciphers(cf, &conf->ssl, &conf->ciphers, + conf->prefer_server_ciphers) + != NGX_OK) { - ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0, - "SSL_CTX_set_cipher_list(\"%V\") failed", - &conf->ciphers); return NGX_CONF_ERROR; } @@ -730,15 +727,6 @@ ngx_http_ssl_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) return NGX_CONF_ERROR; } - if (conf->prefer_server_ciphers) { - SSL_CTX_set_options(conf->ssl.ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); - } - -#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 - if (ngx_ssl_dhparam(cf, &conf->ssl, &conf->dhparam) != NGX_OK) { return NGX_CONF_ERROR; } Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_ssl_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_static_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_stub_status_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_sub_filter_module.c (+89 -35) 92% =================================================================== --- vendor/nginx-1.11.1/src/http/modules/ngx_http_sub_filter_module.c 2016-07-27 12:58:24 +0900 (bb1c50b) +++ vendor/nginx-1.11.3/src/http/modules/ngx_http_sub_filter_module.c 2016-07-27 13:06:13 +0900 (e8d1d80) @@ -83,7 +83,9 @@ static ngx_uint_t ngx_http_sub_cmp_index; static ngx_int_t ngx_http_sub_output(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx); static ngx_int_t ngx_http_sub_parse(ngx_http_request_t *r, - ngx_http_sub_ctx_t *ctx); + ngx_http_sub_ctx_t *ctx, ngx_uint_t flush); +static ngx_int_t ngx_http_sub_match(ngx_http_sub_ctx_t *ctx, ngx_int_t start, + ngx_str_t *m); static char * ngx_http_sub_filter(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); @@ -285,6 +287,7 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in) ngx_int_t rc; ngx_buf_t *b; ngx_str_t *sub; + ngx_uint_t flush, last; ngx_chain_t *cl; ngx_http_sub_ctx_t *ctx; ngx_http_sub_match_t *match; @@ -326,6 +329,9 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in) ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http sub filter \"%V\"", &r->uri); + flush = 0; + last = 0; + while (ctx->in || ctx->buf) { if (ctx->buf == NULL) { @@ -334,11 +340,19 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in) ctx->pos = ctx->buf->pos; } + if (ctx->buf->flush || ctx->buf->recycled) { + flush = 1; + } + + if (ctx->in == NULL) { + last = flush; + } + b = NULL; while (ctx->pos < ctx->buf->last) { - rc = ngx_http_sub_parse(r, ctx); + rc = ngx_http_sub_parse(r, ctx, last); ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "parse: %i, looked: \"%V\" %p-%p", @@ -590,9 +604,10 @@ ngx_http_sub_output(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx) static ngx_int_t -ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx) +ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx, + ngx_uint_t flush) { - u_char *p, *last, *pat, *pat_end, c; + u_char *p, c; ngx_str_t *m; ngx_int_t offset, start, next, end, len, rc; ngx_uint_t shift, i, j; @@ -602,6 +617,7 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx) slcf = ngx_http_get_module_loc_conf(r, ngx_http_sub_filter_module); tables = ctx->tables; + match = ctx->matches->elts; offset = ctx->offset; end = ctx->buf->last - ctx->pos; @@ -628,7 +644,6 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx) /* a potential match */ start = offset - (ngx_int_t) tables->min_match_len + 1; - match = ctx->matches->elts; i = ngx_max(tables->index[c], ctx->index); j = tables->index[c + 1]; @@ -641,41 +656,15 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx) m = &match[i].match; - pat = m->data; - pat_end = m->data + m->len; - - if (start >= 0) { - p = ctx->pos + start; - - } else { - last = ctx->looked.data + ctx->looked.len; - p = last + start; - - while (p < last && pat < pat_end) { - if (ngx_tolower(*p) != *pat) { - goto next; - } - - p++; - pat++; - } - - p = ctx->pos; - } - - while (p < ctx->buf->last && pat < pat_end) { - if (ngx_tolower(*p) != *pat) { - goto next; - } + rc = ngx_http_sub_match(ctx, start, m); - p++; - pat++; + if (rc == NGX_DECLINED) { + goto next; } ctx->index = i; - if (pat != pat_end) { - /* partial match */ + if (rc == NGX_AGAIN) { goto again; } @@ -695,6 +684,26 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx) ctx->index = 0; } + if (flush) { + for ( ;; ) { + start = offset - (ngx_int_t) tables->min_match_len + 1; + + if (start >= end) { + break; + } + + for (i = 0; i < ctx->matches->nelts; i++) { + m = &match[i].match; + + if (ngx_http_sub_match(ctx, start, m) == NGX_AGAIN) { + goto again; + } + } + + offset++; + } + } + again: ctx->offset = offset; @@ -731,6 +740,51 @@ done: } +static ngx_int_t +ngx_http_sub_match(ngx_http_sub_ctx_t *ctx, ngx_int_t start, ngx_str_t *m) +{ + u_char *p, *last, *pat, *pat_end; + + pat = m->data; + pat_end = m->data + m->len; + + if (start >= 0) { + p = ctx->pos + start; + + } else { + last = ctx->looked.data + ctx->looked.len; + p = last + start; + + while (p < last && pat < pat_end) { + if (ngx_tolower(*p) != *pat) { + return NGX_DECLINED; + } + + p++; + pat++; + } + + p = ctx->pos; + } + + while (p < ctx->buf->last && pat < pat_end) { + if (ngx_tolower(*p) != *pat) { + return NGX_DECLINED; + } + + p++; + pat++; + } + + if (pat != pat_end) { + /* partial match */ + return NGX_AGAIN; + } + + return NGX_OK; +} + + static char * ngx_http_sub_filter(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_upstream_hash_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_upstream_ip_hash_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_upstream_keepalive_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_upstream_least_conn_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_upstream_zone_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_userid_filter_module.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.11.1/src/http/modules/ngx_http_userid_filter_module.c 2016-07-27 12:58:24 +0900 (1487c09) +++ vendor/nginx-1.11.3/src/http/modules/ngx_http_userid_filter_module.c 2016-07-27 13:06:13 +0900 (0dbacba) @@ -836,7 +836,7 @@ ngx_http_userid_init_worker(ngx_cycle_t *cycle) ngx_gettimeofday(&tp); /* use the most significant usec part that fits to 16 bits */ - start_value = ((tp.tv_usec / 20) << 16) | ngx_pid; + start_value = (((uint32_t) tp.tv_usec / 20) << 16) | ngx_pid; return NGX_OK; } Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_uwsgi_module.c (+2 -6) 99% =================================================================== --- vendor/nginx-1.11.1/src/http/modules/ngx_http_uwsgi_module.c 2016-07-27 12:58:24 +0900 (a03c6f6) +++ vendor/nginx-1.11.3/src/http/modules/ngx_http_uwsgi_module.c 2016-07-27 13:06:13 +0900 (7f916e8) @@ -2325,13 +2325,9 @@ ngx_http_uwsgi_set_ssl(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *uwcf) } } - if (SSL_CTX_set_cipher_list(uwcf->upstream.ssl->ctx, - (const char *) uwcf->ssl_ciphers.data) - == 0) + if (ngx_ssl_ciphers(cf, uwcf->upstream.ssl, &uwcf->ssl_ciphers, 0) + != NGX_OK) { - ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0, - "SSL_CTX_set_cipher_list(\"%V\") failed", - &uwcf->ssl_ciphers); return NGX_ERROR; } Renamed: vendor/nginx-1.11.3/src/http/modules/ngx_http_xslt_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/perl/Makefile.PL (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/perl/nginx.pm (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/perl/nginx.xs (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/perl/ngx_http_perl_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/perl/ngx_http_perl_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/modules/perl/typemap (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http.c (+1 -25) 99% =================================================================== --- vendor/nginx-1.11.1/src/http/ngx_http.c 2016-07-27 12:58:24 +0900 (13d497c) +++ vendor/nginx-1.11.3/src/http/ngx_http.c 2016-07-27 13:06:13 +0900 (7a46b3e) @@ -1144,12 +1144,8 @@ ngx_http_add_listen(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf, in_port_t p; ngx_uint_t i; struct sockaddr *sa; - struct sockaddr_in *sin; ngx_http_conf_port_t *port; ngx_http_core_main_conf_t *cmcf; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); @@ -1162,27 +1158,7 @@ ngx_http_add_listen(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf, } sa = &lsopt->sockaddr.sockaddr; - - switch (sa->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = &lsopt->sockaddr.sockaddr_in6; - p = sin6->sin6_port; - break; -#endif - -#if (NGX_HAVE_UNIX_DOMAIN) - case AF_UNIX: - p = 0; - break; -#endif - - default: /* AF_INET */ - sin = &lsopt->sockaddr.sockaddr_in; - p = sin->sin_port; - break; - } + p = ngx_inet_get_port(sa); port = cmcf->ports->elts; for (i = 0; i < cmcf->ports->nelts; i++) { Renamed: vendor/nginx-1.11.3/src/http/ngx_http.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_cache.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_copy_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_core_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_core_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_file_cache.c (+5 -5) 99% =================================================================== --- vendor/nginx-1.11.1/src/http/ngx_http_file_cache.c 2016-07-27 12:58:24 +0900 (38b695e) +++ vendor/nginx-1.11.3/src/http/ngx_http_file_cache.c 2016-07-27 13:06:13 +0900 (4bf0f7f) @@ -101,7 +101,7 @@ ngx_http_file_cache_init(ngx_shm_zone_t *shm_zone, void *data) return NGX_ERROR; } - for (n = 0; n < 3; n++) { + for (n = 0; n < NGX_MAX_PATH_LEVEL; n++) { if (cache->path->level[n] != ocache->path->level[n]) { ngx_log_error(NGX_LOG_EMERG, shm_zone->shm.log, 0, "cache \"%V\" had previously different levels", @@ -2257,7 +2257,7 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) p = value[i].data + 7; last = value[i].data + value[i].len; - for (n = 0; n < 3 && p < last; n++) { + for (n = 0; n < NGX_MAX_PATH_LEVEL && p < last; n++) { if (*p > '0' && *p < '3') { @@ -2268,7 +2268,7 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) break; } - if (*p++ == ':' && n < 2 && p != last) { + if (*p++ == ':' && n < NGX_MAX_PATH_LEVEL - 1 && p < last) { continue; } @@ -2278,7 +2278,7 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) goto invalid_levels; } - if (cache->path->len < 10 + 3) { + if (cache->path->len < 10 + NGX_MAX_PATH_LEVEL) { continue; } @@ -2450,7 +2450,7 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_memcpy(p, "/temp", sizeof("/temp")); ngx_memcpy(&cache->temp_path->level, &cache->path->level, - 3 * sizeof(size_t)); + NGX_MAX_PATH_LEVEL * sizeof(size_t)); cache->temp_path->len = cache->path->len; cache->temp_path->conf_file = cf->conf_file->file.name.data; Renamed: vendor/nginx-1.11.3/src/http/ngx_http_header_filter_module.c (+1 -22) 96% =================================================================== --- vendor/nginx-1.11.1/src/http/ngx_http_header_filter_module.c 2016-07-27 12:58:24 +0900 (2cf1205) +++ vendor/nginx-1.11.3/src/http/ngx_http_header_filter_module.c 2016-07-27 13:06:13 +0900 (f000b2e) @@ -161,10 +161,6 @@ ngx_http_header_filter(ngx_http_request_t *r) ngx_connection_t *c; ngx_http_core_loc_conf_t *clcf; ngx_http_core_srv_conf_t *cscf; - struct sockaddr_in *sin; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif u_char addr[NGX_SOCKADDR_STRLEN]; if (r->header_sent) { @@ -333,24 +329,7 @@ ngx_http_header_filter(ngx_http_request_t *r) } } - switch (c->local_sockaddr->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = (struct sockaddr_in6 *) c->local_sockaddr; - port = ntohs(sin6->sin6_port); - break; -#endif -#if (NGX_HAVE_UNIX_DOMAIN) - case AF_UNIX: - port = 0; - break; -#endif - default: /* AF_INET */ - sin = (struct sockaddr_in *) c->local_sockaddr; - port = ntohs(sin->sin_port); - break; - } + port = ngx_inet_get_port(c->local_sockaddr); len += sizeof("Location: https://") - 1 + host.len Renamed: vendor/nginx-1.11.3/src/http/ngx_http_parse.c (+11 -11) 98% =================================================================== --- vendor/nginx-1.11.1/src/http/ngx_http_parse.c 2016-07-27 12:58:24 +0900 (59aa1fe) +++ vendor/nginx-1.11.3/src/http/ngx_http_parse.c 2016-07-27 13:06:13 +0900 (bd6c9c9) @@ -481,7 +481,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b) /* check "/.", "//", "%", and "\" (Win32) in URI */ case sw_after_slash_in_uri: - if (usual[ch >> 5] & (1 << (ch & 0x1f))) { + if (usual[ch >> 5] & (1U << (ch & 0x1f))) { state = sw_check_uri; break; } @@ -540,7 +540,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b) /* check "/", "%" and "\" (Win32) in URI */ case sw_check_uri: - if (usual[ch >> 5] & (1 << (ch & 0x1f))) { + if (usual[ch >> 5] & (1U << (ch & 0x1f))) { break; } @@ -626,7 +626,7 @@ ngx_http_parse_request_line(ngx_http_request_t *r, ngx_buf_t *b) /* URI */ case sw_uri: - if (usual[ch >> 5] & (1 << (ch & 0x1f))) { + if (usual[ch >> 5] & (1U << (ch & 0x1f))) { break; } @@ -1131,7 +1131,7 @@ ngx_http_parse_uri(ngx_http_request_t *r) /* check "/.", "//", "%", and "\" (Win32) in URI */ case sw_after_slash_in_uri: - if (usual[ch >> 5] & (1 << (ch & 0x1f))) { + if (usual[ch >> 5] & (1U << (ch & 0x1f))) { state = sw_check_uri; break; } @@ -1179,7 +1179,7 @@ ngx_http_parse_uri(ngx_http_request_t *r) /* check "/", "%" and "\" (Win32) in URI */ case sw_check_uri: - if (usual[ch >> 5] & (1 << (ch & 0x1f))) { + if (usual[ch >> 5] & (1U << (ch & 0x1f))) { break; } @@ -1228,7 +1228,7 @@ ngx_http_parse_uri(ngx_http_request_t *r) /* URI */ case sw_uri: - if (usual[ch >> 5] & (1 << (ch & 0x1f))) { + if (usual[ch >> 5] & (1U << (ch & 0x1f))) { break; } @@ -1289,7 +1289,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes) case sw_usual: - if (usual[ch >> 5] & (1 << (ch & 0x1f))) { + if (usual[ch >> 5] & (1U << (ch & 0x1f))) { *u++ = ch; ch = *p++; break; @@ -1358,7 +1358,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes) case sw_slash: - if (usual[ch >> 5] & (1 << (ch & 0x1f))) { + if (usual[ch >> 5] & (1U << (ch & 0x1f))) { state = sw_usual; *u++ = ch; ch = *p++; @@ -1401,7 +1401,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes) case sw_dot: - if (usual[ch >> 5] & (1 << (ch & 0x1f))) { + if (usual[ch >> 5] & (1U << (ch & 0x1f))) { state = sw_usual; *u++ = ch; ch = *p++; @@ -1442,7 +1442,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes) case sw_dot_dot: - if (usual[ch >> 5] & (1 << (ch & 0x1f))) { + if (usual[ch >> 5] & (1U << (ch & 0x1f))) { state = sw_usual; *u++ = ch; ch = *p++; @@ -1836,7 +1836,7 @@ ngx_http_parse_unsafe_uri(ngx_http_request_t *r, ngx_str_t *uri, continue; } - if (usual[ch >> 5] & (1 << (ch & 0x1f))) { + if (usual[ch >> 5] & (1U << (ch & 0x1f))) { continue; } Renamed: vendor/nginx-1.11.3/src/http/ngx_http_postpone_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_request.c (+1 -1) 99% =================================================================== --- vendor/nginx-1.11.1/src/http/ngx_http_request.c 2016-07-27 12:58:24 +0900 (31e3539) +++ vendor/nginx-1.11.3/src/http/ngx_http_request.c 2016-07-27 13:06:13 +0900 (6ff7903) @@ -2068,7 +2068,7 @@ ngx_http_set_virtual_server(ngx_http_request_t *r, ngx_str_t *host) if (sscf->verify) { ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, "client attempted to request the server name " - "different from that one was negotiated"); + "different from the one that was negotiated"); ngx_http_finalize_request(r, NGX_HTTP_MISDIRECTED_REQUEST); return NGX_ERROR; } Renamed: vendor/nginx-1.11.3/src/http/ngx_http_request.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_request_body.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_script.c (+8 -6) 99% =================================================================== --- vendor/nginx-1.11.1/src/http/ngx_http_script.c 2016-07-27 12:58:24 +0900 (bff9525) +++ vendor/nginx-1.11.3/src/http/ngx_http_script.c 2016-07-27 13:06:13 +0900 (c2b1658) @@ -350,11 +350,9 @@ ngx_http_script_compile(ngx_http_script_compile_t *sc) goto invalid_variable; } -#if (NGX_PCRE) - { - ngx_uint_t n; - if (sc->source->data[i] >= '1' && sc->source->data[i] <= '9') { +#if (NGX_PCRE) + ngx_uint_t n; n = sc->source->data[i] - '0'; @@ -371,9 +369,13 @@ ngx_http_script_compile(ngx_http_script_compile_t *sc) i++; continue; - } - } +#else + ngx_conf_log_error(NGX_LOG_EMERG, sc->cf, 0, + "using variable \"$%c\" requires " + "PCRE library", sc->source->data[i]); + return NGX_ERROR; #endif + } if (sc->source->data[i] == '{') { bracket = 1; Renamed: vendor/nginx-1.11.3/src/http/ngx_http_script.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_special_response.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_upstream.c (+3 -2) 99% =================================================================== --- vendor/nginx-1.11.1/src/http/ngx_http_upstream.c 2016-07-27 12:58:24 +0900 (89b2160) +++ vendor/nginx-1.11.3/src/http/ngx_http_upstream.c 2016-07-27 13:06:13 +0900 (0f6b3ae) @@ -5828,7 +5828,8 @@ ngx_http_upstream_bind_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, return NGX_CONF_ERROR; } - rc = ngx_parse_addr(cf->pool, local->addr, value[1].data, value[1].len); + rc = ngx_parse_addr_port(cf->pool, local->addr, value[1].data, + value[1].len); switch (rc) { case NGX_OK: @@ -5900,7 +5901,7 @@ ngx_http_upstream_set_local(ngx_http_request_t *r, ngx_http_upstream_t *u, return NGX_ERROR; } - rc = ngx_parse_addr(r->pool, addr, val.data, val.len); + rc = ngx_parse_addr_port(r->pool, addr, val.data, val.len); if (rc == NGX_ERROR) { return NGX_ERROR; } Renamed: vendor/nginx-1.11.3/src/http/ngx_http_upstream.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_upstream_round_robin.c (+1 -10) 98% =================================================================== --- vendor/nginx-1.11.1/src/http/ngx_http_upstream_round_robin.c 2016-07-27 12:58:24 +0900 (8342dc8) +++ vendor/nginx-1.11.3/src/http/ngx_http_upstream_round_robin.c 2016-07-27 13:06:13 +0900 (8479c42) @@ -354,16 +354,7 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r, } ngx_memcpy(sockaddr, ur->addrs[i].sockaddr, socklen); - - switch (sockaddr->sa_family) { -#if (NGX_HAVE_INET6) - case AF_INET6: - ((struct sockaddr_in6 *) sockaddr)->sin6_port = htons(ur->port); - break; -#endif - default: /* AF_INET */ - ((struct sockaddr_in *) sockaddr)->sin_port = htons(ur->port); - } + ngx_inet_set_port(sockaddr, ur->port); p = ngx_pnalloc(r->pool, NGX_SOCKADDR_STRLEN); if (p == NULL) { Renamed: vendor/nginx-1.11.3/src/http/ngx_http_upstream_round_robin.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_variables.c (+4 -50) 98% =================================================================== --- vendor/nginx-1.11.1/src/http/ngx_http_variables.c 2016-07-27 12:58:24 +0900 (d310d32) +++ vendor/nginx-1.11.3/src/http/ngx_http_variables.c 2016-07-27 13:06:13 +0900 (7e65b2e) @@ -1201,11 +1201,7 @@ static ngx_int_t ngx_http_variable_remote_port(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { - ngx_uint_t port; - struct sockaddr_in *sin; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif + ngx_uint_t port; v->len = 0; v->valid = 1; @@ -1217,26 +1213,7 @@ ngx_http_variable_remote_port(ngx_http_request_t *r, return NGX_ERROR; } - switch (r->connection->sockaddr->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = (struct sockaddr_in6 *) r->connection->sockaddr; - port = ntohs(sin6->sin6_port); - break; -#endif - -#if (NGX_HAVE_UNIX_DOMAIN) - case AF_UNIX: - port = 0; - break; -#endif - - default: /* AF_INET */ - sin = (struct sockaddr_in *) r->connection->sockaddr; - port = ntohs(sin->sin_port); - break; - } + port = ngx_inet_get_port(r->connection->sockaddr); if (port > 0 && port < 65536) { v->len = ngx_sprintf(v->data, "%ui", port) - v->data; @@ -1321,11 +1298,7 @@ static ngx_int_t ngx_http_variable_server_port(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { - ngx_uint_t port; - struct sockaddr_in *sin; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif + ngx_uint_t port; v->len = 0; v->valid = 1; @@ -1341,26 +1314,7 @@ ngx_http_variable_server_port(ngx_http_request_t *r, return NGX_ERROR; } - switch (r->connection->local_sockaddr->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = (struct sockaddr_in6 *) r->connection->local_sockaddr; - port = ntohs(sin6->sin6_port); - break; -#endif - -#if (NGX_HAVE_UNIX_DOMAIN) - case AF_UNIX: - port = 0; - break; -#endif - - default: /* AF_INET */ - sin = (struct sockaddr_in *) r->connection->local_sockaddr; - port = ntohs(sin->sin_port); - break; - } + port = ngx_inet_get_port(r->connection->local_sockaddr); if (port > 0 && port < 65536) { v->len = ngx_sprintf(v->data, "%ui", port) - v->data; Renamed: vendor/nginx-1.11.3/src/http/ngx_http_variables.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/ngx_http_write_filter_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/v2/ngx_http_v2.c (+49 -19) 99% =================================================================== --- vendor/nginx-1.11.1/src/http/v2/ngx_http_v2.c 2016-07-27 12:58:24 +0900 (208f0f3) +++ vendor/nginx-1.11.3/src/http/v2/ngx_http_v2.c 2016-07-27 13:06:13 +0900 (d0cd2ab) @@ -410,6 +410,16 @@ ngx_http_v2_write_handler(ngx_event_t *wev) ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http2 write handler"); + if (h2c->last_out == NULL && !c->buffered) { + + if (wev->timer_set) { + ngx_del_timer(wev); + } + + ngx_http_v2_handle_connection(h2c); + return; + } + h2c->blocked = 1; rc = ngx_http_v2_send_output_queue(h2c); @@ -468,7 +478,7 @@ ngx_http_v2_send_output_queue(ngx_http_v2_connection_t *h2c) wev = c->write; if (!wev->ready) { - return NGX_OK; + return NGX_AGAIN; } cl = NULL; @@ -539,15 +549,6 @@ ngx_http_v2_send_output_queue(ngx_http_v2_connection_t *h2c) c->tcp_nodelay = NGX_TCP_NODELAY_SET; } - if (cl) { - ngx_add_timer(wev, clcf->send_timeout); - - } else { - if (wev->timer_set) { - ngx_del_timer(wev); - } - } - for ( /* void */ ; out; out = fn) { fn = out->next; @@ -572,6 +573,15 @@ ngx_http_v2_send_output_queue(ngx_http_v2_connection_t *h2c) h2c->last_out = frame; + if (!wev->ready) { + ngx_add_timer(wev, clcf->send_timeout); + return NGX_AGAIN; + } + + if (wev->timer_set) { + ngx_del_timer(wev); + } + return NGX_OK; error: @@ -589,7 +599,8 @@ error: static void ngx_http_v2_handle_connection(ngx_http_v2_connection_t *h2c) { - ngx_connection_t *c; + ngx_int_t rc; + ngx_connection_t *c; ngx_http_v2_srv_conf_t *h2scf; if (h2c->last_out || h2c->processing) { @@ -604,7 +615,22 @@ ngx_http_v2_handle_connection(ngx_http_v2_connection_t *h2c) } if (c->buffered) { - return; + h2c->blocked = 1; + + rc = ngx_http_v2_send_output_queue(h2c); + + h2c->blocked = 0; + + if (rc == NGX_ERROR) { + ngx_http_close_connection(c); + return; + } + + if (rc == NGX_AGAIN) { + return; + } + + /* rc == NGX_OK */ } h2scf = ngx_http_get_module_srv_conf(h2c->http_connection->conf_ctx, @@ -615,7 +641,7 @@ ngx_http_v2_handle_connection(ngx_http_v2_connection_t *h2c) } if (ngx_terminate || ngx_exiting) { - ngx_http_close_connection(c); + ngx_http_v2_finalize_connection(h2c, NGX_HTTP_V2_NO_ERROR); return; } @@ -3424,7 +3450,9 @@ ngx_http_v2_run_request(ngx_http_request_t *r) return; } - r->headers_in.chunked = (r->headers_in.content_length_n == -1); + if (r->headers_in.content_length_n == -1 && !r->stream->in_closed) { + r->headers_in.chunked = 1; + } ngx_http_process_request(r); } @@ -3638,7 +3666,7 @@ ngx_http_v2_process_request_body(ngx_http_request_t *r, u_char *pos, rb->buf = NULL; } - if (r->headers_in.content_length_n == -1) { + if (r->headers_in.chunked) { r->headers_in.content_length_n = rb->received; } @@ -3890,6 +3918,10 @@ ngx_http_v2_terminate_stream(ngx_http_v2_connection_t *h2c, ngx_event_t *rev; ngx_connection_t *fc; + if (stream->rst_sent) { + return NGX_OK; + } + if (ngx_http_v2_send_rst_stream(h2c, stream->node->id, status) == NGX_ERROR) { @@ -3897,6 +3929,7 @@ ngx_http_v2_terminate_stream(ngx_http_v2_connection_t *h2c, } stream->rst_sent = 1; + stream->skip_data = 1; fc = stream->request->connection; fc->error = 1; @@ -3928,6 +3961,7 @@ ngx_http_v2_close_stream(ngx_http_v2_stream_t *stream, ngx_int_t rc) if (stream->queued) { fc->write->handler = ngx_http_v2_close_stream_handler; + fc->read->handler = ngx_http_empty_handler; return; } @@ -4169,10 +4203,6 @@ ngx_http_v2_finalize_connection(ngx_http_v2_connection_t *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; Renamed: vendor/nginx-1.11.3/src/http/v2/ngx_http_v2.h (+1 -1) 99% =================================================================== --- vendor/nginx-1.11.1/src/http/v2/ngx_http_v2.h 2016-07-27 12:58:24 +0900 (9e738aa) +++ vendor/nginx-1.11.3/src/http/v2/ngx_http_v2.h 2016-07-27 13:06:13 +0900 (d712d38) @@ -298,7 +298,7 @@ size_t ngx_http_v2_huff_encode(u_char *src, size_t len, u_char *dst, #define ngx_http_v2_parse_uint16(p) ((p)[0] << 8 | (p)[1]) #define ngx_http_v2_parse_uint32(p) \ - ((p)[0] << 24 | (p)[1] << 16 | (p)[2] << 8 | (p)[3]) + ((uint32_t) (p)[0] << 24 | (p)[1] << 16 | (p)[2] << 8 | (p)[3]) #endif Renamed: vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_filter_module.c (+19 -36) 97% =================================================================== --- vendor/nginx-1.11.1/src/http/v2/ngx_http_v2_filter_module.c 2016-07-27 12:58:24 +0900 (caa835d) +++ vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_filter_module.c 2016-07-27 13:06:13 +0900 (4ab7791) @@ -137,10 +137,6 @@ ngx_http_v2_header_filter(ngx_http_request_t *r) ngx_http_v2_out_frame_t *frame; ngx_http_core_loc_conf_t *clcf; ngx_http_core_srv_conf_t *cscf; - struct sockaddr_in *sin; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif u_char addr[NGX_SOCKADDR_STRLEN]; static const u_char nginx[5] = "\x84\xaa\x63\x55\xe7"; @@ -169,6 +165,12 @@ ngx_http_v2_header_filter(ngx_http_request_t *r) return NGX_OK; } + fc = r->connection; + + if (fc->error) { + return NGX_ERROR; + } + if (r->method == NGX_HTTP_HEAD) { r->header_only = 1; } @@ -259,8 +261,6 @@ ngx_http_v2_header_filter(ngx_http_request_t *r) len += 1 + ngx_http_v2_literal_size("Wed, 31 Dec 1986 18:00:00 GMT"); } - fc = r->connection; - if (r->headers_out.location && r->headers_out.location->value.len) { if (r->headers_out.location->value.data[0] == '/') { @@ -280,24 +280,7 @@ ngx_http_v2_header_filter(ngx_http_request_t *r) } } - switch (fc->local_sockaddr->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = (struct sockaddr_in6 *) fc->local_sockaddr; - port = ntohs(sin6->sin6_port); - break; -#endif -#if (NGX_HAVE_UNIX_DOMAIN) - case AF_UNIX: - port = 0; - break; -#endif - default: /* AF_INET */ - sin = (struct sockaddr_in *) fc->local_sockaddr; - port = ntohs(sin->sin_port); - break; - } + port = ngx_inet_get_port(fc->local_sockaddr); location.len = sizeof("https://") - 1 + host.len + r->headers_out.location->value.len; @@ -995,12 +978,11 @@ static ngx_http_v2_out_frame_t * ngx_http_v2_filter_get_data_frame(ngx_http_v2_stream_t *stream, size_t len, ngx_chain_t *first, ngx_chain_t *last) { - u_char flags; - ngx_buf_t *buf; - ngx_chain_t *cl; + u_char flags; + ngx_buf_t *buf; + ngx_chain_t *cl; ngx_http_v2_out_frame_t *frame; - frame = stream->free_frames; if (frame) { @@ -1028,7 +1010,7 @@ ngx_http_v2_filter_get_data_frame(ngx_http_v2_stream_t *stream, buf = cl->buf; - if (!buf->start) { + if (buf->start == NULL) { buf->start = ngx_palloc(stream->request->pool, NGX_HTTP_V2_FRAME_HEADER_SIZE); if (buf->start == NULL) { @@ -1203,7 +1185,6 @@ ngx_http_v2_data_frame_handler(ngx_http_v2_connection_t *h2c, ngx_http_v2_stream_t *stream; stream = frame->stream; - cl = frame->first; if (cl->buf->tag == (ngx_buf_tag_t) &ngx_http_v2_module) { @@ -1313,18 +1294,20 @@ static ngx_inline void ngx_http_v2_handle_stream(ngx_http_v2_connection_t *h2c, ngx_http_v2_stream_t *stream) { - ngx_event_t *wev; + ngx_connection_t *fc; - if (stream->handled || stream->blocked || stream->exhausted) { + if (stream->handled || stream->blocked) { return; } - wev = stream->request->connection->write; + fc = stream->request->connection; - if (!wev->delayed) { - stream->handled = 1; - ngx_queue_insert_tail(&h2c->posted, &stream->queue); + if (!fc->error && (stream->exhausted || fc->write->delayed)) { + return; } + + stream->handled = 1; + ngx_queue_insert_tail(&h2c->posted, &stream->queue); } Renamed: vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_huff_decode.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_huff_encode.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/http/v2/ngx_http_v2_table.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail.c (+1 -25) 96% =================================================================== --- vendor/nginx-1.11.1/src/mail/ngx_mail.c 2016-07-27 12:58:24 +0900 (78cbe01) +++ vendor/nginx-1.11.3/src/mail/ngx_mail.c 2016-07-27 13:06:13 +0900 (e5a77b0) @@ -228,35 +228,11 @@ ngx_mail_add_ports(ngx_conf_t *cf, ngx_array_t *ports, in_port_t p; ngx_uint_t i; struct sockaddr *sa; - struct sockaddr_in *sin; ngx_mail_conf_port_t *port; ngx_mail_conf_addr_t *addr; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif sa = &listen->sockaddr.sockaddr; - - switch (sa->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = &listen->sockaddr.sockaddr_in6; - p = sin6->sin6_port; - break; -#endif - -#if (NGX_HAVE_UNIX_DOMAIN) - case AF_UNIX: - p = 0; - break; -#endif - - default: /* AF_INET */ - sin = &listen->sockaddr.sockaddr_in; - p = sin->sin_port; - break; - } + p = ngx_inet_get_port(sa); port = ports->elts; for (i = 0; i < ports->nelts; i++) { Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_auth_http_module.c (+6 -23) 98% =================================================================== --- vendor/nginx-1.11.1/src/mail/ngx_mail_auth_http_module.c 2016-07-27 12:58:24 +0900 (39f9b17) +++ vendor/nginx-1.11.3/src/mail/ngx_mail_auth_http_module.c 2016-07-27 13:06:13 +0900 (a94434a) @@ -462,15 +462,11 @@ static void ngx_mail_auth_http_process_headers(ngx_mail_session_t *s, ngx_mail_auth_http_ctx_t *ctx) { - u_char *p; - time_t timer; - size_t len, size; - ngx_int_t rc, port, n; - ngx_addr_t *peer; - struct sockaddr_in *sin; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif + u_char *p; + time_t timer; + size_t len, size; + ngx_int_t rc, port, n; + ngx_addr_t *peer; ngx_log_debug0(NGX_LOG_DEBUG_MAIL, s->connection->log, 0, "mail auth http process headers"); @@ -813,20 +809,7 @@ ngx_mail_auth_http_process_headers(ngx_mail_session_t *s, return; } - switch (peer->sockaddr->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = (struct sockaddr_in6 *) peer->sockaddr; - sin6->sin6_port = htons((in_port_t) port); - break; -#endif - - default: /* AF_INET */ - sin = (struct sockaddr_in *) peer->sockaddr; - sin->sin_port = htons((in_port_t) port); - break; - } + ngx_inet_set_port(peer->sockaddr, (in_port_t) port); len = ctx->addr.len + 1 + ctx->port.len; Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_core_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_handler.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_imap_handler.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_imap_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_imap_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_parse.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_pop3_handler.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_pop3_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_pop3_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_proxy_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_smtp_handler.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_smtp_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_smtp_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_ssl_module.c (+3 -14) 97% =================================================================== --- vendor/nginx-1.11.1/src/mail/ngx_mail_ssl_module.c 2016-07-27 12:58:24 +0900 (83cffb8) +++ vendor/nginx-1.11.3/src/mail/ngx_mail_ssl_module.c 2016-07-27 13:06:13 +0900 (11e428c) @@ -422,24 +422,13 @@ ngx_mail_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child) } } - if (SSL_CTX_set_cipher_list(conf->ssl.ctx, - (const char *) conf->ciphers.data) - == 0) + if (ngx_ssl_ciphers(cf, &conf->ssl, &conf->ciphers, + conf->prefer_server_ciphers) + != NGX_OK) { - ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0, - "SSL_CTX_set_cipher_list(\"%V\") failed", - &conf->ciphers); return NGX_CONF_ERROR; } - if (conf->prefer_server_ciphers) { - SSL_CTX_set_options(conf->ssl.ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); - } - -#if (OPENSSL_VERSION_NUMBER < 0x10100001L && !defined LIBRESSL_VERSION_NUMBER) - SSL_CTX_set_tmp_rsa_callback(conf->ssl.ctx, ngx_ssl_rsa512_key_callback); -#endif - if (ngx_ssl_dhparam(cf, &conf->ssl, &conf->dhparam) != NGX_OK) { return NGX_CONF_ERROR; } Renamed: vendor/nginx-1.11.3/src/mail/ngx_mail_ssl_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/misc/ngx_cpp_test_module.cpp (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/misc/ngx_google_perftools_module.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_alloc.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_alloc.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_atomic.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_channel.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_channel.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_daemon.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_darwin.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_darwin_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_darwin_init.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_darwin_sendfile_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_dlopen.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_dlopen.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_errno.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_errno.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_file_aio_read.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_files.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_files.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_freebsd.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_freebsd_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_freebsd_init.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_freebsd_sendfile_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_gcc_atomic_amd64.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_gcc_atomic_ppc.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_gcc_atomic_sparc64.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_gcc_atomic_x86.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_linux.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_linux_aio_read.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_linux_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_linux_init.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_linux_sendfile_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_os.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_posix_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_posix_init.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_process.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_process.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_process_cycle.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_process_cycle.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_readv_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_recv.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_send.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_setaffinity.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_setaffinity.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_setproctitle.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_setproctitle.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_shmem.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_shmem.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_socket.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_socket.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_solaris.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_solaris_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_solaris_init.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_solaris_sendfilev_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_sunpro_amd64.il (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_sunpro_atomic_sparc64.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_sunpro_sparc64.il (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_sunpro_x86.il (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_thread.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_thread_cond.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_thread_id.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_thread_mutex.c (+1 -1) 98% =================================================================== --- vendor/nginx-1.11.1/src/os/unix/ngx_thread_mutex.c 2016-07-27 12:58:24 +0900 (6e8385e) +++ vendor/nginx-1.11.3/src/os/unix/ngx_thread_mutex.c 2016-07-27 13:06:13 +0900 (a0ef693) @@ -49,7 +49,7 @@ * for each mutex from 10 to 100 based on spin count taken * previously. * FreeBSD: Deadlock detection. The default spin count is 2000. - * It can be overriden using LIBPTHREAD_SPINLOOPS environment + * It can be overridden using LIBPTHREAD_SPINLOOPS environment * variable or by pthread_mutex_setspinloops_np(). If a lock * is still busy, sched_yield() can be called on both UP and * SMP systems. The default yield loop count is zero, but Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_time.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_time.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_udp_recv.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_udp_send.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_user.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_user.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/unix/ngx_writev_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/nginx.ico (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/nginx.rc (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/nginx_icon16.xpm (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/nginx_icon32.xpm (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/nginx_icon48.xpm (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_alloc.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_alloc.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_atomic.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_dlopen.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_dlopen.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_errno.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_errno.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_event_log.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_files.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_files.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_os.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_process.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_process.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_process_cycle.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_process_cycle.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_service.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_shmem.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_shmem.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_socket.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_socket.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_stat.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_thread.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_thread.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_time.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_time.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_udp_wsarecv.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_user.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_user.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_win32_config.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_win32_init.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_wsarecv.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_wsarecv_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_wsasend.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/os/win32/ngx_wsasend_chain.c (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream.c (+22 -27) 96% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream.c 2016-07-27 12:58:24 +0900 (055622d) +++ vendor/nginx-1.11.3/src/stream/ngx_stream.c 2016-07-27 13:06:13 +0900 (c195171) @@ -143,11 +143,26 @@ ngx_stream_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } - /* parse inside the stream{} block */ - pcf = *cf; cf->ctx = ctx; + for (m = 0; cf->cycle->modules[m]; m++) { + if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) { + continue; + } + + module = cf->cycle->modules[m]->ctx; + + if (module->preconfiguration) { + if (module->preconfiguration(cf) != NGX_OK) { + return NGX_CONF_ERROR; + } + } + } + + + /* parse inside the stream{} block */ + cf->module_type = NGX_STREAM_MODULE; cf->cmd_type = NGX_STREAM_MAIN_CONF; rv = ngx_conf_parse(cf, NULL); @@ -215,6 +230,10 @@ ngx_stream_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } } + if (ngx_stream_variables_init_vars(cf) != NGX_OK) { + return NGX_CONF_ERROR; + } + *cf = pcf; @@ -243,35 +262,11 @@ ngx_stream_add_ports(ngx_conf_t *cf, ngx_array_t *ports, in_port_t p; ngx_uint_t i; struct sockaddr *sa; - struct sockaddr_in *sin; ngx_stream_conf_port_t *port; ngx_stream_conf_addr_t *addr; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif sa = &listen->sockaddr.sockaddr; - - switch (sa->sa_family) { - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = &listen->sockaddr.sockaddr_in6; - p = sin6->sin6_port; - break; -#endif - -#if (NGX_HAVE_UNIX_DOMAIN) - case AF_UNIX: - p = 0; - break; -#endif - - default: /* AF_INET */ - sin = &listen->sockaddr.sockaddr_in; - p = sin->sin_port; - break; - } + p = ngx_inet_get_port(sa); port = ports->elts; for (i = 0; i < ports->nelts; i++) { Added: vendor/nginx-1.11.3/src/stream/ngx_stream.h (+230 -0) 100644 =================================================================== --- /dev/null +++ vendor/nginx-1.11.3/src/stream/ngx_stream.h 2016-07-27 13:06:13 +0900 (807ab5b) @@ -0,0 +1,230 @@ + +/* + * Copyright (C) Roman Arutyunyan + * Copyright (C) Nginx, Inc. + */ + + +#ifndef _NGX_STREAM_H_INCLUDED_ +#define _NGX_STREAM_H_INCLUDED_ + + +#include <ngx_config.h> +#include <ngx_core.h> + +#if (NGX_STREAM_SSL) +#include <ngx_stream_ssl_module.h> +#endif + + +typedef struct ngx_stream_session_s ngx_stream_session_t; + + +#include <ngx_stream_variables.h> +#include <ngx_stream_script.h> +#include <ngx_stream_upstream.h> +#include <ngx_stream_upstream_round_robin.h> + + +typedef struct { + void **main_conf; + void **srv_conf; +} ngx_stream_conf_ctx_t; + + +typedef struct { + ngx_sockaddr_t sockaddr; + socklen_t socklen; + + /* server ctx */ + ngx_stream_conf_ctx_t *ctx; + + unsigned bind:1; + unsigned wildcard:1; +#if (NGX_STREAM_SSL) + unsigned ssl:1; +#endif +#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) + unsigned ipv6only:1; +#endif +#if (NGX_HAVE_REUSEPORT) + unsigned reuseport:1; +#endif + unsigned so_keepalive:2; +#if (NGX_HAVE_KEEPALIVE_TUNABLE) + int tcp_keepidle; + int tcp_keepintvl; + int tcp_keepcnt; +#endif + int backlog; + int type; +} ngx_stream_listen_t; + + +typedef struct { + ngx_stream_conf_ctx_t *ctx; + ngx_str_t addr_text; +#if (NGX_STREAM_SSL) + ngx_uint_t ssl; /* unsigned ssl:1; */ +#endif +} ngx_stream_addr_conf_t; + +typedef struct { + in_addr_t addr; + ngx_stream_addr_conf_t conf; +} ngx_stream_in_addr_t; + + +#if (NGX_HAVE_INET6) + +typedef struct { + struct in6_addr addr6; + ngx_stream_addr_conf_t conf; +} ngx_stream_in6_addr_t; + +#endif + + +typedef struct { + /* ngx_stream_in_addr_t or ngx_stream_in6_addr_t */ + void *addrs; + ngx_uint_t naddrs; +} ngx_stream_port_t; + + +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; + + +typedef struct { + ngx_stream_listen_t opt; +} ngx_stream_conf_addr_t; + + +typedef ngx_int_t (*ngx_stream_access_pt)(ngx_stream_session_t *s); + + +typedef struct { + ngx_array_t servers; /* ngx_stream_core_srv_conf_t */ + ngx_array_t listen; /* ngx_stream_listen_t */ + + ngx_stream_access_pt limit_conn_handler; + ngx_stream_access_pt access_handler; + + ngx_hash_t variables_hash; + + ngx_array_t variables; /* ngx_stream_variable_t */ + ngx_uint_t ncaptures; + + ngx_uint_t variables_hash_max_size; + ngx_uint_t variables_hash_bucket_size; + + ngx_hash_keys_arrays_t *variables_keys; +} ngx_stream_core_main_conf_t; + + +typedef void (*ngx_stream_handler_pt)(ngx_stream_session_t *s); + + +typedef struct { + ngx_stream_handler_pt handler; + + ngx_stream_conf_ctx_t *ctx; + + u_char *file_name; + ngx_int_t line; + + ngx_flag_t tcp_nodelay; + + ngx_log_t *error_log; + + ngx_msec_t resolver_timeout; + ngx_resolver_t *resolver; +} ngx_stream_core_srv_conf_t; + + +struct ngx_stream_session_s { + uint32_t signature; /* "STRM" */ + + ngx_connection_t *connection; + + off_t received; + + ngx_log_handler_pt log_handler; + + void **ctx; + void **main_conf; + void **srv_conf; + + ngx_stream_upstream_t *upstream; + + ngx_stream_variable_value_t *variables; + +#if (NGX_PCRE) + ngx_uint_t ncaptures; + int *captures; + u_char *captures_data; +#endif +}; + + +typedef struct { + ngx_int_t (*preconfiguration)(ngx_conf_t *cf); + ngx_int_t (*postconfiguration)(ngx_conf_t *cf); + + void *(*create_main_conf)(ngx_conf_t *cf); + char *(*init_main_conf)(ngx_conf_t *cf, void *conf); + + void *(*create_srv_conf)(ngx_conf_t *cf); + char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, + void *conf); +} ngx_stream_module_t; + + +#define NGX_STREAM_MODULE 0x4d525453 /* "STRM" */ + +#define NGX_STREAM_MAIN_CONF 0x02000000 +#define NGX_STREAM_SRV_CONF 0x04000000 +#define NGX_STREAM_UPS_CONF 0x08000000 + + +#define NGX_STREAM_MAIN_CONF_OFFSET offsetof(ngx_stream_conf_ctx_t, main_conf) +#define NGX_STREAM_SRV_CONF_OFFSET offsetof(ngx_stream_conf_ctx_t, srv_conf) + + +#define ngx_stream_get_module_ctx(s, module) (s)->ctx[module.ctx_index] +#define ngx_stream_set_ctx(s, c, module) s->ctx[module.ctx_index] = c; +#define ngx_stream_delete_ctx(s, module) s->ctx[module.ctx_index] = NULL; + + +#define ngx_stream_get_module_main_conf(s, module) \ + (s)->main_conf[module.ctx_index] +#define ngx_stream_get_module_srv_conf(s, module) \ + (s)->srv_conf[module.ctx_index] + +#define ngx_stream_conf_get_module_main_conf(cf, module) \ + ((ngx_stream_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index] +#define ngx_stream_conf_get_module_srv_conf(cf, module) \ + ((ngx_stream_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index] + +#define ngx_stream_cycle_get_module_main_conf(cycle, module) \ + (cycle->conf_ctx[ngx_stream_module.index] ? \ + ((ngx_stream_conf_ctx_t *) cycle->conf_ctx[ngx_stream_module.index]) \ + ->main_conf[module.ctx_index]: \ + NULL) + + +void ngx_stream_init_connection(ngx_connection_t *c); +void ngx_stream_close_connection(ngx_connection_t *c); + + +extern ngx_module_t ngx_stream_module; +extern ngx_uint_t ngx_stream_max_module; +extern ngx_module_t ngx_stream_core_module; + + +#endif /* _NGX_STREAM_H_INCLUDED_ */ Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_access_module.c (+1 -0) 99% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_access_module.c 2016-07-27 12:58:24 +0900 (64869d2) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_access_module.c 2016-07-27 13:06:13 +0900 (6985d36) @@ -88,6 +88,7 @@ static ngx_command_t ngx_stream_access_commands[] = { static ngx_stream_module_t ngx_stream_access_module_ctx = { + NULL, /* preconfiguration */ ngx_stream_access_init, /* postconfiguration */ NULL, /* create main configuration */ Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_core_module.c (+107 -1) 82% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_core_module.c 2016-07-27 12:58:24 +0900 (075db82) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_core_module.c 2016-07-27 13:06:13 +0900 (70b9e2d) @@ -10,7 +10,9 @@ #include <ngx_stream.h> +static ngx_int_t ngx_stream_core_preconfiguration(ngx_conf_t *cf); static void *ngx_stream_core_create_main_conf(ngx_conf_t *cf); +static char *ngx_stream_core_init_main_conf(ngx_conf_t *cf, void *conf); static void *ngx_stream_core_create_srv_conf(ngx_conf_t *cf); static char *ngx_stream_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child); @@ -20,10 +22,26 @@ static char *ngx_stream_core_server(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); static char *ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +static char *ngx_stream_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); static ngx_command_t ngx_stream_core_commands[] = { + { ngx_string("variables_hash_max_size"), + NGX_STREAM_MAIN_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + NGX_STREAM_MAIN_CONF_OFFSET, + offsetof(ngx_stream_core_main_conf_t, variables_hash_max_size), + NULL }, + + { ngx_string("variables_hash_bucket_size"), + NGX_STREAM_MAIN_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + NGX_STREAM_MAIN_CONF_OFFSET, + offsetof(ngx_stream_core_main_conf_t, variables_hash_bucket_size), + NULL }, + { ngx_string("server"), NGX_STREAM_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS, ngx_stream_core_server, @@ -45,6 +63,20 @@ static ngx_command_t ngx_stream_core_commands[] = { 0, NULL }, + { ngx_string("resolver"), + NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_1MORE, + ngx_stream_core_resolver, + NGX_STREAM_SRV_CONF_OFFSET, + 0, + NULL }, + + { ngx_string("resolver_timeout"), + NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, + ngx_conf_set_msec_slot, + NGX_STREAM_SRV_CONF_OFFSET, + offsetof(ngx_stream_core_srv_conf_t, resolver_timeout), + NULL }, + { ngx_string("tcp_nodelay"), NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_FLAG, ngx_conf_set_flag_slot, @@ -57,10 +89,11 @@ static ngx_command_t ngx_stream_core_commands[] = { static ngx_stream_module_t ngx_stream_core_module_ctx = { + ngx_stream_core_preconfiguration, /* preconfiguration */ NULL, /* postconfiguration */ ngx_stream_core_create_main_conf, /* create main configuration */ - NULL, /* init main configuration */ + ngx_stream_core_init_main_conf, /* init main configuration */ ngx_stream_core_create_srv_conf, /* create server configuration */ ngx_stream_core_merge_srv_conf /* merge server configuration */ @@ -83,6 +116,13 @@ ngx_module_t ngx_stream_core_module = { }; +static ngx_int_t +ngx_stream_core_preconfiguration(ngx_conf_t *cf) +{ + return ngx_stream_variables_add_core_vars(cf); +} + + static void * ngx_stream_core_create_main_conf(ngx_conf_t *cf) { @@ -106,10 +146,32 @@ ngx_stream_core_create_main_conf(ngx_conf_t *cf) return NULL; } + cmcf->variables_hash_max_size = NGX_CONF_UNSET_UINT; + cmcf->variables_hash_bucket_size = NGX_CONF_UNSET_UINT; + return cmcf; } +static char * +ngx_stream_core_init_main_conf(ngx_conf_t *cf, void *conf) +{ + ngx_stream_core_main_conf_t *cmcf = conf; + + ngx_conf_init_uint_value(cmcf->variables_hash_max_size, 1024); + ngx_conf_init_uint_value(cmcf->variables_hash_bucket_size, 64); + + cmcf->variables_hash_bucket_size = + ngx_align(cmcf->variables_hash_bucket_size, ngx_cacheline_size); + + if (cmcf->ncaptures) { + cmcf->ncaptures = (cmcf->ncaptures + 1) * 3; + } + + return NGX_CONF_OK; +} + + static void * ngx_stream_core_create_srv_conf(ngx_conf_t *cf) { @@ -129,6 +191,7 @@ ngx_stream_core_create_srv_conf(ngx_conf_t *cf) cscf->file_name = cf->conf_file->file.name.data; cscf->line = cf->conf_file->line; + cscf->resolver_timeout = NGX_CONF_UNSET_MSEC; cscf->tcp_nodelay = NGX_CONF_UNSET; return cscf; @@ -141,6 +204,27 @@ ngx_stream_core_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) ngx_stream_core_srv_conf_t *prev = parent; ngx_stream_core_srv_conf_t *conf = child; + ngx_conf_merge_msec_value(conf->resolver_timeout, + prev->resolver_timeout, 30000); + + if (conf->resolver == NULL) { + + if (prev->resolver == NULL) { + + /* + * create dummy resolver in stream {} context + * to inherit it in all servers + */ + + prev->resolver = ngx_resolver_create(cf, NULL, 0); + if (prev->resolver == NULL) { + return NGX_CONF_ERROR; + } + } + + conf->resolver = prev->resolver; + } + if (conf->handler == NULL) { ngx_log_error(NGX_LOG_EMERG, cf->log, 0, "no handler for server in %s:%ui", @@ -519,3 +603,25 @@ ngx_stream_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_OK; } + + +static char * +ngx_stream_core_resolver(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_stream_core_srv_conf_t *cscf = conf; + + ngx_str_t *value; + + if (cscf->resolver) { + return "is duplicate"; + } + + value = cf->args->elts; + + cscf->resolver = ngx_resolver_create(cf, &value[1], cf->args->nelts - 1); + if (cscf->resolver == NULL) { + return NGX_CONF_ERROR; + } + + return NGX_CONF_OK; +} Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_geo_module.c (+259 -331) 65% =================================================================== --- vendor/nginx-1.11.1/src/http/modules/ngx_http_geo_module.c 2016-07-27 12:58:24 +0900 (9b3c6cb) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_geo_module.c 2016-07-27 13:06:13 +0900 (ed1a488) @@ -7,115 +7,109 @@ #include <ngx_config.h> #include <ngx_core.h> -#include <ngx_http.h> +#include <ngx_stream.h> typedef struct { - ngx_http_variable_value_t *value; - u_short start; - u_short end; -} ngx_http_geo_range_t; + ngx_stream_variable_value_t *value; + u_short start; + u_short end; +} ngx_stream_geo_range_t; typedef struct { - ngx_radix_tree_t *tree; + ngx_radix_tree_t *tree; #if (NGX_HAVE_INET6) - ngx_radix_tree_t *tree6; + ngx_radix_tree_t *tree6; #endif -} ngx_http_geo_trees_t; +} ngx_stream_geo_trees_t; typedef struct { - ngx_http_geo_range_t **low; - ngx_http_variable_value_t *default_value; -} ngx_http_geo_high_ranges_t; + ngx_stream_geo_range_t **low; + ngx_stream_variable_value_t *default_value; +} ngx_stream_geo_high_ranges_t; typedef struct { - ngx_str_node_t sn; - ngx_http_variable_value_t *value; - size_t offset; -} ngx_http_geo_variable_value_node_t; + ngx_str_node_t sn; + ngx_stream_variable_value_t *value; + size_t offset; +} ngx_stream_geo_variable_value_node_t; typedef struct { - ngx_http_variable_value_t *value; - ngx_str_t *net; - ngx_http_geo_high_ranges_t high; - ngx_radix_tree_t *tree; + ngx_stream_variable_value_t *value; + ngx_str_t *net; + ngx_stream_geo_high_ranges_t high; + ngx_radix_tree_t *tree; #if (NGX_HAVE_INET6) - ngx_radix_tree_t *tree6; + ngx_radix_tree_t *tree6; #endif - ngx_rbtree_t rbtree; - ngx_rbtree_node_t sentinel; - ngx_array_t *proxies; - ngx_pool_t *pool; - ngx_pool_t *temp_pool; + ngx_rbtree_t rbtree; + ngx_rbtree_node_t sentinel; + ngx_pool_t *pool; + ngx_pool_t *temp_pool; - size_t data_size; + size_t data_size; - ngx_str_t include_name; - ngx_uint_t includes; - ngx_uint_t entries; + ngx_str_t include_name; + ngx_uint_t includes; + ngx_uint_t entries; - unsigned ranges:1; - unsigned outside_entries:1; - unsigned allow_binary_include:1; - unsigned binary_include:1; - unsigned proxy_recursive:1; -} ngx_http_geo_conf_ctx_t; + unsigned ranges:1; + unsigned outside_entries:1; + unsigned allow_binary_include:1; + unsigned binary_include:1; +} ngx_stream_geo_conf_ctx_t; typedef struct { union { - ngx_http_geo_trees_t trees; - ngx_http_geo_high_ranges_t high; + ngx_stream_geo_trees_t trees; + ngx_stream_geo_high_ranges_t high; } u; - ngx_array_t *proxies; - unsigned proxy_recursive:1; - - ngx_int_t index; -} ngx_http_geo_ctx_t; - - -static ngx_int_t ngx_http_geo_addr(ngx_http_request_t *r, - ngx_http_geo_ctx_t *ctx, ngx_addr_t *addr); -static ngx_int_t ngx_http_geo_real_addr(ngx_http_request_t *r, - ngx_http_geo_ctx_t *ctx, ngx_addr_t *addr); -static char *ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf); -static char *ngx_http_geo_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, - ngx_str_t *value); -static char *ngx_http_geo_add_range(ngx_conf_t *cf, - ngx_http_geo_conf_ctx_t *ctx, in_addr_t start, in_addr_t end); -static ngx_uint_t ngx_http_geo_delete_range(ngx_conf_t *cf, - ngx_http_geo_conf_ctx_t *ctx, in_addr_t start, in_addr_t end); -static char *ngx_http_geo_cidr(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, - ngx_str_t *value); -static char *ngx_http_geo_cidr_add(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, - ngx_cidr_t *cidr, ngx_str_t *value, ngx_str_t *net); -static ngx_http_variable_value_t *ngx_http_geo_value(ngx_conf_t *cf, - ngx_http_geo_conf_ctx_t *ctx, ngx_str_t *value); -static char *ngx_http_geo_add_proxy(ngx_conf_t *cf, - ngx_http_geo_conf_ctx_t *ctx, ngx_cidr_t *cidr); -static ngx_int_t ngx_http_geo_cidr_value(ngx_conf_t *cf, ngx_str_t *net, + ngx_int_t index; +} ngx_stream_geo_ctx_t; + + +static ngx_int_t ngx_stream_geo_addr(ngx_stream_session_t *s, + ngx_stream_geo_ctx_t *ctx, ngx_addr_t *addr); + +static char *ngx_stream_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); +static char *ngx_stream_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf); +static char *ngx_stream_geo_range(ngx_conf_t *cf, + ngx_stream_geo_conf_ctx_t *ctx, ngx_str_t *value); +static char *ngx_stream_geo_add_range(ngx_conf_t *cf, + ngx_stream_geo_conf_ctx_t *ctx, in_addr_t start, in_addr_t end); +static ngx_uint_t ngx_stream_geo_delete_range(ngx_conf_t *cf, + ngx_stream_geo_conf_ctx_t *ctx, in_addr_t start, in_addr_t end); +static char *ngx_stream_geo_cidr(ngx_conf_t *cf, + ngx_stream_geo_conf_ctx_t *ctx, ngx_str_t *value); +static char *ngx_stream_geo_cidr_add(ngx_conf_t *cf, + ngx_stream_geo_conf_ctx_t *ctx, ngx_cidr_t *cidr, ngx_str_t *value, + ngx_str_t *net); +static ngx_stream_variable_value_t *ngx_stream_geo_value(ngx_conf_t *cf, + ngx_stream_geo_conf_ctx_t *ctx, ngx_str_t *value); +static ngx_int_t ngx_stream_geo_cidr_value(ngx_conf_t *cf, ngx_str_t *net, ngx_cidr_t *cidr); -static char *ngx_http_geo_include(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, - ngx_str_t *name); -static ngx_int_t ngx_http_geo_include_binary_base(ngx_conf_t *cf, - ngx_http_geo_conf_ctx_t *ctx, ngx_str_t *name); -static void ngx_http_geo_create_binary_base(ngx_http_geo_conf_ctx_t *ctx); -static u_char *ngx_http_geo_copy_values(u_char *base, u_char *p, +static char *ngx_stream_geo_include(ngx_conf_t *cf, + ngx_stream_geo_conf_ctx_t *ctx, ngx_str_t *name); +static ngx_int_t ngx_stream_geo_include_binary_base(ngx_conf_t *cf, + ngx_stream_geo_conf_ctx_t *ctx, ngx_str_t *name); +static void ngx_stream_geo_create_binary_base(ngx_stream_geo_conf_ctx_t *ctx); +static u_char *ngx_stream_geo_copy_values(u_char *base, u_char *p, ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel); -static ngx_command_t ngx_http_geo_commands[] = { +static ngx_command_t ngx_stream_geo_commands[] = { { ngx_string("geo"), - NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE12, - ngx_http_geo_block, - NGX_HTTP_MAIN_CONF_OFFSET, + NGX_STREAM_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE12, + ngx_stream_geo_block, + 0, 0, NULL }, @@ -123,7 +117,7 @@ static ngx_command_t ngx_http_geo_commands[] = { }; -static ngx_http_module_t ngx_http_geo_module_ctx = { +static ngx_stream_module_t ngx_stream_geo_module_ctx = { NULL, /* preconfiguration */ NULL, /* postconfiguration */ @@ -131,18 +125,15 @@ static ngx_http_module_t ngx_http_geo_module_ctx = { NULL, /* init main configuration */ NULL, /* create server configuration */ - NULL, /* merge server configuration */ - - NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL /* merge server configuration */ }; -ngx_module_t ngx_http_geo_module = { +ngx_module_t ngx_stream_geo_module = { NGX_MODULE_V1, - &ngx_http_geo_module_ctx, /* module context */ - ngx_http_geo_commands, /* module directives */ - NGX_HTTP_MODULE, /* module type */ + &ngx_stream_geo_module_ctx, /* module context */ + ngx_stream_geo_commands, /* module directives */ + NGX_STREAM_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ NULL, /* init process */ @@ -160,10 +151,10 @@ typedef struct { u_char ptr_size; uint32_t endianness; uint32_t crc32; -} ngx_http_geo_header_t; +} ngx_stream_geo_header_t; -static ngx_http_geo_header_t ngx_http_geo_header = { +static ngx_stream_geo_header_t ngx_stream_geo_header = { { 'G', 'E', 'O', 'R', 'N', 'G' }, 0, sizeof(void *), 0x12345678, 0 }; @@ -171,22 +162,22 @@ static ngx_http_geo_header_t ngx_http_geo_header = { /* geo range is AF_INET only */ static ngx_int_t -ngx_http_geo_cidr_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, - uintptr_t data) +ngx_stream_geo_cidr_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) { - ngx_http_geo_ctx_t *ctx = (ngx_http_geo_ctx_t *) data; + ngx_stream_geo_ctx_t *ctx = (ngx_stream_geo_ctx_t *) data; - in_addr_t inaddr; - ngx_addr_t addr; - struct sockaddr_in *sin; - ngx_http_variable_value_t *vv; + in_addr_t inaddr; + ngx_addr_t addr; + struct sockaddr_in *sin; + ngx_stream_variable_value_t *vv; #if (NGX_HAVE_INET6) - u_char *p; - struct in6_addr *inaddr6; + u_char *p; + struct in6_addr *inaddr6; #endif - if (ngx_http_geo_addr(r, ctx, &addr) != NGX_OK) { - vv = (ngx_http_variable_value_t *) + if (ngx_stream_geo_addr(s, ctx, &addr) != NGX_OK) { + vv = (ngx_stream_variable_value_t *) ngx_radix32tree_find(ctx->u.trees.tree, INADDR_NONE); goto done; } @@ -204,11 +195,11 @@ ngx_http_geo_cidr_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, inaddr += p[14] << 8; inaddr += p[15]; - vv = (ngx_http_variable_value_t *) + vv = (ngx_stream_variable_value_t *) ngx_radix32tree_find(ctx->u.trees.tree, inaddr); } else { - vv = (ngx_http_variable_value_t *) + vv = (ngx_stream_variable_value_t *) ngx_radix128tree_find(ctx->u.trees.tree6, p); } @@ -219,7 +210,7 @@ ngx_http_geo_cidr_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, sin = (struct sockaddr_in *) addr.sockaddr; inaddr = ntohl(sin->sin_addr.s_addr); - vv = (ngx_http_variable_value_t *) + vv = (ngx_stream_variable_value_t *) ngx_radix32tree_find(ctx->u.trees.tree, inaddr); break; @@ -229,32 +220,32 @@ done: *v = *vv; - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http geo: %v", v); + ngx_log_debug1(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, + "stream geo: %v", v); return NGX_OK; } static ngx_int_t -ngx_http_geo_range_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, - uintptr_t data) +ngx_stream_geo_range_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) { - ngx_http_geo_ctx_t *ctx = (ngx_http_geo_ctx_t *) data; + ngx_stream_geo_ctx_t *ctx = (ngx_stream_geo_ctx_t *) data; - in_addr_t inaddr; - ngx_addr_t addr; - ngx_uint_t n; - struct sockaddr_in *sin; - ngx_http_geo_range_t *range; + in_addr_t inaddr; + ngx_addr_t addr; + ngx_uint_t n; + struct sockaddr_in *sin; + ngx_stream_geo_range_t *range; #if (NGX_HAVE_INET6) - u_char *p; - struct in6_addr *inaddr6; + u_char *p; + struct in6_addr *inaddr6; #endif *v = *ctx->u.high.default_value; - if (ngx_http_geo_addr(r, ctx, &addr) == NGX_OK) { + if (ngx_stream_geo_addr(s, ctx, &addr) == NGX_OK) { switch (addr.sockaddr->sa_family) { @@ -303,64 +294,43 @@ ngx_http_geo_range_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, } } - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http geo: %v", v); - - return NGX_OK; -} - - -static ngx_int_t -ngx_http_geo_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx, - ngx_addr_t *addr) -{ - ngx_array_t *xfwd; - - if (ngx_http_geo_real_addr(r, ctx, addr) != NGX_OK) { - return NGX_ERROR; - } - - xfwd = &r->headers_in.x_forwarded_for; - - if (xfwd->nelts > 0 && ctx->proxies != NULL) { - (void) ngx_http_get_forwarded_addr(r, addr, xfwd, NULL, - ctx->proxies, ctx->proxy_recursive); - } + ngx_log_debug1(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, + "stream geo: %v", v); return NGX_OK; } static ngx_int_t -ngx_http_geo_real_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx, +ngx_stream_geo_addr(ngx_stream_session_t *s, ngx_stream_geo_ctx_t *ctx, ngx_addr_t *addr) { - ngx_http_variable_value_t *v; + ngx_stream_variable_value_t *v; if (ctx->index == -1) { - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http geo started: %V", &r->connection->addr_text); + ngx_log_debug1(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, + "stream geo started: %V", &s->connection->addr_text); - addr->sockaddr = r->connection->sockaddr; - addr->socklen = r->connection->socklen; - /* addr->name = r->connection->addr_text; */ + addr->sockaddr = s->connection->sockaddr; + addr->socklen = s->connection->socklen; + /* addr->name = s->connection->addr_text; */ return NGX_OK; } - v = ngx_http_get_flushed_variable(r, ctx->index); + v = ngx_stream_get_flushed_variable(s, ctx->index); if (v == NULL || v->not_found) { - ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http geo not found"); + ngx_log_debug0(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, + "stream geo not found"); return NGX_ERROR; } - ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http geo started: %v", v); + ngx_log_debug1(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, + "stream geo started: %v", v); - if (ngx_parse_addr(r->pool, addr, v->data, v->len) == NGX_OK) { + if (ngx_parse_addr(s->connection->pool, addr, v->data, v->len) == NGX_OK) { return NGX_OK; } @@ -369,25 +339,25 @@ ngx_http_geo_real_addr(ngx_http_request_t *r, ngx_http_geo_ctx_t *ctx, static char * -ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +ngx_stream_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { - char *rv; - size_t len; - ngx_str_t *value, name; - ngx_uint_t i; - ngx_conf_t save; - ngx_pool_t *pool; - ngx_array_t *a; - ngx_http_variable_t *var; - ngx_http_geo_ctx_t *geo; - ngx_http_geo_conf_ctx_t ctx; + char *rv; + size_t len; + ngx_str_t *value, name; + ngx_uint_t i; + ngx_conf_t save; + ngx_pool_t *pool; + ngx_array_t *a; + ngx_stream_variable_t *var; + ngx_stream_geo_ctx_t *geo; + ngx_stream_geo_conf_ctx_t ctx; #if (NGX_HAVE_INET6) - static struct in6_addr zero; + static struct in6_addr zero; #endif value = cf->args->elts; - geo = ngx_palloc(cf->pool, sizeof(ngx_http_geo_ctx_t)); + geo = ngx_palloc(cf->pool, sizeof(ngx_stream_geo_ctx_t)); if (geo == NULL) { return NGX_CONF_ERROR; } @@ -405,7 +375,7 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) if (cf->args->nelts == 3) { - geo->index = ngx_http_get_variable_index(cf, &name); + geo->index = ngx_stream_get_variable_index(cf, &name); if (geo->index == NGX_ERROR) { return NGX_CONF_ERROR; } @@ -425,7 +395,7 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) geo->index = -1; } - var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE); + var = ngx_stream_add_variable(cf, &name, NGX_STREAM_VAR_CHANGEABLE); if (var == NULL) { return NGX_CONF_ERROR; } @@ -435,7 +405,7 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } - ngx_memzero(&ctx, sizeof(ngx_http_geo_conf_ctx_t)); + ngx_memzero(&ctx, sizeof(ngx_stream_geo_conf_ctx_t)); ctx.temp_pool = ngx_create_pool(NGX_DEFAULT_POOL_SIZE, cf->log); if (ctx.temp_pool == NULL) { @@ -445,24 +415,21 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_rbtree_init(&ctx.rbtree, &ctx.sentinel, ngx_str_rbtree_insert_value); ctx.pool = cf->pool; - ctx.data_size = sizeof(ngx_http_geo_header_t) - + sizeof(ngx_http_variable_value_t) - + 0x10000 * sizeof(ngx_http_geo_range_t *); + ctx.data_size = sizeof(ngx_stream_geo_header_t) + + sizeof(ngx_stream_variable_value_t) + + 0x10000 * sizeof(ngx_stream_geo_range_t *); ctx.allow_binary_include = 1; save = *cf; cf->pool = pool; cf->ctx = &ctx; - cf->handler = ngx_http_geo; + cf->handler = ngx_stream_geo; cf->handler_conf = conf; rv = ngx_conf_parse(cf, NULL); *cf = save; - geo->proxies = ctx.proxies; - geo->proxy_recursive = ctx.proxy_recursive; - if (ctx.ranges) { if (ctx.high.low && !ctx.binary_include) { @@ -473,7 +440,7 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) continue; } - len = a->nelts * sizeof(ngx_http_geo_range_t); + len = a->nelts * sizeof(ngx_stream_geo_range_t); ctx.high.low[i] = ngx_palloc(cf->pool, len + sizeof(void *)); if (ctx.high.low[i] == NULL) { @@ -490,17 +457,17 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) && ctx.entries > 100000 && ctx.includes == 1) { - ngx_http_geo_create_binary_base(&ctx); + ngx_stream_geo_create_binary_base(&ctx); } } if (ctx.high.default_value == NULL) { - ctx.high.default_value = &ngx_http_variable_null_value; + ctx.high.default_value = &ngx_stream_variable_null_value; } geo->u.high = ctx.high; - var->get_handler = ngx_http_geo_range_variable; + var->get_handler = ngx_stream_geo_range_variable; var->data = (uintptr_t) geo; ngx_destroy_pool(ctx.temp_pool); @@ -527,14 +494,14 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) geo->u.trees.tree6 = ctx.tree6; #endif - var->get_handler = ngx_http_geo_cidr_variable; + var->get_handler = ngx_stream_geo_cidr_variable; var->data = (uintptr_t) geo; ngx_destroy_pool(ctx.temp_pool); ngx_destroy_pool(pool); if (ngx_radix32tree_insert(ctx.tree, 0, 0, - (uintptr_t) &ngx_http_variable_null_value) + (uintptr_t) &ngx_stream_variable_null_value) == NGX_ERROR) { return NGX_CONF_ERROR; @@ -544,7 +511,7 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) #if (NGX_HAVE_INET6) if (ngx_radix128tree_insert(ctx.tree6, zero.s6_addr, zero.s6_addr, - (uintptr_t) &ngx_http_variable_null_value) + (uintptr_t) &ngx_stream_variable_null_value) == NGX_ERROR) { return NGX_CONF_ERROR; @@ -557,12 +524,11 @@ ngx_http_geo_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) static char * -ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) +ngx_stream_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) { - char *rv; - ngx_str_t *value; - ngx_cidr_t cidr; - ngx_http_geo_conf_ctx_t *ctx; + char *rv; + ngx_str_t *value; + ngx_stream_geo_conf_ctx_t *ctx; ctx = cf->ctx; @@ -590,12 +556,6 @@ ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) goto done; } - - else if (ngx_strcmp(value[0].data, "proxy_recursive") == 0) { - ctx->proxy_recursive = 1; - rv = NGX_CONF_OK; - goto done; - } } if (cf->args->nelts != 2) { @@ -606,26 +566,16 @@ ngx_http_geo(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) if (ngx_strcmp(value[0].data, "include") == 0) { - rv = ngx_http_geo_include(cf, ctx, &value[1]); - - goto done; - - } else if (ngx_strcmp(value[0].data, "proxy") == 0) { - - if (ngx_http_geo_cidr_value(cf, &value[1], &cidr) != NGX_OK) { - goto failed; - } - - rv = ngx_http_geo_add_proxy(cf, ctx, &cidr); + rv = ngx_stream_geo_include(cf, ctx, &value[1]); goto done; } if (ctx->ranges) { - rv = ngx_http_geo_range(cf, ctx, value); + rv = ngx_stream_geo_range(cf, ctx, value); } else { - rv = ngx_http_geo_cidr(cf, ctx, value); + rv = ngx_stream_geo_cidr(cf, ctx, value); } done: @@ -643,7 +593,7 @@ failed: static char * -ngx_http_geo_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, +ngx_stream_geo_range(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx, ngx_str_t *value) { u_char *p, *last; @@ -659,7 +609,7 @@ ngx_http_geo_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, &value[1], ctx->high.default_value); } - ctx->high.default_value = ngx_http_geo_value(cf, ctx, &value[1]); + ctx->high.default_value = ngx_stream_geo_value(cf, ctx, &value[1]); if (ctx->high.default_value == NULL) { return NGX_CONF_ERROR; } @@ -676,7 +626,7 @@ ngx_http_geo_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, if (ctx->high.low == NULL) { ctx->high.low = ngx_pcalloc(ctx->pool, - 0x10000 * sizeof(ngx_http_geo_range_t *)); + 0x10000 * sizeof(ngx_stream_geo_range_t *)); if (ctx->high.low == NULL) { return NGX_CONF_ERROR; } @@ -725,7 +675,7 @@ ngx_http_geo_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, } if (del) { - if (ngx_http_geo_delete_range(cf, ctx, start, end)) { + if (ngx_stream_geo_delete_range(cf, ctx, start, end)) { ngx_conf_log_error(NGX_LOG_WARN, cf, 0, "no address range \"%V\" to delete", net); } @@ -733,7 +683,7 @@ ngx_http_geo_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, return NGX_CONF_OK; } - ctx->value = ngx_http_geo_value(cf, ctx, &value[1]); + ctx->value = ngx_stream_geo_value(cf, ctx, &value[1]); if (ctx->value == NULL) { return NGX_CONF_ERROR; @@ -741,7 +691,7 @@ ngx_http_geo_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, ctx->net = net; - return ngx_http_geo_add_range(cf, ctx, start, end); + return ngx_stream_geo_add_range(cf, ctx, start, end); invalid: @@ -754,13 +704,13 @@ invalid: /* the add procedure is optimized to add a growing up sequence */ static char * -ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, +ngx_stream_geo_add_range(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx, in_addr_t start, in_addr_t end) { - in_addr_t n; - ngx_uint_t h, i, s, e; - ngx_array_t *a; - ngx_http_geo_range_t *range; + in_addr_t n; + ngx_uint_t h, i, s, e; + ngx_array_t *a; + ngx_stream_geo_range_t *range; for (n = start; n <= end; n = (n + 0x10000) & 0xffff0000) { @@ -783,12 +733,12 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, if (a == NULL) { a = ngx_array_create(ctx->temp_pool, 64, - sizeof(ngx_http_geo_range_t)); + sizeof(ngx_stream_geo_range_t)); if (a == NULL) { return NGX_CONF_ERROR; } - ctx->high.low[h] = (ngx_http_geo_range_t *) a; + ctx->high.low[h] = (ngx_stream_geo_range_t *) a; } i = a->nelts; @@ -814,7 +764,7 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, range = a->elts; ngx_memmove(&range[i + 2], &range[i + 1], - (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); + (a->nelts - 2 - i) * sizeof(ngx_stream_geo_range_t)); range[i + 1].start = (u_short) s; range[i + 1].end = (u_short) e; @@ -853,7 +803,7 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, range = a->elts; ngx_memmove(&range[i + 3], &range[i + 1], - (a->nelts - 3 - i) * sizeof(ngx_http_geo_range_t)); + (a->nelts - 3 - i) * sizeof(ngx_stream_geo_range_t)); range[i + 2].start = (u_short) (e + 1); range[i + 2].end = range[i].end; @@ -881,7 +831,7 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, range = a->elts; ngx_memmove(&range[i + 1], &range[i], - (a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t)); + (a->nelts - 1 - i) * sizeof(ngx_stream_geo_range_t)); range[i + 1].start = (u_short) (e + 1); @@ -905,7 +855,7 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, range = a->elts; ngx_memmove(&range[i + 2], &range[i + 1], - (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); + (a->nelts - 2 - i) * sizeof(ngx_stream_geo_range_t)); range[i + 1].start = (u_short) s; range[i + 1].end = (u_short) e; @@ -949,13 +899,13 @@ ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, static ngx_uint_t -ngx_http_geo_delete_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, +ngx_stream_geo_delete_range(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx, in_addr_t start, in_addr_t end) { - in_addr_t n; - ngx_uint_t h, i, s, e, warn; - ngx_array_t *a; - ngx_http_geo_range_t *range; + in_addr_t n; + ngx_uint_t h, i, s, e, warn; + ngx_array_t *a; + ngx_stream_geo_range_t *range; warn = 0; @@ -990,7 +940,7 @@ ngx_http_geo_delete_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, && e == (ngx_uint_t) range[i].end) { ngx_memmove(&range[i], &range[i + 1], - (a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t)); + (a->nelts - 1 - i) * sizeof(ngx_stream_geo_range_t)); a->nelts--; @@ -1012,7 +962,7 @@ ngx_http_geo_delete_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, static char * -ngx_http_geo_cidr(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, +ngx_stream_geo_cidr(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx, ngx_str_t *value) { char *rv; @@ -1041,7 +991,7 @@ ngx_http_geo_cidr(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, cidr.u.in.addr = 0; cidr.u.in.mask = 0; - rv = ngx_http_geo_cidr_add(cf, ctx, &cidr, &value[1], &value[0]); + rv = ngx_stream_geo_cidr_add(cf, ctx, &cidr, &value[1], &value[0]); if (rv != NGX_CONF_OK) { return rv; @@ -1051,7 +1001,7 @@ ngx_http_geo_cidr(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, cidr.family = AF_INET6; ngx_memzero(&cidr.u.in6, sizeof(ngx_in6_cidr_t)); - rv = ngx_http_geo_cidr_add(cf, ctx, &cidr, &value[1], &value[0]); + rv = ngx_stream_geo_cidr_add(cf, ctx, &cidr, &value[1], &value[0]); if (rv != NGX_CONF_OK) { return rv; @@ -1070,7 +1020,7 @@ ngx_http_geo_cidr(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, del = 0; } - if (ngx_http_geo_cidr_value(cf, net, &cidr) != NGX_OK) { + if (ngx_stream_geo_cidr_value(cf, net, &cidr) != NGX_OK) { return NGX_CONF_ERROR; } @@ -1104,18 +1054,18 @@ ngx_http_geo_cidr(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, return NGX_CONF_OK; } - return ngx_http_geo_cidr_add(cf, ctx, &cidr, &value[1], net); + return ngx_stream_geo_cidr_add(cf, ctx, &cidr, &value[1], net); } static char * -ngx_http_geo_cidr_add(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, +ngx_stream_geo_cidr_add(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx, ngx_cidr_t *cidr, ngx_str_t *value, ngx_str_t *net) { - ngx_int_t rc; - ngx_http_variable_value_t *val, *old; + ngx_int_t rc; + ngx_stream_variable_value_t *val, *old; - val = ngx_http_geo_value(cf, ctx, value); + val = ngx_stream_geo_value(cf, ctx, value); if (val == NULL) { return NGX_CONF_ERROR; @@ -1139,7 +1089,7 @@ ngx_http_geo_cidr_add(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, /* rc == NGX_BUSY */ - old = (ngx_http_variable_value_t *) + old = (ngx_stream_variable_value_t *) ngx_radix128tree_find(ctx->tree6, cidr->u.in6.addr.s6_addr); @@ -1177,7 +1127,7 @@ ngx_http_geo_cidr_add(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, /* rc == NGX_BUSY */ - old = (ngx_http_variable_value_t *) + old = (ngx_stream_variable_value_t *) ngx_radix32tree_find(ctx->tree, cidr->u.in.addr); ngx_conf_log_error(NGX_LOG_WARN, cf, 0, @@ -1206,24 +1156,24 @@ ngx_http_geo_cidr_add(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, } -static ngx_http_variable_value_t * -ngx_http_geo_value(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, +static ngx_stream_variable_value_t * +ngx_stream_geo_value(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx, ngx_str_t *value) { - uint32_t hash; - ngx_http_variable_value_t *val; - ngx_http_geo_variable_value_node_t *gvvn; + uint32_t hash; + ngx_stream_variable_value_t *val; + ngx_stream_geo_variable_value_node_t *gvvn; hash = ngx_crc32_long(value->data, value->len); - gvvn = (ngx_http_geo_variable_value_node_t *) + gvvn = (ngx_stream_geo_variable_value_node_t *) ngx_str_rbtree_lookup(&ctx->rbtree, value, hash); if (gvvn) { return gvvn->value; } - val = ngx_palloc(ctx->pool, sizeof(ngx_http_variable_value_t)); + val = ngx_palloc(ctx->pool, sizeof(ngx_stream_variable_value_t)); if (val == NULL) { return NULL; } @@ -1239,7 +1189,7 @@ ngx_http_geo_value(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, val->not_found = 0; gvvn = ngx_palloc(ctx->temp_pool, - sizeof(ngx_http_geo_variable_value_node_t)); + sizeof(ngx_stream_geo_variable_value_node_t)); if (gvvn == NULL) { return NULL; } @@ -1252,39 +1202,15 @@ ngx_http_geo_value(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, ngx_rbtree_insert(&ctx->rbtree, &gvvn->sn.node); - ctx->data_size += ngx_align(sizeof(ngx_http_variable_value_t) + value->len, - sizeof(void *)); + ctx->data_size += ngx_align(sizeof(ngx_stream_variable_value_t) + + value->len, sizeof(void *)); return val; } -static char * -ngx_http_geo_add_proxy(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, - ngx_cidr_t *cidr) -{ - ngx_cidr_t *c; - - if (ctx->proxies == NULL) { - ctx->proxies = ngx_array_create(ctx->pool, 4, sizeof(ngx_cidr_t)); - if (ctx->proxies == NULL) { - return NGX_CONF_ERROR; - } - } - - c = ngx_array_push(ctx->proxies); - if (c == NULL) { - return NGX_CONF_ERROR; - } - - *c = *cidr; - - return NGX_CONF_OK; -} - - static ngx_int_t -ngx_http_geo_cidr_value(ngx_conf_t *cf, ngx_str_t *net, ngx_cidr_t *cidr) +ngx_stream_geo_cidr_value(ngx_conf_t *cf, ngx_str_t *net, ngx_cidr_t *cidr) { ngx_int_t rc; @@ -1313,7 +1239,7 @@ ngx_http_geo_cidr_value(ngx_conf_t *cf, ngx_str_t *net, ngx_cidr_t *cidr) static char * -ngx_http_geo_include(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, +ngx_stream_geo_include(ngx_conf_t *cf, ngx_stream_geo_conf_ctx_t *ctx, ngx_str_t *name) { char *rv; @@ -1334,7 +1260,7 @@ ngx_http_geo_include(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, if (ctx->ranges) { ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data); - switch (ngx_http_geo_include_binary_base(cf, ctx, &file)) { + switch (ngx_stream_geo_include_binary_base(cf, ctx, &file)) { case NGX_OK: return NGX_CONF_OK; case NGX_ERROR: @@ -1365,22 +1291,22 @@ ngx_http_geo_include(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, static ngx_int_t -ngx_http_geo_include_binary_base(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, - ngx_str_t *name) +ngx_stream_geo_include_binary_base(ngx_conf_t *cf, + ngx_stream_geo_conf_ctx_t *ctx, ngx_str_t *name) { - u_char *base, ch; - time_t mtime; - size_t size, len; - ssize_t n; - uint32_t crc32; - ngx_err_t err; - ngx_int_t rc; - ngx_uint_t i; - ngx_file_t file; - ngx_file_info_t fi; - ngx_http_geo_range_t *range, **ranges; - ngx_http_geo_header_t *header; - ngx_http_variable_value_t *vv; + u_char *base, ch; + time_t mtime; + size_t size, len; + ssize_t n; + uint32_t crc32; + ngx_err_t err; + ngx_int_t rc; + ngx_uint_t i; + ngx_file_t file; + ngx_file_info_t fi; + ngx_stream_geo_range_t *range, **ranges; + ngx_stream_geo_header_t *header; + ngx_stream_variable_value_t *vv; ngx_memzero(&file, sizeof(ngx_file_t)); file.name = *name; @@ -1458,9 +1384,9 @@ ngx_http_geo_include_binary_base(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, goto failed; } - header = (ngx_http_geo_header_t *) base; + header = (ngx_stream_geo_header_t *) base; - if (size < 16 || ngx_memcmp(&ngx_http_geo_header, header, 12) != 0) { + if (size < 16 || ngx_memcmp(&ngx_stream_geo_header, header, 12) != 0) { ngx_conf_log_error(NGX_LOG_WARN, cf, 0, "incompatible binary geo range base \"%s\"", name->data); goto failed; @@ -1468,40 +1394,42 @@ ngx_http_geo_include_binary_base(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, ngx_crc32_init(crc32); - vv = (ngx_http_variable_value_t *) (base + sizeof(ngx_http_geo_header_t)); + vv = (ngx_stream_variable_value_t *) + (base + sizeof(ngx_stream_geo_header_t)); while (vv->data) { - len = ngx_align(sizeof(ngx_http_variable_value_t) + vv->len, + len = ngx_align(sizeof(ngx_stream_variable_value_t) + vv->len, sizeof(void *)); ngx_crc32_update(&crc32, (u_char *) vv, len); vv->data += (size_t) base; - vv = (ngx_http_variable_value_t *) ((u_char *) vv + len); + vv = (ngx_stream_variable_value_t *) ((u_char *) vv + len); } - ngx_crc32_update(&crc32, (u_char *) vv, sizeof(ngx_http_variable_value_t)); + ngx_crc32_update(&crc32, (u_char *) vv, + sizeof(ngx_stream_variable_value_t)); vv++; - ranges = (ngx_http_geo_range_t **) vv; + ranges = (ngx_stream_geo_range_t **) vv; for (i = 0; i < 0x10000; i++) { ngx_crc32_update(&crc32, (u_char *) &ranges[i], sizeof(void *)); if (ranges[i]) { - ranges[i] = (ngx_http_geo_range_t *) + ranges[i] = (ngx_stream_geo_range_t *) ((u_char *) ranges[i] + (size_t) base); } } - range = (ngx_http_geo_range_t *) &ranges[0x10000]; + range = (ngx_stream_geo_range_t *) &ranges[0x10000]; while ((u_char *) range < base + size) { while (range->value) { ngx_crc32_update(&crc32, (u_char *) range, - sizeof(ngx_http_geo_range_t)); - range->value = (ngx_http_variable_value_t *) + sizeof(ngx_stream_geo_range_t)); + range->value = (ngx_stream_variable_value_t *) ((u_char *) range->value + (size_t) base); range++; } ngx_crc32_update(&crc32, (u_char *) range, sizeof(void *)); - range = (ngx_http_geo_range_t *) ((u_char *) range + sizeof(void *)); + range = (ngx_stream_geo_range_t *) ((u_char *) range + sizeof(void *)); } ngx_crc32_final(crc32); @@ -1538,16 +1466,16 @@ done: static void -ngx_http_geo_create_binary_base(ngx_http_geo_conf_ctx_t *ctx) +ngx_stream_geo_create_binary_base(ngx_stream_geo_conf_ctx_t *ctx) { - u_char *p; - uint32_t hash; - ngx_str_t s; - ngx_uint_t i; - ngx_file_mapping_t fm; - ngx_http_geo_range_t *r, *range, **ranges; - ngx_http_geo_header_t *header; - ngx_http_geo_variable_value_node_t *gvvn; + u_char *p; + uint32_t hash; + ngx_str_t s; + ngx_uint_t i; + ngx_file_mapping_t fm; + ngx_stream_geo_range_t *r, *range, **ranges; + ngx_stream_geo_header_t *header; + ngx_stream_geo_variable_value_node_t *gvvn; fm.name = ngx_pnalloc(ctx->temp_pool, ctx->include_name.len + 5); if (fm.name == NULL) { @@ -1566,17 +1494,17 @@ ngx_http_geo_create_binary_base(ngx_http_geo_conf_ctx_t *ctx) return; } - p = ngx_cpymem(fm.addr, &ngx_http_geo_header, - sizeof(ngx_http_geo_header_t)); + p = ngx_cpymem(fm.addr, &ngx_stream_geo_header, + sizeof(ngx_stream_geo_header_t)); - p = ngx_http_geo_copy_values(fm.addr, p, ctx->rbtree.root, - ctx->rbtree.sentinel); + p = ngx_stream_geo_copy_values(fm.addr, p, ctx->rbtree.root, + ctx->rbtree.sentinel); - p += sizeof(ngx_http_variable_value_t); + p += sizeof(ngx_stream_variable_value_t); - ranges = (ngx_http_geo_range_t **) p; + ranges = (ngx_stream_geo_range_t **) p; - p += 0x10000 * sizeof(ngx_http_geo_range_t *); + p += 0x10000 * sizeof(ngx_stream_geo_range_t *); for (i = 0; i < 0x10000; i++) { r = ctx->high.low[i]; @@ -1584,17 +1512,17 @@ ngx_http_geo_create_binary_base(ngx_http_geo_conf_ctx_t *ctx) continue; } - range = (ngx_http_geo_range_t *) p; - ranges[i] = (ngx_http_geo_range_t *) (p - (u_char *) fm.addr); + range = (ngx_stream_geo_range_t *) p; + ranges[i] = (ngx_stream_geo_range_t *) (p - (u_char *) fm.addr); do { s.len = r->value->len; s.data = r->value->data; hash = ngx_crc32_long(s.data, s.len); - gvvn = (ngx_http_geo_variable_value_node_t *) + gvvn = (ngx_stream_geo_variable_value_node_t *) ngx_str_rbtree_lookup(&ctx->rbtree, &s, hash); - range->value = (ngx_http_variable_value_t *) gvvn->offset; + range->value = (ngx_stream_variable_value_t *) gvvn->offset; range->start = r->start; range->end = r->end; range++; @@ -1608,37 +1536,37 @@ ngx_http_geo_create_binary_base(ngx_http_geo_conf_ctx_t *ctx) header = fm.addr; header->crc32 = ngx_crc32_long((u_char *) fm.addr - + sizeof(ngx_http_geo_header_t), - fm.size - sizeof(ngx_http_geo_header_t)); + + sizeof(ngx_stream_geo_header_t), + fm.size - sizeof(ngx_stream_geo_header_t)); ngx_close_file_mapping(&fm); } static u_char * -ngx_http_geo_copy_values(u_char *base, u_char *p, ngx_rbtree_node_t *node, +ngx_stream_geo_copy_values(u_char *base, u_char *p, ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel) { - ngx_http_variable_value_t *vv; - ngx_http_geo_variable_value_node_t *gvvn; + ngx_stream_variable_value_t *vv; + ngx_stream_geo_variable_value_node_t *gvvn; if (node == sentinel) { return p; } - gvvn = (ngx_http_geo_variable_value_node_t *) node; + gvvn = (ngx_stream_geo_variable_value_node_t *) node; gvvn->offset = p - base; - vv = (ngx_http_variable_value_t *) p; + vv = (ngx_stream_variable_value_t *) p; *vv = *gvvn->value; - p += sizeof(ngx_http_variable_value_t); + p += sizeof(ngx_stream_variable_value_t); vv->data = (u_char *) (p - base); p = ngx_cpymem(p, gvvn->sn.str.data, gvvn->sn.str.len); p = ngx_align_ptr(p, sizeof(void *)); - p = ngx_http_geo_copy_values(base, p, node->left, sentinel); + p = ngx_stream_geo_copy_values(base, p, node->left, sentinel); - return ngx_http_geo_copy_values(base, p, node->right, sentinel); + return ngx_stream_geo_copy_values(base, p, node->right, sentinel); } Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_geoip_module.c (+134 -245) 56% =================================================================== --- vendor/nginx-1.11.1/src/http/modules/ngx_http_geoip_module.c 2016-07-27 12:58:24 +0900 (8e151aa) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_geoip_module.c 2016-07-27 13:06:13 +0900 (f694033) @@ -7,7 +7,7 @@ #include <ngx_config.h> #include <ngx_core.h> -#include <ngx_http.h> +#include <ngx_stream.h> #include <GeoIP.h> #include <GeoIPCity.h> @@ -22,27 +22,25 @@ typedef struct { GeoIP *country; GeoIP *org; GeoIP *city; - ngx_array_t *proxies; /* array of ngx_cidr_t */ - ngx_flag_t proxy_recursive; #if (NGX_HAVE_GEOIP_V6) unsigned country_v6:1; unsigned org_v6:1; unsigned city_v6:1; #endif -} ngx_http_geoip_conf_t; +} ngx_stream_geoip_conf_t; typedef struct { ngx_str_t *name; uintptr_t data; -} ngx_http_geoip_var_t; +} ngx_stream_geoip_var_t; -typedef const char *(*ngx_http_geoip_variable_handler_pt)(GeoIP *, +typedef const char *(*ngx_stream_geoip_variable_handler_pt)(GeoIP *, u_long addr); -ngx_http_geoip_variable_handler_pt ngx_http_geoip_country_functions[] = { +ngx_stream_geoip_variable_handler_pt ngx_stream_geoip_country_functions[] = { GeoIP_country_code_by_ipnum, GeoIP_country_code3_by_ipnum, GeoIP_country_name_by_ipnum, @@ -51,11 +49,13 @@ ngx_http_geoip_variable_handler_pt ngx_http_geoip_country_functions[] = { #if (NGX_HAVE_GEOIP_V6) -typedef const char *(*ngx_http_geoip_variable_handler_v6_pt)(GeoIP *, +typedef const char *(*ngx_stream_geoip_variable_handler_v6_pt)(GeoIP *, geoipv6_t addr); -ngx_http_geoip_variable_handler_v6_pt ngx_http_geoip_country_v6_functions[] = { +ngx_stream_geoip_variable_handler_v6_pt + ngx_stream_geoip_country_v6_functions[] = +{ GeoIP_country_code_by_ipnum_v6, GeoIP_country_code3_by_ipnum_v6, GeoIP_country_name_by_ipnum_v6, @@ -64,97 +64,75 @@ ngx_http_geoip_variable_handler_v6_pt ngx_http_geoip_country_v6_functions[] = { #endif -static ngx_int_t ngx_http_geoip_country_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); -static ngx_int_t ngx_http_geoip_org_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); -static ngx_int_t ngx_http_geoip_city_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); -static ngx_int_t ngx_http_geoip_region_name_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); -static ngx_int_t ngx_http_geoip_city_float_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); -static ngx_int_t ngx_http_geoip_city_int_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data); -static GeoIPRecord *ngx_http_geoip_get_city_record(ngx_http_request_t *r); - -static ngx_int_t ngx_http_geoip_add_variables(ngx_conf_t *cf); -static void *ngx_http_geoip_create_conf(ngx_conf_t *cf); -static char *ngx_http_geoip_init_conf(ngx_conf_t *cf, void *conf); -static char *ngx_http_geoip_country(ngx_conf_t *cf, ngx_command_t *cmd, - void *conf); -static char *ngx_http_geoip_org(ngx_conf_t *cf, ngx_command_t *cmd, +static ngx_int_t ngx_stream_geoip_country_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_geoip_org_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_geoip_city_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_geoip_region_name_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_geoip_city_float_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_geoip_city_int_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static GeoIPRecord *ngx_stream_geoip_get_city_record(ngx_stream_session_t *s); + +static ngx_int_t ngx_stream_geoip_add_variables(ngx_conf_t *cf); +static void *ngx_stream_geoip_create_conf(ngx_conf_t *cf); +static char *ngx_stream_geoip_country(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_geoip_city(ngx_conf_t *cf, ngx_command_t *cmd, +static char *ngx_stream_geoip_org(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_geoip_proxy(ngx_conf_t *cf, ngx_command_t *cmd, +static char *ngx_stream_geoip_city(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static ngx_int_t ngx_http_geoip_cidr_value(ngx_conf_t *cf, ngx_str_t *net, - ngx_cidr_t *cidr); -static void ngx_http_geoip_cleanup(void *data); +static void ngx_stream_geoip_cleanup(void *data); -static ngx_command_t ngx_http_geoip_commands[] = { +static ngx_command_t ngx_stream_geoip_commands[] = { { ngx_string("geoip_country"), - NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE12, - ngx_http_geoip_country, - NGX_HTTP_MAIN_CONF_OFFSET, + NGX_STREAM_MAIN_CONF|NGX_CONF_TAKE12, + ngx_stream_geoip_country, + NGX_STREAM_MAIN_CONF_OFFSET, 0, NULL }, { ngx_string("geoip_org"), - NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE12, - ngx_http_geoip_org, - NGX_HTTP_MAIN_CONF_OFFSET, + NGX_STREAM_MAIN_CONF|NGX_CONF_TAKE12, + ngx_stream_geoip_org, + NGX_STREAM_MAIN_CONF_OFFSET, 0, NULL }, { ngx_string("geoip_city"), - NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE12, - ngx_http_geoip_city, - NGX_HTTP_MAIN_CONF_OFFSET, - 0, - NULL }, - - { ngx_string("geoip_proxy"), - NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, - ngx_http_geoip_proxy, - NGX_HTTP_MAIN_CONF_OFFSET, + NGX_STREAM_MAIN_CONF|NGX_CONF_TAKE12, + ngx_stream_geoip_city, + NGX_STREAM_MAIN_CONF_OFFSET, 0, NULL }, - { ngx_string("geoip_proxy_recursive"), - NGX_HTTP_MAIN_CONF|NGX_CONF_FLAG, - ngx_conf_set_flag_slot, - NGX_HTTP_MAIN_CONF_OFFSET, - offsetof(ngx_http_geoip_conf_t, proxy_recursive), - NULL }, - ngx_null_command }; -static ngx_http_module_t ngx_http_geoip_module_ctx = { - ngx_http_geoip_add_variables, /* preconfiguration */ +static ngx_stream_module_t ngx_stream_geoip_module_ctx = { + ngx_stream_geoip_add_variables, /* preconfiguration */ NULL, /* postconfiguration */ - ngx_http_geoip_create_conf, /* create main configuration */ - ngx_http_geoip_init_conf, /* init main configuration */ + ngx_stream_geoip_create_conf, /* create main configuration */ + NULL, /* init main configuration */ NULL, /* create server configuration */ - NULL, /* merge server configuration */ - - NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL /* merge server configuration */ }; -ngx_module_t ngx_http_geoip_module = { +ngx_module_t ngx_stream_geoip_module = { NGX_MODULE_V1, - &ngx_http_geoip_module_ctx, /* module context */ - ngx_http_geoip_commands, /* module directives */ - NGX_HTTP_MODULE, /* module type */ + &ngx_stream_geoip_module_ctx, /* module context */ + ngx_stream_geoip_commands, /* module directives */ + NGX_STREAM_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ NULL, /* init process */ @@ -166,70 +144,70 @@ ngx_module_t ngx_http_geoip_module = { }; -static ngx_http_variable_t ngx_http_geoip_vars[] = { +static ngx_stream_variable_t ngx_stream_geoip_vars[] = { { ngx_string("geoip_country_code"), NULL, - ngx_http_geoip_country_variable, + ngx_stream_geoip_country_variable, NGX_GEOIP_COUNTRY_CODE, 0, 0 }, { ngx_string("geoip_country_code3"), NULL, - ngx_http_geoip_country_variable, + ngx_stream_geoip_country_variable, NGX_GEOIP_COUNTRY_CODE3, 0, 0 }, { ngx_string("geoip_country_name"), NULL, - ngx_http_geoip_country_variable, + ngx_stream_geoip_country_variable, NGX_GEOIP_COUNTRY_NAME, 0, 0 }, { ngx_string("geoip_org"), NULL, - ngx_http_geoip_org_variable, + ngx_stream_geoip_org_variable, 0, 0, 0 }, { ngx_string("geoip_city_continent_code"), NULL, - ngx_http_geoip_city_variable, + ngx_stream_geoip_city_variable, offsetof(GeoIPRecord, continent_code), 0, 0 }, { ngx_string("geoip_city_country_code"), NULL, - ngx_http_geoip_city_variable, + ngx_stream_geoip_city_variable, offsetof(GeoIPRecord, country_code), 0, 0 }, { ngx_string("geoip_city_country_code3"), NULL, - ngx_http_geoip_city_variable, + ngx_stream_geoip_city_variable, offsetof(GeoIPRecord, country_code3), 0, 0 }, { ngx_string("geoip_city_country_name"), NULL, - ngx_http_geoip_city_variable, + ngx_stream_geoip_city_variable, offsetof(GeoIPRecord, country_name), 0, 0 }, { ngx_string("geoip_region"), NULL, - ngx_http_geoip_city_variable, + ngx_stream_geoip_city_variable, offsetof(GeoIPRecord, region), 0, 0 }, { ngx_string("geoip_region_name"), NULL, - ngx_http_geoip_region_name_variable, + ngx_stream_geoip_region_name_variable, 0, 0, 0 }, { ngx_string("geoip_city"), NULL, - ngx_http_geoip_city_variable, + ngx_stream_geoip_city_variable, offsetof(GeoIPRecord, city), 0, 0 }, { ngx_string("geoip_postal_code"), NULL, - ngx_http_geoip_city_variable, + ngx_stream_geoip_city_variable, offsetof(GeoIPRecord, postal_code), 0, 0 }, { ngx_string("geoip_latitude"), NULL, - ngx_http_geoip_city_float_variable, + ngx_stream_geoip_city_float_variable, offsetof(GeoIPRecord, latitude), 0, 0 }, { ngx_string("geoip_longitude"), NULL, - ngx_http_geoip_city_float_variable, + ngx_stream_geoip_city_float_variable, offsetof(GeoIPRecord, longitude), 0, 0 }, { ngx_string("geoip_dma_code"), NULL, - ngx_http_geoip_city_int_variable, + ngx_stream_geoip_city_int_variable, offsetof(GeoIPRecord, dma_code), 0, 0 }, { ngx_string("geoip_area_code"), NULL, - ngx_http_geoip_city_int_variable, + ngx_stream_geoip_city_int_variable, offsetof(GeoIPRecord, area_code), 0, 0 }, { ngx_null_string, NULL, NULL, 0, 0, 0 } @@ -237,22 +215,14 @@ static ngx_http_variable_t ngx_http_geoip_vars[] = { static u_long -ngx_http_geoip_addr(ngx_http_request_t *r, ngx_http_geoip_conf_t *gcf) +ngx_stream_geoip_addr(ngx_stream_session_t *s, ngx_stream_geoip_conf_t *gcf) { ngx_addr_t addr; - ngx_array_t *xfwd; struct sockaddr_in *sin; - addr.sockaddr = r->connection->sockaddr; - addr.socklen = r->connection->socklen; - /* addr.name = r->connection->addr_text; */ - - xfwd = &r->headers_in.x_forwarded_for; - - if (xfwd->nelts > 0 && gcf->proxies != NULL) { - (void) ngx_http_get_forwarded_addr(r, &addr, xfwd, NULL, - gcf->proxies, gcf->proxy_recursive); - } + addr.sockaddr = s->connection->sockaddr; + addr.socklen = s->connection->socklen; + /* addr.name = s->connection->addr_text; */ #if (NGX_HAVE_INET6) @@ -289,25 +259,17 @@ ngx_http_geoip_addr(ngx_http_request_t *r, ngx_http_geoip_conf_t *gcf) #if (NGX_HAVE_GEOIP_V6) static geoipv6_t -ngx_http_geoip_addr_v6(ngx_http_request_t *r, ngx_http_geoip_conf_t *gcf) +ngx_stream_geoip_addr_v6(ngx_stream_session_t *s, ngx_stream_geoip_conf_t *gcf) { ngx_addr_t addr; - ngx_array_t *xfwd; in_addr_t addr4; struct in6_addr addr6; struct sockaddr_in *sin; struct sockaddr_in6 *sin6; - addr.sockaddr = r->connection->sockaddr; - addr.socklen = r->connection->socklen; - /* addr.name = r->connection->addr_text; */ - - xfwd = &r->headers_in.x_forwarded_for; - - if (xfwd->nelts > 0 && gcf->proxies != NULL) { - (void) ngx_http_get_forwarded_addr(r, &addr, xfwd, NULL, - gcf->proxies, gcf->proxy_recursive); - } + addr.sockaddr = s->connection->sockaddr; + addr.socklen = s->connection->socklen; + /* addr.name = s->connection->addr_text; */ switch (addr.sockaddr->sa_family) { @@ -338,20 +300,20 @@ ngx_http_geoip_addr_v6(ngx_http_request_t *r, ngx_http_geoip_conf_t *gcf) static ngx_int_t -ngx_http_geoip_country_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data) +ngx_stream_geoip_country_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) { - ngx_http_geoip_variable_handler_pt handler = - ngx_http_geoip_country_functions[data]; + ngx_stream_geoip_variable_handler_pt handler = + ngx_stream_geoip_country_functions[data]; #if (NGX_HAVE_GEOIP_V6) - ngx_http_geoip_variable_handler_v6_pt handler_v6 = - ngx_http_geoip_country_v6_functions[data]; + ngx_stream_geoip_variable_handler_v6_pt handler_v6 = + ngx_stream_geoip_country_v6_functions[data]; #endif - const char *val; - ngx_http_geoip_conf_t *gcf; + const char *val; + ngx_stream_geoip_conf_t *gcf; - gcf = ngx_http_get_module_main_conf(r, ngx_http_geoip_module); + gcf = ngx_stream_get_module_main_conf(s, ngx_stream_geoip_module); if (gcf->country == NULL) { goto not_found; @@ -359,10 +321,10 @@ ngx_http_geoip_country_variable(ngx_http_request_t *r, #if (NGX_HAVE_GEOIP_V6) val = gcf->country_v6 - ? handler_v6(gcf->country, ngx_http_geoip_addr_v6(r, gcf)) - : handler(gcf->country, ngx_http_geoip_addr(r, gcf)); + ? handler_v6(gcf->country, ngx_stream_geoip_addr_v6(s, gcf)) + : handler(gcf->country, ngx_stream_geoip_addr(s, gcf)); #else - val = handler(gcf->country, ngx_http_geoip_addr(r, gcf)); + val = handler(gcf->country, ngx_stream_geoip_addr(s, gcf)); #endif if (val == NULL) { @@ -386,14 +348,14 @@ not_found: static ngx_int_t -ngx_http_geoip_org_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data) +ngx_stream_geoip_org_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) { - size_t len; - char *val; - ngx_http_geoip_conf_t *gcf; + size_t len; + char *val; + ngx_stream_geoip_conf_t *gcf; - gcf = ngx_http_get_module_main_conf(r, ngx_http_geoip_module); + gcf = ngx_stream_get_module_main_conf(s, ngx_stream_geoip_module); if (gcf->org == NULL) { goto not_found; @@ -402,11 +364,11 @@ ngx_http_geoip_org_variable(ngx_http_request_t *r, #if (NGX_HAVE_GEOIP_V6) val = gcf->org_v6 ? GeoIP_name_by_ipnum_v6(gcf->org, - ngx_http_geoip_addr_v6(r, gcf)) + ngx_stream_geoip_addr_v6(s, gcf)) : GeoIP_name_by_ipnum(gcf->org, - ngx_http_geoip_addr(r, gcf)); + ngx_stream_geoip_addr(s, gcf)); #else - val = GeoIP_name_by_ipnum(gcf->org, ngx_http_geoip_addr(r, gcf)); + val = GeoIP_name_by_ipnum(gcf->org, ngx_stream_geoip_addr(s, gcf)); #endif if (val == NULL) { @@ -414,7 +376,7 @@ ngx_http_geoip_org_variable(ngx_http_request_t *r, } len = ngx_strlen(val); - v->data = ngx_pnalloc(r->pool, len); + v->data = ngx_pnalloc(s->connection->pool, len); if (v->data == NULL) { ngx_free(val); return NGX_ERROR; @@ -440,14 +402,14 @@ not_found: static ngx_int_t -ngx_http_geoip_city_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data) +ngx_stream_geoip_city_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) { char *val; size_t len; GeoIPRecord *gr; - gr = ngx_http_geoip_get_city_record(r); + gr = ngx_stream_geoip_get_city_record(s); if (gr == NULL) { goto not_found; } @@ -458,7 +420,7 @@ ngx_http_geoip_city_variable(ngx_http_request_t *r, } len = ngx_strlen(val); - v->data = ngx_pnalloc(r->pool, len); + v->data = ngx_pnalloc(s->connection->pool, len); if (v->data == NULL) { GeoIPRecord_delete(gr); return NGX_ERROR; @@ -488,14 +450,14 @@ not_found: static ngx_int_t -ngx_http_geoip_region_name_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data) +ngx_stream_geoip_region_name_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) { size_t len; const char *val; GeoIPRecord *gr; - gr = ngx_http_geoip_get_city_record(r); + gr = ngx_stream_geoip_get_city_record(s); if (gr == NULL) { goto not_found; } @@ -509,7 +471,7 @@ ngx_http_geoip_region_name_variable(ngx_http_request_t *r, } len = ngx_strlen(val); - v->data = ngx_pnalloc(r->pool, len); + v->data = ngx_pnalloc(s->connection->pool, len); if (v->data == NULL) { return NGX_ERROR; } @@ -532,19 +494,19 @@ not_found: static ngx_int_t -ngx_http_geoip_city_float_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data) +ngx_stream_geoip_city_float_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) { float val; GeoIPRecord *gr; - gr = ngx_http_geoip_get_city_record(r); + gr = ngx_stream_geoip_get_city_record(s); if (gr == NULL) { v->not_found = 1; return NGX_OK; } - v->data = ngx_pnalloc(r->pool, NGX_INT64_LEN + 5); + v->data = ngx_pnalloc(s->connection->pool, NGX_INT64_LEN + 5); if (v->data == NULL) { GeoIPRecord_delete(gr); return NGX_ERROR; @@ -564,19 +526,19 @@ ngx_http_geoip_city_float_variable(ngx_http_request_t *r, static ngx_int_t -ngx_http_geoip_city_int_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data) +ngx_stream_geoip_city_int_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) { int val; GeoIPRecord *gr; - gr = ngx_http_geoip_get_city_record(r); + gr = ngx_stream_geoip_get_city_record(s); if (gr == NULL) { v->not_found = 1; return NGX_OK; } - v->data = ngx_pnalloc(r->pool, NGX_INT64_LEN); + v->data = ngx_pnalloc(s->connection->pool, NGX_INT64_LEN); if (v->data == NULL) { GeoIPRecord_delete(gr); return NGX_ERROR; @@ -596,21 +558,21 @@ ngx_http_geoip_city_int_variable(ngx_http_request_t *r, static GeoIPRecord * -ngx_http_geoip_get_city_record(ngx_http_request_t *r) +ngx_stream_geoip_get_city_record(ngx_stream_session_t *s) { - ngx_http_geoip_conf_t *gcf; + ngx_stream_geoip_conf_t *gcf; - gcf = ngx_http_get_module_main_conf(r, ngx_http_geoip_module); + gcf = ngx_stream_get_module_main_conf(s, ngx_stream_geoip_module); if (gcf->city) { #if (NGX_HAVE_GEOIP_V6) return gcf->city_v6 ? GeoIP_record_by_ipnum_v6(gcf->city, - ngx_http_geoip_addr_v6(r, gcf)) + ngx_stream_geoip_addr_v6(s, gcf)) : GeoIP_record_by_ipnum(gcf->city, - ngx_http_geoip_addr(r, gcf)); + ngx_stream_geoip_addr(s, gcf)); #else - return GeoIP_record_by_ipnum(gcf->city, ngx_http_geoip_addr(r, gcf)); + return GeoIP_record_by_ipnum(gcf->city, ngx_stream_geoip_addr(s, gcf)); #endif } @@ -619,12 +581,12 @@ ngx_http_geoip_get_city_record(ngx_http_request_t *r) static ngx_int_t -ngx_http_geoip_add_variables(ngx_conf_t *cf) +ngx_stream_geoip_add_variables(ngx_conf_t *cf) { - ngx_http_variable_t *var, *v; + ngx_stream_variable_t *var, *v; - for (v = ngx_http_geoip_vars; v->name.len; v++) { - var = ngx_http_add_variable(cf, &v->name, v->flags); + for (v = ngx_stream_geoip_vars; v->name.len; v++) { + var = ngx_stream_add_variable(cf, &v->name, v->flags); if (var == NULL) { return NGX_ERROR; } @@ -638,24 +600,22 @@ ngx_http_geoip_add_variables(ngx_conf_t *cf) static void * -ngx_http_geoip_create_conf(ngx_conf_t *cf) +ngx_stream_geoip_create_conf(ngx_conf_t *cf) { - ngx_pool_cleanup_t *cln; - ngx_http_geoip_conf_t *conf; + ngx_pool_cleanup_t *cln; + ngx_stream_geoip_conf_t *conf; - conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_geoip_conf_t)); + conf = ngx_pcalloc(cf->pool, sizeof(ngx_stream_geoip_conf_t)); if (conf == NULL) { return NULL; } - conf->proxy_recursive = NGX_CONF_UNSET; - cln = ngx_pool_cleanup_add(cf->pool, 0); if (cln == NULL) { return NULL; } - cln->handler = ngx_http_geoip_cleanup; + cln->handler = ngx_stream_geoip_cleanup; cln->data = conf; return conf; @@ -663,20 +623,9 @@ ngx_http_geoip_create_conf(ngx_conf_t *cf) static char * -ngx_http_geoip_init_conf(ngx_conf_t *cf, void *conf) +ngx_stream_geoip_country(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { - ngx_http_geoip_conf_t *gcf = conf; - - ngx_conf_init_value(gcf->proxy_recursive, 0); - - return NGX_CONF_OK; -} - - -static char * -ngx_http_geoip_country(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) -{ - ngx_http_geoip_conf_t *gcf = conf; + ngx_stream_geoip_conf_t *gcf = conf; ngx_str_t *value; @@ -729,9 +678,9 @@ ngx_http_geoip_country(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) static char * -ngx_http_geoip_org(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +ngx_stream_geoip_org(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { - ngx_http_geoip_conf_t *gcf = conf; + ngx_stream_geoip_conf_t *gcf = conf; ngx_str_t *value; @@ -790,9 +739,9 @@ ngx_http_geoip_org(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) static char * -ngx_http_geoip_city(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +ngx_stream_geoip_city(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { - ngx_http_geoip_conf_t *gcf = conf; + ngx_stream_geoip_conf_t *gcf = conf; ngx_str_t *value; @@ -846,70 +795,10 @@ ngx_http_geoip_city(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } -static char * -ngx_http_geoip_proxy(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) -{ - ngx_http_geoip_conf_t *gcf = conf; - - ngx_str_t *value; - ngx_cidr_t cidr, *c; - - value = cf->args->elts; - - if (ngx_http_geoip_cidr_value(cf, &value[1], &cidr) != NGX_OK) { - return NGX_CONF_ERROR; - } - - if (gcf->proxies == NULL) { - gcf->proxies = ngx_array_create(cf->pool, 4, sizeof(ngx_cidr_t)); - if (gcf->proxies == NULL) { - return NGX_CONF_ERROR; - } - } - - c = ngx_array_push(gcf->proxies); - if (c == NULL) { - return NGX_CONF_ERROR; - } - - *c = cidr; - - return NGX_CONF_OK; -} - -static ngx_int_t -ngx_http_geoip_cidr_value(ngx_conf_t *cf, ngx_str_t *net, ngx_cidr_t *cidr) -{ - ngx_int_t rc; - - if (ngx_strcmp(net->data, "255.255.255.255") == 0) { - cidr->family = AF_INET; - cidr->u.in.addr = 0xffffffff; - cidr->u.in.mask = 0xffffffff; - - return NGX_OK; - } - - rc = ngx_ptocidr(net, cidr); - - if (rc == NGX_ERROR) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid network \"%V\"", net); - return NGX_ERROR; - } - - if (rc == NGX_DONE) { - ngx_conf_log_error(NGX_LOG_WARN, cf, 0, - "low address bits of %V are meaningless", net); - } - - return NGX_OK; -} - - static void -ngx_http_geoip_cleanup(void *data) +ngx_stream_geoip_cleanup(void *data) { - ngx_http_geoip_conf_t *gcf = data; + ngx_stream_geoip_conf_t *gcf = data; if (gcf->country) { GeoIP_delete(gcf->country); Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_handler.c (+9 -0) 96% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_handler.c 2016-07-27 12:58:24 +0900 (aa69e44) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_handler.c 2016-07-27 13:06:13 +0900 (61169e1) @@ -149,6 +149,15 @@ ngx_stream_init_connection(ngx_connection_t *c) cmcf = ngx_stream_get_module_main_conf(s, ngx_stream_core_module); + s->variables = ngx_pcalloc(s->connection->pool, + cmcf->variables.nelts + * sizeof(ngx_stream_variable_value_t)); + + if (s->variables == NULL) { + ngx_stream_close_connection(c); + return; + } + if (cmcf->limit_conn_handler) { rc = cmcf->limit_conn_handler(s); Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_limit_conn_module.c (+75 -67) 82% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_limit_conn_module.c 2016-07-27 12:58:24 +0900 (f1d8a37) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_limit_conn_module.c 2016-07-27 13:06:13 +0900 (40eca94) @@ -11,33 +11,34 @@ typedef struct { - u_char color; - u_char len; - u_short conn; - u_char data[1]; + u_char color; + u_char len; + u_short conn; + u_char data[1]; } ngx_stream_limit_conn_node_t; typedef struct { - ngx_shm_zone_t *shm_zone; - ngx_rbtree_node_t *node; + ngx_shm_zone_t *shm_zone; + ngx_rbtree_node_t *node; } ngx_stream_limit_conn_cleanup_t; typedef struct { - ngx_rbtree_t *rbtree; + ngx_rbtree_t *rbtree; + ngx_stream_complex_value_t key; } ngx_stream_limit_conn_ctx_t; typedef struct { - ngx_shm_zone_t *shm_zone; - ngx_uint_t conn; + ngx_shm_zone_t *shm_zone; + ngx_uint_t conn; } ngx_stream_limit_conn_limit_t; typedef struct { - ngx_array_t limits; - ngx_uint_t log_level; + ngx_array_t limits; + ngx_uint_t log_level; } ngx_stream_limit_conn_conf_t; @@ -93,28 +94,29 @@ static ngx_command_t ngx_stream_limit_conn_commands[] = { static ngx_stream_module_t ngx_stream_limit_conn_module_ctx = { + NULL, /* preconfiguration */ ngx_stream_limit_conn_init, /* postconfiguration */ NULL, /* create main configuration */ NULL, /* init main configuration */ ngx_stream_limit_conn_create_conf, /* create server configuration */ - ngx_stream_limit_conn_merge_conf, /* merge server configuration */ + ngx_stream_limit_conn_merge_conf /* merge server configuration */ }; ngx_module_t ngx_stream_limit_conn_module = { NGX_MODULE_V1, - &ngx_stream_limit_conn_module_ctx, /* module context */ - ngx_stream_limit_conn_commands, /* module directives */ - NGX_STREAM_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_stream_limit_conn_module_ctx, /* module context */ + ngx_stream_limit_conn_commands, /* module directives */ + NGX_STREAM_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 }; @@ -129,48 +131,36 @@ ngx_stream_limit_conn_handler(ngx_stream_session_t *s) ngx_slab_pool_t *shpool; ngx_rbtree_node_t *node; ngx_pool_cleanup_t *cln; - struct sockaddr_in *sin; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif ngx_stream_limit_conn_ctx_t *ctx; ngx_stream_limit_conn_node_t *lc; ngx_stream_limit_conn_conf_t *lccf; ngx_stream_limit_conn_limit_t *limits; ngx_stream_limit_conn_cleanup_t *lccln; - switch (s->connection->sockaddr->sa_family) { - - case AF_INET: - sin = (struct sockaddr_in *) s->connection->sockaddr; - - key.len = sizeof(in_addr_t); - key.data = (u_char *) &sin->sin_addr; - - break; - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = (struct sockaddr_in6 *) s->connection->sockaddr; - - key.len = sizeof(struct in6_addr); - key.data = sin6->sin6_addr.s6_addr; - - break; -#endif - - default: - return NGX_DECLINED; - } - - hash = ngx_crc32_short(key.data, key.len); - lccf = ngx_stream_get_module_srv_conf(s, ngx_stream_limit_conn_module); limits = lccf->limits.elts; for (i = 0; i < lccf->limits.nelts; i++) { ctx = limits[i].shm_zone->data; + if (ngx_stream_complex_value(s, &ctx->key, &key) != NGX_OK) { + return NGX_ERROR; + } + + if (key.len == 0) { + continue; + } + + if (key.len > 255) { + ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, + "the value of the \"%V\" key " + "is more than 255 bytes: \"%V\"", + &ctx->key.value, &key); + continue; + } + + hash = ngx_crc32_short(key.data, key.len); + shpool = (ngx_slab_pool_t *) limits[i].shm_zone->shm.addr; ngx_shmtx_lock(&shpool->mutex); @@ -382,6 +372,19 @@ ngx_stream_limit_conn_init_zone(ngx_shm_zone_t *shm_zone, void *data) ctx = shm_zone->data; if (octx) { + if (ctx->key.value.len != octx->key.value.len + || ngx_strncmp(ctx->key.value.data, octx->key.value.data, + ctx->key.value.len) + != 0) + { + ngx_log_error(NGX_LOG_EMERG, shm_zone->shm.log, 0, + "limit_conn_zone \"%V\" uses the \"%V\" key " + "while previously it used the \"%V\" key", + &shm_zone->shm.name, &ctx->key.value, + &octx->key.value); + return NGX_ERROR; + } + ctx->rbtree = octx->rbtree; return NGX_OK; @@ -465,12 +468,13 @@ ngx_stream_limit_conn_merge_conf(ngx_conf_t *cf, void *parent, void *child) static char * ngx_stream_limit_conn_zone(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { - u_char *p; - ssize_t size; - ngx_str_t *value, name, s; - ngx_uint_t i; - ngx_shm_zone_t *shm_zone; - ngx_stream_limit_conn_ctx_t *ctx; + u_char *p; + ssize_t size; + ngx_str_t *value, name, s; + ngx_uint_t i; + ngx_shm_zone_t *shm_zone; + ngx_stream_limit_conn_ctx_t *ctx; + ngx_stream_compile_complex_value_t ccv; value = cf->args->elts; @@ -479,6 +483,16 @@ ngx_stream_limit_conn_zone(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_ERROR; } + ngx_memzero(&ccv, sizeof(ngx_stream_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[1]; + ccv.complex_value = &ctx->key; + + if (ngx_stream_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + size = 0; name.len = 0; @@ -537,17 +551,11 @@ ngx_stream_limit_conn_zone(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } if (shm_zone->data) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "%V \"%V\" is already bound to key " - "\"$binary_remote_addr\"", - &cmd->name, &name); - return NGX_CONF_ERROR; - } + ctx = shm_zone->data; - if (ngx_strcmp(value[1].data, "$binary_remote_addr") != 0) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "unsupported key \"%V\", use " - "$binary_remote_addr", &value[1]); + "%V \"%V\" is already bound to key \"%V\"", + &cmd->name, &name, &ctx->key.value); return NGX_CONF_ERROR; } Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_map_module.c (+98 -99) 65% =================================================================== --- vendor/nginx-1.11.1/src/http/modules/ngx_http_map_module.c 2016-07-27 12:58:24 +0900 (732aa5d) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_map_module.c 2016-07-27 13:06:13 +0900 (47a15be) @@ -7,91 +7,89 @@ #include <ngx_config.h> #include <ngx_core.h> -#include <ngx_http.h> +#include <ngx_stream.h> typedef struct { - ngx_uint_t hash_max_size; - ngx_uint_t hash_bucket_size; -} ngx_http_map_conf_t; + ngx_uint_t hash_max_size; + ngx_uint_t hash_bucket_size; +} ngx_stream_map_conf_t; typedef struct { - ngx_hash_keys_arrays_t keys; + ngx_hash_keys_arrays_t keys; - ngx_array_t *values_hash; + ngx_array_t *values_hash; #if (NGX_PCRE) - ngx_array_t regexes; + ngx_array_t regexes; #endif - ngx_http_variable_value_t *default_value; - ngx_conf_t *cf; - ngx_uint_t hostnames; /* unsigned hostnames:1 */ -} ngx_http_map_conf_ctx_t; + ngx_stream_variable_value_t *default_value; + ngx_conf_t *cf; + ngx_uint_t hostnames; /* unsigned hostnames:1 */ +} ngx_stream_map_conf_ctx_t; typedef struct { - ngx_http_map_t map; - ngx_http_complex_value_t value; - ngx_http_variable_value_t *default_value; - ngx_uint_t hostnames; /* unsigned hostnames:1 */ -} ngx_http_map_ctx_t; + ngx_stream_map_t map; + ngx_stream_complex_value_t value; + ngx_stream_variable_value_t *default_value; + ngx_uint_t hostnames; /* unsigned hostnames:1 */ +} ngx_stream_map_ctx_t; -static int ngx_libc_cdecl ngx_http_map_cmp_dns_wildcards(const void *one, +static int ngx_libc_cdecl ngx_stream_map_cmp_dns_wildcards(const void *one, const void *two); -static void *ngx_http_map_create_conf(ngx_conf_t *cf); -static char *ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf); +static void *ngx_stream_map_create_conf(ngx_conf_t *cf); +static char *ngx_stream_map_block(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); +static char *ngx_stream_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf); -static ngx_command_t ngx_http_map_commands[] = { +static ngx_command_t ngx_stream_map_commands[] = { { ngx_string("map"), - NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE2, - ngx_http_map_block, - NGX_HTTP_MAIN_CONF_OFFSET, + NGX_STREAM_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE2, + ngx_stream_map_block, + NGX_STREAM_MAIN_CONF_OFFSET, 0, NULL }, { ngx_string("map_hash_max_size"), - NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, + NGX_STREAM_MAIN_CONF|NGX_CONF_TAKE1, ngx_conf_set_num_slot, - NGX_HTTP_MAIN_CONF_OFFSET, - offsetof(ngx_http_map_conf_t, hash_max_size), + NGX_STREAM_MAIN_CONF_OFFSET, + offsetof(ngx_stream_map_conf_t, hash_max_size), NULL }, { ngx_string("map_hash_bucket_size"), - NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, + NGX_STREAM_MAIN_CONF|NGX_CONF_TAKE1, ngx_conf_set_num_slot, - NGX_HTTP_MAIN_CONF_OFFSET, - offsetof(ngx_http_map_conf_t, hash_bucket_size), + NGX_STREAM_MAIN_CONF_OFFSET, + offsetof(ngx_stream_map_conf_t, hash_bucket_size), NULL }, ngx_null_command }; -static ngx_http_module_t ngx_http_map_module_ctx = { +static ngx_stream_module_t ngx_stream_map_module_ctx = { NULL, /* preconfiguration */ NULL, /* postconfiguration */ - ngx_http_map_create_conf, /* create main configuration */ + ngx_stream_map_create_conf, /* create main configuration */ NULL, /* init main configuration */ NULL, /* create server configuration */ - NULL, /* merge server configuration */ - - NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL /* merge server configuration */ }; -ngx_module_t ngx_http_map_module = { +ngx_module_t ngx_stream_map_module = { NGX_MODULE_V1, - &ngx_http_map_module_ctx, /* module context */ - ngx_http_map_commands, /* module directives */ - NGX_HTTP_MODULE, /* module type */ + &ngx_stream_map_module_ctx, /* module context */ + ngx_stream_map_commands, /* module directives */ + NGX_STREAM_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ NULL, /* init process */ @@ -104,19 +102,19 @@ ngx_module_t ngx_http_map_module = { static ngx_int_t -ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, +ngx_stream_map_variable(ngx_stream_session_t *s, ngx_stream_variable_value_t *v, uintptr_t data) { - ngx_http_map_ctx_t *map = (ngx_http_map_ctx_t *) data; + ngx_stream_map_ctx_t *map = (ngx_stream_map_ctx_t *) data; - ngx_str_t val, str; - ngx_http_complex_value_t *cv; - ngx_http_variable_value_t *value; + ngx_str_t val, str; + ngx_stream_complex_value_t *cv; + ngx_stream_variable_value_t *value; - ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http map started"); + ngx_log_debug0(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, + "stream map started"); - if (ngx_http_complex_value(r, &map->value, &val) != NGX_OK) { + if (ngx_stream_complex_value(s, &map->value, &val) != NGX_OK) { return NGX_ERROR; } @@ -124,16 +122,16 @@ ngx_http_map_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, val.len--; } - value = ngx_http_map_find(r, &map->map, &val); + value = ngx_stream_map_find(s, &map->map, &val); if (value == NULL) { value = map->default_value; } if (!value->valid) { - cv = (ngx_http_complex_value_t *) value->data; + cv = (ngx_stream_complex_value_t *) value->data; - if (ngx_http_complex_value(r, cv, &str) != NGX_OK) { + if (ngx_stream_complex_value(s, cv, &str) != NGX_OK) { return NGX_ERROR; } @@ -147,19 +145,19 @@ 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); + ngx_log_debug2(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, + "stream map: \"%V\" \"%v\"", &val, v); return NGX_OK; } static void * -ngx_http_map_create_conf(ngx_conf_t *cf) +ngx_stream_map_create_conf(ngx_conf_t *cf) { - ngx_http_map_conf_t *mcf; + ngx_stream_map_conf_t *mcf; - mcf = ngx_palloc(cf->pool, sizeof(ngx_http_map_conf_t)); + mcf = ngx_palloc(cf->pool, sizeof(ngx_stream_map_conf_t)); if (mcf == NULL) { return NULL; } @@ -172,19 +170,19 @@ ngx_http_map_create_conf(ngx_conf_t *cf) static char * -ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +ngx_stream_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { - ngx_http_map_conf_t *mcf = conf; - - char *rv; - ngx_str_t *value, name; - ngx_conf_t save; - ngx_pool_t *pool; - ngx_hash_init_t hash; - ngx_http_map_ctx_t *map; - ngx_http_variable_t *var; - ngx_http_map_conf_ctx_t ctx; - ngx_http_compile_complex_value_t ccv; + ngx_stream_map_conf_t *mcf = conf; + + char *rv; + ngx_str_t *value, name; + ngx_conf_t save; + ngx_pool_t *pool; + ngx_hash_init_t hash; + ngx_stream_map_ctx_t *map; + ngx_stream_variable_t *var; + ngx_stream_map_conf_ctx_t ctx; + ngx_stream_compile_complex_value_t ccv; if (mcf->hash_max_size == NGX_CONF_UNSET_UINT) { mcf->hash_max_size = 2048; @@ -198,20 +196,20 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_cacheline_size); } - map = ngx_pcalloc(cf->pool, sizeof(ngx_http_map_ctx_t)); + map = ngx_pcalloc(cf->pool, sizeof(ngx_stream_map_ctx_t)); if (map == NULL) { return NGX_CONF_ERROR; } value = cf->args->elts; - ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + ngx_memzero(&ccv, sizeof(ngx_stream_compile_complex_value_t)); ccv.cf = cf; ccv.value = &value[1]; ccv.complex_value = &map->value; - if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + if (ngx_stream_compile_complex_value(&ccv) != NGX_OK) { return NGX_CONF_ERROR; } @@ -226,12 +224,12 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) name.len--; name.data++; - var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE); + var = ngx_stream_add_variable(cf, &name, NGX_STREAM_VAR_CHANGEABLE); if (var == NULL) { return NGX_CONF_ERROR; } - var->get_handler = ngx_http_map_variable; + var->get_handler = ngx_stream_map_variable; var->data = (uintptr_t) map; pool = ngx_create_pool(NGX_DEFAULT_POOL_SIZE, cf->log); @@ -254,7 +252,8 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } #if (NGX_PCRE) - if (ngx_array_init(&ctx.regexes, cf->pool, 2, sizeof(ngx_http_map_regex_t)) + if (ngx_array_init(&ctx.regexes, cf->pool, 2, + sizeof(ngx_stream_map_regex_t)) != NGX_OK) { ngx_destroy_pool(pool); @@ -269,7 +268,7 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) save = *cf; cf->pool = pool; cf->ctx = &ctx; - cf->handler = ngx_http_map; + cf->handler = ngx_stream_map; cf->handler_conf = conf; rv = ngx_conf_parse(cf, NULL); @@ -282,7 +281,7 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) } map->default_value = ctx.default_value ? ctx.default_value: - &ngx_http_variable_null_value; + &ngx_stream_variable_null_value; map->hostnames = ctx.hostnames; @@ -308,7 +307,7 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_qsort(ctx.keys.dns_wc_head.elts, (size_t) ctx.keys.dns_wc_head.nelts, - sizeof(ngx_hash_key_t), ngx_http_map_cmp_dns_wildcards); + sizeof(ngx_hash_key_t), ngx_stream_map_cmp_dns_wildcards); hash.hash = NULL; hash.temp_pool = pool; @@ -328,7 +327,7 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_qsort(ctx.keys.dns_wc_tail.elts, (size_t) ctx.keys.dns_wc_tail.nelts, - sizeof(ngx_hash_key_t), ngx_http_map_cmp_dns_wildcards); + sizeof(ngx_hash_key_t), ngx_stream_map_cmp_dns_wildcards); hash.hash = NULL; hash.temp_pool = pool; @@ -360,7 +359,7 @@ ngx_http_map_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) static int ngx_libc_cdecl -ngx_http_map_cmp_dns_wildcards(const void *one, const void *two) +ngx_stream_map_cmp_dns_wildcards(const void *one, const void *two) { ngx_hash_key_t *first, *second; @@ -372,17 +371,17 @@ ngx_http_map_cmp_dns_wildcards(const void *one, const void *two) static char * -ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) +ngx_stream_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) { - u_char *data; - size_t len; - ngx_int_t rv; - ngx_str_t *value, v; - ngx_uint_t i, key; - ngx_http_map_conf_ctx_t *ctx; - ngx_http_complex_value_t cv, *cvp; - ngx_http_variable_value_t *var, **vp; - ngx_http_compile_complex_value_t ccv; + u_char *data; + size_t len; + ngx_int_t rv; + ngx_str_t *value, v; + ngx_uint_t i, key; + ngx_stream_map_conf_ctx_t *ctx; + ngx_stream_complex_value_t cv, *cvp; + ngx_stream_variable_value_t *var, **vp; + ngx_stream_compile_complex_value_t ccv; ctx = cf->ctx; @@ -422,7 +421,7 @@ ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) len = vp[i]->len; } else { - cvp = (ngx_http_complex_value_t *) vp[i]->data; + cvp = (ngx_stream_complex_value_t *) vp[i]->data; data = cvp->value.data; len = cvp->value.len; } @@ -439,14 +438,14 @@ ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) } else { if (ngx_array_init(&ctx->values_hash[key], cf->pool, 4, - sizeof(ngx_http_variable_value_t *)) + sizeof(ngx_stream_variable_value_t *)) != NGX_OK) { return NGX_CONF_ERROR; } } - var = ngx_palloc(ctx->keys.pool, sizeof(ngx_http_variable_value_t)); + var = ngx_palloc(ctx->keys.pool, sizeof(ngx_stream_variable_value_t)); if (var == NULL) { return NGX_CONF_ERROR; } @@ -457,18 +456,18 @@ ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) return NGX_CONF_ERROR; } - ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + ngx_memzero(&ccv, sizeof(ngx_stream_compile_complex_value_t)); ccv.cf = ctx->cf; ccv.value = &v; ccv.complex_value = &cv; - if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + if (ngx_stream_compile_complex_value(&ccv) != NGX_OK) { return NGX_CONF_ERROR; } if (cv.lengths != NULL) { - cvp = ngx_palloc(ctx->keys.pool, sizeof(ngx_http_complex_value_t)); + cvp = ngx_palloc(ctx->keys.pool, sizeof(ngx_stream_complex_value_t)); if (cvp == NULL) { return NGX_CONF_ERROR; } @@ -513,9 +512,9 @@ found: #if (NGX_PCRE) if (value[0].len && value[0].data[0] == '~') { - ngx_regex_compile_t rc; - ngx_http_map_regex_t *regex; - u_char errstr[NGX_MAX_CONF_ERRSTR]; + ngx_regex_compile_t rc; + ngx_stream_map_regex_t *regex; + u_char errstr[NGX_MAX_CONF_ERRSTR]; regex = ngx_array_push(&ctx->regexes); if (regex == NULL) { @@ -537,7 +536,7 @@ found: rc.err.len = NGX_MAX_CONF_ERRSTR; rc.err.data = errstr; - regex->regex = ngx_http_regex_compile(ctx->cf, &rc); + regex->regex = ngx_stream_regex_compile(ctx->cf, &rc); if (regex->regex == NULL) { return NGX_CONF_ERROR; } Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_proxy_module.c (+371 -97) 81% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_proxy_module.c 2016-07-27 12:58:24 +0900 (d4fa994) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_proxy_module.c 2016-07-27 13:06:13 +0900 (9d43109) @@ -12,6 +12,7 @@ typedef struct { ngx_addr_t *addr; + ngx_stream_complex_value_t *value; #if (NGX_HAVE_TRANSPARENT_PROXY) ngx_uint_t transparent; /* unsigned transparent:1; */ #endif @@ -36,7 +37,7 @@ typedef struct { ngx_flag_t ssl_session_reuse; ngx_uint_t ssl_protocols; ngx_str_t ssl_ciphers; - ngx_str_t ssl_name; + ngx_stream_complex_value_t *ssl_name; ngx_flag_t ssl_server_name; ngx_flag_t ssl_verify; @@ -51,14 +52,18 @@ typedef struct { #endif ngx_stream_upstream_srv_conf_t *upstream; + ngx_stream_complex_value_t *upstream_value; } ngx_stream_proxy_srv_conf_t; static void ngx_stream_proxy_handler(ngx_stream_session_t *s); +static ngx_int_t ngx_stream_proxy_eval(ngx_stream_session_t *s, + ngx_stream_proxy_srv_conf_t *pscf); static ngx_int_t ngx_stream_proxy_set_local(ngx_stream_session_t *s, ngx_stream_upstream_t *u, ngx_stream_upstream_local_t *local); static void ngx_stream_proxy_connect(ngx_stream_session_t *s); static void ngx_stream_proxy_init_upstream(ngx_stream_session_t *s); +static void ngx_stream_proxy_resolve_handler(ngx_resolver_ctx_t *ctx); static void ngx_stream_proxy_upstream_handler(ngx_event_t *ev); static void ngx_stream_proxy_downstream_handler(ngx_event_t *ev); static void ngx_stream_proxy_process_connection(ngx_event_t *ev, @@ -245,7 +250,7 @@ static ngx_command_t ngx_stream_proxy_commands[] = { { ngx_string("proxy_ssl_name"), NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, - ngx_conf_set_str_slot, + ngx_stream_set_complex_value_slot, NGX_STREAM_SRV_CONF_OFFSET, offsetof(ngx_stream_proxy_srv_conf_t, ssl_name), NULL }, @@ -313,6 +318,7 @@ static ngx_command_t ngx_stream_proxy_commands[] = { static ngx_stream_module_t ngx_stream_proxy_module_ctx = { + NULL, /* preconfiguration */ NULL, /* postconfiguration */ NULL, /* create main configuration */ @@ -342,11 +348,16 @@ ngx_module_t ngx_stream_proxy_module = { static void ngx_stream_proxy_handler(ngx_stream_session_t *s) { - u_char *p; - ngx_connection_t *c; - ngx_stream_upstream_t *u; - ngx_stream_proxy_srv_conf_t *pscf; - ngx_stream_upstream_srv_conf_t *uscf; + u_char *p; + ngx_str_t *host; + ngx_uint_t i; + ngx_connection_t *c; + ngx_resolver_ctx_t *ctx, temp; + ngx_stream_upstream_t *u; + ngx_stream_core_srv_conf_t *cscf; + ngx_stream_proxy_srv_conf_t *pscf; + ngx_stream_upstream_srv_conf_t *uscf, **uscfp; + ngx_stream_upstream_main_conf_t *umcf; c = s->connection; @@ -375,7 +386,161 @@ ngx_stream_proxy_handler(ngx_stream_session_t *s) u->peer.type = c->type; - uscf = pscf->upstream; + 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_STREAM) { + p = ngx_pnalloc(c->pool, pscf->buffer_size); + if (p == NULL) { + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + + u->downstream_buf.start = p; + u->downstream_buf.end = p + pscf->buffer_size; + u->downstream_buf.pos = p; + u->downstream_buf.last = p; + + if (u->proxy_protocol +#if (NGX_STREAM_SSL) + && pscf->ssl == NULL +#endif + && pscf->buffer_size >= NGX_PROXY_PROTOCOL_MAX_HEADER) + { + /* optimization for a typical case */ + + ngx_log_debug0(NGX_LOG_DEBUG_STREAM, c->log, 0, + "stream proxy send PROXY protocol header"); + + p = ngx_proxy_protocol_write(c, u->downstream_buf.last, + u->downstream_buf.end); + if (p == NULL) { + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + + u->downstream_buf.last = p; + u->proxy_protocol = 0; + } + + if (c->read->ready) { + ngx_post_event(c->read, &ngx_posted_events); + } + } + + if (pscf->upstream_value) { + if (ngx_stream_proxy_eval(s, pscf) != NGX_OK) { + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + } + + if (u->resolved == NULL) { + + uscf = pscf->upstream; + + } else { + +#if (NGX_STREAM_SSL) + u->ssl_name = u->resolved->host; +#endif + + host = &u->resolved->host; + + if (u->resolved->sockaddr) { + + if (u->resolved->port == 0 + && u->resolved->sockaddr->sa_family != AF_UNIX) + { + ngx_log_error(NGX_LOG_ERR, c->log, 0, + "no port in upstream \"%V\"", host); + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + + if (ngx_stream_upstream_create_round_robin_peer(s, u->resolved) + != NGX_OK) + { + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + + ngx_stream_proxy_connect(s); + + return; + } + + umcf = ngx_stream_get_module_main_conf(s, ngx_stream_upstream_module); + + uscfp = umcf->upstreams.elts; + + for (i = 0; i < umcf->upstreams.nelts; i++) { + + uscf = uscfp[i]; + + if (uscf->host.len == host->len + && ((uscf->port == 0 && u->resolved->no_port) + || uscf->port == u->resolved->port) + && ngx_strncasecmp(uscf->host.data, host->data, host->len) == 0) + { + goto found; + } + } + + if (u->resolved->port == 0) { + ngx_log_error(NGX_LOG_ERR, c->log, 0, + "no port in upstream \"%V\"", host); + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + + temp.name = *host; + + cscf = ngx_stream_get_module_srv_conf(s, ngx_stream_core_module); + + ctx = ngx_resolve_start(cscf->resolver, &temp); + if (ctx == NULL) { + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + + if (ctx == NGX_NO_RESOLVER) { + ngx_log_error(NGX_LOG_ERR, c->log, 0, + "no resolver defined to resolve %V", host); + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + + ctx->name = *host; + ctx->handler = ngx_stream_proxy_resolve_handler; + ctx->data = s; + ctx->timeout = cscf->resolver_timeout; + + u->resolved->ctx = ctx; + + if (ngx_resolve_name(ctx) != NGX_OK) { + u->resolved->ctx = NULL; + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + + return; + } + +found: + + if (uscf == NULL) { + ngx_log_error(NGX_LOG_ALERT, c->log, 0, "no upstream configuration"); + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + +#if (NGX_HTTP_SSL) + u->ssl_name = uscf->host; +#endif if (uscf->peer.init(s, uscf) != NGX_OK) { ngx_stream_proxy_finalize(s, NGX_ERROR); @@ -390,55 +555,58 @@ ngx_stream_proxy_handler(ngx_stream_session_t *s) u->peer.tries = pscf->next_upstream_tries; } - u->proxy_protocol = pscf->proxy_protocol; - u->start_sec = ngx_time(); + ngx_stream_proxy_connect(s); +} - 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; - } +static ngx_int_t +ngx_stream_proxy_eval(ngx_stream_session_t *s, + ngx_stream_proxy_srv_conf_t *pscf) +{ + ngx_str_t host; + ngx_url_t url; + ngx_stream_upstream_t *u; - p = ngx_pnalloc(c->pool, pscf->buffer_size); - if (p == NULL) { - ngx_stream_proxy_finalize(s, NGX_ERROR); - return; + if (ngx_stream_complex_value(s, pscf->upstream_value, &host) != NGX_OK) { + return NGX_ERROR; } - u->downstream_buf.start = p; - u->downstream_buf.end = p + pscf->buffer_size; - u->downstream_buf.pos = p; - u->downstream_buf.last = p; + ngx_memzero(&url, sizeof(ngx_url_t)); - if (u->proxy_protocol -#if (NGX_STREAM_SSL) - && pscf->ssl == NULL -#endif - && pscf->buffer_size >= NGX_PROXY_PROTOCOL_MAX_HEADER) - { - /* optimization for a typical case */ + url.url = host; + url.no_resolve = 1; - ngx_log_debug0(NGX_LOG_DEBUG_STREAM, c->log, 0, - "stream proxy send PROXY protocol header"); - - p = ngx_proxy_protocol_write(c, u->downstream_buf.last, - u->downstream_buf.end); - if (p == NULL) { - ngx_stream_proxy_finalize(s, NGX_ERROR); - return; + if (ngx_parse_url(s->connection->pool, &url) != NGX_OK) { + if (url.err) { + ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, + "%s in upstream \"%V\"", url.err, &url.url); } - u->downstream_buf.last = p; - u->proxy_protocol = 0; + return NGX_ERROR; } - if (c->read->ready) { - ngx_post_event(c->read, &ngx_posted_events); + u = s->upstream; + + u->resolved = ngx_pcalloc(s->connection->pool, + sizeof(ngx_stream_upstream_resolved_t)); + if (u->resolved == NULL) { + return NGX_ERROR; } - ngx_stream_proxy_connect(s); + if (url.addrs && url.addrs[0].sockaddr) { + u->resolved->sockaddr = url.addrs[0].sockaddr; + u->resolved->socklen = url.addrs[0].socklen; + u->resolved->naddrs = 1; + u->resolved->host = url.addrs[0].name; + + } else { + u->resolved->host = url.host; + } + + u->resolved->port = url.port; + u->resolved->no_port = url.no_port; + + return NGX_OK; } @@ -446,12 +614,9 @@ static ngx_int_t ngx_stream_proxy_set_local(ngx_stream_session_t *s, ngx_stream_upstream_t *u, ngx_stream_upstream_local_t *local) { - ngx_addr_t *addr; - ngx_connection_t *c; - struct sockaddr_in *sin; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 *sin6; -#endif + ngx_int_t rc; + ngx_str_t val; + ngx_addr_t *addr; if (local == NULL) { u->peer.local = NULL; @@ -462,45 +627,36 @@ ngx_stream_proxy_set_local(ngx_stream_session_t *s, ngx_stream_upstream_t *u, u->peer.transparent = local->transparent; #endif - if (local->addr) { + if (local->value == NULL) { u->peer.local = local->addr; return NGX_OK; } - /* $remote_addr */ + if (ngx_stream_complex_value(s, local->value, &val) != NGX_OK) { + return NGX_ERROR; + } - c = s->connection; + if (val.len == 0) { + return NGX_OK; + } - addr = ngx_palloc(c->pool, sizeof(ngx_addr_t)); + addr = ngx_palloc(s->connection->pool, sizeof(ngx_addr_t)); if (addr == NULL) { return NGX_ERROR; } - addr->socklen = c->socklen; - - addr->sockaddr = ngx_palloc(c->pool, addr->socklen); - if (addr->sockaddr == NULL) { + rc = ngx_parse_addr_port(s->connection->pool, addr, val.data, val.len); + if (rc == NGX_ERROR) { return NGX_ERROR; } - ngx_memcpy(addr->sockaddr, c->sockaddr, c->socklen); - - switch (addr->sockaddr->sa_family) { - - case AF_INET: - sin = (struct sockaddr_in *) addr->sockaddr; - sin->sin_port = 0; - break; - -#if (NGX_HAVE_INET6) - case AF_INET6: - sin6 = (struct sockaddr_in6 *) addr->sockaddr; - sin6->sin6_port = 0; - break; -#endif + if (rc != NGX_OK) { + ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, + "invalid local address \"%V\"", &val); + return NGX_OK; } - addr->name = c->addr_text; + addr->name = val; u->peer.local = addr; return NGX_OK; @@ -893,10 +1049,13 @@ ngx_stream_proxy_ssl_name(ngx_stream_session_t *s) u = s->upstream; - name = pscf->ssl_name; + if (pscf->ssl_name) { + if (ngx_stream_complex_value(s, pscf->ssl_name, &name) != NGX_OK) { + return NGX_ERROR; + } - if (name.len == 0) { - name = pscf->upstream->host; + } else { + name = u->ssl_name; } if (name.len == 0) { @@ -986,6 +1145,75 @@ ngx_stream_proxy_downstream_handler(ngx_event_t *ev) static void +ngx_stream_proxy_resolve_handler(ngx_resolver_ctx_t *ctx) +{ + ngx_stream_session_t *s; + ngx_stream_upstream_t *u; + ngx_stream_proxy_srv_conf_t *pscf; + ngx_stream_upstream_resolved_t *ur; + + s = ctx->data; + + u = s->upstream; + ur = u->resolved; + + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, s->connection->log, 0, + "stream upstream resolve"); + + if (ctx->state) { + ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, + "%V could not be resolved (%i: %s)", + &ctx->name, ctx->state, + ngx_resolver_strerror(ctx->state)); + + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + + ur->naddrs = ctx->naddrs; + ur->addrs = ctx->addrs; + +#if (NGX_DEBUG) + { + u_char text[NGX_SOCKADDR_STRLEN]; + ngx_str_t addr; + ngx_uint_t i; + + addr.data = text; + + for (i = 0; i < ctx->naddrs; i++) { + addr.len = ngx_sock_ntop(ur->addrs[i].sockaddr, ur->addrs[i].socklen, + text, NGX_SOCKADDR_STRLEN, 0); + + ngx_log_debug1(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, + "name was resolved to %V", &addr); + } + } +#endif + + if (ngx_stream_upstream_create_round_robin_peer(s, ur) != NGX_OK) { + ngx_stream_proxy_finalize(s, NGX_ERROR); + return; + } + + ngx_resolve_name_done(ctx); + ur->ctx = NULL; + + u->peer.start_time = ngx_current_msec; + + pscf = ngx_stream_get_module_srv_conf(s, ngx_stream_proxy_module); + + if (pscf->next_upstream_tries + && u->peer.tries > pscf->next_upstream_tries) + { + u->peer.tries = pscf->next_upstream_tries; + } + + ngx_stream_proxy_connect(s); +} + + +static void ngx_stream_proxy_upstream_handler(ngx_event_t *ev) { ngx_stream_proxy_process_connection(ev, !ev->write); @@ -1407,6 +1635,11 @@ ngx_stream_proxy_finalize(ngx_stream_session_t *s, ngx_int_t rc) goto noupstream; } + if (u->resolved && u->resolved->ctx) { + ngx_resolve_name_done(u->resolved->ctx); + u->resolved->ctx = NULL; + } + if (u->peer.free && u->peer.sockaddr) { u->peer.free(&u->peer, u->peer.data, 0); u->peer.sockaddr = NULL; @@ -1481,7 +1714,7 @@ ngx_stream_proxy_create_srv_conf(ngx_conf_t *cf) * * conf->ssl_protocols = 0; * conf->ssl_ciphers = { 0, NULL }; - * conf->ssl_name = { 0, NULL }; + * conf->ssl_name = NULL; * conf->ssl_trusted_certificate = { 0, NULL }; * conf->ssl_crl = { 0, NULL }; * conf->ssl_certificate = { 0, NULL }; @@ -1489,6 +1722,7 @@ ngx_stream_proxy_create_srv_conf(ngx_conf_t *cf) * * conf->ssl = NULL; * conf->upstream = NULL; + * conf->upstream_value = NULL; */ conf->connect_timeout = NGX_CONF_UNSET_MSEC; @@ -1565,7 +1799,9 @@ ngx_stream_proxy_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers, "DEFAULT"); - ngx_conf_merge_str_value(conf->ssl_name, prev->ssl_name, ""); + if (conf->ssl_name == NULL) { + conf->ssl_name = prev->ssl_name; + } ngx_conf_merge_value(conf->ssl_server_name, prev->ssl_server_name, 0); @@ -1640,13 +1876,7 @@ ngx_stream_proxy_set_ssl(ngx_conf_t *cf, ngx_stream_proxy_srv_conf_t *pscf) } } - if (SSL_CTX_set_cipher_list(pscf->ssl->ctx, - (const char *) pscf->ssl_ciphers.data) - == 0) - { - ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0, - "SSL_CTX_set_cipher_list(\"%V\") failed", - &pscf->ssl_ciphers); + if (ngx_ssl_ciphers(cf, pscf->ssl, &pscf->ssl_ciphers, 0) != NGX_OK) { return NGX_ERROR; } @@ -1681,11 +1911,13 @@ ngx_stream_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_stream_proxy_srv_conf_t *pscf = conf; - ngx_url_t u; - ngx_str_t *value, *url; - ngx_stream_core_srv_conf_t *cscf; + ngx_url_t u; + ngx_str_t *value, *url; + ngx_stream_complex_value_t cv; + ngx_stream_core_srv_conf_t *cscf; + ngx_stream_compile_complex_value_t ccv; - if (pscf->upstream) { + if (pscf->upstream || pscf->upstream_value) { return "is duplicate"; } @@ -1697,6 +1929,28 @@ ngx_stream_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) url = &value[1]; + ngx_memzero(&ccv, sizeof(ngx_stream_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = url; + ccv.complex_value = &cv; + + if (ngx_stream_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + if (cv.lengths) { + pscf->upstream_value = ngx_palloc(cf->pool, + sizeof(ngx_stream_complex_value_t)); + if (pscf->upstream_value == NULL) { + return NGX_CONF_ERROR; + } + + *pscf->upstream_value = cv; + + return NGX_CONF_OK; + } + ngx_memzero(&u, sizeof(ngx_url_t)); u.url = *url; @@ -1716,9 +1970,11 @@ ngx_stream_proxy_bind(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_stream_proxy_srv_conf_t *pscf = conf; - ngx_int_t rc; - ngx_str_t *value; - ngx_stream_upstream_local_t *local; + ngx_int_t rc; + ngx_str_t *value; + ngx_stream_complex_value_t cv; + ngx_stream_upstream_local_t *local; + ngx_stream_compile_complex_value_t ccv; if (pscf->local != NGX_CONF_UNSET_PTR) { return "is duplicate"; @@ -1731,20 +1987,39 @@ ngx_stream_proxy_bind(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) return NGX_CONF_OK; } - local = ngx_palloc(cf->pool, sizeof(ngx_stream_upstream_local_t)); + ngx_memzero(&ccv, sizeof(ngx_stream_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[1]; + ccv.complex_value = &cv; + + if (ngx_stream_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + local = ngx_pcalloc(cf->pool, sizeof(ngx_stream_upstream_local_t)); if (local == NULL) { return NGX_CONF_ERROR; } pscf->local = local; - if (ngx_strcmp(value[1].data, "$remote_addr") != 0) { + if (cv.lengths) { + local->value = ngx_palloc(cf->pool, sizeof(ngx_stream_complex_value_t)); + if (local->value == NULL) { + return NGX_CONF_ERROR; + } + + *local->value = cv; + + } else { local->addr = ngx_palloc(cf->pool, sizeof(ngx_addr_t)); if (local->addr == NULL) { return NGX_CONF_ERROR; } - rc = ngx_parse_addr(cf->pool, local->addr, value[1].data, value[1].len); + rc = ngx_parse_addr_port(cf->pool, local->addr, value[1].data, + value[1].len); switch (rc) { case NGX_OK: @@ -1765,7 +2040,6 @@ ngx_stream_proxy_bind(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) if (ngx_strcmp(value[2].data, "transparent") == 0) { #if (NGX_HAVE_TRANSPARENT_PROXY) local->transparent = 1; - #else ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "transparent proxying is not supported " Added: vendor/nginx-1.11.3/src/stream/ngx_stream_return_module.c (+207 -0) 100644 =================================================================== --- /dev/null +++ vendor/nginx-1.11.3/src/stream/ngx_stream_return_module.c 2016-07-27 13:06:13 +0900 (3ab9bdf) @@ -0,0 +1,207 @@ + +/* + * Copyright (C) Roman Arutyunyan + * Copyright (C) Nginx, Inc. + */ + + +#include <ngx_config.h> +#include <ngx_core.h> +#include <ngx_stream.h> + + +typedef struct { + ngx_stream_complex_value_t text; +} ngx_stream_return_srv_conf_t; + + +typedef struct { + ngx_buf_t buf; +} ngx_stream_return_ctx_t; + + +static void ngx_stream_return_handler(ngx_stream_session_t *s); +static void ngx_stream_return_write_handler(ngx_event_t *ev); + +static void *ngx_stream_return_create_srv_conf(ngx_conf_t *cf); +static char *ngx_stream_return(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); + + +static ngx_command_t ngx_stream_return_commands[] = { + + { ngx_string("return"), + NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, + ngx_stream_return, + NGX_STREAM_SRV_CONF_OFFSET, + 0, + NULL }, + + ngx_null_command +}; + + +static ngx_stream_module_t ngx_stream_return_module_ctx = { + NULL, /* preconfiguration */ + NULL, /* postconfiguration */ + + NULL, /* create main configuration */ + NULL, /* init main configuration */ + + ngx_stream_return_create_srv_conf, /* create server configuration */ + NULL /* merge server configuration */ +}; + + +ngx_module_t ngx_stream_return_module = { + NGX_MODULE_V1, + &ngx_stream_return_module_ctx, /* module context */ + ngx_stream_return_commands, /* module directives */ + NGX_STREAM_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 void +ngx_stream_return_handler(ngx_stream_session_t *s) +{ + ngx_str_t text; + ngx_connection_t *c; + ngx_stream_return_ctx_t *ctx; + ngx_stream_return_srv_conf_t *rscf; + + c = s->connection; + + c->log->action = "returning text"; + + rscf = ngx_stream_get_module_srv_conf(s, ngx_stream_return_module); + + if (ngx_stream_complex_value(s, &rscf->text, &text) != NGX_OK) { + ngx_stream_close_connection(c); + return; + } + + ngx_log_debug1(NGX_LOG_DEBUG_STREAM, c->log, 0, + "stream return text: \"%V\"", &text); + + if (text.len == 0) { + ngx_stream_close_connection(c); + return; + } + + ctx = ngx_pcalloc(c->pool, sizeof(ngx_stream_return_ctx_t)); + if (ctx == NULL) { + ngx_stream_close_connection(c); + return; + } + + ngx_stream_set_ctx(s, ctx, ngx_stream_return_module); + + ctx->buf.pos = text.data; + ctx->buf.last = text.data + text.len; + + c->write->handler = ngx_stream_return_write_handler; + + ngx_stream_return_write_handler(c->write); +} + + +static void +ngx_stream_return_write_handler(ngx_event_t *ev) +{ + ssize_t n; + ngx_buf_t *b; + ngx_connection_t *c; + ngx_stream_session_t *s; + ngx_stream_return_ctx_t *ctx; + + c = ev->data; + s = c->data; + + if (ev->timedout) { + ngx_connection_error(c, NGX_ETIMEDOUT, "connection timed out"); + ngx_stream_close_connection(c); + return; + } + + if (ev->ready) { + ctx = ngx_stream_get_module_ctx(s, ngx_stream_return_module); + + b = &ctx->buf; + + n = c->send(c, b->pos, b->last - b->pos); + if (n == NGX_ERROR) { + ngx_stream_close_connection(c); + return; + } + + if (n > 0) { + b->pos += n; + + if (b->pos == b->last) { + ngx_stream_close_connection(c); + return; + } + } + } + + if (ngx_handle_write_event(ev, 0) != NGX_OK) { + ngx_stream_close_connection(c); + return; + } + + ngx_add_timer(ev, 5000); +} + + +static void * +ngx_stream_return_create_srv_conf(ngx_conf_t *cf) +{ + ngx_stream_return_srv_conf_t *conf; + + conf = ngx_pcalloc(cf->pool, sizeof(ngx_stream_return_srv_conf_t)); + if (conf == NULL) { + return NULL; + } + + return conf; +} + + +static char * +ngx_stream_return(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_stream_return_srv_conf_t *rscf = conf; + + ngx_str_t *value; + ngx_stream_core_srv_conf_t *cscf; + ngx_stream_compile_complex_value_t ccv; + + if (rscf->text.value.data) { + return "is duplicate"; + } + + value = cf->args->elts; + + ngx_memzero(&ccv, sizeof(ngx_stream_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[1]; + ccv.complex_value = &rscf->text; + + if (ngx_stream_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + cscf = ngx_stream_conf_get_module_srv_conf(cf, ngx_stream_core_module); + + cscf->handler = ngx_stream_return_handler; + + return NGX_CONF_OK; +} Added: vendor/nginx-1.11.3/src/stream/ngx_stream_script.c (+854 -0) 100644 =================================================================== --- /dev/null +++ vendor/nginx-1.11.3/src/stream/ngx_stream_script.c 2016-07-27 13:06:13 +0900 (8130f92) @@ -0,0 +1,854 @@ + +/* + * Copyright (C) Igor Sysoev + * Copyright (C) Nginx, Inc. + */ + + +#include <ngx_config.h> +#include <ngx_core.h> +#include <ngx_stream.h> + + +static ngx_int_t ngx_stream_script_init_arrays( + ngx_stream_script_compile_t *sc); +static ngx_int_t ngx_stream_script_done(ngx_stream_script_compile_t *sc); +static ngx_int_t ngx_stream_script_add_copy_code( + ngx_stream_script_compile_t *sc, ngx_str_t *value, ngx_uint_t last); +static ngx_int_t ngx_stream_script_add_var_code( + ngx_stream_script_compile_t *sc, ngx_str_t *name); +#if (NGX_PCRE) +static ngx_int_t ngx_stream_script_add_capture_code( + ngx_stream_script_compile_t *sc, ngx_uint_t n); +#endif +static ngx_int_t ngx_stream_script_add_full_name_code( + ngx_stream_script_compile_t *sc); +static size_t ngx_stream_script_full_name_len_code( + ngx_stream_script_engine_t *e); +static void ngx_stream_script_full_name_code(ngx_stream_script_engine_t *e); + + +#define ngx_stream_script_exit (u_char *) &ngx_stream_script_exit_code + +static uintptr_t ngx_stream_script_exit_code = (uintptr_t) NULL; + + +void +ngx_stream_script_flush_complex_value(ngx_stream_session_t *s, + ngx_stream_complex_value_t *val) +{ + ngx_uint_t *index; + + index = val->flushes; + + if (index) { + while (*index != (ngx_uint_t) -1) { + + if (s->variables[*index].no_cacheable) { + s->variables[*index].valid = 0; + s->variables[*index].not_found = 0; + } + + index++; + } + } +} + + +ngx_int_t +ngx_stream_complex_value(ngx_stream_session_t *s, + ngx_stream_complex_value_t *val, ngx_str_t *value) +{ + size_t len; + ngx_stream_script_code_pt code; + ngx_stream_script_engine_t e; + ngx_stream_script_len_code_pt lcode; + + if (val->lengths == NULL) { + *value = val->value; + return NGX_OK; + } + + ngx_stream_script_flush_complex_value(s, val); + + ngx_memzero(&e, sizeof(ngx_stream_script_engine_t)); + + e.ip = val->lengths; + e.session = s; + e.flushed = 1; + + len = 0; + + while (*(uintptr_t *) e.ip) { + lcode = *(ngx_stream_script_len_code_pt *) e.ip; + len += lcode(&e); + } + + value->len = len; + value->data = ngx_pnalloc(s->connection->pool, len); + if (value->data == NULL) { + return NGX_ERROR; + } + + e.ip = val->values; + e.pos = value->data; + e.buf = *value; + + while (*(uintptr_t *) e.ip) { + code = *(ngx_stream_script_code_pt *) e.ip; + code((ngx_stream_script_engine_t *) &e); + } + + *value = e.buf; + + return NGX_OK; +} + + +ngx_int_t +ngx_stream_compile_complex_value(ngx_stream_compile_complex_value_t *ccv) +{ + ngx_str_t *v; + ngx_uint_t i, n, nv, nc; + ngx_array_t flushes, lengths, values, *pf, *pl, *pv; + ngx_stream_script_compile_t sc; + + v = ccv->value; + + nv = 0; + nc = 0; + + for (i = 0; i < v->len; i++) { + if (v->data[i] == '$') { + if (v->data[i + 1] >= '1' && v->data[i + 1] <= '9') { + nc++; + + } else { + nv++; + } + } + } + + if ((v->len == 0 || v->data[0] != '$') + && (ccv->conf_prefix || ccv->root_prefix)) + { + if (ngx_conf_full_name(ccv->cf->cycle, v, ccv->conf_prefix) != NGX_OK) { + return NGX_ERROR; + } + + ccv->conf_prefix = 0; + ccv->root_prefix = 0; + } + + ccv->complex_value->value = *v; + ccv->complex_value->flushes = NULL; + ccv->complex_value->lengths = NULL; + ccv->complex_value->values = NULL; + + if (nv == 0 && nc == 0) { + return NGX_OK; + } + + n = nv + 1; + + if (ngx_array_init(&flushes, ccv->cf->pool, n, sizeof(ngx_uint_t)) + != NGX_OK) + { + return NGX_ERROR; + } + + n = nv * (2 * sizeof(ngx_stream_script_copy_code_t) + + sizeof(ngx_stream_script_var_code_t)) + + sizeof(uintptr_t); + + if (ngx_array_init(&lengths, ccv->cf->pool, n, 1) != NGX_OK) { + return NGX_ERROR; + } + + n = (nv * (2 * sizeof(ngx_stream_script_copy_code_t) + + sizeof(ngx_stream_script_var_code_t)) + + sizeof(uintptr_t) + + v->len + + sizeof(uintptr_t) - 1) + & ~(sizeof(uintptr_t) - 1); + + if (ngx_array_init(&values, ccv->cf->pool, n, 1) != NGX_OK) { + return NGX_ERROR; + } + + pf = &flushes; + pl = &lengths; + pv = &values; + + ngx_memzero(&sc, sizeof(ngx_stream_script_compile_t)); + + sc.cf = ccv->cf; + sc.source = v; + sc.flushes = &pf; + sc.lengths = &pl; + sc.values = &pv; + sc.complete_lengths = 1; + sc.complete_values = 1; + sc.zero = ccv->zero; + sc.conf_prefix = ccv->conf_prefix; + sc.root_prefix = ccv->root_prefix; + + if (ngx_stream_script_compile(&sc) != NGX_OK) { + return NGX_ERROR; + } + + if (flushes.nelts) { + ccv->complex_value->flushes = flushes.elts; + ccv->complex_value->flushes[flushes.nelts] = (ngx_uint_t) -1; + } + + ccv->complex_value->lengths = lengths.elts; + ccv->complex_value->values = values.elts; + + return NGX_OK; +} + + +char * +ngx_stream_set_complex_value_slot(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf) +{ + char *p = conf; + + ngx_str_t *value; + ngx_stream_complex_value_t **cv; + ngx_stream_compile_complex_value_t ccv; + + cv = (ngx_stream_complex_value_t **) (p + cmd->offset); + + if (*cv != NULL) { + return "duplicate"; + } + + *cv = ngx_palloc(cf->pool, sizeof(ngx_stream_complex_value_t)); + if (*cv == NULL) { + return NGX_CONF_ERROR; + } + + value = cf->args->elts; + + ngx_memzero(&ccv, sizeof(ngx_stream_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[1]; + ccv.complex_value = *cv; + + if (ngx_stream_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + return NGX_CONF_OK; +} + + +ngx_uint_t +ngx_stream_script_variables_count(ngx_str_t *value) +{ + ngx_uint_t i, n; + + for (n = 0, i = 0; i < value->len; i++) { + if (value->data[i] == '$') { + n++; + } + } + + return n; +} + + +ngx_int_t +ngx_stream_script_compile(ngx_stream_script_compile_t *sc) +{ + u_char ch; + ngx_str_t name; + ngx_uint_t i, bracket; + + if (ngx_stream_script_init_arrays(sc) != NGX_OK) { + return NGX_ERROR; + } + + for (i = 0; i < sc->source->len; /* void */ ) { + + name.len = 0; + + if (sc->source->data[i] == '$') { + + if (++i == sc->source->len) { + goto invalid_variable; + } + + if (sc->source->data[i] >= '1' && sc->source->data[i] <= '9') { +#if (NGX_PCRE) + ngx_uint_t n; + + n = sc->source->data[i] - '0'; + + if (ngx_stream_script_add_capture_code(sc, n) != NGX_OK) { + return NGX_ERROR; + } + + i++; + + continue; +#else + ngx_conf_log_error(NGX_LOG_EMERG, sc->cf, 0, + "using variable \"$%c\" requires " + "PCRE library", sc->source->data[i]); + return NGX_ERROR; +#endif + } + + if (sc->source->data[i] == '{') { + bracket = 1; + + if (++i == sc->source->len) { + goto invalid_variable; + } + + name.data = &sc->source->data[i]; + + } else { + bracket = 0; + name.data = &sc->source->data[i]; + } + + for ( /* void */ ; i < sc->source->len; i++, name.len++) { + ch = sc->source->data[i]; + + if (ch == '}' && bracket) { + i++; + bracket = 0; + break; + } + + if ((ch >= 'A' && ch <= 'Z') + || (ch >= 'a' && ch <= 'z') + || (ch >= '0' && ch <= '9') + || ch == '_') + { + continue; + } + + break; + } + + if (bracket) { + ngx_conf_log_error(NGX_LOG_EMERG, sc->cf, 0, + "the closing bracket in \"%V\" " + "variable is missing", &name); + return NGX_ERROR; + } + + if (name.len == 0) { + goto invalid_variable; + } + + sc->variables++; + + if (ngx_stream_script_add_var_code(sc, &name) != NGX_OK) { + return NGX_ERROR; + } + + continue; + } + + name.data = &sc->source->data[i]; + + while (i < sc->source->len) { + + if (sc->source->data[i] == '$') { + break; + } + + i++; + name.len++; + } + + sc->size += name.len; + + if (ngx_stream_script_add_copy_code(sc, &name, (i == sc->source->len)) + != NGX_OK) + { + return NGX_ERROR; + } + } + + return ngx_stream_script_done(sc); + +invalid_variable: + + ngx_conf_log_error(NGX_LOG_EMERG, sc->cf, 0, "invalid variable name"); + + return NGX_ERROR; +} + + +static ngx_int_t +ngx_stream_script_init_arrays(ngx_stream_script_compile_t *sc) +{ + ngx_uint_t n; + + if (sc->flushes && *sc->flushes == NULL) { + n = sc->variables ? sc->variables : 1; + *sc->flushes = ngx_array_create(sc->cf->pool, n, sizeof(ngx_uint_t)); + if (*sc->flushes == NULL) { + return NGX_ERROR; + } + } + + if (*sc->lengths == NULL) { + n = sc->variables * (2 * sizeof(ngx_stream_script_copy_code_t) + + sizeof(ngx_stream_script_var_code_t)) + + sizeof(uintptr_t); + + *sc->lengths = ngx_array_create(sc->cf->pool, n, 1); + if (*sc->lengths == NULL) { + return NGX_ERROR; + } + } + + if (*sc->values == NULL) { + n = (sc->variables * (2 * sizeof(ngx_stream_script_copy_code_t) + + sizeof(ngx_stream_script_var_code_t)) + + sizeof(uintptr_t) + + sc->source->len + + sizeof(uintptr_t) - 1) + & ~(sizeof(uintptr_t) - 1); + + *sc->values = ngx_array_create(sc->cf->pool, n, 1); + if (*sc->values == NULL) { + return NGX_ERROR; + } + } + + sc->variables = 0; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_script_done(ngx_stream_script_compile_t *sc) +{ + ngx_str_t zero; + uintptr_t *code; + + if (sc->zero) { + + zero.len = 1; + zero.data = (u_char *) "\0"; + + if (ngx_stream_script_add_copy_code(sc, &zero, 0) != NGX_OK) { + return NGX_ERROR; + } + } + + if (sc->conf_prefix || sc->root_prefix) { + if (ngx_stream_script_add_full_name_code(sc) != NGX_OK) { + return NGX_ERROR; + } + } + + if (sc->complete_lengths) { + code = ngx_stream_script_add_code(*sc->lengths, sizeof(uintptr_t), + NULL); + if (code == NULL) { + return NGX_ERROR; + } + + *code = (uintptr_t) NULL; + } + + if (sc->complete_values) { + code = ngx_stream_script_add_code(*sc->values, sizeof(uintptr_t), + &sc->main); + if (code == NULL) { + return NGX_ERROR; + } + + *code = (uintptr_t) NULL; + } + + return NGX_OK; +} + + +void * +ngx_stream_script_add_code(ngx_array_t *codes, size_t size, void *code) +{ + u_char *elts, **p; + void *new; + + elts = codes->elts; + + new = ngx_array_push_n(codes, size); + if (new == NULL) { + return NULL; + } + + if (code) { + if (elts != codes->elts) { + p = code; + *p += (u_char *) codes->elts - elts; + } + } + + return new; +} + + +static ngx_int_t +ngx_stream_script_add_copy_code(ngx_stream_script_compile_t *sc, + ngx_str_t *value, ngx_uint_t last) +{ + u_char *p; + size_t size, len, zero; + ngx_stream_script_copy_code_t *code; + + zero = (sc->zero && last); + len = value->len + zero; + + code = ngx_stream_script_add_code(*sc->lengths, + sizeof(ngx_stream_script_copy_code_t), + NULL); + if (code == NULL) { + return NGX_ERROR; + } + + code->code = (ngx_stream_script_code_pt) ngx_stream_script_copy_len_code; + code->len = len; + + size = (sizeof(ngx_stream_script_copy_code_t) + len + sizeof(uintptr_t) - 1) + & ~(sizeof(uintptr_t) - 1); + + code = ngx_stream_script_add_code(*sc->values, size, &sc->main); + if (code == NULL) { + return NGX_ERROR; + } + + code->code = ngx_stream_script_copy_code; + code->len = len; + + p = ngx_cpymem((u_char *) code + sizeof(ngx_stream_script_copy_code_t), + value->data, value->len); + + if (zero) { + *p = '\0'; + sc->zero = 0; + } + + return NGX_OK; +} + + +size_t +ngx_stream_script_copy_len_code(ngx_stream_script_engine_t *e) +{ + ngx_stream_script_copy_code_t *code; + + code = (ngx_stream_script_copy_code_t *) e->ip; + + e->ip += sizeof(ngx_stream_script_copy_code_t); + + return code->len; +} + + +void +ngx_stream_script_copy_code(ngx_stream_script_engine_t *e) +{ + u_char *p; + ngx_stream_script_copy_code_t *code; + + code = (ngx_stream_script_copy_code_t *) e->ip; + + p = e->pos; + + if (!e->skip) { + e->pos = ngx_copy(p, e->ip + sizeof(ngx_stream_script_copy_code_t), + code->len); + } + + e->ip += sizeof(ngx_stream_script_copy_code_t) + + ((code->len + sizeof(uintptr_t) - 1) & ~(sizeof(uintptr_t) - 1)); + + ngx_log_debug2(NGX_LOG_DEBUG_STREAM, e->session->connection->log, 0, + "stream script copy: \"%*s\"", e->pos - p, p); +} + + +static ngx_int_t +ngx_stream_script_add_var_code(ngx_stream_script_compile_t *sc, ngx_str_t *name) +{ + ngx_int_t index, *p; + ngx_stream_script_var_code_t *code; + + index = ngx_stream_get_variable_index(sc->cf, name); + + if (index == NGX_ERROR) { + return NGX_ERROR; + } + + if (sc->flushes) { + p = ngx_array_push(*sc->flushes); + if (p == NULL) { + return NGX_ERROR; + } + + *p = index; + } + + code = ngx_stream_script_add_code(*sc->lengths, + sizeof(ngx_stream_script_var_code_t), + NULL); + if (code == NULL) { + return NGX_ERROR; + } + + code->code = (ngx_stream_script_code_pt) + ngx_stream_script_copy_var_len_code; + code->index = (uintptr_t) index; + + code = ngx_stream_script_add_code(*sc->values, + sizeof(ngx_stream_script_var_code_t), + &sc->main); + if (code == NULL) { + return NGX_ERROR; + } + + code->code = ngx_stream_script_copy_var_code; + code->index = (uintptr_t) index; + + return NGX_OK; +} + + +size_t +ngx_stream_script_copy_var_len_code(ngx_stream_script_engine_t *e) +{ + ngx_stream_variable_value_t *value; + ngx_stream_script_var_code_t *code; + + code = (ngx_stream_script_var_code_t *) e->ip; + + e->ip += sizeof(ngx_stream_script_var_code_t); + + if (e->flushed) { + value = ngx_stream_get_indexed_variable(e->session, code->index); + + } else { + value = ngx_stream_get_flushed_variable(e->session, code->index); + } + + if (value && !value->not_found) { + return value->len; + } + + return 0; +} + + +void +ngx_stream_script_copy_var_code(ngx_stream_script_engine_t *e) +{ + u_char *p; + ngx_stream_variable_value_t *value; + ngx_stream_script_var_code_t *code; + + code = (ngx_stream_script_var_code_t *) e->ip; + + e->ip += sizeof(ngx_stream_script_var_code_t); + + if (!e->skip) { + + if (e->flushed) { + value = ngx_stream_get_indexed_variable(e->session, code->index); + + } else { + value = ngx_stream_get_flushed_variable(e->session, code->index); + } + + if (value && !value->not_found) { + p = e->pos; + e->pos = ngx_copy(p, value->data, value->len); + + ngx_log_debug2(NGX_LOG_DEBUG_STREAM, + e->session->connection->log, 0, + "stream script var: \"%*s\"", e->pos - p, p); + } + } +} + + +#if (NGX_PCRE) + +static ngx_int_t +ngx_stream_script_add_capture_code(ngx_stream_script_compile_t *sc, + ngx_uint_t n) +{ + ngx_stream_script_copy_capture_code_t *code; + + code = ngx_stream_script_add_code(*sc->lengths, + sizeof(ngx_stream_script_copy_capture_code_t), + NULL); + if (code == NULL) { + return NGX_ERROR; + } + + code->code = (ngx_stream_script_code_pt) + ngx_stream_script_copy_capture_len_code; + code->n = 2 * n; + + + code = ngx_stream_script_add_code(*sc->values, + sizeof(ngx_stream_script_copy_capture_code_t), + &sc->main); + if (code == NULL) { + return NGX_ERROR; + } + + code->code = ngx_stream_script_copy_capture_code; + code->n = 2 * n; + + if (sc->ncaptures < n) { + sc->ncaptures = n; + } + + return NGX_OK; +} + + +size_t +ngx_stream_script_copy_capture_len_code(ngx_stream_script_engine_t *e) +{ + int *cap; + ngx_uint_t n; + ngx_stream_session_t *s; + ngx_stream_script_copy_capture_code_t *code; + + s = e->session; + + code = (ngx_stream_script_copy_capture_code_t *) e->ip; + + e->ip += sizeof(ngx_stream_script_copy_capture_code_t); + + n = code->n; + + if (n < s->ncaptures) { + cap = s->captures; + return cap[n + 1] - cap[n]; + } + + return 0; +} + + +void +ngx_stream_script_copy_capture_code(ngx_stream_script_engine_t *e) +{ + int *cap; + u_char *p, *pos; + ngx_uint_t n; + ngx_stream_session_t *s; + ngx_stream_script_copy_capture_code_t *code; + + s = e->session; + + code = (ngx_stream_script_copy_capture_code_t *) e->ip; + + e->ip += sizeof(ngx_stream_script_copy_capture_code_t); + + n = code->n; + + pos = e->pos; + + if (n < s->ncaptures) { + cap = s->captures; + p = s->captures_data; + e->pos = ngx_copy(pos, &p[cap[n]], cap[n + 1] - cap[n]); + } + + ngx_log_debug2(NGX_LOG_DEBUG_STREAM, e->session->connection->log, 0, + "stream script capture: \"%*s\"", e->pos - pos, pos); +} + +#endif + + +static ngx_int_t +ngx_stream_script_add_full_name_code(ngx_stream_script_compile_t *sc) +{ + ngx_stream_script_full_name_code_t *code; + + code = ngx_stream_script_add_code(*sc->lengths, + sizeof(ngx_stream_script_full_name_code_t), + NULL); + if (code == NULL) { + return NGX_ERROR; + } + + code->code = (ngx_stream_script_code_pt) + ngx_stream_script_full_name_len_code; + code->conf_prefix = sc->conf_prefix; + + code = ngx_stream_script_add_code(*sc->values, + sizeof(ngx_stream_script_full_name_code_t), &sc->main); + if (code == NULL) { + return NGX_ERROR; + } + + code->code = ngx_stream_script_full_name_code; + code->conf_prefix = sc->conf_prefix; + + return NGX_OK; +} + + +static size_t +ngx_stream_script_full_name_len_code(ngx_stream_script_engine_t *e) +{ + ngx_stream_script_full_name_code_t *code; + + code = (ngx_stream_script_full_name_code_t *) e->ip; + + e->ip += sizeof(ngx_stream_script_full_name_code_t); + + return code->conf_prefix ? ngx_cycle->conf_prefix.len: + ngx_cycle->prefix.len; +} + + +static void +ngx_stream_script_full_name_code(ngx_stream_script_engine_t *e) +{ + ngx_stream_script_full_name_code_t *code; + + ngx_str_t value, *prefix; + + code = (ngx_stream_script_full_name_code_t *) e->ip; + + value.data = e->buf.data; + value.len = e->pos - e->buf.data; + + prefix = code->conf_prefix ? (ngx_str_t *) &ngx_cycle->conf_prefix: + (ngx_str_t *) &ngx_cycle->prefix; + + if (ngx_get_full_name(e->session->connection->pool, prefix, &value) + != NGX_OK) + { + e->ip = ngx_stream_script_exit; + return; + } + + e->buf = value; + + ngx_log_debug1(NGX_LOG_DEBUG_STREAM, e->session->connection->log, 0, + "stream script fullname: \"%V\"", &value); + + e->ip += sizeof(ngx_stream_script_full_name_code_t); +} Added: vendor/nginx-1.11.3/src/stream/ngx_stream_script.h (+123 -0) 100644 =================================================================== --- /dev/null +++ vendor/nginx-1.11.3/src/stream/ngx_stream_script.h 2016-07-27 13:06:13 +0900 (0abe50e) @@ -0,0 +1,123 @@ + +/* + * Copyright (C) Igor Sysoev + * Copyright (C) Nginx, Inc. + */ + + +#ifndef _NGX_STREAM_SCRIPT_H_INCLUDED_ +#define _NGX_STREAM_SCRIPT_H_INCLUDED_ + + +#include <ngx_config.h> +#include <ngx_core.h> +#include <ngx_stream.h> + + +typedef struct { + u_char *ip; + u_char *pos; + ngx_stream_variable_value_t *sp; + + ngx_str_t buf; + ngx_str_t line; + + unsigned flushed:1; + unsigned skip:1; + + ngx_stream_session_t *session; +} ngx_stream_script_engine_t; + + +typedef struct { + ngx_conf_t *cf; + ngx_str_t *source; + + ngx_array_t **flushes; + ngx_array_t **lengths; + ngx_array_t **values; + + ngx_uint_t variables; + ngx_uint_t ncaptures; + ngx_uint_t size; + + void *main; + + unsigned complete_lengths:1; + unsigned complete_values:1; + unsigned zero:1; + unsigned conf_prefix:1; + unsigned root_prefix:1; +} ngx_stream_script_compile_t; + + +typedef struct { + ngx_str_t value; + ngx_uint_t *flushes; + void *lengths; + void *values; +} ngx_stream_complex_value_t; + + +typedef struct { + ngx_conf_t *cf; + ngx_str_t *value; + ngx_stream_complex_value_t *complex_value; + + unsigned zero:1; + unsigned conf_prefix:1; + unsigned root_prefix:1; +} ngx_stream_compile_complex_value_t; + + +typedef void (*ngx_stream_script_code_pt) (ngx_stream_script_engine_t *e); +typedef size_t (*ngx_stream_script_len_code_pt) (ngx_stream_script_engine_t *e); + + +typedef struct { + ngx_stream_script_code_pt code; + uintptr_t len; +} ngx_stream_script_copy_code_t; + + +typedef struct { + ngx_stream_script_code_pt code; + uintptr_t index; +} ngx_stream_script_var_code_t; + + +typedef struct { + ngx_stream_script_code_pt code; + uintptr_t n; +} ngx_stream_script_copy_capture_code_t; + + +typedef struct { + ngx_stream_script_code_pt code; + uintptr_t conf_prefix; +} ngx_stream_script_full_name_code_t; + + +void ngx_stream_script_flush_complex_value(ngx_stream_session_t *s, + ngx_stream_complex_value_t *val); +ngx_int_t ngx_stream_complex_value(ngx_stream_session_t *s, + ngx_stream_complex_value_t *val, ngx_str_t *value); +ngx_int_t ngx_stream_compile_complex_value( + ngx_stream_compile_complex_value_t *ccv); +char *ngx_stream_set_complex_value_slot(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); + + +ngx_uint_t ngx_stream_script_variables_count(ngx_str_t *value); +ngx_int_t ngx_stream_script_compile(ngx_stream_script_compile_t *sc); + +void *ngx_stream_script_add_code(ngx_array_t *codes, size_t size, void *code); + +size_t ngx_stream_script_copy_len_code(ngx_stream_script_engine_t *e); +void ngx_stream_script_copy_code(ngx_stream_script_engine_t *e); +size_t ngx_stream_script_copy_var_len_code(ngx_stream_script_engine_t *e); +void ngx_stream_script_copy_var_code(ngx_stream_script_engine_t *e); +size_t ngx_stream_script_copy_capture_len_code(ngx_stream_script_engine_t *e); +void ngx_stream_script_copy_capture_code(ngx_stream_script_engine_t *e); + +#endif /* _NGX_STREAM_SCRIPT_H_INCLUDED_ */ Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_split_clients_module.c (+45 -47) 63% =================================================================== --- vendor/nginx-1.11.1/src/http/modules/ngx_http_split_clients_module.c 2016-07-27 12:58:24 +0900 (2f92c9e) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_split_clients_module.c 2016-07-27 13:06:13 +0900 (af6c8a1) @@ -7,32 +7,32 @@ #include <ngx_config.h> #include <ngx_core.h> -#include <ngx_http.h> +#include <ngx_stream.h> typedef struct { - uint32_t percent; - ngx_http_variable_value_t value; -} ngx_http_split_clients_part_t; + uint32_t percent; + ngx_stream_variable_value_t value; +} ngx_stream_split_clients_part_t; typedef struct { - ngx_http_complex_value_t value; - ngx_array_t parts; -} ngx_http_split_clients_ctx_t; + ngx_stream_complex_value_t value; + ngx_array_t parts; +} ngx_stream_split_clients_ctx_t; static char *ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -static char *ngx_http_split_clients(ngx_conf_t *cf, ngx_command_t *dummy, +static char *ngx_stream_split_clients(ngx_conf_t *cf, ngx_command_t *dummy, void *conf); -static ngx_command_t ngx_http_split_clients_commands[] = { +static ngx_command_t ngx_stream_split_clients_commands[] = { { ngx_string("split_clients"), - NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE2, + NGX_STREAM_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE2, ngx_conf_split_clients_block, - NGX_HTTP_MAIN_CONF_OFFSET, + NGX_STREAM_MAIN_CONF_OFFSET, 0, NULL }, @@ -40,7 +40,7 @@ static ngx_command_t ngx_http_split_clients_commands[] = { }; -static ngx_http_module_t ngx_http_split_clients_module_ctx = { +static ngx_stream_module_t ngx_stream_split_clients_module_ctx = { NULL, /* preconfiguration */ NULL, /* postconfiguration */ @@ -48,18 +48,15 @@ static ngx_http_module_t ngx_http_split_clients_module_ctx = { NULL, /* init main configuration */ NULL, /* create server configuration */ - NULL, /* merge server configuration */ - - NULL, /* create location configuration */ - NULL /* merge location configuration */ + NULL /* merge server configuration */ }; -ngx_module_t ngx_http_split_clients_module = { +ngx_module_t ngx_stream_split_clients_module = { NGX_MODULE_V1, - &ngx_http_split_clients_module_ctx, /* module context */ - ngx_http_split_clients_commands, /* module directives */ - NGX_HTTP_MODULE, /* module type */ + &ngx_stream_split_clients_module_ctx, /* module context */ + ngx_stream_split_clients_commands, /* module directives */ + NGX_STREAM_MODULE, /* module type */ NULL, /* init master */ NULL, /* init module */ NULL, /* init process */ @@ -72,19 +69,20 @@ ngx_module_t ngx_http_split_clients_module = { static ngx_int_t -ngx_http_split_clients_variable(ngx_http_request_t *r, - ngx_http_variable_value_t *v, uintptr_t data) +ngx_stream_split_clients_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) { - ngx_http_split_clients_ctx_t *ctx = (ngx_http_split_clients_ctx_t *) data; + ngx_stream_split_clients_ctx_t *ctx = + (ngx_stream_split_clients_ctx_t *) data; - uint32_t hash; - ngx_str_t val; - ngx_uint_t i; - ngx_http_split_clients_part_t *part; + uint32_t hash; + ngx_str_t val; + ngx_uint_t i; + ngx_stream_split_clients_part_t *part; - *v = ngx_http_variable_null_value; + *v = ngx_stream_variable_null_value; - if (ngx_http_complex_value(r, &ctx->value, &val) != NGX_OK) { + if (ngx_stream_complex_value(s, &ctx->value, &val) != NGX_OK) { return NGX_OK; } @@ -94,8 +92,8 @@ ngx_http_split_clients_variable(ngx_http_request_t *r, for (i = 0; i < ctx->parts.nelts; i++) { - ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, - "http split: %uD %uD", hash, part[i].percent); + ngx_log_debug2(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, + "stream split: %uD %uD", hash, part[i].percent); if (hash < part[i].percent || part[i].percent == 0) { *v = part[i].value; @@ -115,25 +113,25 @@ ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_str_t *value, name; ngx_uint_t i; ngx_conf_t save; - ngx_http_variable_t *var; - ngx_http_split_clients_ctx_t *ctx; - ngx_http_split_clients_part_t *part; - ngx_http_compile_complex_value_t ccv; + ngx_stream_variable_t *var; + ngx_stream_split_clients_ctx_t *ctx; + ngx_stream_split_clients_part_t *part; + ngx_stream_compile_complex_value_t ccv; - ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_split_clients_ctx_t)); + ctx = ngx_pcalloc(cf->pool, sizeof(ngx_stream_split_clients_ctx_t)); if (ctx == NULL) { return NGX_CONF_ERROR; } value = cf->args->elts; - ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + ngx_memzero(&ccv, sizeof(ngx_stream_compile_complex_value_t)); ccv.cf = cf; ccv.value = &value[1]; ccv.complex_value = &ctx->value; - if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + if (ngx_stream_compile_complex_value(&ccv) != NGX_OK) { return NGX_CONF_ERROR; } @@ -148,16 +146,16 @@ ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) name.len--; name.data++; - var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE); + var = ngx_stream_add_variable(cf, &name, NGX_STREAM_VAR_CHANGEABLE); if (var == NULL) { return NGX_CONF_ERROR; } - var->get_handler = ngx_http_split_clients_variable; + var->get_handler = ngx_stream_split_clients_variable; var->data = (uintptr_t) ctx; if (ngx_array_init(&ctx->parts, cf->pool, 2, - sizeof(ngx_http_split_clients_part_t)) + sizeof(ngx_stream_split_clients_part_t)) != NGX_OK) { return NGX_CONF_ERROR; @@ -165,7 +163,7 @@ ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) save = *cf; cf->ctx = ctx; - cf->handler = ngx_http_split_clients; + cf->handler = ngx_stream_split_clients; cf->handler_conf = conf; rv = ngx_conf_parse(cf, NULL); @@ -199,12 +197,12 @@ ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) static char * -ngx_http_split_clients(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) +ngx_stream_split_clients(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) { - ngx_int_t n; - ngx_str_t *value; - ngx_http_split_clients_ctx_t *ctx; - ngx_http_split_clients_part_t *part; + ngx_int_t n; + ngx_str_t *value; + ngx_stream_split_clients_ctx_t *ctx; + ngx_stream_split_clients_part_t *part; ctx = cf->ctx; value = cf->args->elts; Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_ssl_module.c (+117 -14) 80% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_ssl_module.c 2016-07-27 12:58:24 +0900 (2d2f3ca) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_ssl_module.c 2016-07-27 13:06:13 +0900 (2661220) @@ -10,10 +10,20 @@ #include <ngx_stream.h> +typedef ngx_int_t (*ngx_ssl_variable_handler_pt)(ngx_connection_t *c, + ngx_pool_t *pool, ngx_str_t *s); + + #define NGX_DEFAULT_CIPHERS "HIGH:!aNULL:!MD5" #define NGX_DEFAULT_ECDH_CURVE "auto" +static ngx_int_t ngx_stream_ssl_static_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_ssl_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); + +static ngx_int_t ngx_stream_ssl_add_variables(ngx_conf_t *cf); static void *ngx_stream_ssl_create_conf(ngx_conf_t *cf); static char *ngx_stream_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child); @@ -132,6 +142,7 @@ static ngx_command_t ngx_stream_ssl_commands[] = { static ngx_stream_module_t ngx_stream_ssl_module_ctx = { + ngx_stream_ssl_add_variables, /* preconfiguration */ NULL, /* postconfiguration */ NULL, /* create main configuration */ @@ -158,9 +169,112 @@ ngx_module_t ngx_stream_ssl_module = { }; +static ngx_stream_variable_t ngx_stream_ssl_vars[] = { + + { ngx_string("ssl_protocol"), NULL, ngx_stream_ssl_static_variable, + (uintptr_t) ngx_ssl_get_protocol, NGX_STREAM_VAR_CHANGEABLE, 0 }, + + { ngx_string("ssl_cipher"), NULL, ngx_stream_ssl_static_variable, + (uintptr_t) ngx_ssl_get_cipher_name, NGX_STREAM_VAR_CHANGEABLE, 0 }, + + { ngx_string("ssl_session_id"), NULL, ngx_stream_ssl_variable, + (uintptr_t) ngx_ssl_get_session_id, NGX_STREAM_VAR_CHANGEABLE, 0 }, + + { ngx_string("ssl_session_reused"), NULL, ngx_stream_ssl_variable, + (uintptr_t) ngx_ssl_get_session_reused, NGX_STREAM_VAR_CHANGEABLE, 0 }, + + { ngx_string("ssl_server_name"), NULL, ngx_stream_ssl_variable, + (uintptr_t) ngx_ssl_get_server_name, NGX_STREAM_VAR_CHANGEABLE, 0 }, + + { ngx_null_string, NULL, NULL, 0, 0, 0 } +}; + + static ngx_str_t ngx_stream_ssl_sess_id_ctx = ngx_string("STREAM"); +static ngx_int_t +ngx_stream_ssl_static_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + ngx_ssl_variable_handler_pt handler = (ngx_ssl_variable_handler_pt) data; + + size_t len; + ngx_str_t str; + + if (s->connection->ssl) { + + (void) handler(s->connection, NULL, &str); + + v->data = str.data; + + for (len = 0; v->data[len]; len++) { /* void */ } + + v->len = len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; + } + + v->not_found = 1; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_ssl_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + ngx_ssl_variable_handler_pt handler = (ngx_ssl_variable_handler_pt) data; + + ngx_str_t str; + + if (s->connection->ssl) { + + if (handler(s->connection, s->connection->pool, &str) != NGX_OK) { + return NGX_ERROR; + } + + v->len = str.len; + v->data = str.data; + + if (v->len) { + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; + } + } + + v->not_found = 1; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_ssl_add_variables(ngx_conf_t *cf) +{ + ngx_stream_variable_t *var, *v; + + for (v = ngx_stream_ssl_vars; v->name.len; v++) { + var = ngx_stream_add_variable(cf, &v->name, v->flags); + if (var == NULL) { + return NGX_ERROR; + } + + var->get_handler = v->get_handler; + var->data = v->data; + } + + return NGX_OK; +} + + static void * ngx_stream_ssl_create_conf(ngx_conf_t *cf) { @@ -266,24 +380,13 @@ ngx_stream_ssl_merge_conf(ngx_conf_t *cf, void *parent, void *child) return NGX_CONF_ERROR; } - if (SSL_CTX_set_cipher_list(conf->ssl.ctx, - (const char *) conf->ciphers.data) - == 0) + if (ngx_ssl_ciphers(cf, &conf->ssl, &conf->ciphers, + conf->prefer_server_ciphers) + != NGX_OK) { - ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0, - "SSL_CTX_set_cipher_list(\"%V\") failed", - &conf->ciphers); return NGX_CONF_ERROR; } - if (conf->prefer_server_ciphers) { - SSL_CTX_set_options(conf->ssl.ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); - } - -#if (OPENSSL_VERSION_NUMBER < 0x10100001L && !defined LIBRESSL_VERSION_NUMBER) - SSL_CTX_set_tmp_rsa_callback(conf->ssl.ctx, ngx_ssl_rsa512_key_callback); -#endif - if (ngx_ssl_dhparam(cf, &conf->ssl, &conf->dhparam) != NGX_OK) { return NGX_CONF_ERROR; } Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_ssl_module.h (+0 -0) 100% =================================================================== Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_upstream.c (+2 -1) 98% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_upstream.c 2016-07-27 12:58:24 +0900 (69dddc5) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_upstream.c 2016-07-27 13:06:13 +0900 (2ea5eeb) @@ -39,13 +39,14 @@ static ngx_command_t ngx_stream_upstream_commands[] = { static ngx_stream_module_t ngx_stream_upstream_module_ctx = { + NULL, /* preconfiguration */ NULL, /* postconfiguration */ ngx_stream_upstream_create_main_conf, /* create main configuration */ ngx_stream_upstream_init_main_conf, /* init main configuration */ NULL, /* create server configuration */ - NULL, /* merge server configuration */ + NULL /* merge server configuration */ }; Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_upstream.h (+16 -0) 86% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_upstream.h 2016-07-27 12:58:24 +0900 (1f4810c) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_upstream.h 2016-07-27 13:06:13 +0900 (5f067c0) @@ -79,6 +79,21 @@ struct ngx_stream_upstream_srv_conf_s { typedef struct { + ngx_str_t host; + in_port_t port; + ngx_uint_t no_port; /* unsigned no_port:1 */ + + ngx_uint_t naddrs; + ngx_resolver_addr_t *addrs; + + struct sockaddr *sockaddr; + socklen_t socklen; + + ngx_resolver_ctx_t *ctx; +} ngx_stream_upstream_resolved_t; + + +typedef struct { ngx_peer_connection_t peer; ngx_buf_t downstream_buf; ngx_buf_t upstream_buf; @@ -88,6 +103,7 @@ typedef struct { #if (NGX_STREAM_SSL) ngx_str_t ssl_name; #endif + ngx_stream_upstream_resolved_t *resolved; unsigned connected:1; unsigned proxy_protocol:1; } ngx_stream_upstream_t; Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_hash_module.c (+18 -8) 96% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_upstream_hash_module.c 2016-07-27 12:58:24 +0900 (56ff7d6) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_hash_module.c 2016-07-27 13:06:13 +0900 (88185eb) @@ -23,6 +23,7 @@ typedef struct { typedef struct { + ngx_stream_complex_value_t key; ngx_stream_upstream_chash_points_t *points; } ngx_stream_upstream_hash_srv_conf_t; @@ -76,13 +77,14 @@ static ngx_command_t ngx_stream_upstream_hash_commands[] = { static ngx_stream_module_t ngx_stream_upstream_hash_module_ctx = { + NULL, /* preconfiguration */ NULL, /* postconfiguration */ NULL, /* create main configuration */ NULL, /* init main configuration */ ngx_stream_upstream_hash_create_conf, /* create server configuration */ - NULL, /* merge server configuration */ + NULL /* merge server configuration */ }; @@ -140,7 +142,9 @@ ngx_stream_upstream_init_hash_peer(ngx_stream_session_t *s, hcf = ngx_stream_conf_upstream_srv_conf(us, ngx_stream_upstream_hash_module); - hp->key = s->connection->addr_text; + if (ngx_stream_complex_value(s, &hcf->key, &hp->key) != NGX_OK) { + return NGX_ERROR; + } ngx_log_debug1(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, "upstream hash key:\"%V\"", &hp->key); @@ -615,15 +619,21 @@ ngx_stream_upstream_hash_create_conf(ngx_conf_t *cf) static char * ngx_stream_upstream_hash(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { - ngx_str_t *value; - ngx_stream_upstream_srv_conf_t *uscf; + ngx_stream_upstream_hash_srv_conf_t *hcf = conf; + + ngx_str_t *value; + ngx_stream_upstream_srv_conf_t *uscf; + ngx_stream_compile_complex_value_t ccv; value = cf->args->elts; - if (ngx_strcmp(value[1].data, "$remote_addr")) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "unsupported hash key \"%V\", use $remote_addr", - &value[1]); + ngx_memzero(&ccv, sizeof(ngx_stream_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[1]; + ccv.complex_value = &hcf->key; + + if (ngx_stream_compile_complex_value(&ccv) != NGX_OK) { return NGX_CONF_ERROR; } Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_least_conn_module.c (+2 -1) 98% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_upstream_least_conn_module.c 2016-07-27 12:58:24 +0900 (c9719f9) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_least_conn_module.c 2016-07-27 13:06:13 +0900 (e884975) @@ -32,13 +32,14 @@ static ngx_command_t ngx_stream_upstream_least_conn_commands[] = { static ngx_stream_module_t ngx_stream_upstream_least_conn_module_ctx = { + NULL, /* preconfiguration */ NULL, /* postconfiguration */ NULL, /* create main configuration */ NULL, /* init main configuration */ NULL, /* create server configuration */ - NULL, /* merge server configuration */ + NULL /* merge server configuration */ }; Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_round_robin.c (+135 -0) 81% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_upstream_round_robin.c 2016-07-27 12:58:24 +0900 (e1ab592) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_round_robin.c 2016-07-27 13:06:13 +0900 (7aced0f) @@ -23,6 +23,10 @@ static ngx_int_t ngx_stream_upstream_set_round_robin_peer_session( ngx_peer_connection_t *pc, void *data); static void ngx_stream_upstream_save_round_robin_peer_session( ngx_peer_connection_t *pc, void *data); +static ngx_int_t ngx_stream_upstream_empty_set_session( + ngx_peer_connection_t *pc, void *data); +static void ngx_stream_upstream_empty_save_session(ngx_peer_connection_t *pc, + void *data); #endif @@ -293,6 +297,123 @@ ngx_stream_upstream_init_round_robin_peer(ngx_stream_session_t *s, ngx_int_t +ngx_stream_upstream_create_round_robin_peer(ngx_stream_session_t *s, + ngx_stream_upstream_resolved_t *ur) +{ + u_char *p; + size_t len; + socklen_t socklen; + ngx_uint_t i, n; + struct sockaddr *sockaddr; + ngx_stream_upstream_rr_peer_t *peer, **peerp; + ngx_stream_upstream_rr_peers_t *peers; + ngx_stream_upstream_rr_peer_data_t *rrp; + + rrp = s->upstream->peer.data; + + if (rrp == NULL) { + rrp = ngx_palloc(s->connection->pool, + sizeof(ngx_stream_upstream_rr_peer_data_t)); + if (rrp == NULL) { + return NGX_ERROR; + } + + s->upstream->peer.data = rrp; + } + + peers = ngx_pcalloc(s->connection->pool, + sizeof(ngx_stream_upstream_rr_peers_t)); + if (peers == NULL) { + return NGX_ERROR; + } + + peer = ngx_pcalloc(s->connection->pool, + sizeof(ngx_stream_upstream_rr_peer_t) * ur->naddrs); + if (peer == NULL) { + return NGX_ERROR; + } + + peers->single = (ur->naddrs == 1); + peers->number = ur->naddrs; + peers->name = &ur->host; + + if (ur->sockaddr) { + peer[0].sockaddr = ur->sockaddr; + peer[0].socklen = ur->socklen; + peer[0].name = ur->host; + peer[0].weight = 1; + peer[0].effective_weight = 1; + peer[0].current_weight = 0; + peer[0].max_fails = 1; + peer[0].fail_timeout = 10; + peers->peer = peer; + + } else { + peerp = &peers->peer; + + for (i = 0; i < ur->naddrs; i++) { + + socklen = ur->addrs[i].socklen; + + sockaddr = ngx_palloc(s->connection->pool, socklen); + if (sockaddr == NULL) { + return NGX_ERROR; + } + + ngx_memcpy(sockaddr, ur->addrs[i].sockaddr, socklen); + ngx_inet_set_port(sockaddr, ur->port); + + p = ngx_pnalloc(s->connection->pool, NGX_SOCKADDR_STRLEN); + if (p == NULL) { + return NGX_ERROR; + } + + len = ngx_sock_ntop(sockaddr, socklen, p, NGX_SOCKADDR_STRLEN, 1); + + peer[i].sockaddr = sockaddr; + peer[i].socklen = socklen; + peer[i].name.len = len; + peer[i].name.data = p; + peer[i].weight = 1; + peer[i].effective_weight = 1; + peer[i].current_weight = 0; + peer[i].max_fails = 1; + peer[i].fail_timeout = 10; + *peerp = &peer[i]; + peerp = &peer[i].next; + } + } + + rrp->peers = peers; + rrp->current = NULL; + + if (rrp->peers->number <= 8 * sizeof(uintptr_t)) { + rrp->tried = &rrp->data; + rrp->data = 0; + + } else { + n = (rrp->peers->number + (8 * sizeof(uintptr_t) - 1)) + / (8 * sizeof(uintptr_t)); + + rrp->tried = ngx_pcalloc(s->connection->pool, n * sizeof(uintptr_t)); + if (rrp->tried == NULL) { + return NGX_ERROR; + } + } + + s->upstream->peer.get = ngx_stream_upstream_get_round_robin_peer; + s->upstream->peer.free = ngx_stream_upstream_free_round_robin_peer; + s->upstream->peer.tries = ngx_stream_upstream_tries(rrp->peers); +#if (NGX_STREAM_SSL) + s->upstream->peer.set_session = ngx_stream_upstream_empty_set_session; + s->upstream->peer.save_session = ngx_stream_upstream_empty_save_session; +#endif + + return NGX_OK; +} + + +ngx_int_t ngx_stream_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data) { ngx_stream_upstream_rr_peer_data_t *rrp = data; @@ -699,4 +820,18 @@ ngx_stream_upstream_save_round_robin_peer_session(ngx_peer_connection_t *pc, } } + +static ngx_int_t +ngx_stream_upstream_empty_set_session(ngx_peer_connection_t *pc, void *data) +{ + return NGX_OK; +} + + +static void +ngx_stream_upstream_empty_save_session(ngx_peer_connection_t *pc, void *data) +{ + return; +} + #endif Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_round_robin.h (+2 -0) 97% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_upstream_round_robin.h 2016-07-27 12:58:24 +0900 (77ee0ab) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_round_robin.h 2016-07-27 13:06:13 +0900 (452c2e9) @@ -130,6 +130,8 @@ ngx_int_t ngx_stream_upstream_init_round_robin(ngx_conf_t *cf, ngx_stream_upstream_srv_conf_t *us); ngx_int_t ngx_stream_upstream_init_round_robin_peer(ngx_stream_session_t *s, ngx_stream_upstream_srv_conf_t *us); +ngx_int_t ngx_stream_upstream_create_round_robin_peer(ngx_stream_session_t *s, + ngx_stream_upstream_resolved_t *ur); ngx_int_t ngx_stream_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data); void ngx_stream_upstream_free_round_robin_peer(ngx_peer_connection_t *pc, Renamed: vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_zone_module.c (+2 -1) 98% =================================================================== --- vendor/nginx-1.11.1/src/stream/ngx_stream_upstream_zone_module.c 2016-07-27 12:58:24 +0900 (ffc9e8a) +++ vendor/nginx-1.11.3/src/stream/ngx_stream_upstream_zone_module.c 2016-07-27 13:06:13 +0900 (07ab88d) @@ -32,13 +32,14 @@ static ngx_command_t ngx_stream_upstream_zone_commands[] = { static ngx_stream_module_t ngx_stream_upstream_zone_module_ctx = { + NULL, /* preconfiguration */ NULL, /* postconfiguration */ NULL, /* create main configuration */ NULL, /* init main configuration */ NULL, /* create server configuration */ - NULL, /* merge server configuration */ + NULL /* merge server configuration */ }; Added: vendor/nginx-1.11.3/src/stream/ngx_stream_variables.c (+971 -0) 100644 =================================================================== --- /dev/null +++ vendor/nginx-1.11.3/src/stream/ngx_stream_variables.c 2016-07-27 13:06:13 +0900 (10f9c7e) @@ -0,0 +1,971 @@ + +/* + * Copyright (C) Igor Sysoev + * Copyright (C) Nginx, Inc. + */ + + +#include <ngx_config.h> +#include <ngx_core.h> +#include <ngx_stream.h> +#include <nginx.h> + + +static ngx_int_t ngx_stream_variable_binary_remote_addr( + ngx_stream_session_t *s, ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_variable_remote_addr(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_variable_remote_port(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_variable_server_addr(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_variable_server_port(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_variable_bytes_sent(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_variable_connection(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); + +static ngx_int_t ngx_stream_variable_nginx_version(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_variable_hostname(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_variable_pid(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_variable_msec(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_variable_time_iso8601(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_variable_time_local(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); + + +static ngx_stream_variable_t ngx_stream_core_variables[] = { + + { ngx_string("binary_remote_addr"), NULL, + ngx_stream_variable_binary_remote_addr, 0, 0, 0 }, + + { ngx_string("remote_addr"), NULL, + ngx_stream_variable_remote_addr, 0, 0, 0 }, + + { ngx_string("remote_port"), NULL, + ngx_stream_variable_remote_port, 0, 0, 0 }, + + { ngx_string("server_addr"), NULL, + ngx_stream_variable_server_addr, 0, 0, 0 }, + + { ngx_string("server_port"), NULL, + ngx_stream_variable_server_port, 0, 0, 0 }, + + { ngx_string("bytes_sent"), NULL, ngx_stream_variable_bytes_sent, + 0, 0, 0 }, + + { ngx_string("connection"), NULL, + ngx_stream_variable_connection, 0, 0, 0 }, + + { ngx_string("nginx_version"), NULL, ngx_stream_variable_nginx_version, + 0, 0, 0 }, + + { ngx_string("hostname"), NULL, ngx_stream_variable_hostname, + 0, 0, 0 }, + + { ngx_string("pid"), NULL, ngx_stream_variable_pid, + 0, 0, 0 }, + + { ngx_string("msec"), NULL, ngx_stream_variable_msec, + 0, NGX_STREAM_VAR_NOCACHEABLE, 0 }, + + { ngx_string("time_iso8601"), NULL, ngx_stream_variable_time_iso8601, + 0, NGX_STREAM_VAR_NOCACHEABLE, 0 }, + + { ngx_string("time_local"), NULL, ngx_stream_variable_time_local, + 0, NGX_STREAM_VAR_NOCACHEABLE, 0 }, + + { ngx_null_string, NULL, NULL, 0, 0, 0 } +}; + + +ngx_stream_variable_value_t ngx_stream_variable_null_value = + ngx_stream_variable(""); +ngx_stream_variable_value_t ngx_stream_variable_true_value = + ngx_stream_variable("1"); + + +ngx_stream_variable_t * +ngx_stream_add_variable(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags) +{ + ngx_int_t rc; + ngx_uint_t i; + ngx_hash_key_t *key; + ngx_stream_variable_t *v; + ngx_stream_core_main_conf_t *cmcf; + + if (name->len == 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid variable name \"$\""); + return NULL; + } + + cmcf = ngx_stream_conf_get_module_main_conf(cf, ngx_stream_core_module); + + key = cmcf->variables_keys->keys.elts; + for (i = 0; i < cmcf->variables_keys->keys.nelts; i++) { + if (name->len != key[i].key.len + || ngx_strncasecmp(name->data, key[i].key.data, name->len) != 0) + { + continue; + } + + v = key[i].value; + + if (!(v->flags & NGX_STREAM_VAR_CHANGEABLE)) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "the duplicate \"%V\" variable", name); + return NULL; + } + + return v; + } + + v = ngx_palloc(cf->pool, sizeof(ngx_stream_variable_t)); + if (v == NULL) { + return NULL; + } + + v->name.len = name->len; + v->name.data = ngx_pnalloc(cf->pool, name->len); + if (v->name.data == NULL) { + return NULL; + } + + ngx_strlow(v->name.data, name->data, name->len); + + v->set_handler = NULL; + v->get_handler = NULL; + v->data = 0; + v->flags = flags; + v->index = 0; + + rc = ngx_hash_add_key(cmcf->variables_keys, &v->name, v, 0); + + if (rc == NGX_ERROR) { + return NULL; + } + + if (rc == NGX_BUSY) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "conflicting variable name \"%V\"", name); + return NULL; + } + + return v; +} + + +ngx_int_t +ngx_stream_get_variable_index(ngx_conf_t *cf, ngx_str_t *name) +{ + ngx_uint_t i; + ngx_stream_variable_t *v; + ngx_stream_core_main_conf_t *cmcf; + + if (name->len == 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid variable name \"$\""); + return NGX_ERROR; + } + + cmcf = ngx_stream_conf_get_module_main_conf(cf, ngx_stream_core_module); + + v = cmcf->variables.elts; + + if (v == NULL) { + if (ngx_array_init(&cmcf->variables, cf->pool, 4, + sizeof(ngx_stream_variable_t)) + != NGX_OK) + { + return NGX_ERROR; + } + + } else { + for (i = 0; i < cmcf->variables.nelts; i++) { + if (name->len != v[i].name.len + || ngx_strncasecmp(name->data, v[i].name.data, name->len) != 0) + { + continue; + } + + return i; + } + } + + v = ngx_array_push(&cmcf->variables); + if (v == NULL) { + return NGX_ERROR; + } + + v->name.len = name->len; + v->name.data = ngx_pnalloc(cf->pool, name->len); + if (v->name.data == NULL) { + return NGX_ERROR; + } + + ngx_strlow(v->name.data, name->data, name->len); + + v->set_handler = NULL; + v->get_handler = NULL; + v->data = 0; + v->flags = 0; + v->index = cmcf->variables.nelts - 1; + + return v->index; +} + + +ngx_stream_variable_value_t * +ngx_stream_get_indexed_variable(ngx_stream_session_t *s, ngx_uint_t index) +{ + ngx_stream_variable_t *v; + ngx_stream_core_main_conf_t *cmcf; + + cmcf = ngx_stream_get_module_main_conf(s, ngx_stream_core_module); + + if (cmcf->variables.nelts <= index) { + ngx_log_error(NGX_LOG_ALERT, s->connection->log, 0, + "unknown variable index: %ui", index); + return NULL; + } + + if (s->variables[index].not_found || s->variables[index].valid) { + return &s->variables[index]; + } + + v = cmcf->variables.elts; + + if (v[index].get_handler(s, &s->variables[index], v[index].data) + == NGX_OK) + { + if (v[index].flags & NGX_STREAM_VAR_NOCACHEABLE) { + s->variables[index].no_cacheable = 1; + } + + return &s->variables[index]; + } + + s->variables[index].valid = 0; + s->variables[index].not_found = 1; + + return NULL; +} + + +ngx_stream_variable_value_t * +ngx_stream_get_flushed_variable(ngx_stream_session_t *s, ngx_uint_t index) +{ + ngx_stream_variable_value_t *v; + + v = &s->variables[index]; + + if (v->valid || v->not_found) { + if (!v->no_cacheable) { + return v; + } + + v->valid = 0; + v->not_found = 0; + } + + return ngx_stream_get_indexed_variable(s, index); +} + + +ngx_stream_variable_value_t * +ngx_stream_get_variable(ngx_stream_session_t *s, ngx_str_t *name, + ngx_uint_t key) +{ + ngx_stream_variable_t *v; + ngx_stream_variable_value_t *vv; + ngx_stream_core_main_conf_t *cmcf; + + cmcf = ngx_stream_get_module_main_conf(s, ngx_stream_core_module); + + v = ngx_hash_find(&cmcf->variables_hash, key, name->data, name->len); + + if (v) { + if (v->flags & NGX_STREAM_VAR_INDEXED) { + return ngx_stream_get_flushed_variable(s, v->index); + + } else { + + vv = ngx_palloc(s->connection->pool, + sizeof(ngx_stream_variable_value_t)); + + if (vv && v->get_handler(s, vv, v->data) == NGX_OK) { + return vv; + } + + return NULL; + } + } + + vv = ngx_palloc(s->connection->pool, sizeof(ngx_stream_variable_value_t)); + if (vv == NULL) { + return NULL; + } + + vv->not_found = 1; + + return vv; +} + + +static ngx_int_t +ngx_stream_variable_binary_remote_addr(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) + { + struct sockaddr_in *sin; +#if (NGX_HAVE_INET6) + struct sockaddr_in6 *sin6; +#endif + + switch (s->connection->sockaddr->sa_family) { + +#if (NGX_HAVE_INET6) + case AF_INET6: + sin6 = (struct sockaddr_in6 *) s->connection->sockaddr; + + v->len = sizeof(struct in6_addr); + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = sin6->sin6_addr.s6_addr; + + break; +#endif + + default: /* AF_INET */ + sin = (struct sockaddr_in *) s->connection->sockaddr; + + v->len = sizeof(in_addr_t); + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = (u_char *) &sin->sin_addr; + + break; + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_remote_addr(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + v->len = s->connection->addr_text.len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = s->connection->addr_text.data; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_remote_port(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + ngx_uint_t port; + + v->len = 0; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + v->data = ngx_pnalloc(s->connection->pool, sizeof("65535") - 1); + if (v->data == NULL) { + return NGX_ERROR; + } + + port = ngx_inet_get_port(s->connection->sockaddr); + + if (port > 0 && port < 65536) { + v->len = ngx_sprintf(v->data, "%ui", port) - v->data; + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_server_addr(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + ngx_str_t str; + u_char addr[NGX_SOCKADDR_STRLEN]; + + str.len = NGX_SOCKADDR_STRLEN; + str.data = addr; + + if (ngx_connection_local_sockaddr(s->connection, &str, 0) != NGX_OK) { + return NGX_ERROR; + } + + str.data = ngx_pnalloc(s->connection->pool, str.len); + if (str.data == NULL) { + return NGX_ERROR; + } + + ngx_memcpy(str.data, addr, str.len); + + v->len = str.len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = str.data; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_server_port(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + ngx_uint_t port; + + v->len = 0; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + if (ngx_connection_local_sockaddr(s->connection, NULL, 0) != NGX_OK) { + return NGX_ERROR; + } + + v->data = ngx_pnalloc(s->connection->pool, sizeof("65535") - 1); + if (v->data == NULL) { + return NGX_ERROR; + } + + port = ngx_inet_get_port(s->connection->local_sockaddr); + + if (port > 0 && port < 65536) { + v->len = ngx_sprintf(v->data, "%ui", port) - v->data; + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_bytes_sent(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + u_char *p; + + p = ngx_pnalloc(s->connection->pool, NGX_OFF_T_LEN); + if (p == NULL) { + return NGX_ERROR; + } + + v->len = ngx_sprintf(p, "%O", s->connection->sent) - p; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = p; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_connection(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + u_char *p; + + p = ngx_pnalloc(s->connection->pool, NGX_ATOMIC_T_LEN); + if (p == NULL) { + return NGX_ERROR; + } + + v->len = ngx_sprintf(p, "%uA", s->connection->number) - p; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = p; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_nginx_version(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + v->len = sizeof(NGINX_VERSION) - 1; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = (u_char *) NGINX_VERSION; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_hostname(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + v->len = ngx_cycle->hostname.len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = ngx_cycle->hostname.data; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_pid(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + u_char *p; + + p = ngx_pnalloc(s->connection->pool, NGX_INT64_LEN); + if (p == NULL) { + return NGX_ERROR; + } + + v->len = ngx_sprintf(p, "%P", ngx_pid) - p; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = p; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_msec(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + u_char *p; + ngx_time_t *tp; + + p = ngx_pnalloc(s->connection->pool, NGX_TIME_T_LEN + 4); + if (p == NULL) { + return NGX_ERROR; + } + + tp = ngx_timeofday(); + + v->len = ngx_sprintf(p, "%T.%03M", tp->sec, tp->msec) - p; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = p; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_time_iso8601(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + u_char *p; + + p = ngx_pnalloc(s->connection->pool, ngx_cached_http_log_iso8601.len); + if (p == NULL) { + return NGX_ERROR; + } + + ngx_memcpy(p, ngx_cached_http_log_iso8601.data, + ngx_cached_http_log_iso8601.len); + + v->len = ngx_cached_http_log_iso8601.len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = p; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_variable_time_local(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + u_char *p; + + p = ngx_pnalloc(s->connection->pool, ngx_cached_http_log_time.len); + if (p == NULL) { + return NGX_ERROR; + } + + ngx_memcpy(p, ngx_cached_http_log_time.data, ngx_cached_http_log_time.len); + + v->len = ngx_cached_http_log_time.len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = p; + + return NGX_OK; +} + + +void * +ngx_stream_map_find(ngx_stream_session_t *s, ngx_stream_map_t *map, + ngx_str_t *match) +{ + void *value; + u_char *low; + size_t len; + ngx_uint_t key; + + len = match->len; + + if (len) { + low = ngx_pnalloc(s->connection->pool, len); + if (low == NULL) { + return NULL; + } + + } else { + low = NULL; + } + + key = ngx_hash_strlow(low, match->data, len); + + value = ngx_hash_find_combined(&map->hash, key, low, len); + if (value) { + return value; + } + +#if (NGX_PCRE) + + if (len && map->nregex) { + ngx_int_t n; + ngx_uint_t i; + ngx_stream_map_regex_t *reg; + + reg = map->regex; + + for (i = 0; i < map->nregex; i++) { + + n = ngx_stream_regex_exec(s, reg[i].regex, match); + + if (n == NGX_OK) { + return reg[i].value; + } + + if (n == NGX_DECLINED) { + continue; + } + + /* NGX_ERROR */ + + return NULL; + } + } + +#endif + + return NULL; +} + + +#if (NGX_PCRE) + +static ngx_int_t +ngx_stream_variable_not_found(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data) +{ + v->not_found = 1; + return NGX_OK; +} + + +ngx_stream_regex_t * +ngx_stream_regex_compile(ngx_conf_t *cf, ngx_regex_compile_t *rc) +{ + u_char *p; + size_t size; + ngx_str_t name; + ngx_uint_t i, n; + ngx_stream_variable_t *v; + ngx_stream_regex_t *re; + ngx_stream_regex_variable_t *rv; + ngx_stream_core_main_conf_t *cmcf; + + rc->pool = cf->pool; + + if (ngx_regex_compile(rc) != NGX_OK) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V", &rc->err); + return NULL; + } + + re = ngx_pcalloc(cf->pool, sizeof(ngx_stream_regex_t)); + if (re == NULL) { + return NULL; + } + + re->regex = rc->regex; + re->ncaptures = rc->captures; + re->name = rc->pattern; + + cmcf = ngx_stream_conf_get_module_main_conf(cf, ngx_stream_core_module); + cmcf->ncaptures = ngx_max(cmcf->ncaptures, re->ncaptures); + + n = (ngx_uint_t) rc->named_captures; + + if (n == 0) { + return re; + } + + rv = ngx_palloc(rc->pool, n * sizeof(ngx_stream_regex_variable_t)); + if (rv == NULL) { + return NULL; + } + + re->variables = rv; + re->nvariables = n; + + size = rc->name_size; + p = rc->names; + + for (i = 0; i < n; i++) { + rv[i].capture = 2 * ((p[0] << 8) + p[1]); + + name.data = &p[2]; + name.len = ngx_strlen(name.data); + + v = ngx_stream_add_variable(cf, &name, NGX_STREAM_VAR_CHANGEABLE); + if (v == NULL) { + return NULL; + } + + rv[i].index = ngx_stream_get_variable_index(cf, &name); + if (rv[i].index == NGX_ERROR) { + return NULL; + } + + v->get_handler = ngx_stream_variable_not_found; + + p += size; + } + + return re; +} + + +ngx_int_t +ngx_stream_regex_exec(ngx_stream_session_t *s, ngx_stream_regex_t *re, + ngx_str_t *str) +{ + ngx_int_t rc, index; + ngx_uint_t i, n, len; + ngx_stream_variable_value_t *vv; + ngx_stream_core_main_conf_t *cmcf; + + cmcf = ngx_stream_get_module_main_conf(s, ngx_stream_core_module); + + if (re->ncaptures) { + len = cmcf->ncaptures; + + if (s->captures == NULL) { + s->captures = ngx_palloc(s->connection->pool, len * sizeof(int)); + if (s->captures == NULL) { + return NGX_ERROR; + } + } + + } else { + len = 0; + } + + rc = ngx_regex_exec(re->regex, str, s->captures, len); + + if (rc == NGX_REGEX_NO_MATCHED) { + return NGX_DECLINED; + } + + if (rc < 0) { + ngx_log_error(NGX_LOG_ALERT, s->connection->log, 0, + ngx_regex_exec_n " failed: %i on \"%V\" using \"%V\"", + rc, str, &re->name); + return NGX_ERROR; + } + + for (i = 0; i < re->nvariables; i++) { + + n = re->variables[i].capture; + index = re->variables[i].index; + vv = &s->variables[index]; + + vv->len = s->captures[n + 1] - s->captures[n]; + vv->valid = 1; + vv->no_cacheable = 0; + vv->not_found = 0; + vv->data = &str->data[s->captures[n]]; + +#if (NGX_DEBUG) + { + ngx_stream_variable_t *v; + + v = cmcf->variables.elts; + + ngx_log_debug2(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, + "stream regex set $%V to \"%v\"", &v[index].name, vv); + } +#endif + } + + s->ncaptures = rc * 2; + s->captures_data = str->data; + + return NGX_OK; +} + +#endif + + +ngx_int_t +ngx_stream_variables_add_core_vars(ngx_conf_t *cf) +{ + ngx_int_t rc; + ngx_stream_variable_t *cv, *v; + ngx_stream_core_main_conf_t *cmcf; + + cmcf = ngx_stream_conf_get_module_main_conf(cf, ngx_stream_core_module); + + cmcf->variables_keys = ngx_pcalloc(cf->temp_pool, + sizeof(ngx_hash_keys_arrays_t)); + if (cmcf->variables_keys == NULL) { + return NGX_ERROR; + } + + cmcf->variables_keys->pool = cf->pool; + cmcf->variables_keys->temp_pool = cf->pool; + + if (ngx_hash_keys_array_init(cmcf->variables_keys, NGX_HASH_SMALL) + != NGX_OK) + { + return NGX_ERROR; + } + + for (cv = ngx_stream_core_variables; cv->name.len; cv++) { + v = ngx_palloc(cf->pool, sizeof(ngx_stream_variable_t)); + if (v == NULL) { + return NGX_ERROR; + } + + *v = *cv; + + rc = ngx_hash_add_key(cmcf->variables_keys, &v->name, v, + NGX_HASH_READONLY_KEY); + + if (rc == NGX_OK) { + continue; + } + + if (rc == NGX_BUSY) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "conflicting variable name \"%V\"", &v->name); + } + + return NGX_ERROR; + } + + return NGX_OK; +} + + +ngx_int_t +ngx_stream_variables_init_vars(ngx_conf_t *cf) +{ + ngx_uint_t i, n; + ngx_hash_key_t *key; + ngx_hash_init_t hash; + ngx_stream_variable_t *v, *av; + ngx_stream_core_main_conf_t *cmcf; + + /* set the handlers for the indexed stream variables */ + + cmcf = ngx_stream_conf_get_module_main_conf(cf, ngx_stream_core_module); + + v = cmcf->variables.elts; + key = cmcf->variables_keys->keys.elts; + + for (i = 0; i < cmcf->variables.nelts; i++) { + + for (n = 0; n < cmcf->variables_keys->keys.nelts; n++) { + + av = key[n].value; + + if (v[i].name.len == key[n].key.len + && ngx_strncmp(v[i].name.data, key[n].key.data, v[i].name.len) + == 0) + { + v[i].get_handler = av->get_handler; + v[i].data = av->data; + + av->flags |= NGX_STREAM_VAR_INDEXED; + v[i].flags = av->flags; + + av->index = i; + + if (av->get_handler == NULL) { + break; + } + + goto next; + } + } + + ngx_log_error(NGX_LOG_EMERG, cf->log, 0, + "unknown \"%V\" variable", &v[i].name); + + return NGX_ERROR; + + next: + continue; + } + + + for (n = 0; n < cmcf->variables_keys->keys.nelts; n++) { + av = key[n].value; + + if (av->flags & NGX_STREAM_VAR_NOHASH) { + key[n].key.data = NULL; + } + } + + + hash.hash = &cmcf->variables_hash; + hash.key = ngx_hash_key; + hash.max_size = cmcf->variables_hash_max_size; + hash.bucket_size = cmcf->variables_hash_bucket_size; + hash.name = "variables_hash"; + hash.pool = cf->pool; + hash.temp_pool = NULL; + + if (ngx_hash_init(&hash, cmcf->variables_keys->keys.elts, + cmcf->variables_keys->keys.nelts) + != NGX_OK) + { + return NGX_ERROR; + } + + cmcf->variables_keys = NULL; + + return NGX_OK; +} Added: vendor/nginx-1.11.3/src/stream/ngx_stream_variables.h (+109 -0) 100644 =================================================================== --- /dev/null +++ vendor/nginx-1.11.3/src/stream/ngx_stream_variables.h 2016-07-27 13:06:13 +0900 (e4151e2) @@ -0,0 +1,109 @@ + +/* + * Copyright (C) Igor Sysoev + * Copyright (C) Nginx, Inc. + */ + + +#ifndef _NGX_STREAM_VARIABLES_H_INCLUDED_ +#define _NGX_STREAM_VARIABLES_H_INCLUDED_ + + +#include <ngx_config.h> +#include <ngx_core.h> +#include <ngx_stream.h> + + +typedef ngx_variable_value_t ngx_stream_variable_value_t; + +#define ngx_stream_variable(v) { sizeof(v) - 1, 1, 0, 0, 0, (u_char *) v } + +typedef struct ngx_stream_variable_s ngx_stream_variable_t; + +typedef void (*ngx_stream_set_variable_pt) (ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +typedef ngx_int_t (*ngx_stream_get_variable_pt) (ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); + + +#define NGX_STREAM_VAR_CHANGEABLE 1 +#define NGX_STREAM_VAR_NOCACHEABLE 2 +#define NGX_STREAM_VAR_INDEXED 4 +#define NGX_STREAM_VAR_NOHASH 8 + + +struct ngx_stream_variable_s { + ngx_str_t name; /* must be first to build the hash */ + ngx_stream_set_variable_pt set_handler; + ngx_stream_get_variable_pt get_handler; + uintptr_t data; + ngx_uint_t flags; + ngx_uint_t index; +}; + + +ngx_stream_variable_t *ngx_stream_add_variable(ngx_conf_t *cf, ngx_str_t *name, + ngx_uint_t flags); +ngx_int_t ngx_stream_get_variable_index(ngx_conf_t *cf, ngx_str_t *name); +ngx_stream_variable_value_t *ngx_stream_get_indexed_variable( + ngx_stream_session_t *s, ngx_uint_t index); +ngx_stream_variable_value_t *ngx_stream_get_flushed_variable( + ngx_stream_session_t *s, ngx_uint_t index); + +ngx_stream_variable_value_t *ngx_stream_get_variable(ngx_stream_session_t *s, + ngx_str_t *name, ngx_uint_t key); + + +#if (NGX_PCRE) + +typedef struct { + ngx_uint_t capture; + ngx_int_t index; +} ngx_stream_regex_variable_t; + + +typedef struct { + ngx_regex_t *regex; + ngx_uint_t ncaptures; + ngx_stream_regex_variable_t *variables; + ngx_uint_t nvariables; + ngx_str_t name; +} ngx_stream_regex_t; + + +typedef struct { + ngx_stream_regex_t *regex; + void *value; +} ngx_stream_map_regex_t; + + +ngx_stream_regex_t *ngx_stream_regex_compile(ngx_conf_t *cf, + ngx_regex_compile_t *rc); +ngx_int_t ngx_stream_regex_exec(ngx_stream_session_t *s, ngx_stream_regex_t *re, + ngx_str_t *str); + +#endif + + +typedef struct { + ngx_hash_combined_t hash; +#if (NGX_PCRE) + ngx_stream_map_regex_t *regex; + ngx_uint_t nregex; +#endif +} ngx_stream_map_t; + + +void *ngx_stream_map_find(ngx_stream_session_t *s, ngx_stream_map_t *map, + ngx_str_t *match); + + +ngx_int_t ngx_stream_variables_add_core_vars(ngx_conf_t *cf); +ngx_int_t ngx_stream_variables_init_vars(ngx_conf_t *cf); + + +extern ngx_stream_variable_value_t ngx_stream_variable_null_value; +extern ngx_stream_variable_value_t ngx_stream_variable_true_value; + + +#endif /* _NGX_STREAM_VARIABLES_H_INCLUDED_ */