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,1019 @@
|
|
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
|
+
ngx_array_t *codes; /* uintptr_t */
|
15
|
+
|
16
|
+
ngx_uint_t stack_size;
|
17
|
+
|
18
|
+
ngx_flag_t log;
|
19
|
+
ngx_flag_t uninitialized_variable_warn;
|
20
|
+
} ngx_http_rewrite_loc_conf_t;
|
21
|
+
|
22
|
+
|
23
|
+
static void *ngx_http_rewrite_create_loc_conf(ngx_conf_t *cf);
|
24
|
+
static char *ngx_http_rewrite_merge_loc_conf(ngx_conf_t *cf,
|
25
|
+
void *parent, void *child);
|
26
|
+
static ngx_int_t ngx_http_rewrite_init(ngx_conf_t *cf);
|
27
|
+
static char *ngx_http_rewrite(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
28
|
+
static char *ngx_http_rewrite_return(ngx_conf_t *cf, ngx_command_t *cmd,
|
29
|
+
void *conf);
|
30
|
+
static char *ngx_http_rewrite_break(ngx_conf_t *cf, ngx_command_t *cmd,
|
31
|
+
void *conf);
|
32
|
+
static char *ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd,
|
33
|
+
void *conf);
|
34
|
+
static char * ngx_http_rewrite_if_condition(ngx_conf_t *cf,
|
35
|
+
ngx_http_rewrite_loc_conf_t *lcf);
|
36
|
+
static char *ngx_http_rewrite_variable(ngx_conf_t *cf,
|
37
|
+
ngx_http_rewrite_loc_conf_t *lcf, ngx_str_t *value);
|
38
|
+
static char *ngx_http_rewrite_set(ngx_conf_t *cf, ngx_command_t *cmd,
|
39
|
+
void *conf);
|
40
|
+
static char * ngx_http_rewrite_value(ngx_conf_t *cf,
|
41
|
+
ngx_http_rewrite_loc_conf_t *lcf, ngx_str_t *value);
|
42
|
+
|
43
|
+
|
44
|
+
static ngx_command_t ngx_http_rewrite_commands[] = {
|
45
|
+
|
46
|
+
{ ngx_string("rewrite"),
|
47
|
+
NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
48
|
+
|NGX_CONF_TAKE23,
|
49
|
+
ngx_http_rewrite,
|
50
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
51
|
+
0,
|
52
|
+
NULL },
|
53
|
+
|
54
|
+
{ ngx_string("return"),
|
55
|
+
NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
56
|
+
|NGX_CONF_TAKE12,
|
57
|
+
ngx_http_rewrite_return,
|
58
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
59
|
+
0,
|
60
|
+
NULL },
|
61
|
+
|
62
|
+
{ ngx_string("break"),
|
63
|
+
NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
64
|
+
|NGX_CONF_NOARGS,
|
65
|
+
ngx_http_rewrite_break,
|
66
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
67
|
+
0,
|
68
|
+
NULL },
|
69
|
+
|
70
|
+
{ ngx_string("if"),
|
71
|
+
NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_BLOCK|NGX_CONF_1MORE,
|
72
|
+
ngx_http_rewrite_if,
|
73
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
74
|
+
0,
|
75
|
+
NULL },
|
76
|
+
|
77
|
+
{ ngx_string("set"),
|
78
|
+
NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
79
|
+
|NGX_CONF_TAKE2,
|
80
|
+
ngx_http_rewrite_set,
|
81
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
82
|
+
0,
|
83
|
+
NULL },
|
84
|
+
|
85
|
+
{ ngx_string("rewrite_log"),
|
86
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF
|
87
|
+
|NGX_HTTP_LIF_CONF|NGX_CONF_FLAG,
|
88
|
+
ngx_conf_set_flag_slot,
|
89
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
90
|
+
offsetof(ngx_http_rewrite_loc_conf_t, log),
|
91
|
+
NULL },
|
92
|
+
|
93
|
+
{ ngx_string("uninitialized_variable_warn"),
|
94
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF
|
95
|
+
|NGX_HTTP_LIF_CONF|NGX_CONF_FLAG,
|
96
|
+
ngx_conf_set_flag_slot,
|
97
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
98
|
+
offsetof(ngx_http_rewrite_loc_conf_t, uninitialized_variable_warn),
|
99
|
+
NULL },
|
100
|
+
|
101
|
+
ngx_null_command
|
102
|
+
};
|
103
|
+
|
104
|
+
|
105
|
+
static ngx_http_module_t ngx_http_rewrite_module_ctx = {
|
106
|
+
NULL, /* preconfiguration */
|
107
|
+
ngx_http_rewrite_init, /* postconfiguration */
|
108
|
+
|
109
|
+
NULL, /* create main configuration */
|
110
|
+
NULL, /* init main configuration */
|
111
|
+
|
112
|
+
NULL, /* create server configuration */
|
113
|
+
NULL, /* merge server configuration */
|
114
|
+
|
115
|
+
ngx_http_rewrite_create_loc_conf, /* create location configuration */
|
116
|
+
ngx_http_rewrite_merge_loc_conf /* merge location configuration */
|
117
|
+
};
|
118
|
+
|
119
|
+
|
120
|
+
ngx_module_t ngx_http_rewrite_module = {
|
121
|
+
NGX_MODULE_V1,
|
122
|
+
&ngx_http_rewrite_module_ctx, /* module context */
|
123
|
+
ngx_http_rewrite_commands, /* module directives */
|
124
|
+
NGX_HTTP_MODULE, /* module type */
|
125
|
+
NULL, /* init master */
|
126
|
+
NULL, /* init module */
|
127
|
+
NULL, /* init process */
|
128
|
+
NULL, /* init thread */
|
129
|
+
NULL, /* exit thread */
|
130
|
+
NULL, /* exit process */
|
131
|
+
NULL, /* exit master */
|
132
|
+
NGX_MODULE_V1_PADDING
|
133
|
+
};
|
134
|
+
|
135
|
+
|
136
|
+
static ngx_int_t
|
137
|
+
ngx_http_rewrite_handler(ngx_http_request_t *r)
|
138
|
+
{
|
139
|
+
ngx_int_t index;
|
140
|
+
ngx_http_script_code_pt code;
|
141
|
+
ngx_http_script_engine_t *e;
|
142
|
+
ngx_http_core_srv_conf_t *cscf;
|
143
|
+
ngx_http_core_main_conf_t *cmcf;
|
144
|
+
ngx_http_rewrite_loc_conf_t *rlcf;
|
145
|
+
|
146
|
+
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
|
147
|
+
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
|
148
|
+
index = cmcf->phase_engine.location_rewrite_index;
|
149
|
+
|
150
|
+
if (r->phase_handler == index && r->loc_conf == cscf->ctx->loc_conf) {
|
151
|
+
/* skipping location rewrite phase for server null location */
|
152
|
+
return NGX_DECLINED;
|
153
|
+
}
|
154
|
+
|
155
|
+
rlcf = ngx_http_get_module_loc_conf(r, ngx_http_rewrite_module);
|
156
|
+
|
157
|
+
if (rlcf->codes == NULL) {
|
158
|
+
return NGX_DECLINED;
|
159
|
+
}
|
160
|
+
|
161
|
+
e = ngx_pcalloc(r->pool, sizeof(ngx_http_script_engine_t));
|
162
|
+
if (e == NULL) {
|
163
|
+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
164
|
+
}
|
165
|
+
|
166
|
+
e->sp = ngx_pcalloc(r->pool,
|
167
|
+
rlcf->stack_size * sizeof(ngx_http_variable_value_t));
|
168
|
+
if (e->sp == NULL) {
|
169
|
+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
170
|
+
}
|
171
|
+
|
172
|
+
e->ip = rlcf->codes->elts;
|
173
|
+
e->request = r;
|
174
|
+
e->quote = 1;
|
175
|
+
e->log = rlcf->log;
|
176
|
+
e->status = NGX_DECLINED;
|
177
|
+
|
178
|
+
while (*(uintptr_t *) e->ip) {
|
179
|
+
code = *(ngx_http_script_code_pt *) e->ip;
|
180
|
+
code(e);
|
181
|
+
}
|
182
|
+
|
183
|
+
if (e->status < NGX_HTTP_BAD_REQUEST) {
|
184
|
+
return e->status;
|
185
|
+
}
|
186
|
+
|
187
|
+
if (r->err_status == 0) {
|
188
|
+
return e->status;
|
189
|
+
}
|
190
|
+
|
191
|
+
return r->err_status;
|
192
|
+
}
|
193
|
+
|
194
|
+
|
195
|
+
static ngx_int_t
|
196
|
+
ngx_http_rewrite_var(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
197
|
+
uintptr_t data)
|
198
|
+
{
|
199
|
+
ngx_http_variable_t *var;
|
200
|
+
ngx_http_core_main_conf_t *cmcf;
|
201
|
+
ngx_http_rewrite_loc_conf_t *rlcf;
|
202
|
+
|
203
|
+
rlcf = ngx_http_get_module_loc_conf(r, ngx_http_rewrite_module);
|
204
|
+
|
205
|
+
if (rlcf->uninitialized_variable_warn == 0) {
|
206
|
+
*v = ngx_http_variable_null_value;
|
207
|
+
return NGX_OK;
|
208
|
+
}
|
209
|
+
|
210
|
+
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
|
211
|
+
|
212
|
+
var = cmcf->variables.elts;
|
213
|
+
|
214
|
+
/*
|
215
|
+
* the ngx_http_rewrite_module sets variables directly in r->variables,
|
216
|
+
* and they should be handled by ngx_http_get_indexed_variable(),
|
217
|
+
* so the handler is called only if the variable is not initialized
|
218
|
+
*/
|
219
|
+
|
220
|
+
ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
|
221
|
+
"using uninitialized \"%V\" variable", &var[data].name);
|
222
|
+
|
223
|
+
*v = ngx_http_variable_null_value;
|
224
|
+
|
225
|
+
return NGX_OK;
|
226
|
+
}
|
227
|
+
|
228
|
+
|
229
|
+
static void *
|
230
|
+
ngx_http_rewrite_create_loc_conf(ngx_conf_t *cf)
|
231
|
+
{
|
232
|
+
ngx_http_rewrite_loc_conf_t *conf;
|
233
|
+
|
234
|
+
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_rewrite_loc_conf_t));
|
235
|
+
if (conf == NULL) {
|
236
|
+
return NULL;
|
237
|
+
}
|
238
|
+
|
239
|
+
conf->stack_size = NGX_CONF_UNSET_UINT;
|
240
|
+
conf->log = NGX_CONF_UNSET;
|
241
|
+
conf->uninitialized_variable_warn = NGX_CONF_UNSET;
|
242
|
+
|
243
|
+
return conf;
|
244
|
+
}
|
245
|
+
|
246
|
+
|
247
|
+
static char *
|
248
|
+
ngx_http_rewrite_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
249
|
+
{
|
250
|
+
ngx_http_rewrite_loc_conf_t *prev = parent;
|
251
|
+
ngx_http_rewrite_loc_conf_t *conf = child;
|
252
|
+
|
253
|
+
uintptr_t *code;
|
254
|
+
|
255
|
+
ngx_conf_merge_value(conf->log, prev->log, 0);
|
256
|
+
ngx_conf_merge_value(conf->uninitialized_variable_warn,
|
257
|
+
prev->uninitialized_variable_warn, 1);
|
258
|
+
ngx_conf_merge_uint_value(conf->stack_size, prev->stack_size, 10);
|
259
|
+
|
260
|
+
if (conf->codes == NULL) {
|
261
|
+
return NGX_CONF_OK;
|
262
|
+
}
|
263
|
+
|
264
|
+
if (conf->codes == prev->codes) {
|
265
|
+
return NGX_CONF_OK;
|
266
|
+
}
|
267
|
+
|
268
|
+
code = ngx_array_push_n(conf->codes, sizeof(uintptr_t));
|
269
|
+
if (code == NULL) {
|
270
|
+
return NGX_CONF_ERROR;
|
271
|
+
}
|
272
|
+
|
273
|
+
*code = (uintptr_t) NULL;
|
274
|
+
|
275
|
+
return NGX_CONF_OK;
|
276
|
+
}
|
277
|
+
|
278
|
+
|
279
|
+
static ngx_int_t
|
280
|
+
ngx_http_rewrite_init(ngx_conf_t *cf)
|
281
|
+
{
|
282
|
+
ngx_http_handler_pt *h;
|
283
|
+
ngx_http_core_main_conf_t *cmcf;
|
284
|
+
|
285
|
+
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
286
|
+
|
287
|
+
h = ngx_array_push(&cmcf->phases[NGX_HTTP_SERVER_REWRITE_PHASE].handlers);
|
288
|
+
if (h == NULL) {
|
289
|
+
return NGX_ERROR;
|
290
|
+
}
|
291
|
+
|
292
|
+
*h = ngx_http_rewrite_handler;
|
293
|
+
|
294
|
+
h = ngx_array_push(&cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers);
|
295
|
+
if (h == NULL) {
|
296
|
+
return NGX_ERROR;
|
297
|
+
}
|
298
|
+
|
299
|
+
*h = ngx_http_rewrite_handler;
|
300
|
+
|
301
|
+
return NGX_OK;
|
302
|
+
}
|
303
|
+
|
304
|
+
|
305
|
+
static char *
|
306
|
+
ngx_http_rewrite(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
307
|
+
{
|
308
|
+
ngx_http_rewrite_loc_conf_t *lcf = conf;
|
309
|
+
|
310
|
+
ngx_str_t *value;
|
311
|
+
ngx_uint_t last;
|
312
|
+
ngx_regex_compile_t rc;
|
313
|
+
ngx_http_script_code_pt *code;
|
314
|
+
ngx_http_script_compile_t sc;
|
315
|
+
ngx_http_script_regex_code_t *regex;
|
316
|
+
ngx_http_script_regex_end_code_t *regex_end;
|
317
|
+
u_char errstr[NGX_MAX_CONF_ERRSTR];
|
318
|
+
|
319
|
+
regex = ngx_http_script_start_code(cf->pool, &lcf->codes,
|
320
|
+
sizeof(ngx_http_script_regex_code_t));
|
321
|
+
if (regex == NULL) {
|
322
|
+
return NGX_CONF_ERROR;
|
323
|
+
}
|
324
|
+
|
325
|
+
ngx_memzero(regex, sizeof(ngx_http_script_regex_code_t));
|
326
|
+
|
327
|
+
value = cf->args->elts;
|
328
|
+
|
329
|
+
ngx_memzero(&rc, sizeof(ngx_regex_compile_t));
|
330
|
+
|
331
|
+
rc.pattern = value[1];
|
332
|
+
rc.err.len = NGX_MAX_CONF_ERRSTR;
|
333
|
+
rc.err.data = errstr;
|
334
|
+
|
335
|
+
/* TODO: NGX_REGEX_CASELESS */
|
336
|
+
|
337
|
+
regex->regex = ngx_http_regex_compile(cf, &rc);
|
338
|
+
if (regex->regex == NULL) {
|
339
|
+
return NGX_CONF_ERROR;
|
340
|
+
}
|
341
|
+
|
342
|
+
regex->code = ngx_http_script_regex_start_code;
|
343
|
+
regex->uri = 1;
|
344
|
+
regex->name = value[1];
|
345
|
+
|
346
|
+
if (value[2].data[value[2].len - 1] == '?') {
|
347
|
+
|
348
|
+
/* the last "?" drops the original arguments */
|
349
|
+
value[2].len--;
|
350
|
+
|
351
|
+
} else {
|
352
|
+
regex->add_args = 1;
|
353
|
+
}
|
354
|
+
|
355
|
+
last = 0;
|
356
|
+
|
357
|
+
if (ngx_strncmp(value[2].data, "http://", sizeof("http://") - 1) == 0
|
358
|
+
|| ngx_strncmp(value[2].data, "https://", sizeof("https://") - 1) == 0
|
359
|
+
|| ngx_strncmp(value[2].data, "$scheme", sizeof("$scheme") - 1) == 0)
|
360
|
+
{
|
361
|
+
regex->status = NGX_HTTP_MOVED_TEMPORARILY;
|
362
|
+
regex->redirect = 1;
|
363
|
+
last = 1;
|
364
|
+
}
|
365
|
+
|
366
|
+
if (cf->args->nelts == 4) {
|
367
|
+
if (ngx_strcmp(value[3].data, "last") == 0) {
|
368
|
+
last = 1;
|
369
|
+
|
370
|
+
} else if (ngx_strcmp(value[3].data, "break") == 0) {
|
371
|
+
regex->break_cycle = 1;
|
372
|
+
last = 1;
|
373
|
+
|
374
|
+
} else if (ngx_strcmp(value[3].data, "redirect") == 0) {
|
375
|
+
regex->status = NGX_HTTP_MOVED_TEMPORARILY;
|
376
|
+
regex->redirect = 1;
|
377
|
+
last = 1;
|
378
|
+
|
379
|
+
} else if (ngx_strcmp(value[3].data, "permanent") == 0) {
|
380
|
+
regex->status = NGX_HTTP_MOVED_PERMANENTLY;
|
381
|
+
regex->redirect = 1;
|
382
|
+
last = 1;
|
383
|
+
|
384
|
+
} else {
|
385
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
386
|
+
"invalid parameter \"%V\"", &value[3]);
|
387
|
+
return NGX_CONF_ERROR;
|
388
|
+
}
|
389
|
+
}
|
390
|
+
|
391
|
+
ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
|
392
|
+
|
393
|
+
sc.cf = cf;
|
394
|
+
sc.source = &value[2];
|
395
|
+
sc.lengths = ®ex->lengths;
|
396
|
+
sc.values = &lcf->codes;
|
397
|
+
sc.variables = ngx_http_script_variables_count(&value[2]);
|
398
|
+
sc.main = regex;
|
399
|
+
sc.complete_lengths = 1;
|
400
|
+
sc.compile_args = !regex->redirect;
|
401
|
+
|
402
|
+
if (ngx_http_script_compile(&sc) != NGX_OK) {
|
403
|
+
return NGX_CONF_ERROR;
|
404
|
+
}
|
405
|
+
|
406
|
+
regex = sc.main;
|
407
|
+
|
408
|
+
regex->size = sc.size;
|
409
|
+
regex->args = sc.args;
|
410
|
+
|
411
|
+
if (sc.variables == 0 && !sc.dup_capture) {
|
412
|
+
regex->lengths = NULL;
|
413
|
+
}
|
414
|
+
|
415
|
+
regex_end = ngx_http_script_add_code(lcf->codes,
|
416
|
+
sizeof(ngx_http_script_regex_end_code_t),
|
417
|
+
®ex);
|
418
|
+
if (regex_end == NULL) {
|
419
|
+
return NGX_CONF_ERROR;
|
420
|
+
}
|
421
|
+
|
422
|
+
regex_end->code = ngx_http_script_regex_end_code;
|
423
|
+
regex_end->uri = regex->uri;
|
424
|
+
regex_end->args = regex->args;
|
425
|
+
regex_end->add_args = regex->add_args;
|
426
|
+
regex_end->redirect = regex->redirect;
|
427
|
+
|
428
|
+
if (last) {
|
429
|
+
code = ngx_http_script_add_code(lcf->codes, sizeof(uintptr_t), ®ex);
|
430
|
+
if (code == NULL) {
|
431
|
+
return NGX_CONF_ERROR;
|
432
|
+
}
|
433
|
+
|
434
|
+
*code = NULL;
|
435
|
+
}
|
436
|
+
|
437
|
+
regex->next = (u_char *) lcf->codes->elts + lcf->codes->nelts
|
438
|
+
- (u_char *) regex;
|
439
|
+
|
440
|
+
return NGX_CONF_OK;
|
441
|
+
}
|
442
|
+
|
443
|
+
|
444
|
+
static char *
|
445
|
+
ngx_http_rewrite_return(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
446
|
+
{
|
447
|
+
ngx_http_rewrite_loc_conf_t *lcf = conf;
|
448
|
+
|
449
|
+
u_char *p;
|
450
|
+
ngx_str_t *value, *v;
|
451
|
+
ngx_http_script_return_code_t *ret;
|
452
|
+
ngx_http_compile_complex_value_t ccv;
|
453
|
+
|
454
|
+
ret = ngx_http_script_start_code(cf->pool, &lcf->codes,
|
455
|
+
sizeof(ngx_http_script_return_code_t));
|
456
|
+
if (ret == NULL) {
|
457
|
+
return NGX_CONF_ERROR;
|
458
|
+
}
|
459
|
+
|
460
|
+
value = cf->args->elts;
|
461
|
+
|
462
|
+
ngx_memzero(ret, sizeof(ngx_http_script_return_code_t));
|
463
|
+
|
464
|
+
ret->code = ngx_http_script_return_code;
|
465
|
+
|
466
|
+
p = value[1].data;
|
467
|
+
|
468
|
+
ret->status = ngx_atoi(p, value[1].len);
|
469
|
+
|
470
|
+
if (ret->status == (uintptr_t) NGX_ERROR) {
|
471
|
+
|
472
|
+
if (cf->args->nelts == 2
|
473
|
+
&& (ngx_strncmp(p, "http://", sizeof("http://") - 1) == 0
|
474
|
+
|| ngx_strncmp(p, "https://", sizeof("https://") - 1) == 0
|
475
|
+
|| ngx_strncmp(p, "$scheme", sizeof("$scheme") - 1) == 0))
|
476
|
+
{
|
477
|
+
ret->status = NGX_HTTP_MOVED_TEMPORARILY;
|
478
|
+
v = &value[1];
|
479
|
+
|
480
|
+
} else {
|
481
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
482
|
+
"invalid return code \"%V\"", &value[1]);
|
483
|
+
return NGX_CONF_ERROR;
|
484
|
+
}
|
485
|
+
|
486
|
+
} else {
|
487
|
+
|
488
|
+
if (cf->args->nelts == 2) {
|
489
|
+
return NGX_CONF_OK;
|
490
|
+
}
|
491
|
+
|
492
|
+
v = &value[2];
|
493
|
+
}
|
494
|
+
|
495
|
+
ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
|
496
|
+
|
497
|
+
ccv.cf = cf;
|
498
|
+
ccv.value = v;
|
499
|
+
ccv.complex_value = &ret->text;
|
500
|
+
|
501
|
+
if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
|
502
|
+
return NGX_CONF_ERROR;
|
503
|
+
}
|
504
|
+
|
505
|
+
return NGX_CONF_OK;
|
506
|
+
}
|
507
|
+
|
508
|
+
|
509
|
+
static char *
|
510
|
+
ngx_http_rewrite_break(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
511
|
+
{
|
512
|
+
ngx_http_rewrite_loc_conf_t *lcf = conf;
|
513
|
+
|
514
|
+
ngx_http_script_code_pt *code;
|
515
|
+
|
516
|
+
code = ngx_http_script_start_code(cf->pool, &lcf->codes, sizeof(uintptr_t));
|
517
|
+
if (code == NULL) {
|
518
|
+
return NGX_CONF_ERROR;
|
519
|
+
}
|
520
|
+
|
521
|
+
*code = ngx_http_script_break_code;
|
522
|
+
|
523
|
+
return NGX_CONF_OK;
|
524
|
+
}
|
525
|
+
|
526
|
+
|
527
|
+
static char *
|
528
|
+
ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
529
|
+
{
|
530
|
+
ngx_http_rewrite_loc_conf_t *lcf = conf;
|
531
|
+
|
532
|
+
void *mconf;
|
533
|
+
char *rv;
|
534
|
+
u_char *elts;
|
535
|
+
ngx_uint_t i;
|
536
|
+
ngx_conf_t save;
|
537
|
+
ngx_http_module_t *module;
|
538
|
+
ngx_http_conf_ctx_t *ctx, *pctx;
|
539
|
+
ngx_http_core_loc_conf_t *clcf, *pclcf;
|
540
|
+
ngx_http_script_if_code_t *if_code;
|
541
|
+
ngx_http_rewrite_loc_conf_t *nlcf;
|
542
|
+
|
543
|
+
ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t));
|
544
|
+
if (ctx == NULL) {
|
545
|
+
return NGX_CONF_ERROR;
|
546
|
+
}
|
547
|
+
|
548
|
+
pctx = cf->ctx;
|
549
|
+
ctx->main_conf = pctx->main_conf;
|
550
|
+
ctx->srv_conf = pctx->srv_conf;
|
551
|
+
|
552
|
+
ctx->loc_conf = ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module);
|
553
|
+
if (ctx->loc_conf == NULL) {
|
554
|
+
return NGX_CONF_ERROR;
|
555
|
+
}
|
556
|
+
|
557
|
+
for (i = 0; ngx_modules[i]; i++) {
|
558
|
+
if (ngx_modules[i]->type != NGX_HTTP_MODULE) {
|
559
|
+
continue;
|
560
|
+
}
|
561
|
+
|
562
|
+
module = ngx_modules[i]->ctx;
|
563
|
+
|
564
|
+
if (module->create_loc_conf) {
|
565
|
+
|
566
|
+
mconf = module->create_loc_conf(cf);
|
567
|
+
if (mconf == NULL) {
|
568
|
+
return NGX_CONF_ERROR;
|
569
|
+
}
|
570
|
+
|
571
|
+
ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf;
|
572
|
+
}
|
573
|
+
}
|
574
|
+
|
575
|
+
pclcf = pctx->loc_conf[ngx_http_core_module.ctx_index];
|
576
|
+
|
577
|
+
clcf = ctx->loc_conf[ngx_http_core_module.ctx_index];
|
578
|
+
clcf->loc_conf = ctx->loc_conf;
|
579
|
+
clcf->name = pclcf->name;
|
580
|
+
clcf->noname = 1;
|
581
|
+
|
582
|
+
if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) {
|
583
|
+
return NGX_CONF_ERROR;
|
584
|
+
}
|
585
|
+
|
586
|
+
if (ngx_http_rewrite_if_condition(cf, lcf) != NGX_CONF_OK) {
|
587
|
+
return NGX_CONF_ERROR;
|
588
|
+
}
|
589
|
+
|
590
|
+
if_code = ngx_array_push_n(lcf->codes, sizeof(ngx_http_script_if_code_t));
|
591
|
+
if (if_code == NULL) {
|
592
|
+
return NGX_CONF_ERROR;
|
593
|
+
}
|
594
|
+
|
595
|
+
if_code->code = ngx_http_script_if_code;
|
596
|
+
|
597
|
+
elts = lcf->codes->elts;
|
598
|
+
|
599
|
+
|
600
|
+
/* the inner directives must be compiled to the same code array */
|
601
|
+
|
602
|
+
nlcf = ctx->loc_conf[ngx_http_rewrite_module.ctx_index];
|
603
|
+
nlcf->codes = lcf->codes;
|
604
|
+
|
605
|
+
|
606
|
+
save = *cf;
|
607
|
+
cf->ctx = ctx;
|
608
|
+
|
609
|
+
if (pclcf->name.len == 0) {
|
610
|
+
if_code->loc_conf = NULL;
|
611
|
+
cf->cmd_type = NGX_HTTP_SIF_CONF;
|
612
|
+
|
613
|
+
} else {
|
614
|
+
if_code->loc_conf = ctx->loc_conf;
|
615
|
+
cf->cmd_type = NGX_HTTP_LIF_CONF;
|
616
|
+
}
|
617
|
+
|
618
|
+
rv = ngx_conf_parse(cf, NULL);
|
619
|
+
|
620
|
+
*cf = save;
|
621
|
+
|
622
|
+
if (rv != NGX_CONF_OK) {
|
623
|
+
return rv;
|
624
|
+
}
|
625
|
+
|
626
|
+
|
627
|
+
if (elts != lcf->codes->elts) {
|
628
|
+
if_code = (ngx_http_script_if_code_t *)
|
629
|
+
((u_char *) if_code + ((u_char *) lcf->codes->elts - elts));
|
630
|
+
}
|
631
|
+
|
632
|
+
if_code->next = (u_char *) lcf->codes->elts + lcf->codes->nelts
|
633
|
+
- (u_char *) if_code;
|
634
|
+
|
635
|
+
/* the code array belong to parent block */
|
636
|
+
|
637
|
+
nlcf->codes = NULL;
|
638
|
+
|
639
|
+
return NGX_CONF_OK;
|
640
|
+
}
|
641
|
+
|
642
|
+
|
643
|
+
static char *
|
644
|
+
ngx_http_rewrite_if_condition(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf)
|
645
|
+
{
|
646
|
+
u_char *p;
|
647
|
+
size_t len;
|
648
|
+
ngx_str_t *value;
|
649
|
+
ngx_uint_t cur, last;
|
650
|
+
ngx_regex_compile_t rc;
|
651
|
+
ngx_http_script_code_pt *code;
|
652
|
+
ngx_http_script_file_code_t *fop;
|
653
|
+
ngx_http_script_regex_code_t *regex;
|
654
|
+
u_char errstr[NGX_MAX_CONF_ERRSTR];
|
655
|
+
|
656
|
+
value = cf->args->elts;
|
657
|
+
last = cf->args->nelts - 1;
|
658
|
+
|
659
|
+
if (value[1].len < 1 || value[1].data[0] != '(') {
|
660
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
661
|
+
"invalid condition \"%V\"", &value[1]);
|
662
|
+
return NGX_CONF_ERROR;
|
663
|
+
}
|
664
|
+
|
665
|
+
if (value[1].len == 1) {
|
666
|
+
cur = 2;
|
667
|
+
|
668
|
+
} else {
|
669
|
+
cur = 1;
|
670
|
+
value[1].len--;
|
671
|
+
value[1].data++;
|
672
|
+
}
|
673
|
+
|
674
|
+
if (value[last].len < 1 || value[last].data[value[last].len - 1] != ')') {
|
675
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
676
|
+
"invalid condition \"%V\"", &value[last]);
|
677
|
+
return NGX_CONF_ERROR;
|
678
|
+
}
|
679
|
+
|
680
|
+
if (value[last].len == 1) {
|
681
|
+
last--;
|
682
|
+
|
683
|
+
} else {
|
684
|
+
value[last].len--;
|
685
|
+
value[last].data[value[last].len] = '\0';
|
686
|
+
}
|
687
|
+
|
688
|
+
len = value[cur].len;
|
689
|
+
p = value[cur].data;
|
690
|
+
|
691
|
+
if (len > 1 && p[0] == '$') {
|
692
|
+
|
693
|
+
if (cur != last && cur + 2 != last) {
|
694
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
695
|
+
"invalid condition \"%V\"", &value[cur]);
|
696
|
+
return NGX_CONF_ERROR;
|
697
|
+
}
|
698
|
+
|
699
|
+
if (ngx_http_rewrite_variable(cf, lcf, &value[cur]) != NGX_CONF_OK) {
|
700
|
+
return NGX_CONF_ERROR;
|
701
|
+
}
|
702
|
+
|
703
|
+
if (cur == last) {
|
704
|
+
return NGX_CONF_OK;
|
705
|
+
}
|
706
|
+
|
707
|
+
cur++;
|
708
|
+
|
709
|
+
len = value[cur].len;
|
710
|
+
p = value[cur].data;
|
711
|
+
|
712
|
+
if (len == 1 && p[0] == '=') {
|
713
|
+
|
714
|
+
if (ngx_http_rewrite_value(cf, lcf, &value[last]) != NGX_CONF_OK) {
|
715
|
+
return NGX_CONF_ERROR;
|
716
|
+
}
|
717
|
+
|
718
|
+
code = ngx_http_script_start_code(cf->pool, &lcf->codes,
|
719
|
+
sizeof(uintptr_t));
|
720
|
+
if (code == NULL) {
|
721
|
+
return NGX_CONF_ERROR;
|
722
|
+
}
|
723
|
+
|
724
|
+
*code = ngx_http_script_equal_code;
|
725
|
+
|
726
|
+
return NGX_CONF_OK;
|
727
|
+
}
|
728
|
+
|
729
|
+
if (len == 2 && p[0] == '!' && p[1] == '=') {
|
730
|
+
|
731
|
+
if (ngx_http_rewrite_value(cf, lcf, &value[last]) != NGX_CONF_OK) {
|
732
|
+
return NGX_CONF_ERROR;
|
733
|
+
}
|
734
|
+
|
735
|
+
code = ngx_http_script_start_code(cf->pool, &lcf->codes,
|
736
|
+
sizeof(uintptr_t));
|
737
|
+
if (code == NULL) {
|
738
|
+
return NGX_CONF_ERROR;
|
739
|
+
}
|
740
|
+
|
741
|
+
*code = ngx_http_script_not_equal_code;
|
742
|
+
return NGX_CONF_OK;
|
743
|
+
}
|
744
|
+
|
745
|
+
if ((len == 1 && p[0] == '~')
|
746
|
+
|| (len == 2 && p[0] == '~' && p[1] == '*')
|
747
|
+
|| (len == 2 && p[0] == '!' && p[1] == '~')
|
748
|
+
|| (len == 3 && p[0] == '!' && p[1] == '~' && p[2] == '*'))
|
749
|
+
{
|
750
|
+
regex = ngx_http_script_start_code(cf->pool, &lcf->codes,
|
751
|
+
sizeof(ngx_http_script_regex_code_t));
|
752
|
+
if (regex == NULL) {
|
753
|
+
return NGX_CONF_ERROR;
|
754
|
+
}
|
755
|
+
|
756
|
+
ngx_memzero(regex, sizeof(ngx_http_script_regex_code_t));
|
757
|
+
|
758
|
+
ngx_memzero(&rc, sizeof(ngx_regex_compile_t));
|
759
|
+
|
760
|
+
rc.pattern = value[last];
|
761
|
+
rc.options = (p[len - 1] == '*') ? NGX_REGEX_CASELESS : 0;
|
762
|
+
rc.err.len = NGX_MAX_CONF_ERRSTR;
|
763
|
+
rc.err.data = errstr;
|
764
|
+
|
765
|
+
regex->regex = ngx_http_regex_compile(cf, &rc);
|
766
|
+
if (regex->regex == NULL) {
|
767
|
+
return NGX_CONF_ERROR;
|
768
|
+
}
|
769
|
+
|
770
|
+
regex->code = ngx_http_script_regex_start_code;
|
771
|
+
regex->next = sizeof(ngx_http_script_regex_code_t);
|
772
|
+
regex->test = 1;
|
773
|
+
if (p[0] == '!') {
|
774
|
+
regex->negative_test = 1;
|
775
|
+
}
|
776
|
+
regex->name = value[last];
|
777
|
+
|
778
|
+
return NGX_CONF_OK;
|
779
|
+
}
|
780
|
+
|
781
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
782
|
+
"unexpected \"%V\" in condition", &value[cur]);
|
783
|
+
return NGX_CONF_ERROR;
|
784
|
+
|
785
|
+
} else if ((len == 2 && p[0] == '-')
|
786
|
+
|| (len == 3 && p[0] == '!' && p[1] == '-'))
|
787
|
+
{
|
788
|
+
if (cur + 1 != last) {
|
789
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
790
|
+
"invalid condition \"%V\"", &value[cur]);
|
791
|
+
return NGX_CONF_ERROR;
|
792
|
+
}
|
793
|
+
|
794
|
+
value[last].data[value[last].len] = '\0';
|
795
|
+
value[last].len++;
|
796
|
+
|
797
|
+
if (ngx_http_rewrite_value(cf, lcf, &value[last]) != NGX_CONF_OK) {
|
798
|
+
return NGX_CONF_ERROR;
|
799
|
+
}
|
800
|
+
|
801
|
+
fop = ngx_http_script_start_code(cf->pool, &lcf->codes,
|
802
|
+
sizeof(ngx_http_script_file_code_t));
|
803
|
+
if (fop == NULL) {
|
804
|
+
return NGX_CONF_ERROR;
|
805
|
+
}
|
806
|
+
|
807
|
+
fop->code = ngx_http_script_file_code;
|
808
|
+
|
809
|
+
if (p[1] == 'f') {
|
810
|
+
fop->op = ngx_http_script_file_plain;
|
811
|
+
return NGX_CONF_OK;
|
812
|
+
}
|
813
|
+
|
814
|
+
if (p[1] == 'd') {
|
815
|
+
fop->op = ngx_http_script_file_dir;
|
816
|
+
return NGX_CONF_OK;
|
817
|
+
}
|
818
|
+
|
819
|
+
if (p[1] == 'e') {
|
820
|
+
fop->op = ngx_http_script_file_exists;
|
821
|
+
return NGX_CONF_OK;
|
822
|
+
}
|
823
|
+
|
824
|
+
if (p[1] == 'x') {
|
825
|
+
fop->op = ngx_http_script_file_exec;
|
826
|
+
return NGX_CONF_OK;
|
827
|
+
}
|
828
|
+
|
829
|
+
if (p[0] == '!') {
|
830
|
+
if (p[2] == 'f') {
|
831
|
+
fop->op = ngx_http_script_file_not_plain;
|
832
|
+
return NGX_CONF_OK;
|
833
|
+
}
|
834
|
+
|
835
|
+
if (p[2] == 'd') {
|
836
|
+
fop->op = ngx_http_script_file_not_dir;
|
837
|
+
return NGX_CONF_OK;
|
838
|
+
}
|
839
|
+
|
840
|
+
if (p[2] == 'e') {
|
841
|
+
fop->op = ngx_http_script_file_not_exists;
|
842
|
+
return NGX_CONF_OK;
|
843
|
+
}
|
844
|
+
|
845
|
+
if (p[2] == 'x') {
|
846
|
+
fop->op = ngx_http_script_file_not_exec;
|
847
|
+
return NGX_CONF_OK;
|
848
|
+
}
|
849
|
+
}
|
850
|
+
|
851
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
852
|
+
"invalid condition \"%V\"", &value[cur]);
|
853
|
+
return NGX_CONF_ERROR;
|
854
|
+
}
|
855
|
+
|
856
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
857
|
+
"invalid condition \"%V\"", &value[cur]);
|
858
|
+
|
859
|
+
return NGX_CONF_ERROR;
|
860
|
+
}
|
861
|
+
|
862
|
+
|
863
|
+
static char *
|
864
|
+
ngx_http_rewrite_variable(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf,
|
865
|
+
ngx_str_t *value)
|
866
|
+
{
|
867
|
+
ngx_int_t index;
|
868
|
+
ngx_http_script_var_code_t *var_code;
|
869
|
+
|
870
|
+
value->len--;
|
871
|
+
value->data++;
|
872
|
+
|
873
|
+
index = ngx_http_get_variable_index(cf, value);
|
874
|
+
|
875
|
+
if (index == NGX_ERROR) {
|
876
|
+
return NGX_CONF_ERROR;
|
877
|
+
}
|
878
|
+
|
879
|
+
var_code = ngx_http_script_start_code(cf->pool, &lcf->codes,
|
880
|
+
sizeof(ngx_http_script_var_code_t));
|
881
|
+
if (var_code == NULL) {
|
882
|
+
return NGX_CONF_ERROR;
|
883
|
+
}
|
884
|
+
|
885
|
+
var_code->code = ngx_http_script_var_code;
|
886
|
+
var_code->index = index;
|
887
|
+
|
888
|
+
return NGX_CONF_OK;
|
889
|
+
}
|
890
|
+
|
891
|
+
|
892
|
+
static char *
|
893
|
+
ngx_http_rewrite_set(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
894
|
+
{
|
895
|
+
ngx_http_rewrite_loc_conf_t *lcf = conf;
|
896
|
+
|
897
|
+
ngx_int_t index;
|
898
|
+
ngx_str_t *value;
|
899
|
+
ngx_http_variable_t *v;
|
900
|
+
ngx_http_script_var_code_t *vcode;
|
901
|
+
ngx_http_script_var_handler_code_t *vhcode;
|
902
|
+
|
903
|
+
value = cf->args->elts;
|
904
|
+
|
905
|
+
if (value[1].data[0] != '$') {
|
906
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
907
|
+
"invalid variable name \"%V\"", &value[1]);
|
908
|
+
return NGX_CONF_ERROR;
|
909
|
+
}
|
910
|
+
|
911
|
+
value[1].len--;
|
912
|
+
value[1].data++;
|
913
|
+
|
914
|
+
v = ngx_http_add_variable(cf, &value[1], NGX_HTTP_VAR_CHANGEABLE);
|
915
|
+
if (v == NULL) {
|
916
|
+
return NGX_CONF_ERROR;
|
917
|
+
}
|
918
|
+
|
919
|
+
index = ngx_http_get_variable_index(cf, &value[1]);
|
920
|
+
if (index == NGX_ERROR) {
|
921
|
+
return NGX_CONF_ERROR;
|
922
|
+
}
|
923
|
+
|
924
|
+
if (v->get_handler == NULL
|
925
|
+
&& ngx_strncasecmp(value[1].data, (u_char *) "http_", 5) != 0
|
926
|
+
&& ngx_strncasecmp(value[1].data, (u_char *) "sent_http_", 10) != 0
|
927
|
+
&& ngx_strncasecmp(value[1].data, (u_char *) "upstream_http_", 14) != 0)
|
928
|
+
{
|
929
|
+
v->get_handler = ngx_http_rewrite_var;
|
930
|
+
v->data = index;
|
931
|
+
}
|
932
|
+
|
933
|
+
if (ngx_http_rewrite_value(cf, lcf, &value[2]) != NGX_CONF_OK) {
|
934
|
+
return NGX_CONF_ERROR;
|
935
|
+
}
|
936
|
+
|
937
|
+
if (v->set_handler) {
|
938
|
+
vhcode = ngx_http_script_start_code(cf->pool, &lcf->codes,
|
939
|
+
sizeof(ngx_http_script_var_handler_code_t));
|
940
|
+
if (vhcode == NULL) {
|
941
|
+
return NGX_CONF_ERROR;
|
942
|
+
}
|
943
|
+
|
944
|
+
vhcode->code = ngx_http_script_var_set_handler_code;
|
945
|
+
vhcode->handler = v->set_handler;
|
946
|
+
vhcode->data = v->data;
|
947
|
+
|
948
|
+
return NGX_CONF_OK;
|
949
|
+
}
|
950
|
+
|
951
|
+
vcode = ngx_http_script_start_code(cf->pool, &lcf->codes,
|
952
|
+
sizeof(ngx_http_script_var_code_t));
|
953
|
+
if (vcode == NULL) {
|
954
|
+
return NGX_CONF_ERROR;
|
955
|
+
}
|
956
|
+
|
957
|
+
vcode->code = ngx_http_script_set_var_code;
|
958
|
+
vcode->index = (uintptr_t) index;
|
959
|
+
|
960
|
+
return NGX_CONF_OK;
|
961
|
+
}
|
962
|
+
|
963
|
+
|
964
|
+
static char *
|
965
|
+
ngx_http_rewrite_value(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf,
|
966
|
+
ngx_str_t *value)
|
967
|
+
{
|
968
|
+
ngx_int_t n;
|
969
|
+
ngx_http_script_compile_t sc;
|
970
|
+
ngx_http_script_value_code_t *val;
|
971
|
+
ngx_http_script_complex_value_code_t *complex;
|
972
|
+
|
973
|
+
n = ngx_http_script_variables_count(value);
|
974
|
+
|
975
|
+
if (n == 0) {
|
976
|
+
val = ngx_http_script_start_code(cf->pool, &lcf->codes,
|
977
|
+
sizeof(ngx_http_script_value_code_t));
|
978
|
+
if (val == NULL) {
|
979
|
+
return NGX_CONF_ERROR;
|
980
|
+
}
|
981
|
+
|
982
|
+
n = ngx_atoi(value->data, value->len);
|
983
|
+
|
984
|
+
if (n == NGX_ERROR) {
|
985
|
+
n = 0;
|
986
|
+
}
|
987
|
+
|
988
|
+
val->code = ngx_http_script_value_code;
|
989
|
+
val->value = (uintptr_t) n;
|
990
|
+
val->text_len = (uintptr_t) value->len;
|
991
|
+
val->text_data = (uintptr_t) value->data;
|
992
|
+
|
993
|
+
return NGX_CONF_OK;
|
994
|
+
}
|
995
|
+
|
996
|
+
complex = ngx_http_script_start_code(cf->pool, &lcf->codes,
|
997
|
+
sizeof(ngx_http_script_complex_value_code_t));
|
998
|
+
if (complex == NULL) {
|
999
|
+
return NGX_CONF_ERROR;
|
1000
|
+
}
|
1001
|
+
|
1002
|
+
complex->code = ngx_http_script_complex_value_code;
|
1003
|
+
complex->lengths = NULL;
|
1004
|
+
|
1005
|
+
ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
|
1006
|
+
|
1007
|
+
sc.cf = cf;
|
1008
|
+
sc.source = value;
|
1009
|
+
sc.lengths = &complex->lengths;
|
1010
|
+
sc.values = &lcf->codes;
|
1011
|
+
sc.variables = n;
|
1012
|
+
sc.complete_lengths = 1;
|
1013
|
+
|
1014
|
+
if (ngx_http_script_compile(&sc) != NGX_OK) {
|
1015
|
+
return NGX_CONF_ERROR;
|
1016
|
+
}
|
1017
|
+
|
1018
|
+
return NGX_CONF_OK;
|
1019
|
+
}
|