nginxtra 1.0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -0
- data/bin/nginxtra +5 -0
- data/lib/nginxtra.rb +12 -0
- data/lib/nginxtra/action.rb +36 -0
- data/lib/nginxtra/actions/compile.rb +60 -0
- data/lib/nginxtra/actions/install.rb +99 -0
- data/lib/nginxtra/actions/reload.rb +14 -0
- data/lib/nginxtra/actions/restart.rb +15 -0
- data/lib/nginxtra/actions/start.rb +53 -0
- data/lib/nginxtra/actions/status.rb +31 -0
- data/lib/nginxtra/actions/stop.rb +14 -0
- data/lib/nginxtra/cli.rb +77 -0
- data/lib/nginxtra/config.rb +339 -0
- data/lib/nginxtra/error.rb +13 -0
- data/lib/nginxtra/status.rb +57 -0
- data/src/nginx/CHANGES +5630 -0
- data/src/nginx/CHANGES.ru +5716 -0
- data/src/nginx/LICENSE +25 -0
- data/src/nginx/README +3 -0
- data/src/nginx/auto/cc/acc +15 -0
- data/src/nginx/auto/cc/bcc +72 -0
- data/src/nginx/auto/cc/ccc +46 -0
- data/src/nginx/auto/cc/conf +189 -0
- data/src/nginx/auto/cc/gcc +183 -0
- data/src/nginx/auto/cc/icc +121 -0
- data/src/nginx/auto/cc/msvc +138 -0
- data/src/nginx/auto/cc/name +101 -0
- data/src/nginx/auto/cc/owc +104 -0
- data/src/nginx/auto/cc/sunc +158 -0
- data/src/nginx/auto/define +12 -0
- data/src/nginx/auto/endianess +45 -0
- data/src/nginx/auto/feature +123 -0
- data/src/nginx/auto/have +12 -0
- data/src/nginx/auto/have_headers +12 -0
- data/src/nginx/auto/headers +13 -0
- data/src/nginx/auto/include +61 -0
- data/src/nginx/auto/init +51 -0
- data/src/nginx/auto/install +184 -0
- data/src/nginx/auto/lib/conf +83 -0
- data/src/nginx/auto/lib/geoip/conf +79 -0
- data/src/nginx/auto/lib/google-perftools/conf +45 -0
- data/src/nginx/auto/lib/libatomic/conf +43 -0
- data/src/nginx/auto/lib/libatomic/make +14 -0
- data/src/nginx/auto/lib/libgd/conf +83 -0
- data/src/nginx/auto/lib/libxslt/conf +156 -0
- data/src/nginx/auto/lib/make +32 -0
- data/src/nginx/auto/lib/md5/conf +103 -0
- data/src/nginx/auto/lib/md5/make +96 -0
- data/src/nginx/auto/lib/md5/makefile.bcc +22 -0
- data/src/nginx/auto/lib/md5/makefile.msvc +22 -0
- data/src/nginx/auto/lib/md5/makefile.owc +11 -0
- data/src/nginx/auto/lib/openssl/conf +74 -0
- data/src/nginx/auto/lib/openssl/make +67 -0
- data/src/nginx/auto/lib/openssl/makefile.bcc +18 -0
- data/src/nginx/auto/lib/openssl/makefile.msvc +14 -0
- data/src/nginx/auto/lib/pcre/conf +180 -0
- data/src/nginx/auto/lib/pcre/make +64 -0
- data/src/nginx/auto/lib/pcre/makefile.bcc +26 -0
- data/src/nginx/auto/lib/pcre/makefile.msvc +22 -0
- data/src/nginx/auto/lib/pcre/makefile.owc +24 -0
- data/src/nginx/auto/lib/perl/conf +60 -0
- data/src/nginx/auto/lib/perl/make +36 -0
- data/src/nginx/auto/lib/sha1/conf +79 -0
- data/src/nginx/auto/lib/sha1/make +96 -0
- data/src/nginx/auto/lib/sha1/makefile.bcc +22 -0
- data/src/nginx/auto/lib/sha1/makefile.msvc +22 -0
- data/src/nginx/auto/lib/sha1/makefile.owc +11 -0
- data/src/nginx/auto/lib/test +40 -0
- data/src/nginx/auto/lib/zlib/conf +76 -0
- data/src/nginx/auto/lib/zlib/make +114 -0
- data/src/nginx/auto/lib/zlib/makefile.bcc +15 -0
- data/src/nginx/auto/lib/zlib/makefile.msvc +14 -0
- data/src/nginx/auto/lib/zlib/makefile.owc +14 -0
- data/src/nginx/auto/lib/zlib/patch.zlib.h +10 -0
- data/src/nginx/auto/make +417 -0
- data/src/nginx/auto/modules +479 -0
- data/src/nginx/auto/nohave +12 -0
- data/src/nginx/auto/options +490 -0
- data/src/nginx/auto/os/conf +105 -0
- data/src/nginx/auto/os/darwin +116 -0
- data/src/nginx/auto/os/freebsd +136 -0
- data/src/nginx/auto/os/linux +152 -0
- data/src/nginx/auto/os/solaris +60 -0
- data/src/nginx/auto/os/win32 +29 -0
- data/src/nginx/auto/sources +518 -0
- data/src/nginx/auto/stubs +8 -0
- data/src/nginx/auto/summary +114 -0
- data/src/nginx/auto/types/sizeof +83 -0
- data/src/nginx/auto/types/typedef +77 -0
- data/src/nginx/auto/types/uintptr_t +42 -0
- data/src/nginx/auto/types/value +12 -0
- data/src/nginx/auto/unix +719 -0
- data/src/nginx/conf/fastcgi.conf +24 -0
- data/src/nginx/conf/fastcgi_params +23 -0
- data/src/nginx/conf/koi-utf +109 -0
- data/src/nginx/conf/koi-win +103 -0
- data/src/nginx/conf/mime.types +80 -0
- data/src/nginx/conf/nginx.conf +118 -0
- data/src/nginx/conf/scgi_params +15 -0
- data/src/nginx/conf/uwsgi_params +15 -0
- data/src/nginx/conf/win-utf +126 -0
- data/src/nginx/configure +108 -0
- data/src/nginx/contrib/README +15 -0
- data/src/nginx/contrib/geo2nginx.pl +58 -0
- data/src/nginx/contrib/unicode2nginx/koi-utf +131 -0
- data/src/nginx/contrib/unicode2nginx/unicode-to-nginx.pl +45 -0
- data/src/nginx/contrib/unicode2nginx/win-utf +130 -0
- data/src/nginx/html/50x.html +18 -0
- data/src/nginx/html/index.html +8 -0
- data/src/nginx/man/nginx.8 +202 -0
- data/src/nginx/src/core/nginx.c +1333 -0
- data/src/nginx/src/core/nginx.h +20 -0
- data/src/nginx/src/core/ngx_array.c +147 -0
- data/src/nginx/src/core/ngx_array.h +53 -0
- data/src/nginx/src/core/ngx_buf.c +218 -0
- data/src/nginx/src/core/ngx_buf.h +162 -0
- data/src/nginx/src/core/ngx_conf_file.c +1506 -0
- data/src/nginx/src/core/ngx_conf_file.h +348 -0
- data/src/nginx/src/core/ngx_config.h +134 -0
- data/src/nginx/src/core/ngx_connection.c +1074 -0
- data/src/nginx/src/core/ngx_connection.h +195 -0
- data/src/nginx/src/core/ngx_core.h +95 -0
- data/src/nginx/src/core/ngx_cpuinfo.c +139 -0
- data/src/nginx/src/core/ngx_crc.h +39 -0
- data/src/nginx/src/core/ngx_crc32.c +129 -0
- data/src/nginx/src/core/ngx_crc32.h +79 -0
- data/src/nginx/src/core/ngx_crypt.c +238 -0
- data/src/nginx/src/core/ngx_crypt.h +20 -0
- data/src/nginx/src/core/ngx_cycle.c +1379 -0
- data/src/nginx/src/core/ngx_cycle.h +142 -0
- data/src/nginx/src/core/ngx_file.c +993 -0
- data/src/nginx/src/core/ngx_file.h +151 -0
- data/src/nginx/src/core/ngx_hash.c +976 -0
- data/src/nginx/src/core/ngx_hash.h +122 -0
- data/src/nginx/src/core/ngx_inet.c +1008 -0
- data/src/nginx/src/core/ngx_inet.h +120 -0
- data/src/nginx/src/core/ngx_list.c +71 -0
- data/src/nginx/src/core/ngx_list.h +83 -0
- data/src/nginx/src/core/ngx_log.c +459 -0
- data/src/nginx/src/core/ngx_log.h +250 -0
- data/src/nginx/src/core/ngx_md5.c +289 -0
- data/src/nginx/src/core/ngx_md5.h +60 -0
- data/src/nginx/src/core/ngx_murmurhash.c +50 -0
- data/src/nginx/src/core/ngx_murmurhash.h +19 -0
- data/src/nginx/src/core/ngx_open_file_cache.c +882 -0
- data/src/nginx/src/core/ngx_open_file_cache.h +119 -0
- data/src/nginx/src/core/ngx_output_chain.c +673 -0
- data/src/nginx/src/core/ngx_palloc.c +433 -0
- data/src/nginx/src/core/ngx_palloc.h +95 -0
- data/src/nginx/src/core/ngx_parse.c +249 -0
- data/src/nginx/src/core/ngx_parse.h +24 -0
- data/src/nginx/src/core/ngx_queue.c +80 -0
- data/src/nginx/src/core/ngx_queue.h +112 -0
- data/src/nginx/src/core/ngx_radix_tree.c +291 -0
- data/src/nginx/src/core/ngx_radix_tree.h +46 -0
- data/src/nginx/src/core/ngx_rbtree.c +383 -0
- data/src/nginx/src/core/ngx_rbtree.h +84 -0
- data/src/nginx/src/core/ngx_regex.c +206 -0
- data/src/nginx/src/core/ngx_regex.h +56 -0
- data/src/nginx/src/core/ngx_resolver.c +2201 -0
- data/src/nginx/src/core/ngx_resolver.h +149 -0
- data/src/nginx/src/core/ngx_sha1.h +31 -0
- data/src/nginx/src/core/ngx_shmtx.c +284 -0
- data/src/nginx/src/core/ngx_shmtx.h +38 -0
- data/src/nginx/src/core/ngx_slab.c +701 -0
- data/src/nginx/src/core/ngx_slab.h +54 -0
- data/src/nginx/src/core/ngx_spinlock.c +53 -0
- data/src/nginx/src/core/ngx_string.c +1837 -0
- data/src/nginx/src/core/ngx_string.h +231 -0
- data/src/nginx/src/core/ngx_times.c +407 -0
- data/src/nginx/src/core/ngx_times.h +51 -0
- data/src/nginx/src/event/modules/ngx_aio_module.c +171 -0
- data/src/nginx/src/event/modules/ngx_devpoll_module.c +569 -0
- data/src/nginx/src/event/modules/ngx_epoll_module.c +833 -0
- data/src/nginx/src/event/modules/ngx_eventport_module.c +602 -0
- data/src/nginx/src/event/modules/ngx_kqueue_module.c +785 -0
- data/src/nginx/src/event/modules/ngx_poll_module.c +443 -0
- data/src/nginx/src/event/modules/ngx_rtsig_module.c +735 -0
- data/src/nginx/src/event/modules/ngx_select_module.c +435 -0
- data/src/nginx/src/event/modules/ngx_win32_select_module.c +400 -0
- data/src/nginx/src/event/ngx_event.c +1275 -0
- data/src/nginx/src/event/ngx_event.h +573 -0
- data/src/nginx/src/event/ngx_event_accept.c +428 -0
- data/src/nginx/src/event/ngx_event_busy_lock.c +286 -0
- data/src/nginx/src/event/ngx_event_busy_lock.h +65 -0
- data/src/nginx/src/event/ngx_event_connect.c +258 -0
- data/src/nginx/src/event/ngx_event_connect.h +76 -0
- data/src/nginx/src/event/ngx_event_mutex.c +70 -0
- data/src/nginx/src/event/ngx_event_openssl.c +2382 -0
- data/src/nginx/src/event/ngx_event_openssl.h +162 -0
- data/src/nginx/src/event/ngx_event_pipe.c +996 -0
- data/src/nginx/src/event/ngx_event_pipe.h +95 -0
- data/src/nginx/src/event/ngx_event_posted.c +173 -0
- data/src/nginx/src/event/ngx_event_posted.h +75 -0
- data/src/nginx/src/event/ngx_event_timer.c +159 -0
- data/src/nginx/src/event/ngx_event_timer.h +102 -0
- data/src/nginx/src/http/modules/ngx_http_access_module.c +384 -0
- data/src/nginx/src/http/modules/ngx_http_addition_filter_module.c +250 -0
- data/src/nginx/src/http/modules/ngx_http_auth_basic_module.c +478 -0
- data/src/nginx/src/http/modules/ngx_http_autoindex_module.c +701 -0
- data/src/nginx/src/http/modules/ngx_http_browser_module.c +713 -0
- data/src/nginx/src/http/modules/ngx_http_charset_filter_module.c +1681 -0
- data/src/nginx/src/http/modules/ngx_http_chunked_filter_module.c +242 -0
- data/src/nginx/src/http/modules/ngx_http_dav_module.c +1141 -0
- data/src/nginx/src/http/modules/ngx_http_degradation_module.c +243 -0
- data/src/nginx/src/http/modules/ngx_http_empty_gif_module.c +140 -0
- data/src/nginx/src/http/modules/ngx_http_fastcgi_module.c +2916 -0
- data/src/nginx/src/http/modules/ngx_http_flv_module.c +254 -0
- data/src/nginx/src/http/modules/ngx_http_geo_module.c +1441 -0
- data/src/nginx/src/http/modules/ngx_http_geoip_module.c +671 -0
- data/src/nginx/src/http/modules/ngx_http_gzip_filter_module.c +1206 -0
- data/src/nginx/src/http/modules/ngx_http_gzip_static_module.c +299 -0
- data/src/nginx/src/http/modules/ngx_http_headers_filter_module.c +616 -0
- data/src/nginx/src/http/modules/ngx_http_image_filter_module.c +1489 -0
- data/src/nginx/src/http/modules/ngx_http_index_module.c +516 -0
- data/src/nginx/src/http/modules/ngx_http_limit_req_module.c +809 -0
- data/src/nginx/src/http/modules/ngx_http_limit_zone_module.c +553 -0
- data/src/nginx/src/http/modules/ngx_http_log_module.c +1357 -0
- data/src/nginx/src/http/modules/ngx_http_map_module.c +575 -0
- data/src/nginx/src/http/modules/ngx_http_memcached_module.c +624 -0
- data/src/nginx/src/http/modules/ngx_http_mp4_module.c +3000 -0
- data/src/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +143 -0
- data/src/nginx/src/http/modules/ngx_http_proxy_module.c +2831 -0
- data/src/nginx/src/http/modules/ngx_http_random_index_module.c +317 -0
- data/src/nginx/src/http/modules/ngx_http_range_filter_module.c +855 -0
- data/src/nginx/src/http/modules/ngx_http_realip_module.c +476 -0
- data/src/nginx/src/http/modules/ngx_http_referer_module.c +613 -0
- data/src/nginx/src/http/modules/ngx_http_rewrite_module.c +1019 -0
- data/src/nginx/src/http/modules/ngx_http_scgi_module.c +1714 -0
- data/src/nginx/src/http/modules/ngx_http_secure_link_module.c +355 -0
- data/src/nginx/src/http/modules/ngx_http_split_clients_module.c +242 -0
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.c +2913 -0
- data/src/nginx/src/http/modules/ngx_http_ssi_filter_module.h +114 -0
- data/src/nginx/src/http/modules/ngx_http_ssl_module.c +652 -0
- data/src/nginx/src/http/modules/ngx_http_ssl_module.h +52 -0
- data/src/nginx/src/http/modules/ngx_http_static_module.c +278 -0
- data/src/nginx/src/http/modules/ngx_http_stub_status_module.c +144 -0
- data/src/nginx/src/http/modules/ngx_http_sub_filter_module.c +716 -0
- data/src/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +237 -0
- data/src/nginx/src/http/modules/ngx_http_userid_filter_module.c +846 -0
- data/src/nginx/src/http/modules/ngx_http_uwsgi_module.c +1774 -0
- data/src/nginx/src/http/modules/ngx_http_xslt_filter_module.c +984 -0
- data/src/nginx/src/http/modules/perl/Makefile.PL +42 -0
- data/src/nginx/src/http/modules/perl/nginx.pm +137 -0
- data/src/nginx/src/http/modules/perl/nginx.xs +986 -0
- data/src/nginx/src/http/modules/perl/ngx_http_perl_module.c +1076 -0
- data/src/nginx/src/http/modules/perl/ngx_http_perl_module.h +67 -0
- data/src/nginx/src/http/modules/perl/typemap +3 -0
- data/src/nginx/src/http/ngx_http.c +2073 -0
- data/src/nginx/src/http/ngx_http.h +160 -0
- data/src/nginx/src/http/ngx_http_busy_lock.c +307 -0
- data/src/nginx/src/http/ngx_http_busy_lock.h +54 -0
- data/src/nginx/src/http/ngx_http_cache.h +148 -0
- data/src/nginx/src/http/ngx_http_config.h +75 -0
- data/src/nginx/src/http/ngx_http_copy_filter_module.c +300 -0
- data/src/nginx/src/http/ngx_http_core_module.c +4736 -0
- data/src/nginx/src/http/ngx_http_core_module.h +541 -0
- data/src/nginx/src/http/ngx_http_file_cache.c +1715 -0
- data/src/nginx/src/http/ngx_http_header_filter_module.c +623 -0
- data/src/nginx/src/http/ngx_http_parse.c +1734 -0
- data/src/nginx/src/http/ngx_http_parse_time.c +276 -0
- data/src/nginx/src/http/ngx_http_postpone_filter_module.c +178 -0
- data/src/nginx/src/http/ngx_http_request.c +3181 -0
- data/src/nginx/src/http/ngx_http_request.h +573 -0
- data/src/nginx/src/http/ngx_http_request_body.c +644 -0
- data/src/nginx/src/http/ngx_http_script.c +1752 -0
- data/src/nginx/src/http/ngx_http_script.h +257 -0
- data/src/nginx/src/http/ngx_http_special_response.c +789 -0
- data/src/nginx/src/http/ngx_http_upstream.c +4555 -0
- data/src/nginx/src/http/ngx_http_upstream.h +350 -0
- data/src/nginx/src/http/ngx_http_upstream_round_robin.c +791 -0
- data/src/nginx/src/http/ngx_http_upstream_round_robin.h +85 -0
- data/src/nginx/src/http/ngx_http_variables.c +2053 -0
- data/src/nginx/src/http/ngx_http_variables.h +115 -0
- data/src/nginx/src/http/ngx_http_write_filter_module.c +315 -0
- data/src/nginx/src/mail/ngx_mail.c +542 -0
- data/src/nginx/src/mail/ngx_mail.h +407 -0
- data/src/nginx/src/mail/ngx_mail_auth_http_module.c +1452 -0
- data/src/nginx/src/mail/ngx_mail_core_module.c +553 -0
- data/src/nginx/src/mail/ngx_mail_handler.c +773 -0
- data/src/nginx/src/mail/ngx_mail_imap_handler.c +457 -0
- data/src/nginx/src/mail/ngx_mail_imap_module.c +253 -0
- data/src/nginx/src/mail/ngx_mail_imap_module.h +39 -0
- data/src/nginx/src/mail/ngx_mail_parse.c +885 -0
- data/src/nginx/src/mail/ngx_mail_pop3_handler.c +500 -0
- data/src/nginx/src/mail/ngx_mail_pop3_module.c +264 -0
- data/src/nginx/src/mail/ngx_mail_pop3_module.h +38 -0
- data/src/nginx/src/mail/ngx_mail_proxy_module.c +1089 -0
- data/src/nginx/src/mail/ngx_mail_smtp_handler.c +872 -0
- data/src/nginx/src/mail/ngx_mail_smtp_module.c +308 -0
- data/src/nginx/src/mail/ngx_mail_smtp_module.h +45 -0
- data/src/nginx/src/mail/ngx_mail_ssl_module.c +491 -0
- data/src/nginx/src/mail/ngx_mail_ssl_module.h +52 -0
- data/src/nginx/src/misc/ngx_cpp_test_module.cpp +27 -0
- data/src/nginx/src/misc/ngx_google_perftools_module.c +126 -0
- data/src/nginx/src/os/unix/ngx_aio_read.c +109 -0
- data/src/nginx/src/os/unix/ngx_aio_read_chain.c +78 -0
- data/src/nginx/src/os/unix/ngx_aio_write.c +109 -0
- data/src/nginx/src/os/unix/ngx_aio_write_chain.c +100 -0
- data/src/nginx/src/os/unix/ngx_alloc.c +90 -0
- data/src/nginx/src/os/unix/ngx_alloc.h +45 -0
- data/src/nginx/src/os/unix/ngx_atomic.h +311 -0
- data/src/nginx/src/os/unix/ngx_channel.c +258 -0
- data/src/nginx/src/os/unix/ngx_channel.h +34 -0
- data/src/nginx/src/os/unix/ngx_daemon.c +69 -0
- data/src/nginx/src/os/unix/ngx_darwin.h +20 -0
- data/src/nginx/src/os/unix/ngx_darwin_config.h +96 -0
- data/src/nginx/src/os/unix/ngx_darwin_init.c +166 -0
- data/src/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +366 -0
- data/src/nginx/src/os/unix/ngx_errno.c +87 -0
- data/src/nginx/src/os/unix/ngx_errno.h +68 -0
- data/src/nginx/src/os/unix/ngx_file_aio_read.c +208 -0
- data/src/nginx/src/os/unix/ngx_files.c +566 -0
- data/src/nginx/src/os/unix/ngx_files.h +343 -0
- data/src/nginx/src/os/unix/ngx_freebsd.h +24 -0
- data/src/nginx/src/os/unix/ngx_freebsd_config.h +119 -0
- data/src/nginx/src/os/unix/ngx_freebsd_init.c +259 -0
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +756 -0
- data/src/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +122 -0
- data/src/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +436 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_amd64.h +82 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_ppc.h +155 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_sparc64.h +82 -0
- data/src/nginx/src/os/unix/ngx_gcc_atomic_x86.h +127 -0
- data/src/nginx/src/os/unix/ngx_linux.h +18 -0
- data/src/nginx/src/os/unix/ngx_linux_aio_read.c +137 -0
- data/src/nginx/src/os/unix/ngx_linux_config.h +117 -0
- data/src/nginx/src/os/unix/ngx_linux_init.c +91 -0
- data/src/nginx/src/os/unix/ngx_linux_sendfile_chain.c +378 -0
- data/src/nginx/src/os/unix/ngx_os.h +84 -0
- data/src/nginx/src/os/unix/ngx_posix_config.h +153 -0
- data/src/nginx/src/os/unix/ngx_posix_init.c +124 -0
- data/src/nginx/src/os/unix/ngx_process.c +590 -0
- data/src/nginx/src/os/unix/ngx_process.h +87 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.c +1390 -0
- data/src/nginx/src/os/unix/ngx_process_cycle.h +61 -0
- data/src/nginx/src/os/unix/ngx_pthread_thread.c +278 -0
- data/src/nginx/src/os/unix/ngx_readv_chain.c +258 -0
- data/src/nginx/src/os/unix/ngx_recv.c +180 -0
- data/src/nginx/src/os/unix/ngx_send.c +73 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.c +135 -0
- data/src/nginx/src/os/unix/ngx_setproctitle.h +52 -0
- data/src/nginx/src/os/unix/ngx_shmem.c +126 -0
- data/src/nginx/src/os/unix/ngx_shmem.h +29 -0
- data/src/nginx/src/os/unix/ngx_socket.c +116 -0
- data/src/nginx/src/os/unix/ngx_socket.h +64 -0
- data/src/nginx/src/os/unix/ngx_solaris.h +16 -0
- data/src/nginx/src/os/unix/ngx_solaris_config.h +107 -0
- data/src/nginx/src/os/unix/ngx_solaris_init.c +75 -0
- data/src/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +251 -0
- data/src/nginx/src/os/unix/ngx_sunpro_amd64.il +43 -0
- data/src/nginx/src/os/unix/ngx_sunpro_atomic_sparc64.h +61 -0
- data/src/nginx/src/os/unix/ngx_sunpro_sparc64.il +36 -0
- data/src/nginx/src/os/unix/ngx_sunpro_x86.il +44 -0
- data/src/nginx/src/os/unix/ngx_thread.h +128 -0
- data/src/nginx/src/os/unix/ngx_time.c +104 -0
- data/src/nginx/src/os/unix/ngx_time.h +66 -0
- data/src/nginx/src/os/unix/ngx_udp_recv.c +115 -0
- data/src/nginx/src/os/unix/ngx_user.c +109 -0
- data/src/nginx/src/os/unix/ngx_user.h +24 -0
- data/src/nginx/src/os/unix/ngx_writev_chain.c +181 -0
- data/src/nginx/src/os/unix/rfork_thread.S +73 -0
- metadata +419 -0
@@ -0,0 +1,355 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Nginx, Inc.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#include <ngx_config.h>
|
9
|
+
#include <ngx_core.h>
|
10
|
+
#include <ngx_http.h>
|
11
|
+
#include <ngx_md5.h>
|
12
|
+
|
13
|
+
|
14
|
+
typedef struct {
|
15
|
+
ngx_http_complex_value_t *variable;
|
16
|
+
ngx_http_complex_value_t *md5;
|
17
|
+
ngx_str_t secret;
|
18
|
+
} ngx_http_secure_link_conf_t;
|
19
|
+
|
20
|
+
|
21
|
+
typedef struct {
|
22
|
+
ngx_str_t expires;
|
23
|
+
} ngx_http_secure_link_ctx_t;
|
24
|
+
|
25
|
+
|
26
|
+
static ngx_int_t ngx_http_secure_link_old_variable(ngx_http_request_t *r,
|
27
|
+
ngx_http_secure_link_conf_t *conf, ngx_http_variable_value_t *v,
|
28
|
+
uintptr_t data);
|
29
|
+
static ngx_int_t ngx_http_secure_link_expires_variable(ngx_http_request_t *r,
|
30
|
+
ngx_http_variable_value_t *v, uintptr_t data);
|
31
|
+
static void *ngx_http_secure_link_create_conf(ngx_conf_t *cf);
|
32
|
+
static char *ngx_http_secure_link_merge_conf(ngx_conf_t *cf, void *parent,
|
33
|
+
void *child);
|
34
|
+
static ngx_int_t ngx_http_secure_link_add_variables(ngx_conf_t *cf);
|
35
|
+
|
36
|
+
|
37
|
+
static ngx_command_t ngx_http_secure_link_commands[] = {
|
38
|
+
|
39
|
+
{ ngx_string("secure_link"),
|
40
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
41
|
+
ngx_http_set_complex_value_slot,
|
42
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
43
|
+
offsetof(ngx_http_secure_link_conf_t, variable),
|
44
|
+
NULL },
|
45
|
+
|
46
|
+
{ ngx_string("secure_link_md5"),
|
47
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
48
|
+
ngx_http_set_complex_value_slot,
|
49
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
50
|
+
offsetof(ngx_http_secure_link_conf_t, md5),
|
51
|
+
NULL },
|
52
|
+
|
53
|
+
{ ngx_string("secure_link_secret"),
|
54
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
55
|
+
ngx_conf_set_str_slot,
|
56
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
57
|
+
offsetof(ngx_http_secure_link_conf_t, secret),
|
58
|
+
NULL },
|
59
|
+
|
60
|
+
ngx_null_command
|
61
|
+
};
|
62
|
+
|
63
|
+
|
64
|
+
static ngx_http_module_t ngx_http_secure_link_module_ctx = {
|
65
|
+
ngx_http_secure_link_add_variables, /* preconfiguration */
|
66
|
+
NULL, /* postconfiguration */
|
67
|
+
|
68
|
+
NULL, /* create main configuration */
|
69
|
+
NULL, /* init main configuration */
|
70
|
+
|
71
|
+
NULL, /* create server configuration */
|
72
|
+
NULL, /* merge server configuration */
|
73
|
+
|
74
|
+
ngx_http_secure_link_create_conf, /* create location configuration */
|
75
|
+
ngx_http_secure_link_merge_conf /* merge location configuration */
|
76
|
+
};
|
77
|
+
|
78
|
+
|
79
|
+
ngx_module_t ngx_http_secure_link_module = {
|
80
|
+
NGX_MODULE_V1,
|
81
|
+
&ngx_http_secure_link_module_ctx, /* module context */
|
82
|
+
ngx_http_secure_link_commands, /* module directives */
|
83
|
+
NGX_HTTP_MODULE, /* module type */
|
84
|
+
NULL, /* init master */
|
85
|
+
NULL, /* init module */
|
86
|
+
NULL, /* init process */
|
87
|
+
NULL, /* init thread */
|
88
|
+
NULL, /* exit thread */
|
89
|
+
NULL, /* exit process */
|
90
|
+
NULL, /* exit master */
|
91
|
+
NGX_MODULE_V1_PADDING
|
92
|
+
};
|
93
|
+
|
94
|
+
|
95
|
+
static ngx_str_t ngx_http_secure_link_name = ngx_string("secure_link");
|
96
|
+
static ngx_str_t ngx_http_secure_link_expires_name =
|
97
|
+
ngx_string("secure_link_expires");
|
98
|
+
|
99
|
+
|
100
|
+
static ngx_int_t
|
101
|
+
ngx_http_secure_link_variable(ngx_http_request_t *r,
|
102
|
+
ngx_http_variable_value_t *v, uintptr_t data)
|
103
|
+
{
|
104
|
+
u_char *p, *last;
|
105
|
+
ngx_str_t val, hash;
|
106
|
+
time_t expires;
|
107
|
+
ngx_md5_t md5;
|
108
|
+
ngx_http_secure_link_ctx_t *ctx;
|
109
|
+
ngx_http_secure_link_conf_t *conf;
|
110
|
+
u_char hash_buf[16], md5_buf[16];
|
111
|
+
|
112
|
+
conf = ngx_http_get_module_loc_conf(r, ngx_http_secure_link_module);
|
113
|
+
|
114
|
+
if (conf->secret.len) {
|
115
|
+
return ngx_http_secure_link_old_variable(r, conf, v, data);
|
116
|
+
}
|
117
|
+
|
118
|
+
if (conf->variable == NULL || conf->md5 == NULL) {
|
119
|
+
goto not_found;
|
120
|
+
}
|
121
|
+
|
122
|
+
if (ngx_http_complex_value(r, conf->variable, &val) != NGX_OK) {
|
123
|
+
return NGX_ERROR;
|
124
|
+
}
|
125
|
+
|
126
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
127
|
+
"secure link: \"%V\"", &val);
|
128
|
+
|
129
|
+
last = val.data + val.len;
|
130
|
+
|
131
|
+
p = ngx_strlchr(val.data, last, ',');
|
132
|
+
expires = 0;
|
133
|
+
|
134
|
+
if (p) {
|
135
|
+
val.len = p++ - val.data;
|
136
|
+
|
137
|
+
expires = ngx_atotm(p, last - p);
|
138
|
+
if (expires <= 0) {
|
139
|
+
goto not_found;
|
140
|
+
}
|
141
|
+
|
142
|
+
ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_secure_link_ctx_t));
|
143
|
+
if (ctx == NULL) {
|
144
|
+
return NGX_ERROR;
|
145
|
+
}
|
146
|
+
|
147
|
+
ngx_http_set_ctx(r, ctx, ngx_http_secure_link_module);
|
148
|
+
|
149
|
+
ctx->expires.len = last - p;
|
150
|
+
ctx->expires.data = p;
|
151
|
+
}
|
152
|
+
|
153
|
+
if (val.len > 24) {
|
154
|
+
goto not_found;
|
155
|
+
}
|
156
|
+
|
157
|
+
hash.len = 16;
|
158
|
+
hash.data = hash_buf;
|
159
|
+
|
160
|
+
if (ngx_decode_base64url(&hash, &val) != NGX_OK) {
|
161
|
+
goto not_found;
|
162
|
+
}
|
163
|
+
|
164
|
+
if (hash.len != 16) {
|
165
|
+
goto not_found;
|
166
|
+
}
|
167
|
+
|
168
|
+
if (ngx_http_complex_value(r, conf->md5, &val) != NGX_OK) {
|
169
|
+
return NGX_ERROR;
|
170
|
+
}
|
171
|
+
|
172
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
173
|
+
"secure link md5: \"%V\"", &val);
|
174
|
+
|
175
|
+
ngx_md5_init(&md5);
|
176
|
+
ngx_md5_update(&md5, val.data, val.len);
|
177
|
+
ngx_md5_final(md5_buf, &md5);
|
178
|
+
|
179
|
+
if (ngx_memcmp(hash_buf, md5_buf, 16) != 0) {
|
180
|
+
goto not_found;
|
181
|
+
}
|
182
|
+
|
183
|
+
v->data = (u_char *) ((expires && expires < ngx_time()) ? "0" : "1");
|
184
|
+
v->len = 1;
|
185
|
+
v->valid = 1;
|
186
|
+
v->no_cacheable = 0;
|
187
|
+
v->not_found = 0;
|
188
|
+
|
189
|
+
return NGX_OK;
|
190
|
+
|
191
|
+
not_found:
|
192
|
+
|
193
|
+
v->not_found = 1;
|
194
|
+
|
195
|
+
return NGX_OK;
|
196
|
+
}
|
197
|
+
|
198
|
+
|
199
|
+
static ngx_int_t
|
200
|
+
ngx_http_secure_link_old_variable(ngx_http_request_t *r,
|
201
|
+
ngx_http_secure_link_conf_t *conf, ngx_http_variable_value_t *v,
|
202
|
+
uintptr_t data)
|
203
|
+
{
|
204
|
+
u_char *p, *start, *end, *last;
|
205
|
+
size_t len;
|
206
|
+
ngx_int_t n;
|
207
|
+
ngx_uint_t i;
|
208
|
+
ngx_md5_t md5;
|
209
|
+
u_char hash[16];
|
210
|
+
|
211
|
+
p = &r->unparsed_uri.data[1];
|
212
|
+
last = r->unparsed_uri.data + r->unparsed_uri.len;
|
213
|
+
|
214
|
+
while (p < last) {
|
215
|
+
if (*p++ == '/') {
|
216
|
+
start = p;
|
217
|
+
goto md5_start;
|
218
|
+
}
|
219
|
+
}
|
220
|
+
|
221
|
+
goto not_found;
|
222
|
+
|
223
|
+
md5_start:
|
224
|
+
|
225
|
+
while (p < last) {
|
226
|
+
if (*p++ == '/') {
|
227
|
+
end = p - 1;
|
228
|
+
goto url_start;
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
232
|
+
goto not_found;
|
233
|
+
|
234
|
+
url_start:
|
235
|
+
|
236
|
+
len = last - p;
|
237
|
+
|
238
|
+
if (end - start != 32 || len == 0) {
|
239
|
+
goto not_found;
|
240
|
+
}
|
241
|
+
|
242
|
+
ngx_md5_init(&md5);
|
243
|
+
ngx_md5_update(&md5, p, len);
|
244
|
+
ngx_md5_update(&md5, conf->secret.data, conf->secret.len);
|
245
|
+
ngx_md5_final(hash, &md5);
|
246
|
+
|
247
|
+
for (i = 0; i < 16; i++) {
|
248
|
+
n = ngx_hextoi(&start[2 * i], 2);
|
249
|
+
if (n == NGX_ERROR || n != hash[i]) {
|
250
|
+
goto not_found;
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
v->len = len;
|
255
|
+
v->valid = 1;
|
256
|
+
v->no_cacheable = 0;
|
257
|
+
v->not_found = 0;
|
258
|
+
v->data = p;
|
259
|
+
|
260
|
+
return NGX_OK;
|
261
|
+
|
262
|
+
not_found:
|
263
|
+
|
264
|
+
v->not_found = 1;
|
265
|
+
|
266
|
+
return NGX_OK;
|
267
|
+
}
|
268
|
+
|
269
|
+
|
270
|
+
static ngx_int_t
|
271
|
+
ngx_http_secure_link_expires_variable(ngx_http_request_t *r,
|
272
|
+
ngx_http_variable_value_t *v, uintptr_t data)
|
273
|
+
{
|
274
|
+
ngx_http_secure_link_ctx_t *ctx;
|
275
|
+
|
276
|
+
ctx = ngx_http_get_module_ctx(r, ngx_http_secure_link_module);
|
277
|
+
|
278
|
+
if (ctx) {
|
279
|
+
v->len = ctx->expires.len;
|
280
|
+
v->valid = 1;
|
281
|
+
v->no_cacheable = 0;
|
282
|
+
v->not_found = 0;
|
283
|
+
v->data = ctx->expires.data;
|
284
|
+
|
285
|
+
} else {
|
286
|
+
v->not_found = 1;
|
287
|
+
}
|
288
|
+
|
289
|
+
return NGX_OK;
|
290
|
+
}
|
291
|
+
|
292
|
+
|
293
|
+
static void *
|
294
|
+
ngx_http_secure_link_create_conf(ngx_conf_t *cf)
|
295
|
+
{
|
296
|
+
ngx_http_secure_link_conf_t *conf;
|
297
|
+
|
298
|
+
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_secure_link_conf_t));
|
299
|
+
if (conf == NULL) {
|
300
|
+
return NULL;
|
301
|
+
}
|
302
|
+
|
303
|
+
/*
|
304
|
+
* set by ngx_pcalloc():
|
305
|
+
*
|
306
|
+
* conf->variable = NULL;
|
307
|
+
* conf->md5 = NULL;
|
308
|
+
* conf->secret = { 0, NULL };
|
309
|
+
*/
|
310
|
+
|
311
|
+
return conf;
|
312
|
+
}
|
313
|
+
|
314
|
+
|
315
|
+
static char *
|
316
|
+
ngx_http_secure_link_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
317
|
+
{
|
318
|
+
ngx_http_secure_link_conf_t *prev = parent;
|
319
|
+
ngx_http_secure_link_conf_t *conf = child;
|
320
|
+
|
321
|
+
ngx_conf_merge_str_value(conf->secret, prev->secret, "");
|
322
|
+
|
323
|
+
if (conf->variable == NULL) {
|
324
|
+
conf->variable = prev->variable;
|
325
|
+
}
|
326
|
+
|
327
|
+
if (conf->md5 == NULL) {
|
328
|
+
conf->md5 = prev->md5;
|
329
|
+
}
|
330
|
+
|
331
|
+
return NGX_CONF_OK;
|
332
|
+
}
|
333
|
+
|
334
|
+
|
335
|
+
static ngx_int_t
|
336
|
+
ngx_http_secure_link_add_variables(ngx_conf_t *cf)
|
337
|
+
{
|
338
|
+
ngx_http_variable_t *var;
|
339
|
+
|
340
|
+
var = ngx_http_add_variable(cf, &ngx_http_secure_link_name, 0);
|
341
|
+
if (var == NULL) {
|
342
|
+
return NGX_ERROR;
|
343
|
+
}
|
344
|
+
|
345
|
+
var->get_handler = ngx_http_secure_link_variable;
|
346
|
+
|
347
|
+
var = ngx_http_add_variable(cf, &ngx_http_secure_link_expires_name, 0);
|
348
|
+
if (var == NULL) {
|
349
|
+
return NGX_ERROR;
|
350
|
+
}
|
351
|
+
|
352
|
+
var->get_handler = ngx_http_secure_link_expires_variable;
|
353
|
+
|
354
|
+
return NGX_OK;
|
355
|
+
}
|
@@ -0,0 +1,242 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Nginx, Inc.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#include <ngx_config.h>
|
9
|
+
#include <ngx_core.h>
|
10
|
+
#include <ngx_http.h>
|
11
|
+
|
12
|
+
|
13
|
+
typedef struct {
|
14
|
+
uint32_t percent;
|
15
|
+
ngx_http_variable_value_t value;
|
16
|
+
} ngx_http_split_clients_part_t;
|
17
|
+
|
18
|
+
|
19
|
+
typedef struct {
|
20
|
+
ngx_http_complex_value_t value;
|
21
|
+
ngx_array_t parts;
|
22
|
+
} ngx_http_split_clients_ctx_t;
|
23
|
+
|
24
|
+
|
25
|
+
static char *ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd,
|
26
|
+
void *conf);
|
27
|
+
static char *ngx_http_split_clients(ngx_conf_t *cf, ngx_command_t *dummy,
|
28
|
+
void *conf);
|
29
|
+
|
30
|
+
static ngx_command_t ngx_http_split_clients_commands[] = {
|
31
|
+
|
32
|
+
{ ngx_string("split_clients"),
|
33
|
+
NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE2,
|
34
|
+
ngx_conf_split_clients_block,
|
35
|
+
NGX_HTTP_MAIN_CONF_OFFSET,
|
36
|
+
0,
|
37
|
+
NULL },
|
38
|
+
|
39
|
+
ngx_null_command
|
40
|
+
};
|
41
|
+
|
42
|
+
|
43
|
+
static ngx_http_module_t ngx_http_split_clients_module_ctx = {
|
44
|
+
NULL, /* preconfiguration */
|
45
|
+
NULL, /* postconfiguration */
|
46
|
+
|
47
|
+
NULL, /* create main configuration */
|
48
|
+
NULL, /* init main configuration */
|
49
|
+
|
50
|
+
NULL, /* create server configuration */
|
51
|
+
NULL, /* merge server configuration */
|
52
|
+
|
53
|
+
NULL, /* create location configuration */
|
54
|
+
NULL /* merge location configuration */
|
55
|
+
};
|
56
|
+
|
57
|
+
|
58
|
+
ngx_module_t ngx_http_split_clients_module = {
|
59
|
+
NGX_MODULE_V1,
|
60
|
+
&ngx_http_split_clients_module_ctx, /* module context */
|
61
|
+
ngx_http_split_clients_commands, /* module directives */
|
62
|
+
NGX_HTTP_MODULE, /* module type */
|
63
|
+
NULL, /* init master */
|
64
|
+
NULL, /* init module */
|
65
|
+
NULL, /* init process */
|
66
|
+
NULL, /* init thread */
|
67
|
+
NULL, /* exit thread */
|
68
|
+
NULL, /* exit process */
|
69
|
+
NULL, /* exit master */
|
70
|
+
NGX_MODULE_V1_PADDING
|
71
|
+
};
|
72
|
+
|
73
|
+
|
74
|
+
static ngx_int_t
|
75
|
+
ngx_http_split_clients_variable(ngx_http_request_t *r,
|
76
|
+
ngx_http_variable_value_t *v, uintptr_t data)
|
77
|
+
{
|
78
|
+
ngx_http_split_clients_ctx_t *ctx = (ngx_http_split_clients_ctx_t *) data;
|
79
|
+
|
80
|
+
uint32_t hash;
|
81
|
+
ngx_str_t val;
|
82
|
+
ngx_uint_t i;
|
83
|
+
ngx_http_split_clients_part_t *part;
|
84
|
+
|
85
|
+
*v = ngx_http_variable_null_value;
|
86
|
+
|
87
|
+
if (ngx_http_complex_value(r, &ctx->value, &val) != NGX_OK) {
|
88
|
+
return NGX_OK;
|
89
|
+
}
|
90
|
+
|
91
|
+
hash = ngx_murmur_hash2(val.data, val.len);
|
92
|
+
|
93
|
+
part = ctx->parts.elts;
|
94
|
+
|
95
|
+
for (i = 0; i < ctx->parts.nelts; i++) {
|
96
|
+
|
97
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
98
|
+
"http split: %uD %uD", hash, part[i].percent);
|
99
|
+
|
100
|
+
if (hash < part[i].percent) {
|
101
|
+
*v = part[i].value;
|
102
|
+
return NGX_OK;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
|
106
|
+
return NGX_OK;
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
static char *
|
111
|
+
ngx_conf_split_clients_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
112
|
+
{
|
113
|
+
char *rv;
|
114
|
+
ngx_str_t *value, name;
|
115
|
+
ngx_uint_t i, sum, last;
|
116
|
+
ngx_conf_t save;
|
117
|
+
ngx_http_variable_t *var;
|
118
|
+
ngx_http_split_clients_ctx_t *ctx;
|
119
|
+
ngx_http_split_clients_part_t *part;
|
120
|
+
ngx_http_compile_complex_value_t ccv;
|
121
|
+
|
122
|
+
ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_split_clients_ctx_t));
|
123
|
+
if (ctx == NULL) {
|
124
|
+
return NGX_CONF_ERROR;
|
125
|
+
}
|
126
|
+
|
127
|
+
value = cf->args->elts;
|
128
|
+
|
129
|
+
ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
|
130
|
+
|
131
|
+
ccv.cf = cf;
|
132
|
+
ccv.value = &value[1];
|
133
|
+
ccv.complex_value = &ctx->value;
|
134
|
+
|
135
|
+
if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
|
136
|
+
return NGX_CONF_ERROR;
|
137
|
+
}
|
138
|
+
|
139
|
+
name = value[2];
|
140
|
+
name.len--;
|
141
|
+
name.data++;
|
142
|
+
|
143
|
+
var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE);
|
144
|
+
if (var == NULL) {
|
145
|
+
return NGX_CONF_ERROR;
|
146
|
+
}
|
147
|
+
|
148
|
+
var->get_handler = ngx_http_split_clients_variable;
|
149
|
+
var->data = (uintptr_t) ctx;
|
150
|
+
|
151
|
+
if (ngx_array_init(&ctx->parts, cf->pool, 2,
|
152
|
+
sizeof(ngx_http_split_clients_part_t))
|
153
|
+
!= NGX_OK)
|
154
|
+
{
|
155
|
+
return NGX_CONF_ERROR;
|
156
|
+
}
|
157
|
+
|
158
|
+
save = *cf;
|
159
|
+
cf->ctx = ctx;
|
160
|
+
cf->handler = ngx_http_split_clients;
|
161
|
+
cf->handler_conf = conf;
|
162
|
+
|
163
|
+
rv = ngx_conf_parse(cf, NULL);
|
164
|
+
|
165
|
+
*cf = save;
|
166
|
+
|
167
|
+
if (rv != NGX_CONF_OK) {
|
168
|
+
return rv;
|
169
|
+
}
|
170
|
+
|
171
|
+
sum = 0;
|
172
|
+
last = 0;
|
173
|
+
part = ctx->parts.elts;
|
174
|
+
|
175
|
+
for (i = 0; i < ctx->parts.nelts; i++) {
|
176
|
+
sum = part[i].percent ? sum + part[i].percent : 10000;
|
177
|
+
if (sum > 10000) {
|
178
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
179
|
+
"percent sum is more than 100%%");
|
180
|
+
return NGX_CONF_ERROR;
|
181
|
+
}
|
182
|
+
|
183
|
+
if (part[i].percent) {
|
184
|
+
part[i].percent = (uint32_t)
|
185
|
+
(last + 0xffffffff / 10000 * part[i].percent);
|
186
|
+
} else {
|
187
|
+
part[i].percent = 0xffffffff;
|
188
|
+
}
|
189
|
+
|
190
|
+
last = part[i].percent;
|
191
|
+
}
|
192
|
+
|
193
|
+
return rv;
|
194
|
+
}
|
195
|
+
|
196
|
+
|
197
|
+
static char *
|
198
|
+
ngx_http_split_clients(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
|
199
|
+
{
|
200
|
+
ngx_int_t n;
|
201
|
+
ngx_str_t *value;
|
202
|
+
ngx_http_split_clients_ctx_t *ctx;
|
203
|
+
ngx_http_split_clients_part_t *part;
|
204
|
+
|
205
|
+
ctx = cf->ctx;
|
206
|
+
value = cf->args->elts;
|
207
|
+
|
208
|
+
part = ngx_array_push(&ctx->parts);
|
209
|
+
if (part == NULL) {
|
210
|
+
return NGX_CONF_ERROR;
|
211
|
+
}
|
212
|
+
|
213
|
+
if (value[0].len == 1 && value[0].data[0] == '*') {
|
214
|
+
part->percent = 0;
|
215
|
+
|
216
|
+
} else {
|
217
|
+
if (value[0].data[value[0].len - 1] != '%') {
|
218
|
+
goto invalid;
|
219
|
+
}
|
220
|
+
|
221
|
+
n = ngx_atofp(value[0].data, value[0].len - 1, 2);
|
222
|
+
if (n == NGX_ERROR || n == 0) {
|
223
|
+
goto invalid;
|
224
|
+
}
|
225
|
+
|
226
|
+
part->percent = (uint32_t) n;
|
227
|
+
}
|
228
|
+
|
229
|
+
part->value.len = value[1].len;
|
230
|
+
part->value.valid = 1;
|
231
|
+
part->value.no_cacheable = 0;
|
232
|
+
part->value.not_found = 0;
|
233
|
+
part->value.data = value[1].data;
|
234
|
+
|
235
|
+
return NGX_CONF_OK;
|
236
|
+
|
237
|
+
invalid:
|
238
|
+
|
239
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
240
|
+
"invalid percent value \"%V\"", &value[0]);
|
241
|
+
return NGX_CONF_ERROR;
|
242
|
+
}
|