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,1506 @@
|
|
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
|
+
|
11
|
+
#define NGX_CONF_BUFFER 4096
|
12
|
+
|
13
|
+
static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last);
|
14
|
+
static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf);
|
15
|
+
static char *ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
16
|
+
static ngx_int_t ngx_conf_test_full_name(ngx_str_t *name);
|
17
|
+
static void ngx_conf_flush_files(ngx_cycle_t *cycle);
|
18
|
+
|
19
|
+
|
20
|
+
static ngx_command_t ngx_conf_commands[] = {
|
21
|
+
|
22
|
+
{ ngx_string("include"),
|
23
|
+
NGX_ANY_CONF|NGX_CONF_TAKE1,
|
24
|
+
ngx_conf_include,
|
25
|
+
0,
|
26
|
+
0,
|
27
|
+
NULL },
|
28
|
+
|
29
|
+
ngx_null_command
|
30
|
+
};
|
31
|
+
|
32
|
+
|
33
|
+
ngx_module_t ngx_conf_module = {
|
34
|
+
NGX_MODULE_V1,
|
35
|
+
NULL, /* module context */
|
36
|
+
ngx_conf_commands, /* module directives */
|
37
|
+
NGX_CONF_MODULE, /* module type */
|
38
|
+
NULL, /* init master */
|
39
|
+
NULL, /* init module */
|
40
|
+
NULL, /* init process */
|
41
|
+
NULL, /* init thread */
|
42
|
+
NULL, /* exit thread */
|
43
|
+
ngx_conf_flush_files, /* exit process */
|
44
|
+
NULL, /* exit master */
|
45
|
+
NGX_MODULE_V1_PADDING
|
46
|
+
};
|
47
|
+
|
48
|
+
|
49
|
+
/* The eight fixed arguments */
|
50
|
+
|
51
|
+
static ngx_uint_t argument_number[] = {
|
52
|
+
NGX_CONF_NOARGS,
|
53
|
+
NGX_CONF_TAKE1,
|
54
|
+
NGX_CONF_TAKE2,
|
55
|
+
NGX_CONF_TAKE3,
|
56
|
+
NGX_CONF_TAKE4,
|
57
|
+
NGX_CONF_TAKE5,
|
58
|
+
NGX_CONF_TAKE6,
|
59
|
+
NGX_CONF_TAKE7
|
60
|
+
};
|
61
|
+
|
62
|
+
|
63
|
+
char *
|
64
|
+
ngx_conf_param(ngx_conf_t *cf)
|
65
|
+
{
|
66
|
+
char *rv;
|
67
|
+
ngx_str_t *param;
|
68
|
+
ngx_buf_t b;
|
69
|
+
ngx_conf_file_t conf_file;
|
70
|
+
|
71
|
+
param = &cf->cycle->conf_param;
|
72
|
+
|
73
|
+
if (param->len == 0) {
|
74
|
+
return NGX_CONF_OK;
|
75
|
+
}
|
76
|
+
|
77
|
+
ngx_memzero(&conf_file, sizeof(ngx_conf_file_t));
|
78
|
+
|
79
|
+
ngx_memzero(&b, sizeof(ngx_buf_t));
|
80
|
+
|
81
|
+
b.start = param->data;
|
82
|
+
b.pos = param->data;
|
83
|
+
b.last = param->data + param->len;
|
84
|
+
b.end = b.last;
|
85
|
+
b.temporary = 1;
|
86
|
+
|
87
|
+
conf_file.file.fd = NGX_INVALID_FILE;
|
88
|
+
conf_file.file.name.data = NULL;
|
89
|
+
conf_file.line = 0;
|
90
|
+
|
91
|
+
cf->conf_file = &conf_file;
|
92
|
+
cf->conf_file->buffer = &b;
|
93
|
+
|
94
|
+
rv = ngx_conf_parse(cf, NULL);
|
95
|
+
|
96
|
+
cf->conf_file = NULL;
|
97
|
+
|
98
|
+
return rv;
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
char *
|
103
|
+
ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
|
104
|
+
{
|
105
|
+
char *rv;
|
106
|
+
ngx_fd_t fd;
|
107
|
+
ngx_int_t rc;
|
108
|
+
ngx_buf_t buf;
|
109
|
+
ngx_conf_file_t *prev, conf_file;
|
110
|
+
enum {
|
111
|
+
parse_file = 0,
|
112
|
+
parse_block,
|
113
|
+
parse_param
|
114
|
+
} type;
|
115
|
+
|
116
|
+
#if (NGX_SUPPRESS_WARN)
|
117
|
+
fd = NGX_INVALID_FILE;
|
118
|
+
prev = NULL;
|
119
|
+
#endif
|
120
|
+
|
121
|
+
if (filename) {
|
122
|
+
|
123
|
+
/* open configuration file */
|
124
|
+
|
125
|
+
fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
|
126
|
+
if (fd == NGX_INVALID_FILE) {
|
127
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
|
128
|
+
ngx_open_file_n " \"%s\" failed",
|
129
|
+
filename->data);
|
130
|
+
return NGX_CONF_ERROR;
|
131
|
+
}
|
132
|
+
|
133
|
+
prev = cf->conf_file;
|
134
|
+
|
135
|
+
cf->conf_file = &conf_file;
|
136
|
+
|
137
|
+
if (ngx_fd_info(fd, &cf->conf_file->file.info) == -1) {
|
138
|
+
ngx_log_error(NGX_LOG_EMERG, cf->log, ngx_errno,
|
139
|
+
ngx_fd_info_n " \"%s\" failed", filename->data);
|
140
|
+
}
|
141
|
+
|
142
|
+
cf->conf_file->buffer = &buf;
|
143
|
+
|
144
|
+
buf.start = ngx_alloc(NGX_CONF_BUFFER, cf->log);
|
145
|
+
if (buf.start == NULL) {
|
146
|
+
goto failed;
|
147
|
+
}
|
148
|
+
|
149
|
+
buf.pos = buf.start;
|
150
|
+
buf.last = buf.start;
|
151
|
+
buf.end = buf.last + NGX_CONF_BUFFER;
|
152
|
+
buf.temporary = 1;
|
153
|
+
|
154
|
+
cf->conf_file->file.fd = fd;
|
155
|
+
cf->conf_file->file.name.len = filename->len;
|
156
|
+
cf->conf_file->file.name.data = filename->data;
|
157
|
+
cf->conf_file->file.offset = 0;
|
158
|
+
cf->conf_file->file.log = cf->log;
|
159
|
+
cf->conf_file->line = 1;
|
160
|
+
|
161
|
+
type = parse_file;
|
162
|
+
|
163
|
+
} else if (cf->conf_file->file.fd != NGX_INVALID_FILE) {
|
164
|
+
|
165
|
+
type = parse_block;
|
166
|
+
|
167
|
+
} else {
|
168
|
+
type = parse_param;
|
169
|
+
}
|
170
|
+
|
171
|
+
|
172
|
+
for ( ;; ) {
|
173
|
+
rc = ngx_conf_read_token(cf);
|
174
|
+
|
175
|
+
/*
|
176
|
+
* ngx_conf_read_token() may return
|
177
|
+
*
|
178
|
+
* NGX_ERROR there is error
|
179
|
+
* NGX_OK the token terminated by ";" was found
|
180
|
+
* NGX_CONF_BLOCK_START the token terminated by "{" was found
|
181
|
+
* NGX_CONF_BLOCK_DONE the "}" was found
|
182
|
+
* NGX_CONF_FILE_DONE the configuration file is done
|
183
|
+
*/
|
184
|
+
|
185
|
+
if (rc == NGX_ERROR) {
|
186
|
+
goto done;
|
187
|
+
}
|
188
|
+
|
189
|
+
if (rc == NGX_CONF_BLOCK_DONE) {
|
190
|
+
|
191
|
+
if (type != parse_block) {
|
192
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unexpected \"}\"");
|
193
|
+
goto failed;
|
194
|
+
}
|
195
|
+
|
196
|
+
goto done;
|
197
|
+
}
|
198
|
+
|
199
|
+
if (rc == NGX_CONF_FILE_DONE) {
|
200
|
+
|
201
|
+
if (type == parse_block) {
|
202
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
203
|
+
"unexpected end of file, expecting \"}\"");
|
204
|
+
goto failed;
|
205
|
+
}
|
206
|
+
|
207
|
+
goto done;
|
208
|
+
}
|
209
|
+
|
210
|
+
if (rc == NGX_CONF_BLOCK_START) {
|
211
|
+
|
212
|
+
if (type == parse_param) {
|
213
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
214
|
+
"block directives are not supported "
|
215
|
+
"in -g option");
|
216
|
+
goto failed;
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
220
|
+
/* rc == NGX_OK || rc == NGX_CONF_BLOCK_START */
|
221
|
+
|
222
|
+
if (cf->handler) {
|
223
|
+
|
224
|
+
/*
|
225
|
+
* the custom handler, i.e., that is used in the http's
|
226
|
+
* "types { ... }" directive
|
227
|
+
*/
|
228
|
+
|
229
|
+
rv = (*cf->handler)(cf, NULL, cf->handler_conf);
|
230
|
+
if (rv == NGX_CONF_OK) {
|
231
|
+
continue;
|
232
|
+
}
|
233
|
+
|
234
|
+
if (rv == NGX_CONF_ERROR) {
|
235
|
+
goto failed;
|
236
|
+
}
|
237
|
+
|
238
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, rv);
|
239
|
+
|
240
|
+
goto failed;
|
241
|
+
}
|
242
|
+
|
243
|
+
|
244
|
+
rc = ngx_conf_handler(cf, rc);
|
245
|
+
|
246
|
+
if (rc == NGX_ERROR) {
|
247
|
+
goto failed;
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
failed:
|
252
|
+
|
253
|
+
rc = NGX_ERROR;
|
254
|
+
|
255
|
+
done:
|
256
|
+
|
257
|
+
if (filename) {
|
258
|
+
if (cf->conf_file->buffer->start) {
|
259
|
+
ngx_free(cf->conf_file->buffer->start);
|
260
|
+
}
|
261
|
+
|
262
|
+
if (ngx_close_file(fd) == NGX_FILE_ERROR) {
|
263
|
+
ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
|
264
|
+
ngx_close_file_n " %s failed",
|
265
|
+
filename->data);
|
266
|
+
return NGX_CONF_ERROR;
|
267
|
+
}
|
268
|
+
|
269
|
+
cf->conf_file = prev;
|
270
|
+
}
|
271
|
+
|
272
|
+
if (rc == NGX_ERROR) {
|
273
|
+
return NGX_CONF_ERROR;
|
274
|
+
}
|
275
|
+
|
276
|
+
return NGX_CONF_OK;
|
277
|
+
}
|
278
|
+
|
279
|
+
|
280
|
+
static ngx_int_t
|
281
|
+
ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last)
|
282
|
+
{
|
283
|
+
char *rv;
|
284
|
+
void *conf, **confp;
|
285
|
+
ngx_uint_t i, multi;
|
286
|
+
ngx_str_t *name;
|
287
|
+
ngx_command_t *cmd;
|
288
|
+
|
289
|
+
name = cf->args->elts;
|
290
|
+
|
291
|
+
multi = 0;
|
292
|
+
|
293
|
+
for (i = 0; ngx_modules[i]; i++) {
|
294
|
+
|
295
|
+
/* look up the directive in the appropriate modules */
|
296
|
+
|
297
|
+
if (ngx_modules[i]->type != NGX_CONF_MODULE
|
298
|
+
&& ngx_modules[i]->type != cf->module_type)
|
299
|
+
{
|
300
|
+
continue;
|
301
|
+
}
|
302
|
+
|
303
|
+
cmd = ngx_modules[i]->commands;
|
304
|
+
if (cmd == NULL) {
|
305
|
+
continue;
|
306
|
+
}
|
307
|
+
|
308
|
+
for ( /* void */ ; cmd->name.len; cmd++) {
|
309
|
+
|
310
|
+
if (name->len != cmd->name.len) {
|
311
|
+
continue;
|
312
|
+
}
|
313
|
+
|
314
|
+
if (ngx_strcmp(name->data, cmd->name.data) != 0) {
|
315
|
+
continue;
|
316
|
+
}
|
317
|
+
|
318
|
+
|
319
|
+
/* is the directive's location right ? */
|
320
|
+
|
321
|
+
if (!(cmd->type & cf->cmd_type)) {
|
322
|
+
if (cmd->type & NGX_CONF_MULTI) {
|
323
|
+
multi = 1;
|
324
|
+
continue;
|
325
|
+
}
|
326
|
+
|
327
|
+
goto not_allowed;
|
328
|
+
}
|
329
|
+
|
330
|
+
if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) {
|
331
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
332
|
+
"directive \"%s\" is not terminated by \";\"",
|
333
|
+
name->data);
|
334
|
+
return NGX_ERROR;
|
335
|
+
}
|
336
|
+
|
337
|
+
if ((cmd->type & NGX_CONF_BLOCK) && last != NGX_CONF_BLOCK_START) {
|
338
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
339
|
+
"directive \"%s\" has no opening \"{\"",
|
340
|
+
name->data);
|
341
|
+
return NGX_ERROR;
|
342
|
+
}
|
343
|
+
|
344
|
+
/* is the directive's argument count right ? */
|
345
|
+
|
346
|
+
if (!(cmd->type & NGX_CONF_ANY)) {
|
347
|
+
|
348
|
+
if (cmd->type & NGX_CONF_FLAG) {
|
349
|
+
|
350
|
+
if (cf->args->nelts != 2) {
|
351
|
+
goto invalid;
|
352
|
+
}
|
353
|
+
|
354
|
+
} else if (cmd->type & NGX_CONF_1MORE) {
|
355
|
+
|
356
|
+
if (cf->args->nelts < 2) {
|
357
|
+
goto invalid;
|
358
|
+
}
|
359
|
+
|
360
|
+
} else if (cmd->type & NGX_CONF_2MORE) {
|
361
|
+
|
362
|
+
if (cf->args->nelts < 3) {
|
363
|
+
goto invalid;
|
364
|
+
}
|
365
|
+
|
366
|
+
} else if (cf->args->nelts > NGX_CONF_MAX_ARGS) {
|
367
|
+
|
368
|
+
goto invalid;
|
369
|
+
|
370
|
+
} else if (!(cmd->type & argument_number[cf->args->nelts - 1]))
|
371
|
+
{
|
372
|
+
goto invalid;
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
376
|
+
/* set up the directive's configuration context */
|
377
|
+
|
378
|
+
conf = NULL;
|
379
|
+
|
380
|
+
if (cmd->type & NGX_DIRECT_CONF) {
|
381
|
+
conf = ((void **) cf->ctx)[ngx_modules[i]->index];
|
382
|
+
|
383
|
+
} else if (cmd->type & NGX_MAIN_CONF) {
|
384
|
+
conf = &(((void **) cf->ctx)[ngx_modules[i]->index]);
|
385
|
+
|
386
|
+
} else if (cf->ctx) {
|
387
|
+
confp = *(void **) ((char *) cf->ctx + cmd->conf);
|
388
|
+
|
389
|
+
if (confp) {
|
390
|
+
conf = confp[ngx_modules[i]->ctx_index];
|
391
|
+
}
|
392
|
+
}
|
393
|
+
|
394
|
+
rv = cmd->set(cf, cmd, conf);
|
395
|
+
|
396
|
+
if (rv == NGX_CONF_OK) {
|
397
|
+
return NGX_OK;
|
398
|
+
}
|
399
|
+
|
400
|
+
if (rv == NGX_CONF_ERROR) {
|
401
|
+
return NGX_ERROR;
|
402
|
+
}
|
403
|
+
|
404
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
405
|
+
"\"%s\" directive %s", name->data, rv);
|
406
|
+
|
407
|
+
return NGX_ERROR;
|
408
|
+
}
|
409
|
+
}
|
410
|
+
|
411
|
+
if (multi == 0) {
|
412
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
413
|
+
"unknown directive \"%s\"", name->data);
|
414
|
+
|
415
|
+
return NGX_ERROR;
|
416
|
+
}
|
417
|
+
|
418
|
+
not_allowed:
|
419
|
+
|
420
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
421
|
+
"\"%s\" directive is not allowed here", name->data);
|
422
|
+
return NGX_ERROR;
|
423
|
+
|
424
|
+
invalid:
|
425
|
+
|
426
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
427
|
+
"invalid number of arguments in \"%s\" directive",
|
428
|
+
name->data);
|
429
|
+
|
430
|
+
return NGX_ERROR;
|
431
|
+
}
|
432
|
+
|
433
|
+
|
434
|
+
static ngx_int_t
|
435
|
+
ngx_conf_read_token(ngx_conf_t *cf)
|
436
|
+
{
|
437
|
+
u_char *start, ch, *src, *dst;
|
438
|
+
off_t file_size;
|
439
|
+
size_t len;
|
440
|
+
ssize_t n, size;
|
441
|
+
ngx_uint_t found, need_space, last_space, sharp_comment, variable;
|
442
|
+
ngx_uint_t quoted, s_quoted, d_quoted, start_line;
|
443
|
+
ngx_str_t *word;
|
444
|
+
ngx_buf_t *b;
|
445
|
+
|
446
|
+
found = 0;
|
447
|
+
need_space = 0;
|
448
|
+
last_space = 1;
|
449
|
+
sharp_comment = 0;
|
450
|
+
variable = 0;
|
451
|
+
quoted = 0;
|
452
|
+
s_quoted = 0;
|
453
|
+
d_quoted = 0;
|
454
|
+
|
455
|
+
cf->args->nelts = 0;
|
456
|
+
b = cf->conf_file->buffer;
|
457
|
+
start = b->pos;
|
458
|
+
start_line = cf->conf_file->line;
|
459
|
+
|
460
|
+
file_size = ngx_file_size(&cf->conf_file->file.info);
|
461
|
+
|
462
|
+
for ( ;; ) {
|
463
|
+
|
464
|
+
if (b->pos >= b->last) {
|
465
|
+
|
466
|
+
if (cf->conf_file->file.offset >= file_size) {
|
467
|
+
|
468
|
+
if (cf->args->nelts > 0) {
|
469
|
+
|
470
|
+
if (cf->conf_file->file.fd == NGX_INVALID_FILE) {
|
471
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
472
|
+
"unexpected end of parameter, "
|
473
|
+
"expecting \";\"");
|
474
|
+
return NGX_ERROR;
|
475
|
+
}
|
476
|
+
|
477
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
478
|
+
"unexpected end of file, "
|
479
|
+
"expecting \";\" or \"}\"");
|
480
|
+
return NGX_ERROR;
|
481
|
+
}
|
482
|
+
|
483
|
+
return NGX_CONF_FILE_DONE;
|
484
|
+
}
|
485
|
+
|
486
|
+
len = b->pos - start;
|
487
|
+
|
488
|
+
if (len == NGX_CONF_BUFFER) {
|
489
|
+
cf->conf_file->line = start_line;
|
490
|
+
|
491
|
+
if (d_quoted) {
|
492
|
+
ch = '"';
|
493
|
+
|
494
|
+
} else if (s_quoted) {
|
495
|
+
ch = '\'';
|
496
|
+
|
497
|
+
} else {
|
498
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
499
|
+
"too long parameter \"%*s...\" started",
|
500
|
+
10, start);
|
501
|
+
return NGX_ERROR;
|
502
|
+
}
|
503
|
+
|
504
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
505
|
+
"too long parameter, probably "
|
506
|
+
"missing terminating \"%c\" character", ch);
|
507
|
+
return NGX_ERROR;
|
508
|
+
}
|
509
|
+
|
510
|
+
if (len) {
|
511
|
+
ngx_memmove(b->start, start, len);
|
512
|
+
}
|
513
|
+
|
514
|
+
size = (ssize_t) (file_size - cf->conf_file->file.offset);
|
515
|
+
|
516
|
+
if (size > b->end - (b->start + len)) {
|
517
|
+
size = b->end - (b->start + len);
|
518
|
+
}
|
519
|
+
|
520
|
+
n = ngx_read_file(&cf->conf_file->file, b->start + len, size,
|
521
|
+
cf->conf_file->file.offset);
|
522
|
+
|
523
|
+
if (n == NGX_ERROR) {
|
524
|
+
return NGX_ERROR;
|
525
|
+
}
|
526
|
+
|
527
|
+
if (n != size) {
|
528
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
529
|
+
ngx_read_file_n " returned "
|
530
|
+
"only %z bytes instead of %z",
|
531
|
+
n, size);
|
532
|
+
return NGX_ERROR;
|
533
|
+
}
|
534
|
+
|
535
|
+
b->pos = b->start + len;
|
536
|
+
b->last = b->pos + n;
|
537
|
+
start = b->start;
|
538
|
+
}
|
539
|
+
|
540
|
+
ch = *b->pos++;
|
541
|
+
|
542
|
+
if (ch == LF) {
|
543
|
+
cf->conf_file->line++;
|
544
|
+
|
545
|
+
if (sharp_comment) {
|
546
|
+
sharp_comment = 0;
|
547
|
+
}
|
548
|
+
}
|
549
|
+
|
550
|
+
if (sharp_comment) {
|
551
|
+
continue;
|
552
|
+
}
|
553
|
+
|
554
|
+
if (quoted) {
|
555
|
+
quoted = 0;
|
556
|
+
continue;
|
557
|
+
}
|
558
|
+
|
559
|
+
if (need_space) {
|
560
|
+
if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
|
561
|
+
last_space = 1;
|
562
|
+
need_space = 0;
|
563
|
+
continue;
|
564
|
+
}
|
565
|
+
|
566
|
+
if (ch == ';') {
|
567
|
+
return NGX_OK;
|
568
|
+
}
|
569
|
+
|
570
|
+
if (ch == '{') {
|
571
|
+
return NGX_CONF_BLOCK_START;
|
572
|
+
}
|
573
|
+
|
574
|
+
if (ch == ')') {
|
575
|
+
last_space = 1;
|
576
|
+
need_space = 0;
|
577
|
+
|
578
|
+
} else {
|
579
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
580
|
+
"unexpected \"%c\"", ch);
|
581
|
+
return NGX_ERROR;
|
582
|
+
}
|
583
|
+
}
|
584
|
+
|
585
|
+
if (last_space) {
|
586
|
+
if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
|
587
|
+
continue;
|
588
|
+
}
|
589
|
+
|
590
|
+
start = b->pos - 1;
|
591
|
+
start_line = cf->conf_file->line;
|
592
|
+
|
593
|
+
switch (ch) {
|
594
|
+
|
595
|
+
case ';':
|
596
|
+
case '{':
|
597
|
+
if (cf->args->nelts == 0) {
|
598
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
599
|
+
"unexpected \"%c\"", ch);
|
600
|
+
return NGX_ERROR;
|
601
|
+
}
|
602
|
+
|
603
|
+
if (ch == '{') {
|
604
|
+
return NGX_CONF_BLOCK_START;
|
605
|
+
}
|
606
|
+
|
607
|
+
return NGX_OK;
|
608
|
+
|
609
|
+
case '}':
|
610
|
+
if (cf->args->nelts != 0) {
|
611
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
612
|
+
"unexpected \"}\"");
|
613
|
+
return NGX_ERROR;
|
614
|
+
}
|
615
|
+
|
616
|
+
return NGX_CONF_BLOCK_DONE;
|
617
|
+
|
618
|
+
case '#':
|
619
|
+
sharp_comment = 1;
|
620
|
+
continue;
|
621
|
+
|
622
|
+
case '\\':
|
623
|
+
quoted = 1;
|
624
|
+
last_space = 0;
|
625
|
+
continue;
|
626
|
+
|
627
|
+
case '"':
|
628
|
+
start++;
|
629
|
+
d_quoted = 1;
|
630
|
+
last_space = 0;
|
631
|
+
continue;
|
632
|
+
|
633
|
+
case '\'':
|
634
|
+
start++;
|
635
|
+
s_quoted = 1;
|
636
|
+
last_space = 0;
|
637
|
+
continue;
|
638
|
+
|
639
|
+
default:
|
640
|
+
last_space = 0;
|
641
|
+
}
|
642
|
+
|
643
|
+
} else {
|
644
|
+
if (ch == '{' && variable) {
|
645
|
+
continue;
|
646
|
+
}
|
647
|
+
|
648
|
+
variable = 0;
|
649
|
+
|
650
|
+
if (ch == '\\') {
|
651
|
+
quoted = 1;
|
652
|
+
continue;
|
653
|
+
}
|
654
|
+
|
655
|
+
if (ch == '$') {
|
656
|
+
variable = 1;
|
657
|
+
continue;
|
658
|
+
}
|
659
|
+
|
660
|
+
if (d_quoted) {
|
661
|
+
if (ch == '"') {
|
662
|
+
d_quoted = 0;
|
663
|
+
need_space = 1;
|
664
|
+
found = 1;
|
665
|
+
}
|
666
|
+
|
667
|
+
} else if (s_quoted) {
|
668
|
+
if (ch == '\'') {
|
669
|
+
s_quoted = 0;
|
670
|
+
need_space = 1;
|
671
|
+
found = 1;
|
672
|
+
}
|
673
|
+
|
674
|
+
} else if (ch == ' ' || ch == '\t' || ch == CR || ch == LF
|
675
|
+
|| ch == ';' || ch == '{')
|
676
|
+
{
|
677
|
+
last_space = 1;
|
678
|
+
found = 1;
|
679
|
+
}
|
680
|
+
|
681
|
+
if (found) {
|
682
|
+
word = ngx_array_push(cf->args);
|
683
|
+
if (word == NULL) {
|
684
|
+
return NGX_ERROR;
|
685
|
+
}
|
686
|
+
|
687
|
+
word->data = ngx_pnalloc(cf->pool, b->pos - start + 1);
|
688
|
+
if (word->data == NULL) {
|
689
|
+
return NGX_ERROR;
|
690
|
+
}
|
691
|
+
|
692
|
+
for (dst = word->data, src = start, len = 0;
|
693
|
+
src < b->pos - 1;
|
694
|
+
len++)
|
695
|
+
{
|
696
|
+
if (*src == '\\') {
|
697
|
+
switch (src[1]) {
|
698
|
+
case '"':
|
699
|
+
case '\'':
|
700
|
+
case '\\':
|
701
|
+
src++;
|
702
|
+
break;
|
703
|
+
|
704
|
+
case 't':
|
705
|
+
*dst++ = '\t';
|
706
|
+
src += 2;
|
707
|
+
continue;
|
708
|
+
|
709
|
+
case 'r':
|
710
|
+
*dst++ = '\r';
|
711
|
+
src += 2;
|
712
|
+
continue;
|
713
|
+
|
714
|
+
case 'n':
|
715
|
+
*dst++ = '\n';
|
716
|
+
src += 2;
|
717
|
+
continue;
|
718
|
+
}
|
719
|
+
|
720
|
+
}
|
721
|
+
*dst++ = *src++;
|
722
|
+
}
|
723
|
+
*dst = '\0';
|
724
|
+
word->len = len;
|
725
|
+
|
726
|
+
if (ch == ';') {
|
727
|
+
return NGX_OK;
|
728
|
+
}
|
729
|
+
|
730
|
+
if (ch == '{') {
|
731
|
+
return NGX_CONF_BLOCK_START;
|
732
|
+
}
|
733
|
+
|
734
|
+
found = 0;
|
735
|
+
}
|
736
|
+
}
|
737
|
+
}
|
738
|
+
}
|
739
|
+
|
740
|
+
|
741
|
+
static char *
|
742
|
+
ngx_conf_include(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
743
|
+
{
|
744
|
+
char *rv;
|
745
|
+
ngx_int_t n;
|
746
|
+
ngx_str_t *value, file, name;
|
747
|
+
ngx_glob_t gl;
|
748
|
+
|
749
|
+
value = cf->args->elts;
|
750
|
+
file = value[1];
|
751
|
+
|
752
|
+
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
|
753
|
+
|
754
|
+
if (ngx_conf_full_name(cf->cycle, &file, 1) != NGX_OK) {
|
755
|
+
return NGX_CONF_ERROR;
|
756
|
+
}
|
757
|
+
|
758
|
+
if (strpbrk((char *) file.data, "*?[") == NULL) {
|
759
|
+
|
760
|
+
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
|
761
|
+
|
762
|
+
return ngx_conf_parse(cf, &file);
|
763
|
+
}
|
764
|
+
|
765
|
+
ngx_memzero(&gl, sizeof(ngx_glob_t));
|
766
|
+
|
767
|
+
gl.pattern = file.data;
|
768
|
+
gl.log = cf->log;
|
769
|
+
gl.test = 1;
|
770
|
+
|
771
|
+
if (ngx_open_glob(&gl) != NGX_OK) {
|
772
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
|
773
|
+
ngx_open_glob_n " \"%s\" failed", file.data);
|
774
|
+
return NGX_CONF_ERROR;
|
775
|
+
}
|
776
|
+
|
777
|
+
rv = NGX_CONF_OK;
|
778
|
+
|
779
|
+
for ( ;; ) {
|
780
|
+
n = ngx_read_glob(&gl, &name);
|
781
|
+
|
782
|
+
if (n != NGX_OK) {
|
783
|
+
break;
|
784
|
+
}
|
785
|
+
|
786
|
+
file.len = name.len++;
|
787
|
+
file.data = ngx_pstrdup(cf->pool, &name);
|
788
|
+
|
789
|
+
ngx_log_debug1(NGX_LOG_DEBUG_CORE, cf->log, 0, "include %s", file.data);
|
790
|
+
|
791
|
+
rv = ngx_conf_parse(cf, &file);
|
792
|
+
|
793
|
+
if (rv != NGX_CONF_OK) {
|
794
|
+
break;
|
795
|
+
}
|
796
|
+
}
|
797
|
+
|
798
|
+
ngx_close_glob(&gl);
|
799
|
+
|
800
|
+
return rv;
|
801
|
+
}
|
802
|
+
|
803
|
+
|
804
|
+
ngx_int_t
|
805
|
+
ngx_conf_full_name(ngx_cycle_t *cycle, ngx_str_t *name, ngx_uint_t conf_prefix)
|
806
|
+
{
|
807
|
+
size_t len;
|
808
|
+
u_char *p, *n, *prefix;
|
809
|
+
ngx_int_t rc;
|
810
|
+
|
811
|
+
rc = ngx_conf_test_full_name(name);
|
812
|
+
|
813
|
+
if (rc == NGX_OK) {
|
814
|
+
return rc;
|
815
|
+
}
|
816
|
+
|
817
|
+
if (conf_prefix) {
|
818
|
+
len = cycle->conf_prefix.len;
|
819
|
+
prefix = cycle->conf_prefix.data;
|
820
|
+
|
821
|
+
} else {
|
822
|
+
len = cycle->prefix.len;
|
823
|
+
prefix = cycle->prefix.data;
|
824
|
+
}
|
825
|
+
|
826
|
+
#if (NGX_WIN32)
|
827
|
+
|
828
|
+
if (rc == 2) {
|
829
|
+
len = rc;
|
830
|
+
}
|
831
|
+
|
832
|
+
#endif
|
833
|
+
|
834
|
+
n = ngx_pnalloc(cycle->pool, len + name->len + 1);
|
835
|
+
if (n == NULL) {
|
836
|
+
return NGX_ERROR;
|
837
|
+
}
|
838
|
+
|
839
|
+
p = ngx_cpymem(n, prefix, len);
|
840
|
+
ngx_cpystrn(p, name->data, name->len + 1);
|
841
|
+
|
842
|
+
name->len += len;
|
843
|
+
name->data = n;
|
844
|
+
|
845
|
+
return NGX_OK;
|
846
|
+
}
|
847
|
+
|
848
|
+
|
849
|
+
static ngx_int_t
|
850
|
+
ngx_conf_test_full_name(ngx_str_t *name)
|
851
|
+
{
|
852
|
+
#if (NGX_WIN32)
|
853
|
+
u_char c0, c1;
|
854
|
+
|
855
|
+
c0 = name->data[0];
|
856
|
+
|
857
|
+
if (name->len < 2) {
|
858
|
+
if (c0 == '/') {
|
859
|
+
return 2;
|
860
|
+
}
|
861
|
+
|
862
|
+
return NGX_DECLINED;
|
863
|
+
}
|
864
|
+
|
865
|
+
c1 = name->data[1];
|
866
|
+
|
867
|
+
if (c1 == ':') {
|
868
|
+
c0 |= 0x20;
|
869
|
+
|
870
|
+
if ((c0 >= 'a' && c0 <= 'z')) {
|
871
|
+
return NGX_OK;
|
872
|
+
}
|
873
|
+
|
874
|
+
return NGX_DECLINED;
|
875
|
+
}
|
876
|
+
|
877
|
+
if (c1 == '/') {
|
878
|
+
return NGX_OK;
|
879
|
+
}
|
880
|
+
|
881
|
+
if (c0 == '/') {
|
882
|
+
return 2;
|
883
|
+
}
|
884
|
+
|
885
|
+
return NGX_DECLINED;
|
886
|
+
|
887
|
+
#else
|
888
|
+
|
889
|
+
if (name->data[0] == '/') {
|
890
|
+
return NGX_OK;
|
891
|
+
}
|
892
|
+
|
893
|
+
return NGX_DECLINED;
|
894
|
+
|
895
|
+
#endif
|
896
|
+
}
|
897
|
+
|
898
|
+
|
899
|
+
ngx_open_file_t *
|
900
|
+
ngx_conf_open_file(ngx_cycle_t *cycle, ngx_str_t *name)
|
901
|
+
{
|
902
|
+
ngx_str_t full;
|
903
|
+
ngx_uint_t i;
|
904
|
+
ngx_list_part_t *part;
|
905
|
+
ngx_open_file_t *file;
|
906
|
+
|
907
|
+
#if (NGX_SUPPRESS_WARN)
|
908
|
+
ngx_str_null(&full);
|
909
|
+
#endif
|
910
|
+
|
911
|
+
if (name->len) {
|
912
|
+
full = *name;
|
913
|
+
|
914
|
+
if (ngx_conf_full_name(cycle, &full, 0) != NGX_OK) {
|
915
|
+
return NULL;
|
916
|
+
}
|
917
|
+
|
918
|
+
part = &cycle->open_files.part;
|
919
|
+
file = part->elts;
|
920
|
+
|
921
|
+
for (i = 0; /* void */ ; i++) {
|
922
|
+
|
923
|
+
if (i >= part->nelts) {
|
924
|
+
if (part->next == NULL) {
|
925
|
+
break;
|
926
|
+
}
|
927
|
+
part = part->next;
|
928
|
+
file = part->elts;
|
929
|
+
i = 0;
|
930
|
+
}
|
931
|
+
|
932
|
+
if (full.len != file[i].name.len) {
|
933
|
+
continue;
|
934
|
+
}
|
935
|
+
|
936
|
+
if (ngx_strcmp(full.data, file[i].name.data) == 0) {
|
937
|
+
return &file[i];
|
938
|
+
}
|
939
|
+
}
|
940
|
+
}
|
941
|
+
|
942
|
+
file = ngx_list_push(&cycle->open_files);
|
943
|
+
if (file == NULL) {
|
944
|
+
return NULL;
|
945
|
+
}
|
946
|
+
|
947
|
+
if (name->len) {
|
948
|
+
file->fd = NGX_INVALID_FILE;
|
949
|
+
file->name = full;
|
950
|
+
|
951
|
+
} else {
|
952
|
+
file->fd = ngx_stderr;
|
953
|
+
file->name = *name;
|
954
|
+
}
|
955
|
+
|
956
|
+
file->buffer = NULL;
|
957
|
+
|
958
|
+
return file;
|
959
|
+
}
|
960
|
+
|
961
|
+
|
962
|
+
static void
|
963
|
+
ngx_conf_flush_files(ngx_cycle_t *cycle)
|
964
|
+
{
|
965
|
+
ssize_t n, len;
|
966
|
+
ngx_uint_t i;
|
967
|
+
ngx_list_part_t *part;
|
968
|
+
ngx_open_file_t *file;
|
969
|
+
|
970
|
+
ngx_log_debug0(NGX_LOG_DEBUG_CORE, cycle->log, 0, "flush files");
|
971
|
+
|
972
|
+
part = &cycle->open_files.part;
|
973
|
+
file = part->elts;
|
974
|
+
|
975
|
+
for (i = 0; /* void */ ; i++) {
|
976
|
+
|
977
|
+
if (i >= part->nelts) {
|
978
|
+
if (part->next == NULL) {
|
979
|
+
break;
|
980
|
+
}
|
981
|
+
part = part->next;
|
982
|
+
file = part->elts;
|
983
|
+
i = 0;
|
984
|
+
}
|
985
|
+
|
986
|
+
len = file[i].pos - file[i].buffer;
|
987
|
+
|
988
|
+
if (file[i].buffer == NULL || len == 0) {
|
989
|
+
continue;
|
990
|
+
}
|
991
|
+
|
992
|
+
n = ngx_write_fd(file[i].fd, file[i].buffer, len);
|
993
|
+
|
994
|
+
if (n == NGX_FILE_ERROR) {
|
995
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
996
|
+
ngx_write_fd_n " to \"%s\" failed",
|
997
|
+
file[i].name.data);
|
998
|
+
|
999
|
+
} else if (n != len) {
|
1000
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
|
1001
|
+
ngx_write_fd_n " to \"%s\" was incomplete: %z of %uz",
|
1002
|
+
file[i].name.data, n, len);
|
1003
|
+
}
|
1004
|
+
}
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
|
1008
|
+
void ngx_cdecl
|
1009
|
+
ngx_conf_log_error(ngx_uint_t level, ngx_conf_t *cf, ngx_err_t err,
|
1010
|
+
const char *fmt, ...)
|
1011
|
+
{
|
1012
|
+
u_char errstr[NGX_MAX_CONF_ERRSTR], *p, *last;
|
1013
|
+
va_list args;
|
1014
|
+
|
1015
|
+
last = errstr + NGX_MAX_CONF_ERRSTR;
|
1016
|
+
|
1017
|
+
va_start(args, fmt);
|
1018
|
+
p = ngx_vslprintf(errstr, last, fmt, args);
|
1019
|
+
va_end(args);
|
1020
|
+
|
1021
|
+
if (err) {
|
1022
|
+
p = ngx_log_errno(p, last, err);
|
1023
|
+
}
|
1024
|
+
|
1025
|
+
if (cf->conf_file == NULL) {
|
1026
|
+
ngx_log_error(level, cf->log, 0, "%*s", p - errstr, errstr);
|
1027
|
+
return;
|
1028
|
+
}
|
1029
|
+
|
1030
|
+
if (cf->conf_file->file.fd == NGX_INVALID_FILE) {
|
1031
|
+
ngx_log_error(level, cf->log, 0, "%*s in command line",
|
1032
|
+
p - errstr, errstr);
|
1033
|
+
return;
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
ngx_log_error(level, cf->log, 0, "%*s in %s:%ui",
|
1037
|
+
p - errstr, errstr,
|
1038
|
+
cf->conf_file->file.name.data, cf->conf_file->line);
|
1039
|
+
}
|
1040
|
+
|
1041
|
+
|
1042
|
+
char *
|
1043
|
+
ngx_conf_set_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1044
|
+
{
|
1045
|
+
char *p = conf;
|
1046
|
+
|
1047
|
+
ngx_str_t *value;
|
1048
|
+
ngx_flag_t *fp;
|
1049
|
+
ngx_conf_post_t *post;
|
1050
|
+
|
1051
|
+
fp = (ngx_flag_t *) (p + cmd->offset);
|
1052
|
+
|
1053
|
+
if (*fp != NGX_CONF_UNSET) {
|
1054
|
+
return "is duplicate";
|
1055
|
+
}
|
1056
|
+
|
1057
|
+
value = cf->args->elts;
|
1058
|
+
|
1059
|
+
if (ngx_strcasecmp(value[1].data, (u_char *) "on") == 0) {
|
1060
|
+
*fp = 1;
|
1061
|
+
|
1062
|
+
} else if (ngx_strcasecmp(value[1].data, (u_char *) "off") == 0) {
|
1063
|
+
*fp = 0;
|
1064
|
+
|
1065
|
+
} else {
|
1066
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
1067
|
+
"invalid value \"%s\" in \"%s\" directive, "
|
1068
|
+
"it must be \"on\" or \"off\"",
|
1069
|
+
value[1].data, cmd->name.data);
|
1070
|
+
return NGX_CONF_ERROR;
|
1071
|
+
}
|
1072
|
+
|
1073
|
+
if (cmd->post) {
|
1074
|
+
post = cmd->post;
|
1075
|
+
return post->post_handler(cf, post, fp);
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
return NGX_CONF_OK;
|
1079
|
+
}
|
1080
|
+
|
1081
|
+
|
1082
|
+
char *
|
1083
|
+
ngx_conf_set_str_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1084
|
+
{
|
1085
|
+
char *p = conf;
|
1086
|
+
|
1087
|
+
ngx_str_t *field, *value;
|
1088
|
+
ngx_conf_post_t *post;
|
1089
|
+
|
1090
|
+
field = (ngx_str_t *) (p + cmd->offset);
|
1091
|
+
|
1092
|
+
if (field->data) {
|
1093
|
+
return "is duplicate";
|
1094
|
+
}
|
1095
|
+
|
1096
|
+
value = cf->args->elts;
|
1097
|
+
|
1098
|
+
*field = value[1];
|
1099
|
+
|
1100
|
+
if (cmd->post) {
|
1101
|
+
post = cmd->post;
|
1102
|
+
return post->post_handler(cf, post, field);
|
1103
|
+
}
|
1104
|
+
|
1105
|
+
return NGX_CONF_OK;
|
1106
|
+
}
|
1107
|
+
|
1108
|
+
|
1109
|
+
char *
|
1110
|
+
ngx_conf_set_str_array_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1111
|
+
{
|
1112
|
+
char *p = conf;
|
1113
|
+
|
1114
|
+
ngx_str_t *value, *s;
|
1115
|
+
ngx_array_t **a;
|
1116
|
+
ngx_conf_post_t *post;
|
1117
|
+
|
1118
|
+
a = (ngx_array_t **) (p + cmd->offset);
|
1119
|
+
|
1120
|
+
if (*a == NGX_CONF_UNSET_PTR) {
|
1121
|
+
*a = ngx_array_create(cf->pool, 4, sizeof(ngx_str_t));
|
1122
|
+
if (*a == NULL) {
|
1123
|
+
return NGX_CONF_ERROR;
|
1124
|
+
}
|
1125
|
+
}
|
1126
|
+
|
1127
|
+
s = ngx_array_push(*a);
|
1128
|
+
if (s == NULL) {
|
1129
|
+
return NGX_CONF_ERROR;
|
1130
|
+
}
|
1131
|
+
|
1132
|
+
value = cf->args->elts;
|
1133
|
+
|
1134
|
+
*s = value[1];
|
1135
|
+
|
1136
|
+
if (cmd->post) {
|
1137
|
+
post = cmd->post;
|
1138
|
+
return post->post_handler(cf, post, s);
|
1139
|
+
}
|
1140
|
+
|
1141
|
+
return NGX_CONF_OK;
|
1142
|
+
}
|
1143
|
+
|
1144
|
+
|
1145
|
+
char *
|
1146
|
+
ngx_conf_set_keyval_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1147
|
+
{
|
1148
|
+
char *p = conf;
|
1149
|
+
|
1150
|
+
ngx_str_t *value;
|
1151
|
+
ngx_array_t **a;
|
1152
|
+
ngx_keyval_t *kv;
|
1153
|
+
ngx_conf_post_t *post;
|
1154
|
+
|
1155
|
+
a = (ngx_array_t **) (p + cmd->offset);
|
1156
|
+
|
1157
|
+
if (*a == NULL) {
|
1158
|
+
*a = ngx_array_create(cf->pool, 4, sizeof(ngx_keyval_t));
|
1159
|
+
if (*a == NULL) {
|
1160
|
+
return NGX_CONF_ERROR;
|
1161
|
+
}
|
1162
|
+
}
|
1163
|
+
|
1164
|
+
kv = ngx_array_push(*a);
|
1165
|
+
if (kv == NULL) {
|
1166
|
+
return NGX_CONF_ERROR;
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
value = cf->args->elts;
|
1170
|
+
|
1171
|
+
kv->key = value[1];
|
1172
|
+
kv->value = value[2];
|
1173
|
+
|
1174
|
+
if (cmd->post) {
|
1175
|
+
post = cmd->post;
|
1176
|
+
return post->post_handler(cf, post, kv);
|
1177
|
+
}
|
1178
|
+
|
1179
|
+
return NGX_CONF_OK;
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
|
1183
|
+
char *
|
1184
|
+
ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1185
|
+
{
|
1186
|
+
char *p = conf;
|
1187
|
+
|
1188
|
+
ngx_int_t *np;
|
1189
|
+
ngx_str_t *value;
|
1190
|
+
ngx_conf_post_t *post;
|
1191
|
+
|
1192
|
+
|
1193
|
+
np = (ngx_int_t *) (p + cmd->offset);
|
1194
|
+
|
1195
|
+
if (*np != NGX_CONF_UNSET) {
|
1196
|
+
return "is duplicate";
|
1197
|
+
}
|
1198
|
+
|
1199
|
+
value = cf->args->elts;
|
1200
|
+
*np = ngx_atoi(value[1].data, value[1].len);
|
1201
|
+
if (*np == NGX_ERROR) {
|
1202
|
+
return "invalid number";
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
if (cmd->post) {
|
1206
|
+
post = cmd->post;
|
1207
|
+
return post->post_handler(cf, post, np);
|
1208
|
+
}
|
1209
|
+
|
1210
|
+
return NGX_CONF_OK;
|
1211
|
+
}
|
1212
|
+
|
1213
|
+
|
1214
|
+
char *
|
1215
|
+
ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1216
|
+
{
|
1217
|
+
char *p = conf;
|
1218
|
+
|
1219
|
+
size_t *sp;
|
1220
|
+
ngx_str_t *value;
|
1221
|
+
ngx_conf_post_t *post;
|
1222
|
+
|
1223
|
+
|
1224
|
+
sp = (size_t *) (p + cmd->offset);
|
1225
|
+
if (*sp != NGX_CONF_UNSET_SIZE) {
|
1226
|
+
return "is duplicate";
|
1227
|
+
}
|
1228
|
+
|
1229
|
+
value = cf->args->elts;
|
1230
|
+
|
1231
|
+
*sp = ngx_parse_size(&value[1]);
|
1232
|
+
if (*sp == (size_t) NGX_ERROR) {
|
1233
|
+
return "invalid value";
|
1234
|
+
}
|
1235
|
+
|
1236
|
+
if (cmd->post) {
|
1237
|
+
post = cmd->post;
|
1238
|
+
return post->post_handler(cf, post, sp);
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
return NGX_CONF_OK;
|
1242
|
+
}
|
1243
|
+
|
1244
|
+
|
1245
|
+
char *
|
1246
|
+
ngx_conf_set_off_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1247
|
+
{
|
1248
|
+
char *p = conf;
|
1249
|
+
|
1250
|
+
off_t *op;
|
1251
|
+
ngx_str_t *value;
|
1252
|
+
ngx_conf_post_t *post;
|
1253
|
+
|
1254
|
+
|
1255
|
+
op = (off_t *) (p + cmd->offset);
|
1256
|
+
if (*op != NGX_CONF_UNSET) {
|
1257
|
+
return "is duplicate";
|
1258
|
+
}
|
1259
|
+
|
1260
|
+
value = cf->args->elts;
|
1261
|
+
|
1262
|
+
*op = ngx_parse_offset(&value[1]);
|
1263
|
+
if (*op == (off_t) NGX_ERROR) {
|
1264
|
+
return "invalid value";
|
1265
|
+
}
|
1266
|
+
|
1267
|
+
if (cmd->post) {
|
1268
|
+
post = cmd->post;
|
1269
|
+
return post->post_handler(cf, post, op);
|
1270
|
+
}
|
1271
|
+
|
1272
|
+
return NGX_CONF_OK;
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
|
1276
|
+
char *
|
1277
|
+
ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1278
|
+
{
|
1279
|
+
char *p = conf;
|
1280
|
+
|
1281
|
+
ngx_msec_t *msp;
|
1282
|
+
ngx_str_t *value;
|
1283
|
+
ngx_conf_post_t *post;
|
1284
|
+
|
1285
|
+
|
1286
|
+
msp = (ngx_msec_t *) (p + cmd->offset);
|
1287
|
+
if (*msp != NGX_CONF_UNSET_MSEC) {
|
1288
|
+
return "is duplicate";
|
1289
|
+
}
|
1290
|
+
|
1291
|
+
value = cf->args->elts;
|
1292
|
+
|
1293
|
+
*msp = ngx_parse_time(&value[1], 0);
|
1294
|
+
if (*msp == (ngx_msec_t) NGX_ERROR) {
|
1295
|
+
return "invalid value";
|
1296
|
+
}
|
1297
|
+
|
1298
|
+
if (*msp == (ngx_msec_t) NGX_PARSE_LARGE_TIME) {
|
1299
|
+
return "value must be less than 597 hours";
|
1300
|
+
}
|
1301
|
+
|
1302
|
+
if (cmd->post) {
|
1303
|
+
post = cmd->post;
|
1304
|
+
return post->post_handler(cf, post, msp);
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
return NGX_CONF_OK;
|
1308
|
+
}
|
1309
|
+
|
1310
|
+
|
1311
|
+
char *
|
1312
|
+
ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1313
|
+
{
|
1314
|
+
char *p = conf;
|
1315
|
+
|
1316
|
+
time_t *sp;
|
1317
|
+
ngx_str_t *value;
|
1318
|
+
ngx_conf_post_t *post;
|
1319
|
+
|
1320
|
+
|
1321
|
+
sp = (time_t *) (p + cmd->offset);
|
1322
|
+
if (*sp != NGX_CONF_UNSET) {
|
1323
|
+
return "is duplicate";
|
1324
|
+
}
|
1325
|
+
|
1326
|
+
value = cf->args->elts;
|
1327
|
+
|
1328
|
+
*sp = ngx_parse_time(&value[1], 1);
|
1329
|
+
if (*sp == NGX_ERROR) {
|
1330
|
+
return "invalid value";
|
1331
|
+
}
|
1332
|
+
|
1333
|
+
if (*sp == NGX_PARSE_LARGE_TIME) {
|
1334
|
+
return "value must be less than 68 years";
|
1335
|
+
}
|
1336
|
+
|
1337
|
+
if (cmd->post) {
|
1338
|
+
post = cmd->post;
|
1339
|
+
return post->post_handler(cf, post, sp);
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
return NGX_CONF_OK;
|
1343
|
+
}
|
1344
|
+
|
1345
|
+
|
1346
|
+
char *
|
1347
|
+
ngx_conf_set_bufs_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1348
|
+
{
|
1349
|
+
char *p = conf;
|
1350
|
+
|
1351
|
+
ngx_str_t *value;
|
1352
|
+
ngx_bufs_t *bufs;
|
1353
|
+
|
1354
|
+
|
1355
|
+
bufs = (ngx_bufs_t *) (p + cmd->offset);
|
1356
|
+
if (bufs->num) {
|
1357
|
+
return "is duplicate";
|
1358
|
+
}
|
1359
|
+
|
1360
|
+
value = cf->args->elts;
|
1361
|
+
|
1362
|
+
bufs->num = ngx_atoi(value[1].data, value[1].len);
|
1363
|
+
if (bufs->num == NGX_ERROR || bufs->num == 0) {
|
1364
|
+
return "invalid value";
|
1365
|
+
}
|
1366
|
+
|
1367
|
+
bufs->size = ngx_parse_size(&value[2]);
|
1368
|
+
if (bufs->size == (size_t) NGX_ERROR || bufs->size == 0) {
|
1369
|
+
return "invalid value";
|
1370
|
+
}
|
1371
|
+
|
1372
|
+
return NGX_CONF_OK;
|
1373
|
+
}
|
1374
|
+
|
1375
|
+
|
1376
|
+
char *
|
1377
|
+
ngx_conf_set_enum_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1378
|
+
{
|
1379
|
+
char *p = conf;
|
1380
|
+
|
1381
|
+
ngx_uint_t *np, i;
|
1382
|
+
ngx_str_t *value;
|
1383
|
+
ngx_conf_enum_t *e;
|
1384
|
+
|
1385
|
+
np = (ngx_uint_t *) (p + cmd->offset);
|
1386
|
+
|
1387
|
+
if (*np != NGX_CONF_UNSET_UINT) {
|
1388
|
+
return "is duplicate";
|
1389
|
+
}
|
1390
|
+
|
1391
|
+
value = cf->args->elts;
|
1392
|
+
e = cmd->post;
|
1393
|
+
|
1394
|
+
for (i = 0; e[i].name.len != 0; i++) {
|
1395
|
+
if (e[i].name.len != value[1].len
|
1396
|
+
|| ngx_strcasecmp(e[i].name.data, value[1].data) != 0)
|
1397
|
+
{
|
1398
|
+
continue;
|
1399
|
+
}
|
1400
|
+
|
1401
|
+
*np = e[i].value;
|
1402
|
+
|
1403
|
+
return NGX_CONF_OK;
|
1404
|
+
}
|
1405
|
+
|
1406
|
+
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
1407
|
+
"invalid value \"%s\"", value[1].data);
|
1408
|
+
|
1409
|
+
return NGX_CONF_ERROR;
|
1410
|
+
}
|
1411
|
+
|
1412
|
+
|
1413
|
+
char *
|
1414
|
+
ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1415
|
+
{
|
1416
|
+
char *p = conf;
|
1417
|
+
|
1418
|
+
ngx_uint_t *np, i, m;
|
1419
|
+
ngx_str_t *value;
|
1420
|
+
ngx_conf_bitmask_t *mask;
|
1421
|
+
|
1422
|
+
|
1423
|
+
np = (ngx_uint_t *) (p + cmd->offset);
|
1424
|
+
value = cf->args->elts;
|
1425
|
+
mask = cmd->post;
|
1426
|
+
|
1427
|
+
for (i = 1; i < cf->args->nelts; i++) {
|
1428
|
+
for (m = 0; mask[m].name.len != 0; m++) {
|
1429
|
+
|
1430
|
+
if (mask[m].name.len != value[i].len
|
1431
|
+
|| ngx_strcasecmp(mask[m].name.data, value[i].data) != 0)
|
1432
|
+
{
|
1433
|
+
continue;
|
1434
|
+
}
|
1435
|
+
|
1436
|
+
if (*np & mask[m].mask) {
|
1437
|
+
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
1438
|
+
"duplicate value \"%s\"", value[i].data);
|
1439
|
+
|
1440
|
+
} else {
|
1441
|
+
*np |= mask[m].mask;
|
1442
|
+
}
|
1443
|
+
|
1444
|
+
break;
|
1445
|
+
}
|
1446
|
+
|
1447
|
+
if (mask[m].name.len == 0) {
|
1448
|
+
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
1449
|
+
"invalid value \"%s\"", value[i].data);
|
1450
|
+
|
1451
|
+
return NGX_CONF_ERROR;
|
1452
|
+
}
|
1453
|
+
}
|
1454
|
+
|
1455
|
+
return NGX_CONF_OK;
|
1456
|
+
}
|
1457
|
+
|
1458
|
+
|
1459
|
+
char *
|
1460
|
+
ngx_conf_unsupported(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
1461
|
+
{
|
1462
|
+
return "unsupported on this platform";
|
1463
|
+
}
|
1464
|
+
|
1465
|
+
|
1466
|
+
char *
|
1467
|
+
ngx_conf_deprecated(ngx_conf_t *cf, void *post, void *data)
|
1468
|
+
{
|
1469
|
+
ngx_conf_deprecated_t *d = post;
|
1470
|
+
|
1471
|
+
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
|
1472
|
+
"the \"%s\" directive is deprecated, "
|
1473
|
+
"use the \"%s\" directive instead",
|
1474
|
+
d->old_name, d->new_name);
|
1475
|
+
|
1476
|
+
return NGX_CONF_OK;
|
1477
|
+
}
|
1478
|
+
|
1479
|
+
|
1480
|
+
char *
|
1481
|
+
ngx_conf_check_num_bounds(ngx_conf_t *cf, void *post, void *data)
|
1482
|
+
{
|
1483
|
+
ngx_conf_num_bounds_t *bounds = post;
|
1484
|
+
ngx_int_t *np = data;
|
1485
|
+
|
1486
|
+
if (bounds->high == -1) {
|
1487
|
+
if (*np >= bounds->low) {
|
1488
|
+
return NGX_CONF_OK;
|
1489
|
+
}
|
1490
|
+
|
1491
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
1492
|
+
"value must be equal or more than %i", bounds->low);
|
1493
|
+
|
1494
|
+
return NGX_CONF_ERROR;
|
1495
|
+
}
|
1496
|
+
|
1497
|
+
if (*np >= bounds->low && *np <= bounds->high) {
|
1498
|
+
return NGX_CONF_OK;
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
1502
|
+
"value must be between %i and %i",
|
1503
|
+
bounds->low, bounds->high);
|
1504
|
+
|
1505
|
+
return NGX_CONF_ERROR;
|
1506
|
+
}
|