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,713 @@
|
|
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
|
+
/*
|
14
|
+
* The module can check browser versions conforming to the following formats:
|
15
|
+
* X, X.X, X.X.X, and X.X.X.X. The maximum values of each format may be
|
16
|
+
* 4000, 4000.99, 4000.99.99, and 4000.99.99.99.
|
17
|
+
*/
|
18
|
+
|
19
|
+
|
20
|
+
#define NGX_HTTP_MODERN_BROWSER 0
|
21
|
+
#define NGX_HTTP_ANCIENT_BROWSER 1
|
22
|
+
|
23
|
+
|
24
|
+
typedef struct {
|
25
|
+
u_char browser[12];
|
26
|
+
size_t skip;
|
27
|
+
size_t add;
|
28
|
+
u_char name[12];
|
29
|
+
} ngx_http_modern_browser_mask_t;
|
30
|
+
|
31
|
+
|
32
|
+
typedef struct {
|
33
|
+
ngx_uint_t version;
|
34
|
+
size_t skip;
|
35
|
+
size_t add;
|
36
|
+
u_char name[12];
|
37
|
+
} ngx_http_modern_browser_t;
|
38
|
+
|
39
|
+
|
40
|
+
typedef struct {
|
41
|
+
ngx_str_t name;
|
42
|
+
ngx_http_get_variable_pt handler;
|
43
|
+
uintptr_t data;
|
44
|
+
} ngx_http_browser_variable_t;
|
45
|
+
|
46
|
+
|
47
|
+
typedef struct {
|
48
|
+
ngx_array_t *modern_browsers;
|
49
|
+
ngx_array_t *ancient_browsers;
|
50
|
+
ngx_http_variable_value_t *modern_browser_value;
|
51
|
+
ngx_http_variable_value_t *ancient_browser_value;
|
52
|
+
|
53
|
+
unsigned modern_unlisted_browsers:1;
|
54
|
+
unsigned netscape4:1;
|
55
|
+
} ngx_http_browser_conf_t;
|
56
|
+
|
57
|
+
|
58
|
+
static ngx_int_t ngx_http_msie_variable(ngx_http_request_t *r,
|
59
|
+
ngx_http_variable_value_t *v, uintptr_t data);
|
60
|
+
static ngx_int_t ngx_http_browser_variable(ngx_http_request_t *r,
|
61
|
+
ngx_http_variable_value_t *v, uintptr_t data);
|
62
|
+
|
63
|
+
static ngx_uint_t ngx_http_browser(ngx_http_request_t *r,
|
64
|
+
ngx_http_browser_conf_t *cf);
|
65
|
+
|
66
|
+
static ngx_int_t ngx_http_browser_add_variable(ngx_conf_t *cf);
|
67
|
+
static void *ngx_http_browser_create_conf(ngx_conf_t *cf);
|
68
|
+
static char *ngx_http_browser_merge_conf(ngx_conf_t *cf, void *parent,
|
69
|
+
void *child);
|
70
|
+
static int ngx_libc_cdecl ngx_http_modern_browser_sort(const void *one,
|
71
|
+
const void *two);
|
72
|
+
static char *ngx_http_modern_browser(ngx_conf_t *cf, ngx_command_t *cmd,
|
73
|
+
void *conf);
|
74
|
+
static char *ngx_http_ancient_browser(ngx_conf_t *cf, ngx_command_t *cmd,
|
75
|
+
void *conf);
|
76
|
+
static char *ngx_http_modern_browser_value(ngx_conf_t *cf, ngx_command_t *cmd,
|
77
|
+
void *conf);
|
78
|
+
static char *ngx_http_ancient_browser_value(ngx_conf_t *cf, ngx_command_t *cmd,
|
79
|
+
void *conf);
|
80
|
+
|
81
|
+
|
82
|
+
static ngx_command_t ngx_http_browser_commands[] = {
|
83
|
+
|
84
|
+
{ ngx_string("modern_browser"),
|
85
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12,
|
86
|
+
ngx_http_modern_browser,
|
87
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
88
|
+
0,
|
89
|
+
NULL },
|
90
|
+
|
91
|
+
{ ngx_string("ancient_browser"),
|
92
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
|
93
|
+
ngx_http_ancient_browser,
|
94
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
95
|
+
0,
|
96
|
+
NULL },
|
97
|
+
|
98
|
+
{ ngx_string("modern_browser_value"),
|
99
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
100
|
+
ngx_http_modern_browser_value,
|
101
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
102
|
+
0,
|
103
|
+
NULL },
|
104
|
+
|
105
|
+
{ ngx_string("ancient_browser_value"),
|
106
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
|
107
|
+
ngx_http_ancient_browser_value,
|
108
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
109
|
+
0,
|
110
|
+
NULL },
|
111
|
+
|
112
|
+
ngx_null_command
|
113
|
+
};
|
114
|
+
|
115
|
+
|
116
|
+
static ngx_http_module_t ngx_http_browser_module_ctx = {
|
117
|
+
ngx_http_browser_add_variable, /* preconfiguration */
|
118
|
+
NULL, /* postconfiguration */
|
119
|
+
|
120
|
+
NULL, /* create main configuration */
|
121
|
+
NULL, /* init main configuration */
|
122
|
+
|
123
|
+
NULL, /* create server configuration */
|
124
|
+
NULL, /* merge server configuration */
|
125
|
+
|
126
|
+
ngx_http_browser_create_conf, /* create location configuration */
|
127
|
+
ngx_http_browser_merge_conf /* merge location configuration */
|
128
|
+
};
|
129
|
+
|
130
|
+
|
131
|
+
ngx_module_t ngx_http_browser_module = {
|
132
|
+
NGX_MODULE_V1,
|
133
|
+
&ngx_http_browser_module_ctx, /* module context */
|
134
|
+
ngx_http_browser_commands, /* module directives */
|
135
|
+
NGX_HTTP_MODULE, /* module type */
|
136
|
+
NULL, /* init master */
|
137
|
+
NULL, /* init module */
|
138
|
+
NULL, /* init process */
|
139
|
+
NULL, /* init thread */
|
140
|
+
NULL, /* exit thread */
|
141
|
+
NULL, /* exit process */
|
142
|
+
NULL, /* exit master */
|
143
|
+
NGX_MODULE_V1_PADDING
|
144
|
+
};
|
145
|
+
|
146
|
+
|
147
|
+
static ngx_http_modern_browser_mask_t ngx_http_modern_browser_masks[] = {
|
148
|
+
|
149
|
+
/* Opera must be the first browser to check */
|
150
|
+
|
151
|
+
/*
|
152
|
+
* "Opera/7.50 (X11; FreeBSD i386; U) [en]"
|
153
|
+
* "Mozilla/5.0 (X11; FreeBSD i386; U) Opera 7.50 [en]"
|
154
|
+
* "Mozilla/4.0 (compatible; MSIE 6.0; X11; FreeBSD i386) Opera 7.50 [en]"
|
155
|
+
* "Opera/8.0 (Windows NT 5.1; U; ru)"
|
156
|
+
* "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; en) Opera 8.0"
|
157
|
+
* "Opera/9.01 (X11; FreeBSD 6 i386; U; en)"
|
158
|
+
*/
|
159
|
+
|
160
|
+
{ "opera",
|
161
|
+
0,
|
162
|
+
sizeof("Opera ") - 1,
|
163
|
+
"Opera"},
|
164
|
+
|
165
|
+
/* "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" */
|
166
|
+
|
167
|
+
{ "msie",
|
168
|
+
sizeof("Mozilla/4.0 (compatible; ") - 1,
|
169
|
+
sizeof("MSIE ") - 1,
|
170
|
+
"MSIE "},
|
171
|
+
|
172
|
+
/*
|
173
|
+
* "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020610"
|
174
|
+
* "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.5) Gecko/20031006"
|
175
|
+
* "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.6) Gecko/20040206
|
176
|
+
* Firefox/0.8"
|
177
|
+
* "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.8)
|
178
|
+
* Gecko/20050511 Firefox/1.0.4"
|
179
|
+
* "Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.0.5) Gecko/20060729
|
180
|
+
* Firefox/1.5.0.5"
|
181
|
+
*/
|
182
|
+
|
183
|
+
{ "gecko",
|
184
|
+
sizeof("Mozilla/5.0 (") - 1,
|
185
|
+
sizeof("rv:") - 1,
|
186
|
+
"rv:"},
|
187
|
+
|
188
|
+
/*
|
189
|
+
* "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; ru-ru) AppleWebKit/125.2
|
190
|
+
* (KHTML, like Gecko) Safari/125.7"
|
191
|
+
* "Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413
|
192
|
+
* (KHTML, like Gecko) Safari/413"
|
193
|
+
* "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418
|
194
|
+
* (KHTML, like Gecko) Safari/417.9.3"
|
195
|
+
* "Mozilla/5.0 (Macintosh; U; PPC Mac OS X; ru-ru) AppleWebKit/418.8
|
196
|
+
* (KHTML, like Gecko) Safari/419.3"
|
197
|
+
*/
|
198
|
+
|
199
|
+
{ "safari",
|
200
|
+
sizeof("Mozilla/5.0 (") - 1,
|
201
|
+
sizeof("Safari/") - 1,
|
202
|
+
"Safari/"},
|
203
|
+
|
204
|
+
/*
|
205
|
+
* "Mozilla/5.0 (compatible; Konqueror/3.1; Linux)"
|
206
|
+
* "Mozilla/5.0 (compatible; Konqueror/3.4; Linux) KHTML/3.4.2 (like Gecko)"
|
207
|
+
* "Mozilla/5.0 (compatible; Konqueror/3.5; FreeBSD) KHTML/3.5.1
|
208
|
+
* (like Gecko)"
|
209
|
+
*/
|
210
|
+
|
211
|
+
{ "konqueror",
|
212
|
+
sizeof("Mozilla/5.0 (compatible; ") - 1,
|
213
|
+
sizeof("Konqueror/") - 1,
|
214
|
+
"Konqueror/"},
|
215
|
+
|
216
|
+
{ "", 0, 0, "" }
|
217
|
+
|
218
|
+
};
|
219
|
+
|
220
|
+
|
221
|
+
static ngx_http_browser_variable_t ngx_http_browsers[] = {
|
222
|
+
{ ngx_string("msie"), ngx_http_msie_variable, 0 },
|
223
|
+
{ ngx_string("modern_browser"), ngx_http_browser_variable,
|
224
|
+
NGX_HTTP_MODERN_BROWSER },
|
225
|
+
{ ngx_string("ancient_browser"), ngx_http_browser_variable,
|
226
|
+
NGX_HTTP_ANCIENT_BROWSER },
|
227
|
+
{ ngx_null_string, NULL, 0 }
|
228
|
+
};
|
229
|
+
|
230
|
+
|
231
|
+
static ngx_int_t
|
232
|
+
ngx_http_browser_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
233
|
+
uintptr_t data)
|
234
|
+
{
|
235
|
+
ngx_uint_t rc;
|
236
|
+
ngx_http_browser_conf_t *cf;
|
237
|
+
|
238
|
+
cf = ngx_http_get_module_loc_conf(r, ngx_http_browser_module);
|
239
|
+
|
240
|
+
rc = ngx_http_browser(r, cf);
|
241
|
+
|
242
|
+
if (data == NGX_HTTP_MODERN_BROWSER && rc == NGX_HTTP_MODERN_BROWSER) {
|
243
|
+
*v = *cf->modern_browser_value;
|
244
|
+
return NGX_OK;
|
245
|
+
}
|
246
|
+
|
247
|
+
if (data == NGX_HTTP_ANCIENT_BROWSER && rc == NGX_HTTP_ANCIENT_BROWSER) {
|
248
|
+
*v = *cf->ancient_browser_value;
|
249
|
+
return NGX_OK;
|
250
|
+
}
|
251
|
+
|
252
|
+
*v = ngx_http_variable_null_value;
|
253
|
+
return NGX_OK;
|
254
|
+
}
|
255
|
+
|
256
|
+
|
257
|
+
static ngx_uint_t
|
258
|
+
ngx_http_browser(ngx_http_request_t *r, ngx_http_browser_conf_t *cf)
|
259
|
+
{
|
260
|
+
size_t len;
|
261
|
+
u_char *name, *ua, *last, c;
|
262
|
+
ngx_str_t *ancient;
|
263
|
+
ngx_uint_t i, version, ver, scale;
|
264
|
+
ngx_http_modern_browser_t *modern;
|
265
|
+
|
266
|
+
if (r->headers_in.user_agent == NULL) {
|
267
|
+
if (cf->modern_unlisted_browsers) {
|
268
|
+
return NGX_HTTP_MODERN_BROWSER;
|
269
|
+
}
|
270
|
+
|
271
|
+
return NGX_HTTP_ANCIENT_BROWSER;
|
272
|
+
}
|
273
|
+
|
274
|
+
ua = r->headers_in.user_agent->value.data;
|
275
|
+
len = r->headers_in.user_agent->value.len;
|
276
|
+
last = ua + len;
|
277
|
+
|
278
|
+
if (cf->modern_browsers) {
|
279
|
+
modern = cf->modern_browsers->elts;
|
280
|
+
|
281
|
+
for (i = 0; i < cf->modern_browsers->nelts; i++) {
|
282
|
+
name = ua + modern[i].skip;
|
283
|
+
|
284
|
+
if (name >= last) {
|
285
|
+
continue;
|
286
|
+
}
|
287
|
+
|
288
|
+
name = (u_char *) ngx_strstr(name, modern[i].name);
|
289
|
+
|
290
|
+
if (name == NULL) {
|
291
|
+
continue;
|
292
|
+
}
|
293
|
+
|
294
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
295
|
+
"browser: \"%s\"", name);
|
296
|
+
|
297
|
+
name += modern[i].add;
|
298
|
+
|
299
|
+
if (name >= last) {
|
300
|
+
continue;
|
301
|
+
}
|
302
|
+
|
303
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
304
|
+
"version: \"%ui\" \"%s\"", modern[i].version, name);
|
305
|
+
|
306
|
+
version = 0;
|
307
|
+
ver = 0;
|
308
|
+
scale = 1000000;
|
309
|
+
|
310
|
+
while (name < last) {
|
311
|
+
|
312
|
+
c = *name++;
|
313
|
+
|
314
|
+
if (c >= '0' && c <= '9') {
|
315
|
+
ver = ver * 10 + (c - '0');
|
316
|
+
continue;
|
317
|
+
}
|
318
|
+
|
319
|
+
if (c == '.') {
|
320
|
+
version += ver * scale;
|
321
|
+
|
322
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
323
|
+
"version: \"%ui\" \"%ui\"",
|
324
|
+
modern[i].version, version);
|
325
|
+
|
326
|
+
if (version > modern[i].version) {
|
327
|
+
return NGX_HTTP_MODERN_BROWSER;
|
328
|
+
}
|
329
|
+
|
330
|
+
ver = 0;
|
331
|
+
scale /= 100;
|
332
|
+
continue;
|
333
|
+
}
|
334
|
+
|
335
|
+
break;
|
336
|
+
}
|
337
|
+
|
338
|
+
version += ver * scale;
|
339
|
+
|
340
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
341
|
+
"version: \"%ui\" \"%ui\"",
|
342
|
+
modern[i].version, version);
|
343
|
+
|
344
|
+
if (version >= modern[i].version) {
|
345
|
+
return NGX_HTTP_MODERN_BROWSER;
|
346
|
+
}
|
347
|
+
|
348
|
+
return NGX_HTTP_ANCIENT_BROWSER;
|
349
|
+
}
|
350
|
+
|
351
|
+
if (!cf->modern_unlisted_browsers) {
|
352
|
+
return NGX_HTTP_ANCIENT_BROWSER;
|
353
|
+
}
|
354
|
+
}
|
355
|
+
|
356
|
+
if (cf->netscape4) {
|
357
|
+
if (len > sizeof("Mozilla/4.72 ") - 1
|
358
|
+
&& ngx_strncmp(ua, "Mozilla/", sizeof("Mozilla/") - 1) == 0
|
359
|
+
&& ua[8] > '0' && ua[8] < '5')
|
360
|
+
{
|
361
|
+
return NGX_HTTP_ANCIENT_BROWSER;
|
362
|
+
}
|
363
|
+
}
|
364
|
+
|
365
|
+
if (cf->ancient_browsers) {
|
366
|
+
ancient = cf->ancient_browsers->elts;
|
367
|
+
|
368
|
+
for (i = 0; i < cf->ancient_browsers->nelts; i++) {
|
369
|
+
if (len >= ancient[i].len
|
370
|
+
&& ngx_strstr(ua, ancient[i].data) != NULL)
|
371
|
+
{
|
372
|
+
return NGX_HTTP_ANCIENT_BROWSER;
|
373
|
+
}
|
374
|
+
}
|
375
|
+
}
|
376
|
+
|
377
|
+
if (cf->modern_unlisted_browsers) {
|
378
|
+
return NGX_HTTP_MODERN_BROWSER;
|
379
|
+
}
|
380
|
+
|
381
|
+
return NGX_HTTP_ANCIENT_BROWSER;
|
382
|
+
}
|
383
|
+
|
384
|
+
|
385
|
+
static ngx_int_t
|
386
|
+
ngx_http_msie_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
|
387
|
+
uintptr_t data)
|
388
|
+
{
|
389
|
+
if (r->headers_in.msie) {
|
390
|
+
*v = ngx_http_variable_true_value;
|
391
|
+
return NGX_OK;
|
392
|
+
}
|
393
|
+
|
394
|
+
*v = ngx_http_variable_null_value;
|
395
|
+
return NGX_OK;
|
396
|
+
}
|
397
|
+
|
398
|
+
|
399
|
+
static ngx_int_t
|
400
|
+
ngx_http_browser_add_variable(ngx_conf_t *cf)
|
401
|
+
{
|
402
|
+
ngx_http_browser_variable_t *var;
|
403
|
+
ngx_http_variable_t *v;
|
404
|
+
|
405
|
+
for (var = ngx_http_browsers; var->name.len; var++) {
|
406
|
+
|
407
|
+
v = ngx_http_add_variable(cf, &var->name, NGX_HTTP_VAR_CHANGEABLE);
|
408
|
+
if (v == NULL) {
|
409
|
+
return NGX_ERROR;
|
410
|
+
}
|
411
|
+
|
412
|
+
v->get_handler = var->handler;
|
413
|
+
v->data = var->data;
|
414
|
+
}
|
415
|
+
|
416
|
+
return NGX_OK;
|
417
|
+
}
|
418
|
+
|
419
|
+
|
420
|
+
static void *
|
421
|
+
ngx_http_browser_create_conf(ngx_conf_t *cf)
|
422
|
+
{
|
423
|
+
ngx_http_browser_conf_t *conf;
|
424
|
+
|
425
|
+
conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_browser_conf_t));
|
426
|
+
if (conf == NULL) {
|
427
|
+
return NULL;
|
428
|
+
}
|
429
|
+
|
430
|
+
/*
|
431
|
+
* set by ngx_pcalloc():
|
432
|
+
*
|
433
|
+
* conf->modern_browsers = NULL;
|
434
|
+
* conf->ancient_browsers = NULL;
|
435
|
+
* conf->modern_browser_value = NULL;
|
436
|
+
* conf->ancient_browser_value = NULL;
|
437
|
+
*
|
438
|
+
* conf->modern_unlisted_browsers = 0;
|
439
|
+
* conf->netscape4 = 0;
|
440
|
+
*/
|
441
|
+
|
442
|
+
return conf;
|
443
|
+
}
|
444
|
+
|
445
|
+
|
446
|
+
static char *
|
447
|
+
ngx_http_browser_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
448
|
+
{
|
449
|
+
ngx_http_browser_conf_t *prev = parent;
|
450
|
+
ngx_http_browser_conf_t *conf = child;
|
451
|
+
|
452
|
+
ngx_uint_t i, n;
|
453
|
+
ngx_http_modern_browser_t *browsers, *opera;
|
454
|
+
|
455
|
+
/*
|
456
|
+
* At the merge the skip field is used to store the browser slot,
|
457
|
+
* it will be used in sorting and then will overwritten
|
458
|
+
* with a real skip value. The zero value means Opera.
|
459
|
+
*/
|
460
|
+
|
461
|
+
if (conf->modern_browsers == NULL) {
|
462
|
+
conf->modern_browsers = prev->modern_browsers;
|
463
|
+
|
464
|
+
} else {
|
465
|
+
browsers = conf->modern_browsers->elts;
|
466
|
+
|
467
|
+
for (i = 0; i < conf->modern_browsers->nelts; i++) {
|
468
|
+
if (browsers[i].skip == 0) {
|
469
|
+
goto found;
|
470
|
+
}
|
471
|
+
}
|
472
|
+
|
473
|
+
/*
|
474
|
+
* Opera may contain MSIE string, so if Opera was not enumerated
|
475
|
+
* as modern browsers, then add it and set a unreachable version
|
476
|
+
*/
|
477
|
+
|
478
|
+
opera = ngx_array_push(conf->modern_browsers);
|
479
|
+
if (opera == NULL) {
|
480
|
+
return NGX_CONF_ERROR;
|
481
|
+
}
|
482
|
+
|
483
|
+
opera->skip = 0;
|
484
|
+
opera->version = 4001000000U;
|
485
|
+
|
486
|
+
browsers = conf->modern_browsers->elts;
|
487
|
+
|
488
|
+
found:
|
489
|
+
|
490
|
+
ngx_qsort(browsers, (size_t) conf->modern_browsers->nelts,
|
491
|
+
sizeof(ngx_http_modern_browser_t),
|
492
|
+
ngx_http_modern_browser_sort);
|
493
|
+
|
494
|
+
for (i = 0; i < conf->modern_browsers->nelts; i++) {
|
495
|
+
n = browsers[i].skip;
|
496
|
+
|
497
|
+
browsers[i].skip = ngx_http_modern_browser_masks[n].skip;
|
498
|
+
browsers[i].add = ngx_http_modern_browser_masks[n].add;
|
499
|
+
(void) ngx_cpystrn(browsers[i].name,
|
500
|
+
ngx_http_modern_browser_masks[n].name, 12);
|
501
|
+
}
|
502
|
+
}
|
503
|
+
|
504
|
+
if (conf->ancient_browsers == NULL) {
|
505
|
+
conf->ancient_browsers = prev->ancient_browsers;
|
506
|
+
}
|
507
|
+
|
508
|
+
if (conf->modern_browser_value == NULL) {
|
509
|
+
conf->modern_browser_value = prev->modern_browser_value;
|
510
|
+
}
|
511
|
+
|
512
|
+
if (conf->modern_browser_value == NULL) {
|
513
|
+
conf->modern_browser_value = &ngx_http_variable_true_value;
|
514
|
+
}
|
515
|
+
|
516
|
+
if (conf->ancient_browser_value == NULL) {
|
517
|
+
conf->ancient_browser_value = prev->ancient_browser_value;
|
518
|
+
}
|
519
|
+
|
520
|
+
if (conf->ancient_browser_value == NULL) {
|
521
|
+
conf->ancient_browser_value = &ngx_http_variable_true_value;
|
522
|
+
}
|
523
|
+
|
524
|
+
return NGX_CONF_OK;
|
525
|
+
}
|
526
|
+
|
527
|
+
|
528
|
+
static int ngx_libc_cdecl
|
529
|
+
ngx_http_modern_browser_sort(const void *one, const void *two)
|
530
|
+
{
|
531
|
+
ngx_http_modern_browser_t *first = (ngx_http_modern_browser_t *) one;
|
532
|
+
ngx_http_modern_browser_t *second = (ngx_http_modern_browser_t *) two;
|
533
|
+
|
534
|
+
return (first->skip - second->skip);
|
535
|
+
}
|
536
|
+
|
537
|
+
|
538
|
+
static char *
|
539
|
+
ngx_http_modern_browser(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
540
|
+
{
|
541
|
+
ngx_http_browser_conf_t *bcf = conf;
|
542
|
+
|
543
|
+
u_char c;
|
544
|
+
ngx_str_t *value;
|
545
|
+
ngx_uint_t i, n, version, ver, scale;
|
546
|
+
ngx_http_modern_browser_t *browser;
|
547
|
+
ngx_http_modern_browser_mask_t *mask;
|
548
|
+
|
549
|
+
value = cf->args->elts;
|
550
|
+
|
551
|
+
if (cf->args->nelts == 2) {
|
552
|
+
if (ngx_strcmp(value[1].data, "unlisted") == 0) {
|
553
|
+
bcf->modern_unlisted_browsers = 1;
|
554
|
+
return NGX_CONF_OK;
|
555
|
+
}
|
556
|
+
|
557
|
+
return NGX_CONF_ERROR;
|
558
|
+
}
|
559
|
+
|
560
|
+
if (bcf->modern_browsers == NULL) {
|
561
|
+
bcf->modern_browsers = ngx_array_create(cf->pool, 5,
|
562
|
+
sizeof(ngx_http_modern_browser_t));
|
563
|
+
if (bcf->modern_browsers == NULL) {
|
564
|
+
return NGX_CONF_ERROR;
|
565
|
+
}
|
566
|
+
}
|
567
|
+
|
568
|
+
browser = ngx_array_push(bcf->modern_browsers);
|
569
|
+
if (browser == NULL) {
|
570
|
+
return NGX_CONF_ERROR;
|
571
|
+
}
|
572
|
+
|
573
|
+
mask = ngx_http_modern_browser_masks;
|
574
|
+
|
575
|
+
for (n = 0; mask[n].browser[0] != '\0'; n++) {
|
576
|
+
if (ngx_strcasecmp(mask[n].browser, value[1].data) == 0) {
|
577
|
+
goto found;
|
578
|
+
}
|
579
|
+
}
|
580
|
+
|
581
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
582
|
+
"unknown browser name \"%V\"", &value[1]);
|
583
|
+
|
584
|
+
return NGX_CONF_ERROR;
|
585
|
+
|
586
|
+
found:
|
587
|
+
|
588
|
+
/*
|
589
|
+
* at this stage the skip field is used to store the browser slot,
|
590
|
+
* it will be used in sorting in merge stage and then will overwritten
|
591
|
+
* with a real value
|
592
|
+
*/
|
593
|
+
|
594
|
+
browser->skip = n;
|
595
|
+
|
596
|
+
version = 0;
|
597
|
+
ver = 0;
|
598
|
+
scale = 1000000;
|
599
|
+
|
600
|
+
for (i = 0; i < value[2].len; i++) {
|
601
|
+
|
602
|
+
c = value[2].data[i];
|
603
|
+
|
604
|
+
if (c >= '0' && c <= '9') {
|
605
|
+
ver = ver * 10 + (c - '0');
|
606
|
+
continue;
|
607
|
+
}
|
608
|
+
|
609
|
+
if (c == '.') {
|
610
|
+
version += ver * scale;
|
611
|
+
ver = 0;
|
612
|
+
scale /= 100;
|
613
|
+
continue;
|
614
|
+
}
|
615
|
+
|
616
|
+
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
617
|
+
"invalid browser version \"%V\"", &value[2]);
|
618
|
+
|
619
|
+
return NGX_CONF_ERROR;
|
620
|
+
}
|
621
|
+
|
622
|
+
version += ver * scale;
|
623
|
+
|
624
|
+
browser->version = version;
|
625
|
+
|
626
|
+
return NGX_CONF_OK;
|
627
|
+
}
|
628
|
+
|
629
|
+
|
630
|
+
static char *
|
631
|
+
ngx_http_ancient_browser(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
632
|
+
{
|
633
|
+
ngx_http_browser_conf_t *bcf = conf;
|
634
|
+
|
635
|
+
ngx_str_t *value, *browser;
|
636
|
+
ngx_uint_t i;
|
637
|
+
|
638
|
+
value = cf->args->elts;
|
639
|
+
|
640
|
+
for (i = 1; i < cf->args->nelts; i++) {
|
641
|
+
if (ngx_strcmp(value[i].data, "netscape4") == 0) {
|
642
|
+
bcf->netscape4 = 1;
|
643
|
+
continue;
|
644
|
+
}
|
645
|
+
|
646
|
+
if (bcf->ancient_browsers == NULL) {
|
647
|
+
bcf->ancient_browsers = ngx_array_create(cf->pool, 4,
|
648
|
+
sizeof(ngx_str_t));
|
649
|
+
if (bcf->ancient_browsers == NULL) {
|
650
|
+
return NGX_CONF_ERROR;
|
651
|
+
}
|
652
|
+
}
|
653
|
+
|
654
|
+
browser = ngx_array_push(bcf->ancient_browsers);
|
655
|
+
if (browser == NULL) {
|
656
|
+
return NGX_CONF_ERROR;
|
657
|
+
}
|
658
|
+
|
659
|
+
*browser = value[i];
|
660
|
+
}
|
661
|
+
|
662
|
+
return NGX_CONF_OK;
|
663
|
+
}
|
664
|
+
|
665
|
+
|
666
|
+
static char *
|
667
|
+
ngx_http_modern_browser_value(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
668
|
+
{
|
669
|
+
ngx_http_browser_conf_t *bcf = conf;
|
670
|
+
|
671
|
+
ngx_str_t *value;
|
672
|
+
|
673
|
+
bcf->modern_browser_value = ngx_palloc(cf->pool,
|
674
|
+
sizeof(ngx_http_variable_value_t));
|
675
|
+
if (bcf->modern_browser_value == NULL) {
|
676
|
+
return NGX_CONF_ERROR;
|
677
|
+
}
|
678
|
+
|
679
|
+
value = cf->args->elts;
|
680
|
+
|
681
|
+
bcf->modern_browser_value->len = value[1].len;
|
682
|
+
bcf->modern_browser_value->valid = 1;
|
683
|
+
bcf->modern_browser_value->no_cacheable = 0;
|
684
|
+
bcf->modern_browser_value->not_found = 0;
|
685
|
+
bcf->modern_browser_value->data = value[1].data;
|
686
|
+
|
687
|
+
return NGX_CONF_OK;
|
688
|
+
}
|
689
|
+
|
690
|
+
|
691
|
+
static char *
|
692
|
+
ngx_http_ancient_browser_value(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
693
|
+
{
|
694
|
+
ngx_http_browser_conf_t *bcf = conf;
|
695
|
+
|
696
|
+
ngx_str_t *value;
|
697
|
+
|
698
|
+
bcf->ancient_browser_value = ngx_palloc(cf->pool,
|
699
|
+
sizeof(ngx_http_variable_value_t));
|
700
|
+
if (bcf->ancient_browser_value == NULL) {
|
701
|
+
return NGX_CONF_ERROR;
|
702
|
+
}
|
703
|
+
|
704
|
+
value = cf->args->elts;
|
705
|
+
|
706
|
+
bcf->ancient_browser_value->len = value[1].len;
|
707
|
+
bcf->ancient_browser_value->valid = 1;
|
708
|
+
bcf->ancient_browser_value->no_cacheable = 0;
|
709
|
+
bcf->ancient_browser_value->not_found = 0;
|
710
|
+
bcf->ancient_browser_value->data = value[1].data;
|
711
|
+
|
712
|
+
return NGX_CONF_OK;
|
713
|
+
}
|