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,42 @@
|
|
1
|
+
|
2
|
+
# Copyright (C) Igor Sysoev
|
3
|
+
# Copyright (C) Nginx, Inc.
|
4
|
+
|
5
|
+
use 5.006001;
|
6
|
+
use ExtUtils::MakeMaker;
|
7
|
+
|
8
|
+
WriteMakefile(
|
9
|
+
NAME => 'nginx',
|
10
|
+
VERSION_FROM => 'nginx.pm', # finds $VERSION
|
11
|
+
PREREQ_PM => {}, # e.g., Module::Name => 1.1
|
12
|
+
|
13
|
+
ABSTRACT_FROM => 'nginx.pm', # retrieve abstract from module
|
14
|
+
AUTHOR => 'Igor Sysoev',
|
15
|
+
|
16
|
+
CCFLAGS => "$ENV{NGX_PM_CFLAGS}",
|
17
|
+
OPTIMIZE => '-O',
|
18
|
+
|
19
|
+
INC => "-I ../../../../../src/core " .
|
20
|
+
"-I ../../../../../src/event " .
|
21
|
+
"-I ../../../../../src/os/unix " .
|
22
|
+
"-I ../../../../../src/http " .
|
23
|
+
"-I ../../../../../src/http/modules " .
|
24
|
+
"-I ../../../../../src/http/modules/perl " .
|
25
|
+
"-I ../../../../../$ENV{NGX_OBJS} " .
|
26
|
+
($ENV{NGX_PCRE} =~ /^(YES|NO)/ ? "" :
|
27
|
+
($ENV{NGX_PCRE} =~ m#^/# ? "-I $ENV{NGX_PCRE} " :
|
28
|
+
"-I ../../../../../$ENV{NGX_PCRE} ")) .
|
29
|
+
($ENV{NGX_OPENSSL} =~ /^(YES|NO)/ ? "" :
|
30
|
+
($ENV{NGX_OPENSSL} =~ m#^/# ?
|
31
|
+
"-I $ENV{NGX_OPENSSL}/.openssl/include " :
|
32
|
+
"-I ../../../../../$ENV{NGX_OPENSSL}/.openssl/include ")),
|
33
|
+
|
34
|
+
depend => {
|
35
|
+
'nginx.c' =>
|
36
|
+
"../../../../../src/http/modules/perl/ngx_http_perl_module.h"
|
37
|
+
},
|
38
|
+
|
39
|
+
PM => {
|
40
|
+
'nginx.pm' => '$(INST_LIBDIR)/nginx.pm'
|
41
|
+
}
|
42
|
+
);
|
@@ -0,0 +1,137 @@
|
|
1
|
+
package nginx;
|
2
|
+
|
3
|
+
use 5.006001;
|
4
|
+
use strict;
|
5
|
+
use warnings;
|
6
|
+
|
7
|
+
require Exporter;
|
8
|
+
|
9
|
+
our @ISA = qw(Exporter);
|
10
|
+
|
11
|
+
our @EXPORT = qw(
|
12
|
+
OK
|
13
|
+
DECLINED
|
14
|
+
|
15
|
+
HTTP_OK
|
16
|
+
HTTP_CREATED
|
17
|
+
HTTP_ACCEPTED
|
18
|
+
HTTP_NO_CONTENT
|
19
|
+
HTTP_PARTIAL_CONTENT
|
20
|
+
|
21
|
+
HTTP_MOVED_PERMANENTLY
|
22
|
+
HTTP_MOVED_TEMPORARILY
|
23
|
+
HTTP_REDIRECT
|
24
|
+
HTTP_SEE_OTHER
|
25
|
+
HTTP_NOT_MODIFIED
|
26
|
+
HTTP_TEMPORARY_REDIRECT
|
27
|
+
|
28
|
+
HTTP_BAD_REQUEST
|
29
|
+
HTTP_UNAUTHORIZED
|
30
|
+
HTTP_PAYMENT_REQUIRED
|
31
|
+
HTTP_FORBIDDEN
|
32
|
+
HTTP_NOT_FOUND
|
33
|
+
HTTP_NOT_ALLOWED
|
34
|
+
HTTP_NOT_ACCEPTABLE
|
35
|
+
HTTP_REQUEST_TIME_OUT
|
36
|
+
HTTP_CONFLICT
|
37
|
+
HTTP_GONE
|
38
|
+
HTTP_LENGTH_REQUIRED
|
39
|
+
HTTP_REQUEST_ENTITY_TOO_LARGE
|
40
|
+
HTTP_REQUEST_URI_TOO_LARGE
|
41
|
+
HTTP_UNSUPPORTED_MEDIA_TYPE
|
42
|
+
HTTP_RANGE_NOT_SATISFIABLE
|
43
|
+
|
44
|
+
HTTP_INTERNAL_SERVER_ERROR
|
45
|
+
HTTP_SERVER_ERROR
|
46
|
+
HTTP_NOT_IMPLEMENTED
|
47
|
+
HTTP_BAD_GATEWAY
|
48
|
+
HTTP_SERVICE_UNAVAILABLE
|
49
|
+
HTTP_GATEWAY_TIME_OUT
|
50
|
+
HTTP_INSUFFICIENT_STORAGE
|
51
|
+
);
|
52
|
+
|
53
|
+
our $VERSION = '1.0.15';
|
54
|
+
|
55
|
+
require XSLoader;
|
56
|
+
XSLoader::load('nginx', $VERSION);
|
57
|
+
|
58
|
+
# Preloaded methods go here.
|
59
|
+
|
60
|
+
use constant OK => 0;
|
61
|
+
use constant DECLINED => -5;
|
62
|
+
|
63
|
+
use constant HTTP_OK => 200;
|
64
|
+
use constant HTTP_CREATED => 201;
|
65
|
+
use constant HTTP_ACCEPTED => 202;
|
66
|
+
use constant HTTP_NO_CONTENT => 204;
|
67
|
+
use constant HTTP_PARTIAL_CONTENT => 206;
|
68
|
+
|
69
|
+
use constant HTTP_MOVED_PERMANENTLY => 301;
|
70
|
+
use constant HTTP_MOVED_TEMPORARILY => 302;
|
71
|
+
use constant HTTP_REDIRECT => 302;
|
72
|
+
use constant HTTP_SEE_OTHER => 303;
|
73
|
+
use constant HTTP_NOT_MODIFIED => 304;
|
74
|
+
use constant HTTP_TEMPORARY_REDIRECT => 307;
|
75
|
+
|
76
|
+
use constant HTTP_BAD_REQUEST => 400;
|
77
|
+
use constant HTTP_UNAUTHORIZED => 401;
|
78
|
+
use constant HTTP_PAYMENT_REQUIRED => 402;
|
79
|
+
use constant HTTP_FORBIDDEN => 403;
|
80
|
+
use constant HTTP_NOT_FOUND => 404;
|
81
|
+
use constant HTTP_NOT_ALLOWED => 405;
|
82
|
+
use constant HTTP_NOT_ACCEPTABLE => 406;
|
83
|
+
use constant HTTP_REQUEST_TIME_OUT => 408;
|
84
|
+
use constant HTTP_CONFLICT => 409;
|
85
|
+
use constant HTTP_GONE => 410;
|
86
|
+
use constant HTTP_LENGTH_REQUIRED => 411;
|
87
|
+
use constant HTTP_REQUEST_ENTITY_TOO_LARGE => 413;
|
88
|
+
use constant HTTP_REQUEST_URI_TOO_LARGE => 414;
|
89
|
+
use constant HTTP_UNSUPPORTED_MEDIA_TYPE => 415;
|
90
|
+
use constant HTTP_RANGE_NOT_SATISFIABLE => 416;
|
91
|
+
|
92
|
+
use constant HTTP_INTERNAL_SERVER_ERROR => 500;
|
93
|
+
use constant HTTP_SERVER_ERROR => 500;
|
94
|
+
use constant HTTP_NOT_IMPLEMENTED => 501;
|
95
|
+
use constant HTTP_BAD_GATEWAY => 502;
|
96
|
+
use constant HTTP_SERVICE_UNAVAILABLE => 503;
|
97
|
+
use constant HTTP_GATEWAY_TIME_OUT => 504;
|
98
|
+
use constant HTTP_INSUFFICIENT_STORAGE => 507;
|
99
|
+
|
100
|
+
|
101
|
+
sub rflush {
|
102
|
+
my $r = shift;
|
103
|
+
|
104
|
+
$r->flush;
|
105
|
+
}
|
106
|
+
|
107
|
+
|
108
|
+
1;
|
109
|
+
__END__
|
110
|
+
|
111
|
+
=head1 NAME
|
112
|
+
|
113
|
+
nginx - Perl interface to the nginx HTTP server API
|
114
|
+
|
115
|
+
=head1 SYNOPSIS
|
116
|
+
|
117
|
+
use nginx;
|
118
|
+
|
119
|
+
=head1 DESCRIPTION
|
120
|
+
|
121
|
+
This module provides a Perl interface to the nginx HTTP server API.
|
122
|
+
|
123
|
+
|
124
|
+
=head1 SEE ALSO
|
125
|
+
|
126
|
+
http://sysoev.ru/nginx/docs/http/ngx_http_perl_module.html
|
127
|
+
|
128
|
+
=head1 AUTHOR
|
129
|
+
|
130
|
+
Igor Sysoev
|
131
|
+
|
132
|
+
=head1 COPYRIGHT AND LICENSE
|
133
|
+
|
134
|
+
Copyright (C) Igor Sysoev
|
135
|
+
|
136
|
+
|
137
|
+
=cut
|
@@ -0,0 +1,986 @@
|
|
1
|
+
|
2
|
+
/*
|
3
|
+
* Copyright (C) Igor Sysoev
|
4
|
+
* Copyright (C) Nginx, Inc.
|
5
|
+
*/
|
6
|
+
|
7
|
+
|
8
|
+
#define PERL_NO_GET_CONTEXT
|
9
|
+
|
10
|
+
#include <ngx_config.h>
|
11
|
+
#include <ngx_core.h>
|
12
|
+
#include <ngx_http.h>
|
13
|
+
#include <ngx_http_perl_module.h>
|
14
|
+
|
15
|
+
#include "XSUB.h"
|
16
|
+
|
17
|
+
|
18
|
+
#define ngx_http_perl_set_request(r) \
|
19
|
+
r = INT2PTR(ngx_http_request_t *, SvIV((SV *) SvRV(ST(0))))
|
20
|
+
|
21
|
+
|
22
|
+
#define ngx_http_perl_set_targ(p, len) \
|
23
|
+
\
|
24
|
+
SvUPGRADE(TARG, SVt_PV); \
|
25
|
+
SvPOK_on(TARG); \
|
26
|
+
sv_setpvn(TARG, (char *) p, len)
|
27
|
+
|
28
|
+
|
29
|
+
static ngx_int_t
|
30
|
+
ngx_http_perl_sv2str(pTHX_ ngx_http_request_t *r, ngx_str_t *s, SV *sv)
|
31
|
+
{
|
32
|
+
u_char *p;
|
33
|
+
STRLEN len;
|
34
|
+
|
35
|
+
if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PV) {
|
36
|
+
sv = SvRV(sv);
|
37
|
+
}
|
38
|
+
|
39
|
+
p = (u_char *) SvPV(sv, len);
|
40
|
+
|
41
|
+
s->len = len;
|
42
|
+
|
43
|
+
if (SvREADONLY(sv) && SvPOK(sv)) {
|
44
|
+
s->data = p;
|
45
|
+
|
46
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
47
|
+
"perl sv2str: %08XD \"%V\"", sv->sv_flags, s);
|
48
|
+
|
49
|
+
return NGX_OK;
|
50
|
+
}
|
51
|
+
|
52
|
+
s->data = ngx_pnalloc(r->pool, len);
|
53
|
+
if (s->data == NULL) {
|
54
|
+
return NGX_ERROR;
|
55
|
+
}
|
56
|
+
|
57
|
+
ngx_memcpy(s->data, p, len);
|
58
|
+
|
59
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
60
|
+
"perl sv2str: %08XD \"%V\"", sv->sv_flags, s);
|
61
|
+
|
62
|
+
return NGX_OK;
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
static ngx_int_t
|
67
|
+
ngx_http_perl_output(ngx_http_request_t *r, ngx_buf_t *b)
|
68
|
+
{
|
69
|
+
ngx_chain_t out;
|
70
|
+
#if (NGX_HTTP_SSI)
|
71
|
+
ngx_chain_t *cl;
|
72
|
+
ngx_http_perl_ctx_t *ctx;
|
73
|
+
|
74
|
+
ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
|
75
|
+
|
76
|
+
if (ctx->ssi) {
|
77
|
+
cl = ngx_alloc_chain_link(r->pool);
|
78
|
+
if (cl == NULL) {
|
79
|
+
return NGX_ERROR;
|
80
|
+
}
|
81
|
+
|
82
|
+
cl->buf = b;
|
83
|
+
cl->next = NULL;
|
84
|
+
*ctx->ssi->last_out = cl;
|
85
|
+
ctx->ssi->last_out = &cl->next;
|
86
|
+
|
87
|
+
return NGX_OK;
|
88
|
+
}
|
89
|
+
#endif
|
90
|
+
|
91
|
+
out.buf = b;
|
92
|
+
out.next = NULL;
|
93
|
+
|
94
|
+
return ngx_http_output_filter(r, &out);
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
MODULE = nginx PACKAGE = nginx
|
99
|
+
|
100
|
+
|
101
|
+
void
|
102
|
+
status(r, code)
|
103
|
+
CODE:
|
104
|
+
|
105
|
+
ngx_http_request_t *r;
|
106
|
+
|
107
|
+
ngx_http_perl_set_request(r);
|
108
|
+
|
109
|
+
r->headers_out.status = SvIV(ST(1));
|
110
|
+
|
111
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
112
|
+
"perl status: %d", r->headers_out.status);
|
113
|
+
|
114
|
+
XSRETURN_UNDEF;
|
115
|
+
|
116
|
+
|
117
|
+
void
|
118
|
+
send_http_header(r, ...)
|
119
|
+
CODE:
|
120
|
+
|
121
|
+
ngx_http_request_t *r;
|
122
|
+
SV *sv;
|
123
|
+
|
124
|
+
ngx_http_perl_set_request(r);
|
125
|
+
|
126
|
+
if (r->headers_out.status == 0) {
|
127
|
+
r->headers_out.status = NGX_HTTP_OK;
|
128
|
+
}
|
129
|
+
|
130
|
+
if (items != 1) {
|
131
|
+
sv = ST(1);
|
132
|
+
|
133
|
+
if (ngx_http_perl_sv2str(aTHX_ r, &r->headers_out.content_type, sv)
|
134
|
+
!= NGX_OK)
|
135
|
+
{
|
136
|
+
XSRETURN_EMPTY;
|
137
|
+
}
|
138
|
+
|
139
|
+
r->headers_out.content_type_len = r->headers_out.content_type.len;
|
140
|
+
|
141
|
+
} else {
|
142
|
+
if (ngx_http_set_content_type(r) != NGX_OK) {
|
143
|
+
XSRETURN_EMPTY;
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
(void) ngx_http_send_header(r);
|
148
|
+
|
149
|
+
|
150
|
+
void
|
151
|
+
header_only(r)
|
152
|
+
CODE:
|
153
|
+
|
154
|
+
dXSTARG;
|
155
|
+
ngx_http_request_t *r;
|
156
|
+
|
157
|
+
ngx_http_perl_set_request(r);
|
158
|
+
|
159
|
+
sv_upgrade(TARG, SVt_IV);
|
160
|
+
sv_setiv(TARG, r->header_only);
|
161
|
+
|
162
|
+
ST(0) = TARG;
|
163
|
+
|
164
|
+
|
165
|
+
void
|
166
|
+
uri(r)
|
167
|
+
CODE:
|
168
|
+
|
169
|
+
dXSTARG;
|
170
|
+
ngx_http_request_t *r;
|
171
|
+
|
172
|
+
ngx_http_perl_set_request(r);
|
173
|
+
ngx_http_perl_set_targ(r->uri.data, r->uri.len);
|
174
|
+
|
175
|
+
ST(0) = TARG;
|
176
|
+
|
177
|
+
|
178
|
+
void
|
179
|
+
args(r)
|
180
|
+
CODE:
|
181
|
+
|
182
|
+
dXSTARG;
|
183
|
+
ngx_http_request_t *r;
|
184
|
+
|
185
|
+
ngx_http_perl_set_request(r);
|
186
|
+
ngx_http_perl_set_targ(r->args.data, r->args.len);
|
187
|
+
|
188
|
+
ST(0) = TARG;
|
189
|
+
|
190
|
+
|
191
|
+
void
|
192
|
+
request_method(r)
|
193
|
+
CODE:
|
194
|
+
|
195
|
+
dXSTARG;
|
196
|
+
ngx_http_request_t *r;
|
197
|
+
|
198
|
+
ngx_http_perl_set_request(r);
|
199
|
+
ngx_http_perl_set_targ(r->method_name.data, r->method_name.len);
|
200
|
+
|
201
|
+
ST(0) = TARG;
|
202
|
+
|
203
|
+
|
204
|
+
void
|
205
|
+
remote_addr(r)
|
206
|
+
CODE:
|
207
|
+
|
208
|
+
dXSTARG;
|
209
|
+
ngx_http_request_t *r;
|
210
|
+
|
211
|
+
ngx_http_perl_set_request(r);
|
212
|
+
ngx_http_perl_set_targ(r->connection->addr_text.data,
|
213
|
+
r->connection->addr_text.len);
|
214
|
+
|
215
|
+
ST(0) = TARG;
|
216
|
+
|
217
|
+
|
218
|
+
void
|
219
|
+
header_in(r, key)
|
220
|
+
CODE:
|
221
|
+
|
222
|
+
dXSTARG;
|
223
|
+
ngx_http_request_t *r;
|
224
|
+
SV *key;
|
225
|
+
u_char *p, *lowcase_key, *cookie;
|
226
|
+
STRLEN len;
|
227
|
+
ssize_t size;
|
228
|
+
ngx_uint_t i, n, hash;
|
229
|
+
ngx_list_part_t *part;
|
230
|
+
ngx_table_elt_t *h, **ph;
|
231
|
+
ngx_http_header_t *hh;
|
232
|
+
ngx_http_core_main_conf_t *cmcf;
|
233
|
+
|
234
|
+
ngx_http_perl_set_request(r);
|
235
|
+
|
236
|
+
key = ST(1);
|
237
|
+
|
238
|
+
if (SvROK(key) && SvTYPE(SvRV(key)) == SVt_PV) {
|
239
|
+
key = SvRV(key);
|
240
|
+
}
|
241
|
+
|
242
|
+
p = (u_char *) SvPV(key, len);
|
243
|
+
|
244
|
+
/* look up hashed headers */
|
245
|
+
|
246
|
+
lowcase_key = ngx_pnalloc(r->pool, len);
|
247
|
+
if (lowcase_key == NULL) {
|
248
|
+
XSRETURN_UNDEF;
|
249
|
+
}
|
250
|
+
|
251
|
+
hash = ngx_hash_strlow(lowcase_key, p, len);
|
252
|
+
|
253
|
+
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
|
254
|
+
|
255
|
+
hh = ngx_hash_find(&cmcf->headers_in_hash, hash, lowcase_key, len);
|
256
|
+
|
257
|
+
if (hh) {
|
258
|
+
if (hh->offset) {
|
259
|
+
|
260
|
+
ph = (ngx_table_elt_t **) ((char *) &r->headers_in + hh->offset);
|
261
|
+
|
262
|
+
if (*ph) {
|
263
|
+
ngx_http_perl_set_targ((*ph)->value.data, (*ph)->value.len);
|
264
|
+
|
265
|
+
goto done;
|
266
|
+
}
|
267
|
+
|
268
|
+
XSRETURN_UNDEF;
|
269
|
+
}
|
270
|
+
|
271
|
+
/* Cookie */
|
272
|
+
|
273
|
+
n = r->headers_in.cookies.nelts;
|
274
|
+
|
275
|
+
if (n == 0) {
|
276
|
+
XSRETURN_UNDEF;
|
277
|
+
}
|
278
|
+
|
279
|
+
ph = r->headers_in.cookies.elts;
|
280
|
+
|
281
|
+
if (n == 1) {
|
282
|
+
ngx_http_perl_set_targ((*ph)->value.data, (*ph)->value.len);
|
283
|
+
|
284
|
+
goto done;
|
285
|
+
}
|
286
|
+
|
287
|
+
size = - (ssize_t) (sizeof("; ") - 1);
|
288
|
+
|
289
|
+
for (i = 0; i < n; i++) {
|
290
|
+
size += ph[i]->value.len + sizeof("; ") - 1;
|
291
|
+
}
|
292
|
+
|
293
|
+
cookie = ngx_pnalloc(r->pool, size);
|
294
|
+
if (cookie == NULL) {
|
295
|
+
XSRETURN_UNDEF;
|
296
|
+
}
|
297
|
+
|
298
|
+
p = cookie;
|
299
|
+
|
300
|
+
for (i = 0; /* void */ ; i++) {
|
301
|
+
p = ngx_copy(p, ph[i]->value.data, ph[i]->value.len);
|
302
|
+
|
303
|
+
if (i == n - 1) {
|
304
|
+
break;
|
305
|
+
}
|
306
|
+
|
307
|
+
*p++ = ';'; *p++ = ' ';
|
308
|
+
}
|
309
|
+
|
310
|
+
ngx_http_perl_set_targ(cookie, size);
|
311
|
+
|
312
|
+
goto done;
|
313
|
+
}
|
314
|
+
|
315
|
+
/* iterate over all headers */
|
316
|
+
|
317
|
+
part = &r->headers_in.headers.part;
|
318
|
+
h = part->elts;
|
319
|
+
|
320
|
+
for (i = 0; /* void */ ; i++) {
|
321
|
+
|
322
|
+
if (i >= part->nelts) {
|
323
|
+
if (part->next == NULL) {
|
324
|
+
break;
|
325
|
+
}
|
326
|
+
|
327
|
+
part = part->next;
|
328
|
+
h = part->elts;
|
329
|
+
i = 0;
|
330
|
+
}
|
331
|
+
|
332
|
+
if (len != h[i].key.len
|
333
|
+
|| ngx_strcasecmp(p, h[i].key.data) != 0)
|
334
|
+
{
|
335
|
+
continue;
|
336
|
+
}
|
337
|
+
|
338
|
+
ngx_http_perl_set_targ(h[i].value.data, h[i].value.len);
|
339
|
+
|
340
|
+
goto done;
|
341
|
+
}
|
342
|
+
|
343
|
+
XSRETURN_UNDEF;
|
344
|
+
|
345
|
+
done:
|
346
|
+
|
347
|
+
ST(0) = TARG;
|
348
|
+
|
349
|
+
|
350
|
+
void
|
351
|
+
has_request_body(r, next)
|
352
|
+
CODE:
|
353
|
+
|
354
|
+
dXSTARG;
|
355
|
+
ngx_http_request_t *r;
|
356
|
+
ngx_http_perl_ctx_t *ctx;
|
357
|
+
|
358
|
+
ngx_http_perl_set_request(r);
|
359
|
+
|
360
|
+
if (r->headers_in.content_length_n <= 0) {
|
361
|
+
XSRETURN_UNDEF;
|
362
|
+
}
|
363
|
+
|
364
|
+
ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
|
365
|
+
ctx->next = SvRV(ST(1));
|
366
|
+
|
367
|
+
r->request_body_in_single_buf = 1;
|
368
|
+
r->request_body_in_persistent_file = 1;
|
369
|
+
r->request_body_in_clean_file = 1;
|
370
|
+
|
371
|
+
if (r->request_body_in_file_only) {
|
372
|
+
r->request_body_file_log_level = 0;
|
373
|
+
}
|
374
|
+
|
375
|
+
ngx_http_read_client_request_body(r, ngx_http_perl_handle_request);
|
376
|
+
|
377
|
+
sv_upgrade(TARG, SVt_IV);
|
378
|
+
sv_setiv(TARG, 1);
|
379
|
+
|
380
|
+
ST(0) = TARG;
|
381
|
+
|
382
|
+
|
383
|
+
void
|
384
|
+
request_body(r)
|
385
|
+
CODE:
|
386
|
+
|
387
|
+
dXSTARG;
|
388
|
+
ngx_http_request_t *r;
|
389
|
+
size_t len;
|
390
|
+
|
391
|
+
ngx_http_perl_set_request(r);
|
392
|
+
|
393
|
+
if (r->request_body == NULL
|
394
|
+
|| r->request_body->temp_file
|
395
|
+
|| r->request_body->bufs == NULL)
|
396
|
+
{
|
397
|
+
XSRETURN_UNDEF;
|
398
|
+
}
|
399
|
+
|
400
|
+
len = r->request_body->bufs->buf->last - r->request_body->bufs->buf->pos;
|
401
|
+
|
402
|
+
if (len == 0) {
|
403
|
+
XSRETURN_UNDEF;
|
404
|
+
}
|
405
|
+
|
406
|
+
ngx_http_perl_set_targ(r->request_body->bufs->buf->pos, len);
|
407
|
+
|
408
|
+
ST(0) = TARG;
|
409
|
+
|
410
|
+
|
411
|
+
void
|
412
|
+
request_body_file(r)
|
413
|
+
CODE:
|
414
|
+
|
415
|
+
dXSTARG;
|
416
|
+
ngx_http_request_t *r;
|
417
|
+
|
418
|
+
ngx_http_perl_set_request(r);
|
419
|
+
|
420
|
+
if (r->request_body == NULL || r->request_body->temp_file == NULL) {
|
421
|
+
XSRETURN_UNDEF;
|
422
|
+
}
|
423
|
+
|
424
|
+
ngx_http_perl_set_targ(r->request_body->temp_file->file.name.data,
|
425
|
+
r->request_body->temp_file->file.name.len);
|
426
|
+
|
427
|
+
ST(0) = TARG;
|
428
|
+
|
429
|
+
|
430
|
+
void
|
431
|
+
discard_request_body(r)
|
432
|
+
CODE:
|
433
|
+
|
434
|
+
ngx_http_request_t *r;
|
435
|
+
|
436
|
+
ngx_http_perl_set_request(r);
|
437
|
+
|
438
|
+
ngx_http_discard_request_body(r);
|
439
|
+
|
440
|
+
|
441
|
+
void
|
442
|
+
header_out(r, key, value)
|
443
|
+
CODE:
|
444
|
+
|
445
|
+
ngx_http_request_t *r;
|
446
|
+
SV *key;
|
447
|
+
SV *value;
|
448
|
+
ngx_table_elt_t *header;
|
449
|
+
|
450
|
+
ngx_http_perl_set_request(r);
|
451
|
+
|
452
|
+
key = ST(1);
|
453
|
+
value = ST(2);
|
454
|
+
|
455
|
+
header = ngx_list_push(&r->headers_out.headers);
|
456
|
+
if (header == NULL) {
|
457
|
+
XSRETURN_EMPTY;
|
458
|
+
}
|
459
|
+
|
460
|
+
header->hash = 1;
|
461
|
+
|
462
|
+
if (ngx_http_perl_sv2str(aTHX_ r, &header->key, key) != NGX_OK) {
|
463
|
+
XSRETURN_EMPTY;
|
464
|
+
}
|
465
|
+
|
466
|
+
if (ngx_http_perl_sv2str(aTHX_ r, &header->value, value) != NGX_OK) {
|
467
|
+
XSRETURN_EMPTY;
|
468
|
+
}
|
469
|
+
|
470
|
+
if (header->key.len == sizeof("Content-Length") - 1
|
471
|
+
&& ngx_strncasecmp(header->key.data, (u_char *) "Content-Length",
|
472
|
+
sizeof("Content-Length") - 1) == 0)
|
473
|
+
{
|
474
|
+
r->headers_out.content_length_n = (off_t) SvIV(value);
|
475
|
+
r->headers_out.content_length = header;
|
476
|
+
}
|
477
|
+
|
478
|
+
if (header->key.len == sizeof("Content-Encoding") - 1
|
479
|
+
&& ngx_strncasecmp(header->key.data, "Content-Encoding",
|
480
|
+
sizeof("Content-Encoding") - 1) == 0)
|
481
|
+
{
|
482
|
+
r->headers_out.content_encoding = header;
|
483
|
+
}
|
484
|
+
|
485
|
+
|
486
|
+
void
|
487
|
+
filename(r)
|
488
|
+
CODE:
|
489
|
+
|
490
|
+
dXSTARG;
|
491
|
+
size_t root;
|
492
|
+
ngx_http_request_t *r;
|
493
|
+
ngx_http_perl_ctx_t *ctx;
|
494
|
+
|
495
|
+
ngx_http_perl_set_request(r);
|
496
|
+
|
497
|
+
ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
|
498
|
+
if (ctx->filename.data) {
|
499
|
+
goto done;
|
500
|
+
}
|
501
|
+
|
502
|
+
if (ngx_http_map_uri_to_path(r, &ctx->filename, &root, 0) == NULL) {
|
503
|
+
XSRETURN_UNDEF;
|
504
|
+
}
|
505
|
+
|
506
|
+
ctx->filename.len--;
|
507
|
+
sv_setpv(PL_statname, (char *) ctx->filename.data);
|
508
|
+
|
509
|
+
done:
|
510
|
+
|
511
|
+
ngx_http_perl_set_targ(ctx->filename.data, ctx->filename.len);
|
512
|
+
|
513
|
+
ST(0) = TARG;
|
514
|
+
|
515
|
+
|
516
|
+
void
|
517
|
+
print(r, ...)
|
518
|
+
CODE:
|
519
|
+
|
520
|
+
ngx_http_request_t *r;
|
521
|
+
SV *sv;
|
522
|
+
int i;
|
523
|
+
u_char *p;
|
524
|
+
size_t size;
|
525
|
+
STRLEN len;
|
526
|
+
ngx_buf_t *b;
|
527
|
+
|
528
|
+
ngx_http_perl_set_request(r);
|
529
|
+
|
530
|
+
if (items == 2) {
|
531
|
+
|
532
|
+
/*
|
533
|
+
* do zero copy for prolate single read-only SV:
|
534
|
+
* $r->print("some text\n");
|
535
|
+
*/
|
536
|
+
|
537
|
+
sv = ST(1);
|
538
|
+
|
539
|
+
if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PV) {
|
540
|
+
sv = SvRV(sv);
|
541
|
+
}
|
542
|
+
|
543
|
+
if (SvREADONLY(sv) && SvPOK(sv)) {
|
544
|
+
|
545
|
+
p = (u_char *) SvPV(sv, len);
|
546
|
+
|
547
|
+
if (len == 0) {
|
548
|
+
XSRETURN_EMPTY;
|
549
|
+
}
|
550
|
+
|
551
|
+
b = ngx_calloc_buf(r->pool);
|
552
|
+
if (b == NULL) {
|
553
|
+
XSRETURN_EMPTY;
|
554
|
+
}
|
555
|
+
|
556
|
+
b->memory = 1;
|
557
|
+
b->pos = p;
|
558
|
+
b->last = p + len;
|
559
|
+
b->start = p;
|
560
|
+
b->end = b->last;
|
561
|
+
|
562
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
563
|
+
"$r->print: read-only SV: %z", len);
|
564
|
+
|
565
|
+
goto out;
|
566
|
+
}
|
567
|
+
}
|
568
|
+
|
569
|
+
size = 0;
|
570
|
+
|
571
|
+
for (i = 1; i < items; i++) {
|
572
|
+
|
573
|
+
sv = ST(i);
|
574
|
+
|
575
|
+
if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PV) {
|
576
|
+
sv = SvRV(sv);
|
577
|
+
}
|
578
|
+
|
579
|
+
(void) SvPV(sv, len);
|
580
|
+
|
581
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
582
|
+
"$r->print: copy SV: %z", len);
|
583
|
+
|
584
|
+
size += len;
|
585
|
+
}
|
586
|
+
|
587
|
+
if (size == 0) {
|
588
|
+
XSRETURN_EMPTY;
|
589
|
+
}
|
590
|
+
|
591
|
+
b = ngx_create_temp_buf(r->pool, size);
|
592
|
+
if (b == NULL) {
|
593
|
+
XSRETURN_EMPTY;
|
594
|
+
}
|
595
|
+
|
596
|
+
for (i = 1; i < items; i++) {
|
597
|
+
sv = ST(i);
|
598
|
+
|
599
|
+
if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PV) {
|
600
|
+
sv = SvRV(sv);
|
601
|
+
}
|
602
|
+
|
603
|
+
p = (u_char *) SvPV(sv, len);
|
604
|
+
b->last = ngx_cpymem(b->last, p, len);
|
605
|
+
}
|
606
|
+
|
607
|
+
out:
|
608
|
+
|
609
|
+
(void) ngx_http_perl_output(r, b);
|
610
|
+
|
611
|
+
|
612
|
+
void
|
613
|
+
sendfile(r, filename, offset = -1, bytes = 0)
|
614
|
+
CODE:
|
615
|
+
|
616
|
+
ngx_http_request_t *r;
|
617
|
+
char *filename;
|
618
|
+
off_t offset;
|
619
|
+
size_t bytes;
|
620
|
+
ngx_str_t path;
|
621
|
+
ngx_buf_t *b;
|
622
|
+
ngx_open_file_info_t of;
|
623
|
+
ngx_http_core_loc_conf_t *clcf;
|
624
|
+
|
625
|
+
ngx_http_perl_set_request(r);
|
626
|
+
|
627
|
+
filename = SvPV_nolen(ST(1));
|
628
|
+
|
629
|
+
if (filename == NULL) {
|
630
|
+
croak("sendfile(): NULL filename");
|
631
|
+
}
|
632
|
+
|
633
|
+
offset = items < 3 ? -1 : SvIV(ST(2));
|
634
|
+
bytes = items < 4 ? 0 : SvIV(ST(3));
|
635
|
+
|
636
|
+
b = ngx_calloc_buf(r->pool);
|
637
|
+
if (b == NULL) {
|
638
|
+
XSRETURN_EMPTY;
|
639
|
+
}
|
640
|
+
|
641
|
+
b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t));
|
642
|
+
if (b->file == NULL) {
|
643
|
+
XSRETURN_EMPTY;
|
644
|
+
}
|
645
|
+
|
646
|
+
path.len = ngx_strlen(filename);
|
647
|
+
|
648
|
+
path.data = ngx_pnalloc(r->pool, path.len + 1);
|
649
|
+
if (path.data == NULL) {
|
650
|
+
XSRETURN_EMPTY;
|
651
|
+
}
|
652
|
+
|
653
|
+
(void) ngx_cpystrn(path.data, (u_char *) filename, path.len + 1);
|
654
|
+
|
655
|
+
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
656
|
+
|
657
|
+
ngx_memzero(&of, sizeof(ngx_open_file_info_t));
|
658
|
+
|
659
|
+
of.read_ahead = clcf->read_ahead;
|
660
|
+
of.directio = clcf->directio;
|
661
|
+
of.valid = clcf->open_file_cache_valid;
|
662
|
+
of.min_uses = clcf->open_file_cache_min_uses;
|
663
|
+
of.errors = clcf->open_file_cache_errors;
|
664
|
+
of.events = clcf->open_file_cache_events;
|
665
|
+
|
666
|
+
if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
|
667
|
+
!= NGX_OK)
|
668
|
+
{
|
669
|
+
if (of.err == 0) {
|
670
|
+
XSRETURN_EMPTY;
|
671
|
+
}
|
672
|
+
|
673
|
+
ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
|
674
|
+
"%s \"%s\" failed", of.failed, filename);
|
675
|
+
XSRETURN_EMPTY;
|
676
|
+
}
|
677
|
+
|
678
|
+
if (offset == -1) {
|
679
|
+
offset = 0;
|
680
|
+
}
|
681
|
+
|
682
|
+
if (bytes == 0) {
|
683
|
+
bytes = of.size - offset;
|
684
|
+
}
|
685
|
+
|
686
|
+
b->in_file = 1;
|
687
|
+
|
688
|
+
b->file_pos = offset;
|
689
|
+
b->file_last = offset + bytes;
|
690
|
+
|
691
|
+
b->file->fd = of.fd;
|
692
|
+
b->file->log = r->connection->log;
|
693
|
+
b->file->directio = of.is_directio;
|
694
|
+
|
695
|
+
(void) ngx_http_perl_output(r, b);
|
696
|
+
|
697
|
+
|
698
|
+
void
|
699
|
+
flush(r)
|
700
|
+
CODE:
|
701
|
+
|
702
|
+
ngx_http_request_t *r;
|
703
|
+
ngx_buf_t *b;
|
704
|
+
|
705
|
+
ngx_http_perl_set_request(r);
|
706
|
+
|
707
|
+
b = ngx_calloc_buf(r->pool);
|
708
|
+
if (b == NULL) {
|
709
|
+
XSRETURN_EMPTY;
|
710
|
+
}
|
711
|
+
|
712
|
+
b->flush = 1;
|
713
|
+
|
714
|
+
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "$r->flush");
|
715
|
+
|
716
|
+
(void) ngx_http_perl_output(r, b);
|
717
|
+
|
718
|
+
XSRETURN_EMPTY;
|
719
|
+
|
720
|
+
|
721
|
+
void
|
722
|
+
internal_redirect(r, uri)
|
723
|
+
CODE:
|
724
|
+
|
725
|
+
ngx_http_request_t *r;
|
726
|
+
SV *uri;
|
727
|
+
ngx_uint_t i;
|
728
|
+
ngx_http_perl_ctx_t *ctx;
|
729
|
+
|
730
|
+
ngx_http_perl_set_request(r);
|
731
|
+
|
732
|
+
uri = ST(1);
|
733
|
+
|
734
|
+
ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
|
735
|
+
|
736
|
+
if (ngx_http_perl_sv2str(aTHX_ r, &ctx->redirect_uri, uri) != NGX_OK) {
|
737
|
+
XSRETURN_EMPTY;
|
738
|
+
}
|
739
|
+
|
740
|
+
for (i = 0; i < ctx->redirect_uri.len; i++) {
|
741
|
+
if (ctx->redirect_uri.data[i] == '?') {
|
742
|
+
|
743
|
+
ctx->redirect_args.len = ctx->redirect_uri.len - (i + 1);
|
744
|
+
ctx->redirect_args.data = &ctx->redirect_uri.data[i + 1];
|
745
|
+
ctx->redirect_uri.len = i;
|
746
|
+
|
747
|
+
XSRETURN_EMPTY;
|
748
|
+
}
|
749
|
+
}
|
750
|
+
|
751
|
+
|
752
|
+
void
|
753
|
+
allow_ranges(r)
|
754
|
+
CODE:
|
755
|
+
|
756
|
+
ngx_http_request_t *r;
|
757
|
+
|
758
|
+
ngx_http_perl_set_request(r);
|
759
|
+
|
760
|
+
r->allow_ranges = 1;
|
761
|
+
|
762
|
+
|
763
|
+
void
|
764
|
+
unescape(r, text, type = 0)
|
765
|
+
CODE:
|
766
|
+
|
767
|
+
dXSTARG;
|
768
|
+
ngx_http_request_t *r;
|
769
|
+
SV *text;
|
770
|
+
int type;
|
771
|
+
u_char *p, *dst, *src;
|
772
|
+
STRLEN len;
|
773
|
+
|
774
|
+
ngx_http_perl_set_request(r);
|
775
|
+
|
776
|
+
text = ST(1);
|
777
|
+
|
778
|
+
src = (u_char *) SvPV(text, len);
|
779
|
+
|
780
|
+
p = ngx_pnalloc(r->pool, len + 1);
|
781
|
+
if (p == NULL) {
|
782
|
+
XSRETURN_UNDEF;
|
783
|
+
}
|
784
|
+
|
785
|
+
dst = p;
|
786
|
+
|
787
|
+
type = items < 3 ? 0 : SvIV(ST(2));
|
788
|
+
|
789
|
+
ngx_unescape_uri(&dst, &src, len, (ngx_uint_t) type);
|
790
|
+
*dst = '\0';
|
791
|
+
|
792
|
+
ngx_http_perl_set_targ(p, dst - p);
|
793
|
+
|
794
|
+
ST(0) = TARG;
|
795
|
+
|
796
|
+
|
797
|
+
void
|
798
|
+
variable(r, name, value = NULL)
|
799
|
+
CODE:
|
800
|
+
|
801
|
+
dXSTARG;
|
802
|
+
ngx_http_request_t *r;
|
803
|
+
SV *name, *value;
|
804
|
+
u_char *p, *lowcase;
|
805
|
+
STRLEN len;
|
806
|
+
ngx_str_t var, val;
|
807
|
+
ngx_uint_t i, hash;
|
808
|
+
ngx_http_perl_var_t *v;
|
809
|
+
ngx_http_perl_ctx_t *ctx;
|
810
|
+
ngx_http_variable_value_t *vv;
|
811
|
+
|
812
|
+
ngx_http_perl_set_request(r);
|
813
|
+
|
814
|
+
name = ST(1);
|
815
|
+
|
816
|
+
if (SvROK(name) && SvTYPE(SvRV(name)) == SVt_PV) {
|
817
|
+
name = SvRV(name);
|
818
|
+
}
|
819
|
+
|
820
|
+
if (items == 2) {
|
821
|
+
value = NULL;
|
822
|
+
|
823
|
+
} else {
|
824
|
+
value = ST(2);
|
825
|
+
|
826
|
+
if (SvROK(value) && SvTYPE(SvRV(value)) == SVt_PV) {
|
827
|
+
value = SvRV(value);
|
828
|
+
}
|
829
|
+
|
830
|
+
if (ngx_http_perl_sv2str(aTHX_ r, &val, value) != NGX_OK) {
|
831
|
+
XSRETURN_UNDEF;
|
832
|
+
}
|
833
|
+
}
|
834
|
+
|
835
|
+
p = (u_char *) SvPV(name, len);
|
836
|
+
|
837
|
+
lowcase = ngx_pnalloc(r->pool, len);
|
838
|
+
if (lowcase == NULL) {
|
839
|
+
XSRETURN_UNDEF;
|
840
|
+
}
|
841
|
+
|
842
|
+
hash = ngx_hash_strlow(lowcase, p, len);
|
843
|
+
|
844
|
+
var.len = len;
|
845
|
+
var.data = lowcase;
|
846
|
+
|
847
|
+
#if (NGX_DEBUG)
|
848
|
+
|
849
|
+
if (value) {
|
850
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
851
|
+
"perl variable: \"%V\"=\"%V\"", &var, &val);
|
852
|
+
} else {
|
853
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
854
|
+
"perl variable: \"%V\"", &var);
|
855
|
+
}
|
856
|
+
|
857
|
+
#endif
|
858
|
+
|
859
|
+
vv = ngx_http_get_variable(r, &var, hash);
|
860
|
+
if (vv == NULL) {
|
861
|
+
XSRETURN_UNDEF;
|
862
|
+
}
|
863
|
+
|
864
|
+
if (vv->not_found) {
|
865
|
+
|
866
|
+
ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
|
867
|
+
|
868
|
+
if (ctx->variables) {
|
869
|
+
|
870
|
+
v = ctx->variables->elts;
|
871
|
+
for (i = 0; i < ctx->variables->nelts; i++) {
|
872
|
+
|
873
|
+
if (hash != v[i].hash
|
874
|
+
|| len != v[i].name.len
|
875
|
+
|| ngx_strncmp(lowcase, v[i].name.data, len) != 0)
|
876
|
+
{
|
877
|
+
continue;
|
878
|
+
}
|
879
|
+
|
880
|
+
if (value) {
|
881
|
+
v[i].value = val;
|
882
|
+
XSRETURN_UNDEF;
|
883
|
+
}
|
884
|
+
|
885
|
+
ngx_http_perl_set_targ(v[i].value.data, v[i].value.len);
|
886
|
+
|
887
|
+
goto done;
|
888
|
+
}
|
889
|
+
}
|
890
|
+
|
891
|
+
if (value) {
|
892
|
+
if (ctx->variables == NULL) {
|
893
|
+
ctx->variables = ngx_array_create(r->pool, 1,
|
894
|
+
sizeof(ngx_http_perl_var_t));
|
895
|
+
if (ctx->variables == NULL) {
|
896
|
+
XSRETURN_UNDEF;
|
897
|
+
}
|
898
|
+
}
|
899
|
+
|
900
|
+
v = ngx_array_push(ctx->variables);
|
901
|
+
if (v == NULL) {
|
902
|
+
XSRETURN_UNDEF;
|
903
|
+
}
|
904
|
+
|
905
|
+
v->hash = hash;
|
906
|
+
v->name.len = len;
|
907
|
+
v->name.data = lowcase;
|
908
|
+
v->value = val;
|
909
|
+
|
910
|
+
XSRETURN_UNDEF;
|
911
|
+
}
|
912
|
+
|
913
|
+
XSRETURN_UNDEF;
|
914
|
+
}
|
915
|
+
|
916
|
+
if (value) {
|
917
|
+
vv->len = val.len;
|
918
|
+
vv->valid = 1;
|
919
|
+
vv->no_cacheable = 0;
|
920
|
+
vv->not_found = 0;
|
921
|
+
vv->data = val.data;
|
922
|
+
|
923
|
+
XSRETURN_UNDEF;
|
924
|
+
}
|
925
|
+
|
926
|
+
ngx_http_perl_set_targ(vv->data, vv->len);
|
927
|
+
|
928
|
+
done:
|
929
|
+
|
930
|
+
ST(0) = TARG;
|
931
|
+
|
932
|
+
|
933
|
+
void
|
934
|
+
sleep(r, sleep, next)
|
935
|
+
CODE:
|
936
|
+
|
937
|
+
ngx_http_request_t *r;
|
938
|
+
ngx_msec_t sleep;
|
939
|
+
ngx_http_perl_ctx_t *ctx;
|
940
|
+
|
941
|
+
ngx_http_perl_set_request(r);
|
942
|
+
|
943
|
+
sleep = (ngx_msec_t) SvIV(ST(1));
|
944
|
+
|
945
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
946
|
+
"perl sleep: %M", sleep);
|
947
|
+
|
948
|
+
ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
|
949
|
+
|
950
|
+
ctx->next = SvRV(ST(2));
|
951
|
+
|
952
|
+
ngx_add_timer(r->connection->write, sleep);
|
953
|
+
|
954
|
+
r->write_event_handler = ngx_http_perl_sleep_handler;
|
955
|
+
r->main->count++;
|
956
|
+
|
957
|
+
|
958
|
+
void
|
959
|
+
log_error(r, err, msg)
|
960
|
+
CODE:
|
961
|
+
|
962
|
+
ngx_http_request_t *r;
|
963
|
+
SV *err, *msg;
|
964
|
+
u_char *p;
|
965
|
+
STRLEN len;
|
966
|
+
ngx_err_t e;
|
967
|
+
|
968
|
+
ngx_http_perl_set_request(r);
|
969
|
+
|
970
|
+
err = ST(1);
|
971
|
+
|
972
|
+
if (SvROK(err) && SvTYPE(SvRV(err)) == SVt_PV) {
|
973
|
+
err = SvRV(err);
|
974
|
+
}
|
975
|
+
|
976
|
+
e = SvIV(err);
|
977
|
+
|
978
|
+
msg = ST(2);
|
979
|
+
|
980
|
+
if (SvROK(msg) && SvTYPE(SvRV(msg)) == SVt_PV) {
|
981
|
+
msg = SvRV(msg);
|
982
|
+
}
|
983
|
+
|
984
|
+
p = (u_char *) SvPV(msg, len);
|
985
|
+
|
986
|
+
ngx_log_error(NGX_LOG_ERR, r->connection->log, e, "perl: %s", p);
|