From e6b5141a531eca2e190f091747fb7eca1fd1cab2 Mon Sep 17 00:00:00 2001 From: skyever Date: Wed, 8 Mar 2017 16:24:09 +0800 Subject: [PATCH] Merge original nginx v1.10.2, ready to launch a new SEnginx release Signed-off-by: skyever --- .../lua-nginx-module-0.10.7/.gitattributes | 1 + .../.github/ISSUE_TEMPLATE.md | 23 + .../.github/PULL_REQUEST_TEMPLATE.md | 2 + .../.gitignore | 8 + 3rd-party/lua-nginx-module-0.10.7/.travis.yml | 126 + .../README.markdown | 9835 ++++--- 3rd-party/lua-nginx-module-0.10.7/config | 557 + .../doc/HttpLuaModule.wiki | 5486 ++-- .../dtrace/ngx_lua_provider.d | 24 +- .../misc/recv-until-pm/lib/RecvUntil.pm | 0 .../misc/recv-until-pm/t/sanity.t | 0 .../src/api/ngx_http_lua_api.h | 9 +- .../src/ddebug.h | 7 +- .../src/ngx_http_lua_accessby.c | 105 +- .../src/ngx_http_lua_accessby.h | 0 .../src/ngx_http_lua_api.c | 215 + .../src/ngx_http_lua_args.c | 33 +- .../src/ngx_http_lua_args.h | 20 + .../src/ngx_http_lua_balancer.c | 754 + .../src/ngx_http_lua_balancer.h | 27 + .../src/ngx_http_lua_bodyfilterby.c | 159 +- .../src/ngx_http_lua_bodyfilterby.h | 0 .../src/ngx_http_lua_cache.c | 83 +- .../src/ngx_http_lua_cache.h | 9 +- .../src/ngx_http_lua_capturefilter.c | 1 + .../src/ngx_http_lua_capturefilter.h | 0 .../src/ngx_http_lua_clfactory.c | 45 +- .../src/ngx_http_lua_clfactory.h | 4 +- .../src/ngx_http_lua_common.h | 171 +- .../src/ngx_http_lua_config.c | 7 +- .../src/ngx_http_lua_config.h | 0 .../src/ngx_http_lua_consts.c | 55 +- .../src/ngx_http_lua_consts.h | 20 + .../src/ngx_http_lua_contentby.c | 44 +- .../src/ngx_http_lua_contentby.h | 2 +- .../src/ngx_http_lua_control.c | 154 +- .../src/ngx_http_lua_control.h | 0 .../src/ngx_http_lua_coroutine.c | 37 +- .../src/ngx_http_lua_coroutine.h | 0 .../src/ngx_http_lua_ctx.c | 77 +- .../src/ngx_http_lua_ctx.h | 0 .../src/ngx_http_lua_directive.c | 788 +- .../src/ngx_http_lua_directive.h | 77 + .../src/ngx_http_lua_exception.c | 4 + .../src/ngx_http_lua_exception.h | 0 .../src/ngx_http_lua_headerfilterby.c | 27 +- .../src/ngx_http_lua_headerfilterby.h | 0 .../src/ngx_http_lua_headers.c | 423 +- .../src/ngx_http_lua_headers.h | 0 .../src/ngx_http_lua_headers_in.c | 117 +- .../src/ngx_http_lua_headers_in.h | 0 .../src/ngx_http_lua_headers_out.c | 45 +- .../src/ngx_http_lua_headers_out.h | 0 .../src/ngx_http_lua_initby.c | 0 .../src/ngx_http_lua_initby.h | 0 .../src/ngx_http_lua_initworkerby.c | 158 +- .../src/ngx_http_lua_initworkerby.h | 0 .../src/ngx_http_lua_lex.c | 8251 ++++++ .../src/ngx_http_lua_lex.h | 17 + .../src/ngx_http_lua_log.c | 16 + .../src/ngx_http_lua_log.h | 0 .../src/ngx_http_lua_logby.c | 66 +- .../src/ngx_http_lua_logby.h | 0 .../src/ngx_http_lua_misc.c | 58 +- .../src/ngx_http_lua_misc.h | 2 + .../src/ngx_http_lua_module.c | 609 +- .../src/ngx_http_lua_ndk.c | 13 +- .../src/ngx_http_lua_ndk.h | 0 .../src/ngx_http_lua_output.c | 119 +- .../src/ngx_http_lua_output.h | 2 +- .../src/ngx_http_lua_pcrefix.c | 0 .../src/ngx_http_lua_pcrefix.h | 0 .../src/ngx_http_lua_phase.c | 24 +- .../src/ngx_http_lua_phase.h | 0 .../src/ngx_http_lua_probe.h | 0 .../src/ngx_http_lua_regex.c | 134 +- .../src/ngx_http_lua_regex.h | 0 .../src/ngx_http_lua_req_body.c | 90 +- .../src/ngx_http_lua_req_body.h | 0 .../src/ngx_http_lua_req_method.c | 110 +- .../src/ngx_http_lua_req_method.h | 0 .../src/ngx_http_lua_rewriteby.c | 96 +- .../src/ngx_http_lua_rewriteby.h | 0 .../src/ngx_http_lua_script.c | 4 +- .../src/ngx_http_lua_script.h | 6 +- .../src/ngx_http_lua_semaphore.c | 573 + .../src/ngx_http_lua_semaphore.h | 53 + .../src/ngx_http_lua_setby.c | 2 +- .../src/ngx_http_lua_setby.h | 0 .../src/ngx_http_lua_shdict.c | 1376 +- .../src/ngx_http_lua_shdict.h | 25 +- .../src/ngx_http_lua_sleep.c | 14 +- .../src/ngx_http_lua_sleep.h | 0 .../src/ngx_http_lua_socket_tcp.c | 2203 +- .../src/ngx_http_lua_socket_tcp.h | 30 +- .../src/ngx_http_lua_socket_udp.c | 118 +- .../src/ngx_http_lua_socket_udp.h | 15 +- .../src/ngx_http_lua_ssl.c | 37 + .../src/ngx_http_lua_ssl.h | 43 + .../src/ngx_http_lua_ssl_certby.c | 1238 + .../src/ngx_http_lua_ssl_certby.h | 37 + .../src/ngx_http_lua_ssl_ocsp.c | 503 + .../src/ngx_http_lua_ssl_session_fetchby.c | 592 + .../src/ngx_http_lua_ssl_session_fetchby.h | 34 + .../src/ngx_http_lua_ssl_session_storeby.c | 602 + .../src/ngx_http_lua_ssl_session_storeby.h | 34 + .../src/ngx_http_lua_string.c | 89 +- .../src/ngx_http_lua_string.h | 0 .../src/ngx_http_lua_subrequest.c | 88 +- .../src/ngx_http_lua_subrequest.h | 0 .../src/ngx_http_lua_time.c | 28 + .../src/ngx_http_lua_time.h | 0 .../src/ngx_http_lua_timer.c | 200 +- .../src/ngx_http_lua_timer.h | 0 .../src/ngx_http_lua_uri.c | 4 +- .../src/ngx_http_lua_uri.h | 0 .../src/ngx_http_lua_uthread.c | 95 +- .../src/ngx_http_lua_uthread.h | 0 .../src/ngx_http_lua_util.c | 864 +- .../src/ngx_http_lua_util.h | 88 +- .../src/ngx_http_lua_variable.c | 17 +- .../src/ngx_http_lua_variable.h | 0 .../src/ngx_http_lua_worker.c | 133 + .../src/ngx_http_lua_worker.h | 0 .../t/.gitignore | 0 .../t/000--init.t | 1 - .../t/000-sanity.t | 1 - .../t/001-set.t | 3 +- .../t/002-content.t | 12 +- .../t/003-errors.t | 1 - .../t/004-require.t | 2 +- .../t/005-exit.t | 1 - .../t/006-escape.t | 9 +- .../t/007-md5.t | 2 +- .../t/008-today.t | 6 +- .../t/009-log.t | 141 +- .../t/010-request_body.t | 4 +- .../t/011-md5_bin.t | 5 +- .../t/012-now.t | 2 +- .../t/013-base64.t | 53 +- .../t/014-bugs.t | 161 +- .../t/015-status.t | 24 +- .../t/016-resp-header.t | 237 +- .../t/017-exec.t | 1 - .../t/018-ndk.t | 3 +- .../t/019-const.t | 1 - .../t/020-subrequest.t | 131 +- .../t/021-cookie-time.t | 2 +- .../t/022-redirect.t | 57 +- .../t/023-rewrite/client-abort.t | 1 - .../t/023-rewrite/exec.t | 1 - .../t/023-rewrite/exit.t | 1 - .../t/023-rewrite/mixed.t | 24 +- .../t/023-rewrite/multi-capture.t | 1 - .../t/023-rewrite/on-abort.t | 41 +- .../t/023-rewrite/redirect.t | 3 +- .../t/023-rewrite/req-body.t | 103 +- .../t/023-rewrite/req-socket.t | 1 - .../t/023-rewrite/request_body.t | 3 +- .../t/023-rewrite/sanity.t | 54 +- .../t/023-rewrite/sleep.t | 1 - .../t/023-rewrite/socket-keepalive.t | 1 - .../t/023-rewrite/subrequest.t | 7 +- .../t/023-rewrite/tcp-socket-timeout.t | 19 +- .../t/023-rewrite/tcp-socket.t | 66 +- .../t/023-rewrite/unix-socket.t | 7 +- .../t/023-rewrite/uthread-exec.t | 11 +- .../t/023-rewrite/uthread-exit.t | 75 +- .../t/023-rewrite/uthread-redirect.t | 8 +- .../t/023-rewrite/uthread-spawn.t | 103 +- .../t/024-access/auth.t | 3 +- .../t/024-access/client-abort.t | 1 - .../t/024-access/exec.t | 25 +- .../t/024-access/exit.t | 1 - .../t/024-access/mixed.t | 64 +- .../t/024-access/multi-capture.t | 1 - .../t/024-access/on-abort.t | 41 +- .../t/024-access/redirect.t | 3 +- .../t/024-access/req-body.t | 100 +- .../t/024-access/request_body.t | 3 +- .../t/024-access/sanity.t | 54 +- .../t/024-access/satisfy.t | 1 - .../t/024-access/sleep.t | 1 - .../t/024-access/subrequest.t | 7 +- .../t/024-access/uthread-exec.t | 10 +- .../t/024-access/uthread-exit.t | 75 +- .../t/024-access/uthread-redirect.t | 9 +- .../t/024-access/uthread-spawn.t | 83 +- .../t/025-codecache.t | 1 - .../t/026-mysql.t | 1 - .../t/027-multi-capture.t | 42 +- .../t/028-req-header.t | 242 +- .../t/029-http-time.t | 1 - .../t/030-uri-args.t | 110 +- .../t/031-post-args.t | 38 +- .../t/032-iolist.t | 1 - .../t/033-ctx.t | 59 +- .../t/034-match.t | 77 +- .../t/035-gmatch.t | 9 +- .../t/036-sub.t | 112 +- .../t/037-gsub.t | 130 +- .../t/038-match-o.t | 11 +- .../t/039-sub-o.t | 1 - .../t/040-gsub-o.t | 1 - .../t/041-header-filter.t | 30 +- .../t/042-crc32.t | 1 - .../t/043-shdict.t | 195 +- .../t/044-req-body.t | 280 +- .../t/045-ngx-var.t | 1 - .../t/046-hmac.t | 1 - .../t/047-match-jit.t | 1 - .../t/048-match-dfa.t | 40 +- .../t/049-gmatch-jit.t | 1 - .../t/050-gmatch-dfa.t | 51 +- .../t/051-sub-jit.t | 1 - .../t/052-sub-dfa.t | 38 +- .../t/053-gsub-jit.t | 1 - .../t/054-gsub-dfa.t | 38 +- .../t/055-subreq-vars.t | 5 +- .../t/056-flush.t | 38 +- .../t/057-flush-timeout.t | 111 +- .../t/058-tcp-socket.t | 707 +- .../t/059-unix-socket.t | 85 +- .../t/060-lua-memcached.t | 1 - .../t/061-lua-redis.t | 1 - .../t/062-count.t | 112 +- .../t/063-abort.t | 1 - .../t/064-pcall.t | 14 +- .../t/065-tcp-socket-timeout.t | 126 +- .../t/066-socket-receiveuntil.t | 35 +- .../t/067-req-socket.t | 1 - .../t/068-socket-keepalive.t | 78 +- .../t/069-null.t | 1 - .../t/070-sha1.t | 10 +- .../t/071-idle-socket.t | 3 +- .../t/072-conditional-get.t | 1 - .../t/073-backtrace.t | 17 +- .../t/074-prefix-var.t | 1 - .../t/075-logby.t | 28 +- .../t/076-no-postpone.t | 65 +- .../t/077-sleep.t | 155 +- .../t/078-hup-vars.t | 1 - .../t/079-unused-directives.t | 12 +- .../t/080-hup-shdict.t | 1 - .../t/081-bytecode.t | 62 +- .../t/082-body-filter.t | 272 +- .../t/083-bad-sock-self.t | 1 - .../t/084-inclusive-receiveuntil.t | 17 +- .../t/085-if.t | 1 - .../t/086-init-by.t | 30 +- .../t/087-udp-socket.t | 59 +- .../t/088-req-method.t | 1 - .../t/089-phase.t | 21 +- .../t/090-log-socket-errors.t | 1 - .../t/091-coroutine.t | 146 +- .../t/092-eof.t | 1 - .../t/093-uthread-spawn.t | 5 +- .../t/094-uthread-exit.t | 29 +- .../t/095-uthread-exec.t | 8 +- .../t/096-uthread-redirect.t | 5 +- .../t/097-uthread-rewrite.t | 10 +- .../t/098-uthread-wait.t | 27 +- .../t/099-c-api.t | 36 +- .../t/100-client-abort.t | 1 - .../t/101-on-abort.t | 78 +- .../t/102-req-start-time.t | 1 - .../t/103-req-http-ver.t | 1 - .../t/104-req-raw-header.t | 310 +- .../t/105-pressure.t | 1 - .../t/106-timer.t | 76 +- .../t/107-timer-errors.t | 73 +- .../t/108-timer-safe.t | 15 +- .../t/109-timer-hup.t | 70 +- .../t/110-etag.t | 1 - .../t/111-req-header-ua.t | 1 - .../t/112-req-header-conn.t | 1 - .../t/113-req-header-cookie.t | 1 - .../t/114-config.t | 17 +- .../t/115-quote-sql-str.t | 5 +- .../t/116-raw-req-socket.t | 106 +- .../t/117-raw-req-socket-timeout.t | 1 - .../t/118-use-default-type.t | 20 +- .../t/119-config-prefix.t | 1 - .../t/120-re-find.t | 0 .../t/121-version.t | 1 - .../t/122-worker.t | 0 .../t/123-lua-path.t | 9 +- .../t/124-init-worker.t | 83 +- .../t/125-configure-args.t | 1 - .../t/126-shdict-frag.t | 1267 + .../t/127-uthread-kill.t | 508 + .../t/128-duplex-tcp-socket.t | 626 + .../t/129-ssl-socket.t | 2620 ++ .../t/130-internal-api.t | 50 + .../t/131-duplex-req-socket.t | 141 + .../t/132-lua-blocks.t | 606 + .../t/133-worker-count.t | 72 + .../t/134-worker-count-5.t | 78 + .../lua-nginx-module-0.10.7/t/135-worker-id.t | 93 + .../t/136-timer-counts.t | 111 + .../lua-nginx-module-0.10.7/t/137-req-misc.t | 62 + .../lua-nginx-module-0.10.7/t/138-balancer.t | 433 + .../t/139-ssl-cert-by.t | 1576 + .../lua-nginx-module-0.10.7/t/140-ssl-c-api.t | 813 + .../lua-nginx-module-0.10.7/t/141-luajit.t | 47 + .../t/142-ssl-session-store.t | 900 + .../t/143-ssl-session-fetch.t | 1111 + .../t/144-shdict-incr-init.t | 226 + .../t/145-shdict-list.t | 745 + .../t/146-malloc-trim.t | 337 + .../t/147-tcp-socket-timeouts.t | 534 + .../t/148-fake-shm-zone.t | 170 + .../t/149-hup-fake-shm-zone.t | 91 + .../t/StapThread.pm | 0 .../t/cert/equifax.crt | 19 + .../t/cert/startcom.crt | 87 + .../lua-nginx-module-0.10.7/t/cert/test.crl | 11 + .../lua-nginx-module-0.10.7/t/cert/test.crt | 17 + .../lua-nginx-module-0.10.7/t/cert/test.key | 15 + .../lua-nginx-module-0.10.7/t/cert/test2.crt | 16 + .../lua-nginx-module-0.10.7/t/cert/test2.key | 15 + .../t/cert/test_ecdsa.crt | 12 + .../t/cert/test_ecdsa.key | 5 + .../t/data/fake-module/config | 3 + .../t/data/fake-module/ngx_http_fake_module.c | 119 + .../t/data/fake-shm-module/config | 3 + .../ngx_http_lua_fake_shm_module.c | 294 + .../t/lib/CRC32.lua | 2 +- .../t/lib/Memcached.lua | 0 .../t/lib/Redis.lua | 0 .../t/lib/ljson.lua | 0 .../tapset/ngx_lua.stp | 0 .../util/build.sh} | 23 +- .../util/fix-comments | 0 .../util/gdbinit | 0 .../lua-nginx-module-0.10.7/util/gen-lexer-c | 18 + .../util/ngx-links | 2 +- .../util/retab | 0 .../util/revim | 0 .../util/run_test.sh | 0 .../util/update-readme.sh | 0 .../valgrind.suppress | 30 + 3rd-party/lua-nginx-module/.gitmodules | 3 - 3rd-party/lua-nginx-module/Changes | 51 - 3rd-party/lua-nginx-module/config | 335 - 3rd-party/lua-nginx-module/deps/ngx_devel_kit | 1 - .../misc/recv-until-pm/Makefile | 3 - .../lua-nginx-module/src/ngx_http_lua_api.c | 77 - .../lua-nginx-module/src/ngx_http_lua_args.h | 13 - .../src/ngx_http_lua_consts.h | 13 - .../src/ngx_http_lua_directive.h | 56 - .../src/ngx_http_lua_worker.c | 48 - 3rd-party/lua-nginx-module/util/build.sh | 39 - 3rd-party/lua-nginx-module/util/reindex | 64 - 3rd-party/lua-nginx-module/util/releng | 8 - .../memc-nginx-module-0.17/.gitattributes | 1 + 3rd-party/memc-nginx-module-0.17/.gitignore | 54 + .../README.markdown | 358 +- 3rd-party/memc-nginx-module-0.17/config | 31 + .../src/ddebug.h | 10 +- .../src/memc_common.rl | 0 .../src/memc_delete.rl | 0 .../src/memc_flush_all.rl | 0 .../src/memc_incr_decr.rl | 0 .../src/memc_stats.rl | 0 .../src/memc_storage.rl | 0 .../src/memc_version.rl | 0 .../src/ngx_http_memc_handler.c | 0 .../src/ngx_http_memc_handler.h | 0 .../src/ngx_http_memc_module.c | 0 .../src/ngx_http_memc_module.h | 0 .../src/ngx_http_memc_request.c | 8 +- .../src/ngx_http_memc_request.h | 0 .../src/ngx_http_memc_response.c | 18 +- .../src/ngx_http_memc_response.h | 0 .../src/ngx_http_memc_response.rl | 12 +- .../src/ngx_http_memc_util.c | 0 .../src/ngx_http_memc_util.h | 2 +- .../t/bugs.t | 0 .../t/cmd.t | 0 .../t/core-bugs.t | 0 .../t/delete.t | 0 .../t/errors.t | 0 .../t/eval.t | 0 .../t/exptime.t | 0 .../t/flags.t | 0 .../t/flush-all.t | 0 .../t/if.t | 0 .../t/incr-decr.t | 0 .../t/keepalive.t | 0 .../t/keepalive/incr-decr.t | 0 .../t/keepalive/storage.t | 0 .../t/stats.t | 0 .../t/storage.t | 0 .../t/upstream.t | 0 .../t/used.t | 0 .../t/version.t | 0 .../util/build.sh | 2 +- .../util/fix-clang-warnings | 53 + .../util/update-readme.sh | 0 .../util/wiki2pod.pl | 0 .../valgrind.suppress | 16 + 3rd-party/memc-nginx-module/config | 5 - .../memc-nginx-module/doc/HttpMemcModule.wiki | 598 - 3rd-party/nginx-upstream-fair/config | 1 + 3rd-party/nginx_syslog_patch/config | 5 - 3rd-party/nginx_tcp_proxy_module/.gitignore | 6 - 3rd-party/nginx_tcp_proxy_module/README | 757 - 3rd-party/nginx_tcp_proxy_module/config | 38 - .../nginx_tcp_proxy_module/config_without_ssl | 38 - .../nginx_tcp_proxy_module/doc/README.html | 756 - .../nginx_tcp_proxy_module/doc/README.txt | 757 - .../nginx_tcp_proxy_module/doc/README.wiki | 694 - .../modules/ngx_tcp_generic_proxy_module.c | 609 - .../modules/ngx_tcp_ssl_module.c | 532 - .../modules/ngx_tcp_ssl_module.h | 48 - .../ngx_tcp_upstream_busyness_module.c | 235 - .../modules/ngx_tcp_upstream_ip_hash_module.c | 232 - .../modules/ngx_tcp_websocket_proxy_module.c | 1216 - 3rd-party/nginx_tcp_proxy_module/ngx_tcp.c | 579 - 3rd-party/nginx_tcp_proxy_module/ngx_tcp.h | 278 - .../nginx_tcp_proxy_module/ngx_tcp_access.c | 49 - .../ngx_tcp_core_module.c | 902 - .../nginx_tcp_proxy_module/ngx_tcp_log.c | 233 - .../nginx_tcp_proxy_module/ngx_tcp_session.c | 523 - .../nginx_tcp_proxy_module/ngx_tcp_session.h | 71 - .../nginx_tcp_proxy_module/ngx_tcp_upstream.c | 1124 - .../nginx_tcp_proxy_module/ngx_tcp_upstream.h | 188 - .../ngx_tcp_upstream_check.c | 1954 -- .../ngx_tcp_upstream_check.h | 180 - .../ngx_tcp_upstream_round_robin.c | 821 - .../ngx_tcp_upstream_round_robin.h | 80 - .../nginx_tcp_proxy_module/parsers/gen.shell | 4 - .../parsers/http_request_parser.c | 1231 - .../parsers/http_request_parser.h | 41 - .../parsers/http_request_parser.rl | 189 - .../parsers/http_response_parser.c | 418 - .../parsers/http_response_parser.h | 39 - .../parsers/http_response_parser.rl | 151 - .../nginx_tcp_proxy_module/parsers/parser.h | 13 - .../parsers/smtp_response_parser.c | 6550 ----- .../parsers/smtp_response_parser.h | 31 - .../parsers/smtp_response_parser.rl | 162 - 3rd-party/nginx_tcp_proxy_module/tcp.patch | 55 - 3rd-party/nginx_tcp_proxy_module/test/README | 61 - .../test/inc/Module/AutoInstall.pm | 805 - .../test/inc/Module/Install.pm | 430 - .../test/inc/Module/Install/AutoInstall.pm | 61 - .../test/inc/Module/Install/Base.pm | 78 - .../test/inc/Module/Install/Can.pm | 81 - .../test/inc/Module/Install/Fetch.pm | 93 - .../test/inc/Module/Install/Include.pm | 34 - .../test/inc/Module/Install/Makefile.pm | 268 - .../test/inc/Module/Install/Metadata.pm | 624 - .../test/inc/Module/Install/TestBase.pm | 29 - .../test/inc/Module/Install/Win32.pm | 64 - .../test/inc/Module/Install/WriteAll.pm | 60 - .../nginx_tcp_proxy_module/test/inc/Spiffy.pm | 539 - .../test/inc/Test/Base.pm | 684 - .../test/inc/Test/Base/Filter.pm | 344 - .../test/inc/Test/Builder.pm | 1589 - .../test/inc/Test/Builder/Module.pm | 73 - .../test/inc/Test/More.pm | 746 - .../test/lib/Test/Nginx.pm | 77 - .../test/lib/Test/Nginx/LWP.pm | 505 - .../test/lib/Test/Nginx/Socket.pm | 755 - .../test/lib/Test/Nginx/Util.pm | 516 - .../test/ragel/Makefile | 13 - .../test/ragel/http11.c | 534 - .../test/ragel/http11_parser.c | 1231 - .../test/ragel/http11_parser.h | 49 - .../test/ragel/http11_parser.rl | 141 - .../test/ragel/http11_parser_common.rl | 55 - .../test/ragel/http11_response.c | 419 - .../test/ragel/http11_response.h | 43 - .../test/ragel/http11_response.rl | 124 - .../test/ragel/http11_response_common.rl | 35 - .../test/ragel/ragel_http_client.c | 115 - .../test/ragel/ragel_http_server.c | 139 - 3rd-party/nginx_tcp_proxy_module/test/t/acl.t | 84 - .../test/t/http_check.t | 83 - .../test/t/imap_check.t | 47 - .../test/t/mysql_check.t | 48 - .../test/t/pop3_check.t | 48 - .../test/t/smtp_check.t | 50 - 3rd-party/nginx_tcp_proxy_module/test/t/ssl.t | 117 - .../test/t/ssl_hello_check.t | 48 - .../nginx_tcp_proxy_module/test/t/tcp_check.t | 80 - .../test/t/upstream_busyness.t | 64 - .../test/t/upstream_ip_hash.t | 64 - .../nginx_tcp_proxy_module/test/t/websocket.t | 251 - .../test/websocket/server.rb | 20 - .../util/update-readme.sh | 7 - .../nginx_tcp_proxy_module/util/wiki2pod.pl | 131 - 3rd-party/ngx_cache_purge-1.3/CHANGES | 29 - .../ngx_cache_purge_module.c | 747 - 3rd-party/ngx_cache_purge-2.3/CHANGES | 66 + .../LICENSE | 4 +- .../README => ngx_cache_purge-2.3/README.md} | 72 +- 3rd-party/ngx_cache_purge-2.3/TODO.md | 7 + .../config | 8 +- .../ngx_cache_purge_module.c | 1803 ++ .../t/proxy1.t} | 32 +- 3rd-party/ngx_cache_purge-2.3/t/proxy1_vars.t | 138 + 3rd-party/ngx_cache_purge-2.3/t/proxy2.t | 349 + 3rd-party/ngx_cache_purge-2.3/t/proxy2_vars.t | 353 + .../ngx_http_upstream_check_module/config | 5 + .../ngx_http_upstream_check_module.c | 2 + CHANGES | 687 + CHANGES.ru | 708 + CHANGES.senginx | 13 + auto/cc/conf | 57 +- auto/cc/gcc | 2 +- auto/cc/icc | 4 +- auto/cc/msvc | 37 +- auto/cc/name | 27 +- auto/cc/sunc | 3 + auto/configure | 116 + auto/endianness | 9 +- auto/init | 1 - auto/install | 92 +- auto/lib/conf | 8 +- auto/lib/geoip/conf | 7 +- auto/lib/libgd/conf | 7 +- auto/lib/libxslt/conf | 13 +- auto/lib/make | 2 +- auto/lib/md5/conf | 4 +- auto/lib/md5/make | 4 +- auto/lib/openssl/conf | 55 +- auto/lib/openssl/make | 7 +- auto/lib/pcre/conf | 4 +- auto/lib/pcre/make | 4 +- auto/lib/perl/conf | 9 +- auto/lib/perl/make | 5 +- auto/lib/sha1/conf | 4 +- auto/lib/sha1/make | 4 +- auto/lib/zlib/conf | 4 +- auto/lib/zlib/make | 4 +- auto/make | 299 +- auto/module | 122 + auto/modules | 1094 +- auto/options | 109 +- auto/os/conf | 9 + auto/os/darwin | 4 +- auto/os/freebsd | 49 +- auto/os/linux | 12 - auto/os/win32 | 6 +- auto/sources | 345 +- auto/summary | 28 +- auto/threads | 20 + auto/types/sizeof | 22 +- auto/types/typedef | 13 +- auto/types/uintptr_t | 9 +- auto/unix | 108 +- docs/GNUmakefile | 41 + docs/dtd/change_log_conf.dtd | 22 + docs/dtd/changes.dtd | 22 + docs/html/50x.html | 21 + docs/html/index.html | 25 + {man => docs/man}/nginx.8 | 8 +- docs/text/LICENSE | 26 + docs/text/README | 3 + docs/xml/change_log_conf.xml | 47 + docs/xml/nginx/changes.xml | 24511 ++++++++++++++++ docs/xsls/changes.xsls | 128 + docs/xslt/changes.xslt | 122 + neusoft/ngx_http_dynamic_resolve/config | 1 + neusoft/ngx_http_neteye_security/config | 2 +- neusoft/ngx_http_session/ngx_http_session.c | 2 +- neusoft/ngx_http_upstream_fastest/config | 2 + .../ngx_http_upstream_fastest.c | 8 +- rpm/senginx.spec | 8 + se-configure.sh | 9 +- src/core/nginx.c | 383 +- src/core/nginx.h | 6 +- src/core/ngx_buf.c | 88 + src/core/ngx_buf.h | 16 +- src/core/ngx_conf_file.c | 67 +- src/core/ngx_conf_file.h | 60 +- src/core/ngx_config.h | 8 +- src/core/ngx_connection.c | 386 +- src/core/ngx_connection.h | 51 +- src/core/ngx_core.h | 13 + src/core/ngx_crypt.c | 6 +- src/core/ngx_cycle.c | 97 +- src/core/ngx_cycle.h | 63 +- src/core/ngx_file.c | 37 +- src/core/ngx_file.h | 8 + src/core/ngx_hash.c | 16 +- src/core/ngx_inet.c | 38 +- src/core/ngx_log.c | 172 +- src/core/ngx_log.h | 22 +- src/core/ngx_module.c | 360 + src/core/ngx_module.h | 307 + src/core/ngx_open_file_cache.c | 4 +- src/core/ngx_output_chain.c | 123 +- src/core/ngx_palloc.c | 86 +- src/core/ngx_parse.c | 82 +- .../ngx_parse_time.c} | 5 +- src/core/ngx_parse_time.h | 22 + src/core/ngx_proxy_protocol.c | 51 +- src/core/ngx_proxy_protocol.h | 4 +- src/core/ngx_rbtree.c | 6 +- src/core/ngx_rbtree.h | 6 +- src/core/ngx_regex.c | 53 +- src/core/ngx_resolver.c | 2395 +- src/core/ngx_resolver.h | 82 +- src/core/ngx_rwlock.c | 120 + src/core/ngx_rwlock.h | 21 + src/core/ngx_shmtx.c | 5 +- src/core/ngx_slab.c | 11 +- src/core/ngx_string.c | 159 +- src/core/ngx_string.h | 1 + src/core/ngx_syslog.c | 58 +- src/core/ngx_syslog.h | 3 +- src/core/ngx_thread_pool.c | 634 + src/core/ngx_thread_pool.h | 36 + src/core/ngx_times.c | 4 +- src/event/modules/ngx_aio_module.c | 171 - src/event/modules/ngx_devpoll_module.c | 37 +- src/event/modules/ngx_epoll_module.c | 179 +- src/event/modules/ngx_eventport_module.c | 78 +- src/event/modules/ngx_iocp_module.c | 378 + src/event/modules/ngx_iocp_module.h | 22 + src/event/modules/ngx_kqueue_module.c | 263 +- src/event/modules/ngx_poll_module.c | 66 +- src/event/modules/ngx_rtsig_module.c | 747 - src/event/modules/ngx_select_module.c | 30 +- src/event/modules/ngx_win32_select_module.c | 16 +- src/event/ngx_event.c | 199 +- src/event/ngx_event.h | 109 +- src/event/ngx_event_accept.c | 509 +- src/event/ngx_event_acceptex.c | 229 + src/event/ngx_event_busy_lock.c | 286 - src/event/ngx_event_busy_lock.h | 65 - src/event/ngx_event_connect.c | 98 +- src/event/ngx_event_connect.h | 26 +- src/event/ngx_event_connectex.c | 206 + src/event/ngx_event_mutex.c | 70 - src/event/ngx_event_openssl.c | 348 +- src/event/ngx_event_openssl.h | 26 +- src/event/ngx_event_openssl_stapling.c | 82 +- src/event/ngx_event_pipe.c | 163 +- src/event/ngx_event_pipe.h | 13 + src/event/ngx_event_posted.c | 152 +- src/event/ngx_event_posted.h | 51 +- src/event/ngx_event_timer.c | 120 +- src/event/ngx_event_timer.h | 16 +- src/http/modules/ngx_http_auth_basic_module.c | 2 +- .../modules/ngx_http_auth_request_module.c | 4 +- src/http/modules/ngx_http_autoindex_module.c | 487 +- .../modules/ngx_http_chunked_filter_module.c | 4 +- src/http/modules/ngx_http_dav_module.c | 12 +- src/http/modules/ngx_http_fastcgi_module.c | 761 +- .../modules/ngx_http_gunzip_filter_module.c | 10 +- .../modules/ngx_http_gzip_filter_module.c | 14 +- .../modules/ngx_http_headers_filter_module.c | 304 +- .../modules/ngx_http_image_filter_module.c | 5 +- src/http/modules/ngx_http_limit_conn_module.c | 231 +- src/http/modules/ngx_http_limit_req_module.c | 370 +- src/http/modules/ngx_http_log_module.c | 82 +- src/http/modules/ngx_http_map_module.c | 12 +- src/http/modules/ngx_http_memcached_module.c | 27 +- src/http/modules/ngx_http_mp4_module.c | 28 +- .../ngx_http_not_modified_filter_module.c | 4 +- src/http/modules/ngx_http_proxy_module.c | 956 +- .../modules/ngx_http_random_index_module.c | 2 +- .../modules/ngx_http_range_filter_module.c | 45 +- src/http/modules/ngx_http_realip_module.c | 76 +- src/http/modules/ngx_http_referer_module.c | 2 +- src/http/modules/ngx_http_rewrite_module.c | 61 +- src/http/modules/ngx_http_scgi_module.c | 411 +- .../modules/ngx_http_slice_filter_module.c | 526 + src/http/modules/ngx_http_ssi_filter_module.c | 14 +- src/http/modules/ngx_http_ssl_module.c | 35 +- src/http/modules/ngx_http_static_module.c | 2 +- .../modules/ngx_http_stub_status_module.c | 4 +- src/http/modules/ngx_http_sub_filter_module.c | 590 +- .../modules/ngx_http_upstream_hash_module.c | 170 +- .../ngx_http_upstream_ip_hash_module.c | 59 +- .../ngx_http_upstream_keepalive_module.c | 109 +- .../ngx_http_upstream_least_conn_module.c | 238 +- .../modules/ngx_http_upstream_zone_module.c | 246 + src/http/modules/ngx_http_uwsgi_module.c | 585 +- src/http/modules/perl/nginx.xs | 18 +- src/http/modules/perl/ngx_http_perl_module.c | 3 +- src/http/ngx_http.c | 111 +- src/http/ngx_http.h | 19 +- src/http/ngx_http_busy_lock.c | 307 - src/http/ngx_http_busy_lock.h | 54 - src/http/ngx_http_cache.h | 25 +- src/http/ngx_http_copy_filter_module.c | 187 +- src/http/ngx_http_core_module.c | 401 +- src/http/ngx_http_core_module.h | 43 +- src/http/ngx_http_file_cache.c | 668 +- src/http/ngx_http_header_filter_module.c | 28 +- src/http/ngx_http_parse.c | 12 +- src/http/ngx_http_request.c | 121 +- src/http/ngx_http_request.h | 55 +- src/http/ngx_http_request_body.c | 272 +- src/http/ngx_http_script.c | 17 +- src/http/ngx_http_spdy.c | 3647 --- src/http/ngx_http_spdy.h | 261 - src/http/ngx_http_spdy_filter_module.c | 1213 - src/http/ngx_http_spdy_module.c | 408 - src/http/ngx_http_special_response.c | 24 +- src/http/ngx_http_upstream.c | 1192 +- src/http/ngx_http_upstream.h | 107 +- src/http/ngx_http_upstream_round_robin.c | 385 +- src/http/ngx_http_upstream_round_robin.h | 91 +- src/http/ngx_http_variables.c | 61 +- src/http/ngx_http_write_filter_module.c | 32 +- src/http/v2/ngx_http_v2.c | 4445 +++ src/http/v2/ngx_http_v2.h | 342 + src/http/v2/ngx_http_v2_filter_module.c | 1397 + src/http/v2/ngx_http_v2_huff_decode.c | 2714 ++ src/http/v2/ngx_http_v2_huff_encode.c | 254 + src/http/v2/ngx_http_v2_module.c | 500 + .../ngx_http_v2_module.h} | 20 +- src/http/v2/ngx_http_v2_table.c | 349 + src/mail/ngx_mail.c | 136 +- src/mail/ngx_mail.h | 47 +- src/mail/ngx_mail_auth_http_module.c | 154 +- src/mail/ngx_mail_core_module.c | 104 +- src/mail/ngx_mail_handler.c | 102 +- src/mail/ngx_mail_imap_handler.c | 3 +- src/mail/ngx_mail_imap_module.c | 4 +- src/mail/ngx_mail_pop3_handler.c | 3 +- src/mail/ngx_mail_pop3_module.c | 4 +- src/mail/ngx_mail_proxy_module.c | 17 +- src/mail/ngx_mail_smtp_handler.c | 4 +- src/mail/ngx_mail_smtp_module.c | 4 +- src/mail/ngx_mail_ssl_module.c | 97 +- src/mail/ngx_mail_ssl_module.h | 6 + src/os/unix/ngx_aio_read.c | 109 - src/os/unix/ngx_aio_read_chain.c | 78 - src/os/unix/ngx_aio_write.c | 109 - src/os/unix/ngx_aio_write_chain.c | 100 - src/os/unix/ngx_atomic.h | 20 +- src/os/unix/ngx_channel.c | 7 - src/os/unix/ngx_channel.h | 8 +- src/os/unix/ngx_darwin_config.h | 2 + src/os/unix/ngx_darwin_init.c | 1 + src/os/unix/ngx_darwin_sendfile_chain.c | 250 +- src/os/unix/ngx_dlopen.c | 28 + src/os/unix/ngx_dlopen.h | 31 + src/os/unix/ngx_errno.h | 1 + src/os/unix/ngx_file_aio_read.c | 44 +- src/os/unix/ngx_files.c | 464 +- src/os/unix/ngx_files.h | 9 + src/os/unix/ngx_freebsd_config.h | 10 +- src/os/unix/ngx_freebsd_init.c | 1 + src/os/unix/ngx_freebsd_rfork_thread.c | 756 - src/os/unix/ngx_freebsd_rfork_thread.h | 122 - src/os/unix/ngx_freebsd_sendfile_chain.c | 293 +- src/os/unix/ngx_linux.h | 2 - src/os/unix/ngx_linux_aio_read.c | 41 +- src/os/unix/ngx_linux_config.h | 10 +- src/os/unix/ngx_linux_init.c | 34 +- src/os/unix/ngx_linux_sendfile_chain.c | 466 +- src/os/unix/ngx_os.h | 34 +- src/os/unix/ngx_posix_config.h | 15 +- src/os/unix/ngx_posix_init.c | 7 +- src/os/unix/ngx_process.c | 2 +- src/os/unix/ngx_process_cycle.c | 277 +- src/os/unix/ngx_process_cycle.h | 7 +- src/os/unix/ngx_pthread_thread.c | 278 - src/os/unix/ngx_readv_chain.c | 187 +- src/os/unix/ngx_recv.c | 109 +- src/os/unix/ngx_send.c | 2 +- src/os/unix/ngx_setaffinity.c | 44 +- src/os/unix/ngx_setaffinity.h | 16 +- src/os/unix/ngx_setproctitle.h | 4 +- src/os/unix/ngx_solaris_config.h | 2 + src/os/unix/ngx_solaris_init.c | 1 + src/os/unix/ngx_solaris_sendfilev_chain.c | 98 +- src/os/unix/ngx_sunpro_amd64.il | 6 +- src/os/unix/ngx_sunpro_x86.il | 6 +- src/os/unix/ngx_thread.h | 109 +- src/os/unix/ngx_thread_cond.c | 87 + src/os/unix/ngx_thread_id.c | 70 + src/os/unix/ngx_thread_mutex.c | 174 + src/os/unix/ngx_udp_recv.c | 53 +- src/os/unix/ngx_udp_send.c | 56 + src/os/unix/ngx_user.c | 22 +- src/os/unix/ngx_writev_chain.c | 227 +- src/os/unix/rfork_thread.S | 73 - src/stream/ngx_stream.c | 564 + src/stream/ngx_stream.h | 212 + src/stream/ngx_stream_access_module.c | 451 + src/stream/ngx_stream_core_module.c | 562 + src/stream/ngx_stream_handler.c | 344 + src/stream/ngx_stream_limit_conn_module.c | 632 + src/stream/ngx_stream_proxy_module.c | 1674 ++ src/stream/ngx_stream_ssl_module.c | 460 + src/stream/ngx_stream_ssl_module.h | 49 + src/stream/ngx_stream_upstream.c | 464 + src/stream/ngx_stream_upstream.h | 107 + src/stream/ngx_stream_upstream_hash_module.c | 656 + .../ngx_stream_upstream_least_conn_module.c | 307 + src/stream/ngx_stream_upstream_round_robin.c | 702 + src/stream/ngx_stream_upstream_round_robin.h | 139 + src/stream/ngx_stream_upstream_zone_module.c | 242 + test/3rd-party/client_certificate_upstream.t | 159 - test/3rd-party/persistenct_least_conn.t | 430 + test/auto-test.sh | 6 + test/dynamic_resolve.t | 27 +- 807 files changed, 116326 insertions(+), 62710 deletions(-) create mode 100644 3rd-party/lua-nginx-module-0.10.7/.gitattributes create mode 100644 3rd-party/lua-nginx-module-0.10.7/.github/ISSUE_TEMPLATE.md create mode 100644 3rd-party/lua-nginx-module-0.10.7/.github/PULL_REQUEST_TEMPLATE.md rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/.gitignore (93%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/.travis.yml rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/README.markdown (54%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/config rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/doc/HttpLuaModule.wiki (72%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/dtrace/ngx_lua_provider.d (64%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/misc/recv-until-pm/lib/RecvUntil.pm (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/misc/recv-until-pm/t/sanity.t (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/api/ngx_http_lua_api.h (77%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ddebug.h (92%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_accessby.c (73%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_accessby.h (100%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_api.c rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_args.c (95%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_args.h create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_balancer.c create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_balancer.h rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_bodyfilterby.c (83%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_bodyfilterby.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_cache.c (76%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_cache.h (52%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_capturefilter.c (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_capturefilter.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_clfactory.c (97%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_clfactory.h (69%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_common.h (72%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_config.c (87%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_config.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_consts.c (69%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_consts.h rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_contentby.c (87%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_contentby.h (91%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_control.c (75%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_control.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_coroutine.c (87%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_coroutine.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_ctx.c (64%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_ctx.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_directive.c (55%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_directive.h rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_exception.c (95%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_exception.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_headerfilterby.c (93%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_headerfilterby.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_headers.c (74%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_headers.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_headers_in.c (88%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_headers_in.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_headers_out.c (93%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_headers_out.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_initby.c (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_initby.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_initworkerby.c (59%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_initworkerby.h (100%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_lex.c create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_lex.h rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_log.c (92%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_log.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_logby.c (79%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_logby.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_misc.c (82%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_misc.h (86%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_module.c (55%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_ndk.c (94%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_ndk.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_output.c (90%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_output.h (87%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_pcrefix.c (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_pcrefix.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_phase.c (73%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_phase.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_probe.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_regex.c (95%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_regex.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_req_body.c (93%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_req_body.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_req_method.c (58%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_req_method.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_rewriteby.c (75%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_rewriteby.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_script.c (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_script.h (92%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_semaphore.c create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_semaphore.h rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_setby.c (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_setby.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_shdict.c (56%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_shdict.h (73%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_sleep.c (91%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_sleep.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_socket_tcp.c (68%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_socket_tcp.h (78%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_socket_udp.c (94%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_socket_udp.h (75%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_ssl.c create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_ssl.h create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_ssl_certby.c create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_ssl_certby.h create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_ssl_ocsp.c create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_ssl_session_fetchby.c create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_ssl_session_fetchby.h create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_ssl_session_storeby.c create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_ssl_session_storeby.h rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_string.c (88%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_string.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_subrequest.c (95%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_subrequest.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_time.c (93%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_time.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_timer.c (74%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_timer.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_uri.c (95%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_uri.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_uthread.c (64%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_uthread.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_util.c (88%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_util.h (79%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_variable.c (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_variable.h (100%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/src/ngx_http_lua_worker.c rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/src/ngx_http_lua_worker.h (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/.gitignore (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/000--init.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/000-sanity.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/001-set.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/002-content.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/003-errors.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/004-require.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/005-exit.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/006-escape.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/007-md5.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/008-today.t (89%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/009-log.t (65%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/010-request_body.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/011-md5_bin.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/012-now.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/013-base64.t (77%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/014-bugs.t (84%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/015-status.t (90%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/016-resp-header.t (84%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/017-exec.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/018-ndk.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/019-const.t (97%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/020-subrequest.t (95%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/021-cookie-time.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/022-redirect.t (70%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/client-abort.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/exec.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/exit.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/mixed.t (91%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/multi-capture.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/on-abort.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/redirect.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/req-body.t (54%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/req-socket.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/request_body.t (97%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/sanity.t (93%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/sleep.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/socket-keepalive.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/subrequest.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/tcp-socket-timeout.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/tcp-socket.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/unix-socket.t (95%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/uthread-exec.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/uthread-exit.t (95%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/uthread-redirect.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/023-rewrite/uthread-spawn.t (93%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/auth.t (97%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/client-abort.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/exec.t (92%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/exit.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/mixed.t (83%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/multi-capture.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/on-abort.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/redirect.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/req-body.t (55%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/request_body.t (97%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/sanity.t (93%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/satisfy.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/sleep.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/subrequest.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/uthread-exec.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/uthread-exit.t (95%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/uthread-redirect.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/024-access/uthread-spawn.t (92%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/025-codecache.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/026-mysql.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/027-multi-capture.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/028-req-header.t (85%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/029-http-time.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/030-uri-args.t (90%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/031-post-args.t (87%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/032-iolist.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/033-ctx.t (84%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/034-match.t (94%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/035-gmatch.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/036-sub.t (85%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/037-gsub.t (82%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/038-match-o.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/039-sub-o.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/040-gsub-o.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/041-header-filter.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/042-crc32.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/043-shdict.t (92%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/044-req-body.t (84%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/045-ngx-var.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/046-hmac.t (97%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/047-match-jit.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/048-match-dfa.t (81%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/049-gmatch-jit.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/050-gmatch-dfa.t (84%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/051-sub-jit.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/052-sub-dfa.t (85%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/053-gsub-jit.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/054-gsub-dfa.t (85%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/055-subreq-vars.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/056-flush.t (92%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/057-flush-timeout.t (62%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/058-tcp-socket.t (81%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/059-unix-socket.t (65%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/060-lua-memcached.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/061-lua-redis.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/062-count.t (78%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/063-abort.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/064-pcall.t (91%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/065-tcp-socket-timeout.t (87%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/066-socket-receiveuntil.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/067-req-socket.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/068-socket-keepalive.t (94%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/069-null.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/070-sha1.t (89%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/071-idle-socket.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/072-conditional-get.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/073-backtrace.t (93%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/074-prefix-var.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/075-logby.t (94%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/076-no-postpone.t (50%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/077-sleep.t (60%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/078-hup-vars.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/079-unused-directives.t (94%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/080-hup-shdict.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/081-bytecode.t (90%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/082-body-filter.t (62%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/083-bad-sock-self.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/084-inclusive-receiveuntil.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/085-if.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/086-init-by.t (90%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/087-udp-socket.t (95%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/088-req-method.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/089-phase.t (88%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/090-log-socket-errors.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/091-coroutine.t (90%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/092-eof.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/093-uthread-spawn.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/094-uthread-exit.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/095-uthread-exec.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/096-uthread-redirect.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/097-uthread-rewrite.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/098-uthread-wait.t (97%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/099-c-api.t (92%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/100-client-abort.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/101-on-abort.t (91%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/102-req-start-time.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/103-req-http-ver.t (97%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/104-req-raw-header.t (64%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/105-pressure.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/106-timer.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/107-timer-errors.t (86%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/108-timer-safe.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/109-timer-hup.t (85%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/110-etag.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/111-req-header-ua.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/112-req-header-conn.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/113-req-header-cookie.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/114-config.t (67%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/115-quote-sql-str.t (96%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/116-raw-req-socket.t (87%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/117-raw-req-socket-timeout.t (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/118-use-default-type.t (84%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/119-config-prefix.t (97%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/120-re-find.t (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/121-version.t (98%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/122-worker.t (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/123-lua-path.t (92%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/124-init-worker.t (90%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/125-configure-args.t (97%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/126-shdict-frag.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/127-uthread-kill.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/128-duplex-tcp-socket.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/129-ssl-socket.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/130-internal-api.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/131-duplex-req-socket.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/132-lua-blocks.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/133-worker-count.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/134-worker-count-5.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/135-worker-id.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/136-timer-counts.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/137-req-misc.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/138-balancer.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/139-ssl-cert-by.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/140-ssl-c-api.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/141-luajit.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/142-ssl-session-store.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/143-ssl-session-fetch.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/144-shdict-incr-init.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/145-shdict-list.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/146-malloc-trim.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/147-tcp-socket-timeouts.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/148-fake-shm-zone.t create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/149-hup-fake-shm-zone.t rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/StapThread.pm (100%) create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/cert/equifax.crt create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/cert/startcom.crt create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/cert/test.crl create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/cert/test.crt create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/cert/test.key create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/cert/test2.crt create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/cert/test2.key create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/cert/test_ecdsa.crt create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/cert/test_ecdsa.key create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/data/fake-module/config create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/data/fake-module/ngx_http_fake_module.c create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/data/fake-shm-module/config create mode 100644 3rd-party/lua-nginx-module-0.10.7/t/data/fake-shm-module/ngx_http_lua_fake_shm_module.c rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/lib/CRC32.lua (99%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/lib/Memcached.lua (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/lib/Redis.lua (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/t/lib/ljson.lua (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/tapset/ngx_lua.stp (100%) rename 3rd-party/{lua-nginx-module/util/build2.sh => lua-nginx-module-0.10.7/util/build.sh} (67%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/util/fix-comments (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/util/gdbinit (100%) create mode 100755 3rd-party/lua-nginx-module-0.10.7/util/gen-lexer-c rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/util/ngx-links (95%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/util/retab (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/util/revim (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/util/run_test.sh (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/util/update-readme.sh (100%) rename 3rd-party/{lua-nginx-module => lua-nginx-module-0.10.7}/valgrind.suppress (79%) delete mode 100644 3rd-party/lua-nginx-module/.gitmodules delete mode 100644 3rd-party/lua-nginx-module/Changes delete mode 100644 3rd-party/lua-nginx-module/config delete mode 160000 3rd-party/lua-nginx-module/deps/ngx_devel_kit delete mode 100644 3rd-party/lua-nginx-module/misc/recv-until-pm/Makefile delete mode 100644 3rd-party/lua-nginx-module/src/ngx_http_lua_api.c delete mode 100644 3rd-party/lua-nginx-module/src/ngx_http_lua_args.h delete mode 100644 3rd-party/lua-nginx-module/src/ngx_http_lua_consts.h delete mode 100644 3rd-party/lua-nginx-module/src/ngx_http_lua_directive.h delete mode 100644 3rd-party/lua-nginx-module/src/ngx_http_lua_worker.c delete mode 100755 3rd-party/lua-nginx-module/util/build.sh delete mode 100755 3rd-party/lua-nginx-module/util/reindex delete mode 100755 3rd-party/lua-nginx-module/util/releng create mode 100644 3rd-party/memc-nginx-module-0.17/.gitattributes create mode 100644 3rd-party/memc-nginx-module-0.17/.gitignore rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/README.markdown (80%) create mode 100644 3rd-party/memc-nginx-module-0.17/config rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ddebug.h (92%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/memc_common.rl (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/memc_delete.rl (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/memc_flush_all.rl (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/memc_incr_decr.rl (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/memc_stats.rl (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/memc_storage.rl (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/memc_version.rl (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ngx_http_memc_handler.c (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ngx_http_memc_handler.h (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ngx_http_memc_module.c (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ngx_http_memc_module.h (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ngx_http_memc_request.c (98%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ngx_http_memc_request.h (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ngx_http_memc_response.c (98%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ngx_http_memc_response.h (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ngx_http_memc_response.rl (97%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ngx_http_memc_util.c (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/src/ngx_http_memc_util.h (91%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/bugs.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/cmd.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/core-bugs.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/delete.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/errors.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/eval.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/exptime.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/flags.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/flush-all.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/if.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/incr-decr.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/keepalive.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/keepalive/incr-decr.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/keepalive/storage.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/stats.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/storage.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/upstream.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/used.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/t/version.t (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/util/build.sh (97%) create mode 100755 3rd-party/memc-nginx-module-0.17/util/fix-clang-warnings rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/util/update-readme.sh (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/util/wiki2pod.pl (100%) rename 3rd-party/{memc-nginx-module => memc-nginx-module-0.17}/valgrind.suppress (65%) delete mode 100644 3rd-party/memc-nginx-module/config delete mode 100644 3rd-party/memc-nginx-module/doc/HttpMemcModule.wiki delete mode 100644 3rd-party/nginx_syslog_patch/config delete mode 100644 3rd-party/nginx_tcp_proxy_module/.gitignore delete mode 100644 3rd-party/nginx_tcp_proxy_module/README delete mode 100644 3rd-party/nginx_tcp_proxy_module/config delete mode 100644 3rd-party/nginx_tcp_proxy_module/config_without_ssl delete mode 100644 3rd-party/nginx_tcp_proxy_module/doc/README.html delete mode 100644 3rd-party/nginx_tcp_proxy_module/doc/README.txt delete mode 100644 3rd-party/nginx_tcp_proxy_module/doc/README.wiki delete mode 100644 3rd-party/nginx_tcp_proxy_module/modules/ngx_tcp_generic_proxy_module.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/modules/ngx_tcp_ssl_module.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/modules/ngx_tcp_ssl_module.h delete mode 100644 3rd-party/nginx_tcp_proxy_module/modules/ngx_tcp_upstream_busyness_module.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/modules/ngx_tcp_upstream_ip_hash_module.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/modules/ngx_tcp_websocket_proxy_module.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp.h delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp_access.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp_core_module.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp_log.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp_session.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp_session.h delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp_upstream.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp_upstream.h delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp_upstream_check.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp_upstream_check.h delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp_upstream_round_robin.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/ngx_tcp_upstream_round_robin.h delete mode 100755 3rd-party/nginx_tcp_proxy_module/parsers/gen.shell delete mode 100644 3rd-party/nginx_tcp_proxy_module/parsers/http_request_parser.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/parsers/http_request_parser.h delete mode 100644 3rd-party/nginx_tcp_proxy_module/parsers/http_request_parser.rl delete mode 100644 3rd-party/nginx_tcp_proxy_module/parsers/http_response_parser.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/parsers/http_response_parser.h delete mode 100644 3rd-party/nginx_tcp_proxy_module/parsers/http_response_parser.rl delete mode 100644 3rd-party/nginx_tcp_proxy_module/parsers/parser.h delete mode 100644 3rd-party/nginx_tcp_proxy_module/parsers/smtp_response_parser.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/parsers/smtp_response_parser.h delete mode 100644 3rd-party/nginx_tcp_proxy_module/parsers/smtp_response_parser.rl delete mode 100644 3rd-party/nginx_tcp_proxy_module/tcp.patch delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/README delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/AutoInstall.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/Install.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/Install/AutoInstall.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/Install/Base.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/Install/Can.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/Install/Fetch.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/Install/Include.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/Install/Makefile.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/Install/Metadata.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/Install/TestBase.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/Install/Win32.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Module/Install/WriteAll.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Spiffy.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Test/Base.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Test/Base/Filter.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Test/Builder.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Test/Builder/Module.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/inc/Test/More.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/lib/Test/Nginx.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/lib/Test/Nginx/LWP.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/lib/Test/Nginx/Socket.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/lib/Test/Nginx/Util.pm delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/Makefile delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/http11.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/http11_parser.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/http11_parser.h delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/http11_parser.rl delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/http11_parser_common.rl delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/http11_response.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/http11_response.h delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/http11_response.rl delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/http11_response_common.rl delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/ragel_http_client.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/ragel/ragel_http_server.c delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/acl.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/http_check.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/imap_check.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/mysql_check.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/pop3_check.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/smtp_check.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/ssl.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/ssl_hello_check.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/tcp_check.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/upstream_busyness.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/upstream_ip_hash.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/t/websocket.t delete mode 100644 3rd-party/nginx_tcp_proxy_module/test/websocket/server.rb delete mode 100755 3rd-party/nginx_tcp_proxy_module/util/update-readme.sh delete mode 100644 3rd-party/nginx_tcp_proxy_module/util/wiki2pod.pl delete mode 100644 3rd-party/ngx_cache_purge-1.3/CHANGES delete mode 100644 3rd-party/ngx_cache_purge-1.3/ngx_cache_purge_module.c create mode 100644 3rd-party/ngx_cache_purge-2.3/CHANGES rename 3rd-party/{ngx_cache_purge-1.3 => ngx_cache_purge-2.3}/LICENSE (91%) rename 3rd-party/{ngx_cache_purge-1.3/README => ngx_cache_purge-2.3/README.md} (63%) create mode 100644 3rd-party/ngx_cache_purge-2.3/TODO.md rename 3rd-party/{ngx_cache_purge-1.3 => ngx_cache_purge-2.3}/config (100%) create mode 100644 3rd-party/ngx_cache_purge-2.3/ngx_cache_purge_module.c rename 3rd-party/{ngx_cache_purge-1.3/t/proxy.t => ngx_cache_purge-2.3/t/proxy1.t} (79%) create mode 100644 3rd-party/ngx_cache_purge-2.3/t/proxy1_vars.t create mode 100644 3rd-party/ngx_cache_purge-2.3/t/proxy2.t create mode 100644 3rd-party/ngx_cache_purge-2.3/t/proxy2_vars.t create mode 100644 3rd-party/ngx_http_upstream_check_module/config rename {src/http => 3rd-party/ngx_http_upstream_check_module}/ngx_http_upstream_check_module.c (99%) create mode 100755 auto/configure create mode 100644 auto/module create mode 100644 auto/threads create mode 100644 docs/GNUmakefile create mode 100644 docs/dtd/change_log_conf.dtd create mode 100644 docs/dtd/changes.dtd create mode 100644 docs/html/50x.html create mode 100644 docs/html/index.html rename {man => docs/man}/nginx.8 (97%) create mode 100644 docs/text/LICENSE create mode 100644 docs/text/README create mode 100644 docs/xml/change_log_conf.xml create mode 100644 docs/xml/nginx/changes.xml create mode 100644 docs/xsls/changes.xsls create mode 100644 docs/xslt/changes.xslt create mode 100644 neusoft/ngx_http_dynamic_resolve/config create mode 100644 src/core/ngx_module.c create mode 100644 src/core/ngx_module.h rename src/{http/ngx_http_parse_time.c => core/ngx_parse_time.c} (98%) create mode 100644 src/core/ngx_parse_time.h create mode 100644 src/core/ngx_rwlock.c create mode 100644 src/core/ngx_rwlock.h create mode 100644 src/core/ngx_thread_pool.c create mode 100644 src/core/ngx_thread_pool.h delete mode 100644 src/event/modules/ngx_aio_module.c create mode 100644 src/event/modules/ngx_iocp_module.c create mode 100644 src/event/modules/ngx_iocp_module.h delete mode 100644 src/event/modules/ngx_rtsig_module.c create mode 100644 src/event/ngx_event_acceptex.c delete mode 100644 src/event/ngx_event_busy_lock.c delete mode 100644 src/event/ngx_event_busy_lock.h create mode 100644 src/event/ngx_event_connectex.c delete mode 100644 src/event/ngx_event_mutex.c create mode 100644 src/http/modules/ngx_http_slice_filter_module.c create mode 100644 src/http/modules/ngx_http_upstream_zone_module.c delete mode 100644 src/http/ngx_http_busy_lock.c delete mode 100644 src/http/ngx_http_busy_lock.h delete mode 100644 src/http/ngx_http_spdy.c delete mode 100644 src/http/ngx_http_spdy.h delete mode 100644 src/http/ngx_http_spdy_filter_module.c delete mode 100644 src/http/ngx_http_spdy_module.c create mode 100644 src/http/v2/ngx_http_v2.c create mode 100644 src/http/v2/ngx_http_v2.h create mode 100644 src/http/v2/ngx_http_v2_filter_module.c create mode 100644 src/http/v2/ngx_http_v2_huff_decode.c create mode 100644 src/http/v2/ngx_http_v2_huff_encode.c create mode 100644 src/http/v2/ngx_http_v2_module.c rename src/http/{ngx_http_spdy_module.h => v2/ngx_http_v2_module.h} (55%) create mode 100644 src/http/v2/ngx_http_v2_table.c delete mode 100644 src/os/unix/ngx_aio_read.c delete mode 100644 src/os/unix/ngx_aio_read_chain.c delete mode 100644 src/os/unix/ngx_aio_write.c delete mode 100644 src/os/unix/ngx_aio_write_chain.c create mode 100644 src/os/unix/ngx_dlopen.c create mode 100644 src/os/unix/ngx_dlopen.h delete mode 100644 src/os/unix/ngx_freebsd_rfork_thread.c delete mode 100644 src/os/unix/ngx_freebsd_rfork_thread.h delete mode 100644 src/os/unix/ngx_pthread_thread.c create mode 100644 src/os/unix/ngx_thread_cond.c create mode 100644 src/os/unix/ngx_thread_id.c create mode 100644 src/os/unix/ngx_thread_mutex.c create mode 100644 src/os/unix/ngx_udp_send.c delete mode 100644 src/os/unix/rfork_thread.S create mode 100644 src/stream/ngx_stream.c create mode 100644 src/stream/ngx_stream.h create mode 100644 src/stream/ngx_stream_access_module.c create mode 100644 src/stream/ngx_stream_core_module.c create mode 100644 src/stream/ngx_stream_handler.c create mode 100644 src/stream/ngx_stream_limit_conn_module.c create mode 100644 src/stream/ngx_stream_proxy_module.c create mode 100644 src/stream/ngx_stream_ssl_module.c create mode 100644 src/stream/ngx_stream_ssl_module.h create mode 100644 src/stream/ngx_stream_upstream.c create mode 100644 src/stream/ngx_stream_upstream.h create mode 100644 src/stream/ngx_stream_upstream_hash_module.c create mode 100644 src/stream/ngx_stream_upstream_least_conn_module.c create mode 100644 src/stream/ngx_stream_upstream_round_robin.c create mode 100644 src/stream/ngx_stream_upstream_round_robin.h create mode 100644 src/stream/ngx_stream_upstream_zone_module.c delete mode 100644 test/3rd-party/client_certificate_upstream.t create mode 100644 test/3rd-party/persistenct_least_conn.t mode change 100644 => 100755 test/dynamic_resolve.t diff --git a/3rd-party/lua-nginx-module-0.10.7/.gitattributes b/3rd-party/lua-nginx-module-0.10.7/.gitattributes new file mode 100644 index 00000000..6fe6f35c --- /dev/null +++ b/3rd-party/lua-nginx-module-0.10.7/.gitattributes @@ -0,0 +1 @@ +*.t linguist-language=Text diff --git a/3rd-party/lua-nginx-module-0.10.7/.github/ISSUE_TEMPLATE.md b/3rd-party/lua-nginx-module-0.10.7/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..e6359b0a --- /dev/null +++ b/3rd-party/lua-nginx-module-0.10.7/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,23 @@ +This place is for bug reports and development discussions only. For general questions and +discussions, please join the openresty-en mailing list instead: https://openresty.org/en/community.html + +Ensure you have provided the following details while reporting a problem: + +* The exact version of the related software, including but not limited to the OpenResty version +(if any), the NGINX core version, the `ngx_lua` module version, +and your operating system version. +* A minimal and standalone test case that others can easily run on their side and +reproduce the issue you are seeing. +* Do not simply say "something is broken" or "something does not work". Always provide +as much details as possible. Always describe the symptoms and your expected results. +* You can (temporarily) enable the nginx debugging logs to see the internal workings +of NGINX in your nginx''s `error.log` file. See http://nginx.org/en/docs/debugging_log.html +The same instructions apply equally well to OpenResty. +* If you are seeing crashes, please provide the full backtrace for the crash. See +https://www.nginx.com/resources/wiki/start/topics/tutorials/debugging/#core-dump +for more details. + +Please, do not use Chinese here. This place is considered English only. If you +really want to use Chinese, please join and post to the openresty (Chinese) +mailing list instead. Please see https://openresty.org/en/community.html Thanks for +your cooperation. diff --git a/3rd-party/lua-nginx-module-0.10.7/.github/PULL_REQUEST_TEMPLATE.md b/3rd-party/lua-nginx-module-0.10.7/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..5e833bab --- /dev/null +++ b/3rd-party/lua-nginx-module-0.10.7/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,2 @@ +I hereby granted the copyright of the changes in this pull request +to the authors of this lua-nginx-module project. diff --git a/3rd-party/lua-nginx-module/.gitignore b/3rd-party/lua-nginx-module-0.10.7/.gitignore similarity index 93% rename from 3rd-party/lua-nginx-module/.gitignore rename to 3rd-party/lua-nginx-module-0.10.7/.gitignore index 61613b2d..eff33724 100644 --- a/3rd-party/lua-nginx-module/.gitignore +++ b/3rd-party/lua-nginx-module-0.10.7/.gitignore @@ -153,6 +153,14 @@ src/uthread.[ch] src/timer.[ch] src/config.[ch] src/worker.[ch] +src/certby.[ch] +src/storeby.[ch] +src/fetchby.[ch] +src/ssl.[ch] +src/ocsp.c +src/lex.[ch] +src/balancer.[ch] +src/semaphore.[ch] *.plist lua ttimer diff --git a/3rd-party/lua-nginx-module-0.10.7/.travis.yml b/3rd-party/lua-nginx-module-0.10.7/.travis.yml new file mode 100644 index 00000000..dc1185e1 --- /dev/null +++ b/3rd-party/lua-nginx-module-0.10.7/.travis.yml @@ -0,0 +1,126 @@ +sudo: required +dist: trusty + +os: linux + +language: c + +compiler: + - gcc + - clang + +addons: + apt: + packages: + - mysql-server + - axel + - cpanminus + - libtest-base-perl + - libtext-diff-perl + - liburi-perl + - libwww-perl + - libtest-longstring-perl + - liblist-moreutils-perl + - libgd-dev + +cache: + apt: true + directories: + - download-cache + +env: + global: + - JOBS=3 + - NGX_BUILD_JOBS=$JOBS + - LUAJIT_PREFIX=/opt/luajit21 + - LUAJIT_LIB=$LUAJIT_PREFIX/lib + - LUAJIT_INC=$LUAJIT_PREFIX/include/luajit-2.1 + - LUA_INCLUDE_DIR=$LUAJIT_INC + - PCRE_VER=8.33 + - PCRE_PREFIX=/opt/pcre + - PCRE_LIB=$PCRE_PREFIX/lib + - PCRE_INC=$PCRE_PREFIX/include + - OPENSSL_PREFIX=/opt/ssl + - OPENSSL_LIB=$OPENSSL_PREFIX/lib + - OPENSSL_INC=$OPENSSL_PREFIX/include + - OPENSSL_VER=1.0.2j + - LIBDRIZZLE_PREFIX=/opt/drizzle + - LIBDRIZZLE_INC=$LIBDRIZZLE_PREFIX/include/libdrizzle-1.0 + - LIBDRIZZLE_LIB=$LIBDRIZZLE_PREFIX/lib + - LD_LIBRARY_PATH=$LUAJIT_LIB:$LD_LIBRARY_PATH + - DRIZZLE_VER=2011.07.21 + - TEST_NGINX_SLEEP=0.006 + matrix: + - NGINX_VERSION=1.9.15 + - NGINX_VERSION=1.11.2 + +services: + - memcache + - redis-server + +install: + - if [ ! -d download-cache ]; then mkdir download-cache; fi + - rm -f download-cache/drizzle7-$DRIZZLE_VER.tar.gz # alas, we may end up with corrupted drizzle tarball stuck in the download-cache/ forever. + - if [ ! -f download-cache/drizzle7-$DRIZZLE_VER.tar.gz ]; then wget -O download-cache/drizzle7-$DRIZZLE_VER.tar.gz http://openresty.org/download/drizzle7-$DRIZZLE_VER.tar.gz; fi + - if [ ! -f download-cache/pcre-$PCRE_VER.tar.gz ]; then wget -O download-cache/pcre-$PCRE_VER.tar.gz http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-$PCRE_VER.tar.gz; fi + - if [ ! -f download-cache/openssl-$OPENSSL_VER.tar.gz ]; then wget -O download-cache/openssl-$OPENSSL_VER.tar.gz https://www.openssl.org/source/openssl-$OPENSSL_VER.tar.gz; fi + - git clone https://github.com/openresty/test-nginx.git + - git clone https://github.com/openresty/openresty.git ../openresty + - git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx + - git clone https://github.com/openresty/nginx-devel-utils.git + - git clone https://github.com/openresty/mockeagain.git + - git clone https://github.com/openresty/lua-cjson.git + - git clone https://github.com/openresty/lua-upstream-nginx-module.git ../lua-upstream-nginx-module + - git clone https://github.com/openresty/echo-nginx-module.git ../echo-nginx-module + - git clone https://github.com/openresty/nginx-eval-module.git ../nginx-eval-module + - git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module + - git clone https://github.com/FRiCKLE/ngx_coolkit.git ../coolkit-nginx-module + - git clone https://github.com/openresty/headers-more-nginx-module.git ../headers-more-nginx-module + - git clone https://github.com/openresty/drizzle-nginx-module.git ../drizzle-nginx-module + - git clone https://github.com/openresty/set-misc-nginx-module.git ../set-misc-nginx-module + - git clone https://github.com/openresty/memc-nginx-module.git ../memc-nginx-module + - git clone https://github.com/openresty/rds-json-nginx-module.git ../rds-json-nginx-module + - git clone https://github.com/openresty/srcache-nginx-module.git ../srcache-nginx-module + - git clone https://github.com/openresty/redis2-nginx-module.git ../redis2-nginx-module + - git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git + +before_script: + - mysql -uroot -e 'create database ngx_test; grant all on ngx_test.* to "ngx_test"@"%" identified by "ngx_test"; flush privileges;' + +script: + - cd luajit2/ + - make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' > build.log 2>&1 || (cat build.log && exit 1) + - sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1) + - cd .. + - tar xzf download-cache/drizzle7-$DRIZZLE_VER.tar.gz && cd drizzle7-$DRIZZLE_VER + - ./configure --prefix=$LIBDRIZZLE_PREFIX --without-server > build.log 2>&1 || (cat build.log && exit 1) + - make libdrizzle-1.0 -j$JOBS > build.log 2>&1 || (cat build.log && exit 1) + - sudo make install-libdrizzle-1.0 > build.log 2>&1 || (cat build.log && exit 1) + - cd ../mockeagain/ && make CC=$CC -j$JOBS && cd .. + - cd test-nginx/ && sudo cpanm . && cd .. + - cd lua-cjson/ && make -j$JOBS && sudo make install && cd .. + - tar zxf download-cache/pcre-$PCRE_VER.tar.gz + - cd pcre-$PCRE_VER/ + - ./configure --prefix=$PCRE_PREFIX --enable-jit --enable-utf --enable-unicode-properties > build.log 2>&1 || (cat build.log && exit 1) + - make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1) + - sudo PATH=$PATH make install > build.log 2>&1 || (cat build.log && exit 1) + - cd .. + - tar zxf download-cache/openssl-$OPENSSL_VER.tar.gz + - cd openssl-$OPENSSL_VER/ + - if [ ! -f ../download-cache/openssl-1.0.2h-sess_set_get_cb_yield.patch ]; then wget -O ../download-cache/openssl-1.0.2h-sess_set_get_cb_yield.patch https://raw.githubusercontent.com/openresty/openresty/master/patches/openssl-1.0.2h-sess_set_get_cb_yield.patch; fi + - patch -p1 < ../download-cache/openssl-1.0.2h-sess_set_get_cb_yield.patch + - ./config shared --prefix=$OPENSSL_PREFIX -DPURIFY > build.log 2>&1 || (cat build.log && exit 1) + - make -j$JOBS > build.log 2>&1 || (cat build.log && exit 1) + - sudo make PATH=$PATH install_sw > build.log 2>&1 || (cat build.log && exit 1) + - cd .. + - export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH + - export NGX_BUILD_CC=$CC + - sh util/build.sh $NGINX_VERSION > build.log 2>&1 || (cat build.log && exit 1) + - nginx -V + - ldd `which nginx`|grep -E 'luajit|ssl|pcre' + - export LD_PRELOAD=$PWD/mockeagain/mockeagain.so + - export LD_LIBRARY_PATH=$PWD/mockeagain:$LD_LIBRARY_PATH + - export TEST_NGINX_RESOLVER=8.8.4.4 + - dig +short @$TEST_NGINX_RESOLVER openresty.org || exit 0 + - dig +short @$TEST_NGINX_RESOLVER agentzh.org || exit 0 + - prove -r t diff --git a/3rd-party/lua-nginx-module/README.markdown b/3rd-party/lua-nginx-module-0.10.7/README.markdown similarity index 54% rename from 3rd-party/lua-nginx-module/README.markdown rename to 3rd-party/lua-nginx-module-0.10.7/README.markdown index 8fccf946..3699a72d 100644 --- a/3rd-party/lua-nginx-module/README.markdown +++ b/3rd-party/lua-nginx-module-0.10.7/README.markdown @@ -6,183 +6,29 @@ Don't edit this file manually! Instead you should generate it by using: Name ==== -ngx_lua - Embed the power of Lua into Nginx +ngx_http_lua_module - Embed the power of Lua into Nginx HTTP Servers. *This module is not distributed with the Nginx source.* See [the installation instructions](#installation). Table of Contents ================= +* [Name](#name) * [Status](#status) * [Version](#version) * [Synopsis](#synopsis) * [Description](#description) -* [Directives](#directives) - * [lua_use_default_type](#lua_use_default_type) - * [lua_code_cache](#lua_code_cache) - * [lua_regex_cache_max_entries](#lua_regex_cache_max_entries) - * [lua_regex_match_limit](#lua_regex_match_limit) - * [lua_package_path](#lua_package_path) - * [lua_package_cpath](#lua_package_cpath) - * [init_by_lua](#init_by_lua) - * [init_by_lua_file](#init_by_lua_file) - * [init_worker_by_lua](#init_worker_by_lua) - * [init_worker_by_lua_file](#init_worker_by_lua_file) - * [set_by_lua](#set_by_lua) - * [set_by_lua_file](#set_by_lua_file) - * [content_by_lua](#content_by_lua) - * [content_by_lua_file](#content_by_lua_file) - * [rewrite_by_lua](#rewrite_by_lua) - * [rewrite_by_lua_file](#rewrite_by_lua_file) - * [access_by_lua](#access_by_lua) - * [access_by_lua_file](#access_by_lua_file) - * [header_filter_by_lua](#header_filter_by_lua) - * [header_filter_by_lua_file](#header_filter_by_lua_file) - * [body_filter_by_lua](#body_filter_by_lua) - * [body_filter_by_lua_file](#body_filter_by_lua_file) - * [log_by_lua](#log_by_lua) - * [log_by_lua_file](#log_by_lua_file) - * [lua_need_request_body](#lua_need_request_body) - * [lua_shared_dict](#lua_shared_dict) - * [lua_socket_connect_timeout](#lua_socket_connect_timeout) - * [lua_socket_send_timeout](#lua_socket_send_timeout) - * [lua_socket_send_lowat](#lua_socket_send_lowat) - * [lua_socket_read_timeout](#lua_socket_read_timeout) - * [lua_socket_buffer_size](#lua_socket_buffer_size) - * [lua_socket_pool_size](#lua_socket_pool_size) - * [lua_socket_keepalive_timeout](#lua_socket_keepalive_timeout) - * [lua_socket_log_errors](#lua_socket_log_errors) - * [lua_http10_buffering](#lua_http10_buffering) - * [rewrite_by_lua_no_postpone](#rewrite_by_lua_no_postpone) - * [lua_transform_underscores_in_response_headers](#lua_transform_underscores_in_response_headers) - * [lua_check_client_abort](#lua_check_client_abort) - * [lua_max_pending_timers](#lua_max_pending_timers) - * [lua_max_running_timers](#lua_max_running_timers) -* [Nginx API for Lua](#nginx-api-for-lua) - * [Introduction](#introduction) - * [ngx.arg](#ngxarg) - * [ngx.var.VARIABLE](#ngxvarvariable) - * [Core constants](#core-constants) - * [HTTP method constants](#http-method-constants) - * [HTTP status constants](#http-status-constants) - * [Nginx log level constants](#nginx-log-level-constants) - * [print](#print) - * [ngx.ctx](#ngxctx) - * [ngx.location.capture](#ngxlocationcapture) - * [ngx.location.capture_multi](#ngxlocationcapture_multi) - * [ngx.status](#ngxstatus) - * [ngx.header.HEADER](#ngxheaderheader) - * [ngx.resp.get_headers](#ngxrespget_headers) - * [ngx.req.start_time](#ngxreqstart_time) - * [ngx.req.http_version](#ngxreqhttp_version) - * [ngx.req.raw_header](#ngxreqraw_header) - * [ngx.req.get_method](#ngxreqget_method) - * [ngx.req.set_method](#ngxreqset_method) - * [ngx.req.set_uri](#ngxreqset_uri) - * [ngx.req.set_uri_args](#ngxreqset_uri_args) - * [ngx.req.get_uri_args](#ngxreqget_uri_args) - * [ngx.req.get_post_args](#ngxreqget_post_args) - * [ngx.req.get_headers](#ngxreqget_headers) - * [ngx.req.set_header](#ngxreqset_header) - * [ngx.req.clear_header](#ngxreqclear_header) - * [ngx.req.read_body](#ngxreqread_body) - * [ngx.req.discard_body](#ngxreqdiscard_body) - * [ngx.req.get_body_data](#ngxreqget_body_data) - * [ngx.req.get_body_file](#ngxreqget_body_file) - * [ngx.req.set_body_data](#ngxreqset_body_data) - * [ngx.req.set_body_file](#ngxreqset_body_file) - * [ngx.req.init_body](#ngxreqinit_body) - * [ngx.req.append_body](#ngxreqappend_body) - * [ngx.req.finish_body](#ngxreqfinish_body) - * [ngx.req.socket](#ngxreqsocket) - * [ngx.exec](#ngxexec) - * [ngx.redirect](#ngxredirect) - * [ngx.send_headers](#ngxsend_headers) - * [ngx.headers_sent](#ngxheaders_sent) - * [ngx.print](#ngxprint) - * [ngx.say](#ngxsay) - * [ngx.log](#ngxlog) - * [ngx.flush](#ngxflush) - * [ngx.exit](#ngxexit) - * [ngx.eof](#ngxeof) - * [ngx.sleep](#ngxsleep) - * [ngx.escape_uri](#ngxescape_uri) - * [ngx.unescape_uri](#ngxunescape_uri) - * [ngx.encode_args](#ngxencode_args) - * [ngx.decode_args](#ngxdecode_args) - * [ngx.encode_base64](#ngxencode_base64) - * [ngx.decode_base64](#ngxdecode_base64) - * [ngx.crc32_short](#ngxcrc32_short) - * [ngx.crc32_long](#ngxcrc32_long) - * [ngx.hmac_sha1](#ngxhmac_sha1) - * [ngx.md5](#ngxmd5) - * [ngx.md5_bin](#ngxmd5_bin) - * [ngx.sha1_bin](#ngxsha1_bin) - * [ngx.quote_sql_str](#ngxquote_sql_str) - * [ngx.today](#ngxtoday) - * [ngx.time](#ngxtime) - * [ngx.now](#ngxnow) - * [ngx.update_time](#ngxupdate_time) - * [ngx.localtime](#ngxlocaltime) - * [ngx.utctime](#ngxutctime) - * [ngx.cookie_time](#ngxcookie_time) - * [ngx.http_time](#ngxhttp_time) - * [ngx.parse_http_time](#ngxparse_http_time) - * [ngx.is_subrequest](#ngxis_subrequest) - * [ngx.re.match](#ngxrematch) - * [ngx.re.find](#ngxrefind) - * [ngx.re.gmatch](#ngxregmatch) - * [ngx.re.sub](#ngxresub) - * [ngx.re.gsub](#ngxregsub) - * [ngx.shared.DICT](#ngxshareddict) - * [ngx.shared.DICT.get](#ngxshareddictget) - * [ngx.shared.DICT.get_stale](#ngxshareddictget_stale) - * [ngx.shared.DICT.set](#ngxshareddictset) - * [ngx.shared.DICT.safe_set](#ngxshareddictsafe_set) - * [ngx.shared.DICT.add](#ngxshareddictadd) - * [ngx.shared.DICT.safe_add](#ngxshareddictsafe_add) - * [ngx.shared.DICT.replace](#ngxshareddictreplace) - * [ngx.shared.DICT.delete](#ngxshareddictdelete) - * [ngx.shared.DICT.incr](#ngxshareddictincr) - * [ngx.shared.DICT.flush_all](#ngxshareddictflush_all) - * [ngx.shared.DICT.flush_expired](#ngxshareddictflush_expired) - * [ngx.shared.DICT.get_keys](#ngxshareddictget_keys) - * [ngx.socket.udp](#ngxsocketudp) - * [udpsock:setpeername](#udpsocksetpeername) - * [udpsock:send](#udpsocksend) - * [udpsock:receive](#udpsockreceive) - * [udpsock:close](#udpsockclose) - * [udpsock:settimeout](#udpsocksettimeout) - * [ngx.socket.tcp](#ngxsockettcp) - * [tcpsock:connect](#tcpsockconnect) - * [tcpsock:send](#tcpsocksend) - * [tcpsock:receive](#tcpsockreceive) - * [tcpsock:receiveuntil](#tcpsockreceiveuntil) - * [tcpsock:close](#tcpsockclose) - * [tcpsock:settimeout](#tcpsocksettimeout) - * [tcpsock:setoption](#tcpsocksetoption) - * [tcpsock:setkeepalive](#tcpsocksetkeepalive) - * [tcpsock:getreusedtimes](#tcpsockgetreusedtimes) - * [ngx.socket.connect](#ngxsocketconnect) - * [ngx.get_phase](#ngxget_phase) - * [ngx.thread.spawn](#ngxthreadspawn) - * [ngx.thread.wait](#ngxthreadwait) - * [ngx.on_abort](#ngxon_abort) - * [ngx.timer.at](#ngxtimerat) - * [ngx.config.debug](#ngxconfigdebug) - * [ngx.config.prefix](#ngxconfigprefix) - * [ngx.config.nginx_version](#ngxconfignginx_version) - * [ngx.config.nginx_configure](#ngxconfignginx_configure) - * [ngx.config.ngx_lua_version](#ngxconfigngx_lua_version) - * [ngx.worker.exiting](#ngxworkerexiting) - * [ngx.worker.pid](#ngxworkerpid) - * [ndk.set_var.DIRECTIVE](#ndkset_vardirective) - * [coroutine.create](#coroutinecreate) - * [coroutine.resume](#coroutineresume) - * [coroutine.yield](#coroutineyield) - * [coroutine.wrap](#coroutinewrap) - * [coroutine.running](#coroutinerunning) - * [coroutine.status](#coroutinestatus) +* [Typical Uses](#typical-uses) +* [Nginx Compatibility](#nginx-compatibility) +* [Installation](#installation) + * [Building as a dynamic module](#building-as-a-dynamic-module) + * [C Macro Configurations](#c-macro-configurations) + * [Installation on Ubuntu 11.10](#installation-on-ubuntu-1110) +* [Community](#community) + * [English Mailing List](#english-mailing-list) + * [Chinese Mailing List](#chinese-mailing-list) +* [Code Repository](#code-repository) +* [Bugs and Patches](#bugs-and-patches) * [Lua/LuaJIT bytecode support](#lualuajit-bytecode-support) * [System Environment Variable Support](#system-environment-variable-support) * [HTTP 1.0 support](#http-10-support) @@ -193,205 +39,147 @@ Table of Contents * [Lua Coroutine Yielding/Resuming](#lua-coroutine-yieldingresuming) * [Lua Variable Scope](#lua-variable-scope) * [Locations Configured by Subrequest Directives of Other Modules](#locations-configured-by-subrequest-directives-of-other-modules) - * [Special PCRE Sequences](#special-pcre-sequences) + * [Cosockets Not Available Everywhere](#cosockets-not-available-everywhere) + * [Special Escaping Sequences](#special-escaping-sequences) * [Mixing with SSI Not Supported](#mixing-with-ssi-not-supported) * [SPDY Mode Not Fully Supported](#spdy-mode-not-fully-supported) -* [Typical Uses](#typical-uses) -* [Nginx Compatibility](#nginx-compatibility) -* [Code Repository](#code-repository) -* [Installation](#installation) - * [Installation on Ubuntu 11.10](#installation-on-ubuntu-1110) -* [Community](#community) - * [English Mailing List](#english-mailing-list) - * [Chinese Mailing List](#chinese-mailing-list) -* [Bugs and Patches](#bugs-and-patches) + * [Missing data on short circuited requests](#missing-data-on-short-circuited-requests) * [TODO](#todo) - * [Short Term](#short-term) - * [Longer Term](#longer-term) * [Changes](#changes) * [Test Suite](#test-suite) * [Copyright and License](#copyright-and-license) * [See Also](#see-also) +* [Directives](#directives) +* [Nginx API for Lua](#nginx-api-for-lua) +* [Obsolete Sections](#obsolete-sections) + * [Special PCRE Sequences](#special-pcre-sequences) Status ====== -This module is under active development and is production ready. +Production ready. Version ======= -This document describes ngx_lua [v0.9.6](https://github.com/chaoslawful/lua-nginx-module/tags) released on 20 March 2014. +This document describes ngx_lua [v0.10.7](https://github.com/openresty/lua-nginx-module/tags) released on 4 November 2016. Synopsis ======== ```nginx -# set search paths for pure Lua external libraries (';;' is the default path): -lua_package_path '/foo/bar/?.lua;/blah/?.lua;;'; - -# set search paths for Lua external libraries written in C (can also use ';;'): -lua_package_cpath '/bar/baz/?.so;/blah/blah/?.so;;'; - -server { - location /inline_concat { - # MIME type determined by default_type: - default_type 'text/plain'; - - set $a "hello"; - set $b "world"; - # inline Lua script - set_by_lua $res "return ngx.arg[1]..ngx.arg[2]" $a $b; - echo $res; - } - - location /rel_file_concat { - set $a "foo"; - set $b "bar"; - # script path relative to nginx prefix - # $ngx_prefix/conf/concat.lua contents: - # - # return ngx.arg[1]..ngx.arg[2] - # - set_by_lua_file $res conf/concat.lua $a $b; - echo $res; - } - - location /abs_file_concat { - set $a "fee"; - set $b "baz"; - # absolute script path not modified - set_by_lua_file $res /usr/nginx/conf/concat.lua $a $b; - echo $res; - } - - location /lua_content { - # MIME type determined by default_type: - default_type 'text/plain'; - - content_by_lua "ngx.say('Hello,world!')"; - } - + # set search paths for pure Lua external libraries (';;' is the default path): + lua_package_path '/foo/bar/?.lua;/blah/?.lua;;'; + + # set search paths for Lua external libraries written in C (can also use ';;'): + lua_package_cpath '/bar/baz/?.so;/blah/blah/?.so;;'; + + server { + location /lua_content { + # MIME type determined by default_type: + default_type 'text/plain'; + + content_by_lua_block { + ngx.say('Hello,world!') + } + } + location /nginx_var { - # MIME type determined by default_type: - default_type 'text/plain'; - - # try access /nginx_var?a=hello,world - content_by_lua "ngx.print(ngx.var['arg_a'], '\\n')"; - } - - location /request_body { - # force reading request body (default off) - lua_need_request_body on; + # MIME type determined by default_type: + default_type 'text/plain'; + + # try access /nginx_var?a=hello,world + content_by_lua_block { + ngx.say(ngx.var.arg_a) + } + } + + location = /request_body { client_max_body_size 50k; client_body_buffer_size 50k; - - content_by_lua 'ngx.print(ngx.var.request_body)'; - } - - # transparent non-blocking I/O in Lua via subrequests - location /lua { - # MIME type determined by default_type: - default_type 'text/plain'; - - content_by_lua ' - local res = ngx.location.capture("/some_other_location") - if res.status == 200 then - ngx.print(res.body) - end'; - } - - # GET /recur?num=5 - location /recur { - # MIME type determined by default_type: - default_type 'text/plain'; - - content_by_lua ' - local num = tonumber(ngx.var.arg_num) or 0 - - if num > 50 then - ngx.say("num too big") - return - end - ngx.say("num is: ", num) - - if num > 0 then - res = ngx.location.capture("/recur?num=" .. tostring(num - 1)) - ngx.print("status=", res.status, " ") - ngx.print("body=", res.body) - else - ngx.say("end") - end - '; - } - - location /foo { - rewrite_by_lua ' - res = ngx.location.capture("/memc", - { args = { cmd = "incr", key = ngx.var.uri } } - ) - '; - - proxy_pass http://blah.blah.com; - } - - location /blah { - access_by_lua ' - local res = ngx.location.capture("/auth") - - if res.status == ngx.HTTP_OK then - return + content_by_lua_block { + ngx.req.read_body() -- explicitly read the req body + local data = ngx.req.get_body_data() + if data then + ngx.say("body data:") + ngx.print(data) + return + end + + -- body may get buffered in a temp file: + local file = ngx.req.get_body_file() + if file then + ngx.say("body is in file ", file) + else + ngx.say("no body found") + end + } + } + + # transparent non-blocking I/O in Lua via subrequests + # (well, a better way is to use cosockets) + location = /lua { + # MIME type determined by default_type: + default_type 'text/plain'; + + content_by_lua_block { + local res = ngx.location.capture("/some_other_location") + if res then + ngx.say("status: ", res.status) + ngx.say("body:") + ngx.print(res.body) + end + } + } + + location = /foo { + rewrite_by_lua_block { + res = ngx.location.capture("/memc", + { args = { cmd = "incr", key = ngx.var.uri } } + ) + } + + proxy_pass http://blah.blah.com; + } + + location = /mixed { + rewrite_by_lua_file /path/to/rewrite.lua; + access_by_lua_file /path/to/access.lua; + content_by_lua_file /path/to/content.lua; + } + + # use nginx var in code path + # WARNING: contents in nginx var must be carefully filtered, + # otherwise there'll be great security risk! + location ~ ^/app/([-_a-zA-Z0-9/]+) { + set $path $1; + content_by_lua_file /path/to/lua/app/root/$path.lua; + } + + location / { + client_max_body_size 100k; + client_body_buffer_size 100k; + + access_by_lua_block { + -- check the client IP address is in our black list + if ngx.var.remote_addr == "132.5.72.3" then + ngx.exit(ngx.HTTP_FORBIDDEN) end - - if res.status == ngx.HTTP_FORBIDDEN then - ngx.exit(res.status) + + -- check if the URI contains bad words + if ngx.var.uri and + string.match(ngx.var.request_body, "evil") + then + return ngx.redirect("/terms_of_use.html") end - - ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) - '; - - # proxy_pass/fastcgi_pass/postgres_pass/... - } - - location /mixed { - rewrite_by_lua_file /path/to/rewrite.lua; - access_by_lua_file /path/to/access.lua; - content_by_lua_file /path/to/content.lua; - } - - # use nginx var in code path - # WARN: contents in nginx var must be carefully filtered, - # otherwise there'll be great security risk! - location ~ ^/app/(.+) { - content_by_lua_file /path/to/lua/app/root/$1.lua; - } - - location / { - lua_need_request_body on; - - client_max_body_size 100k; - client_body_buffer_size 100k; - - access_by_lua ' - -- check the client IP address is in our black list - if ngx.var.remote_addr == "132.5.72.3" then - ngx.exit(ngx.HTTP_FORBIDDEN) - end - - -- check if the request body contains bad words - if ngx.var.request_body and - string.match(ngx.var.request_body, "fsck") - then - return ngx.redirect("/terms_of_use.html") - end - - -- tests passed - '; - - # proxy_pass/fastcgi_pass/etc settings - } -} + + -- tests passed + } + + # proxy_pass/fastcgi_pass/etc settings + } + } ``` [Back to TOC](#table-of-contents) @@ -406,17 +194,19 @@ requests to upstream services such as MySQL, PostgreSQL, Memcached, Redis, or up At least the following Lua libraries and Nginx modules can be used with this ngx_lua module: -* [lua-resty-memcached](https://github.com/agentzh/lua-resty-memcached) -* [lua-resty-mysql](https://github.com/agentzh/lua-resty-mysql) -* [lua-resty-redis](https://github.com/agentzh/lua-resty-redis) -* [lua-resty-dns](https://github.com/agentzh/lua-resty-dns) -* [lua-resty-upload](https://github.com/agentzh/lua-resty-upload) -* [lua-resty-websocket](https://github.com/agentzh/lua-resty-websocket) -* [lua-resty-lock](https://github.com/agentzh/lua-resty-lock) -* [lua-resty-string](https://github.com/agentzh/lua-resty-string) -* [ngx_memc](http://github.com/agentzh/memc-nginx-module) +* [lua-resty-memcached](https://github.com/openresty/lua-resty-memcached) +* [lua-resty-mysql](https://github.com/openresty/lua-resty-mysql) +* [lua-resty-redis](https://github.com/openresty/lua-resty-redis) +* [lua-resty-dns](https://github.com/openresty/lua-resty-dns) +* [lua-resty-upload](https://github.com/openresty/lua-resty-upload) +* [lua-resty-websocket](https://github.com/openresty/lua-resty-websocket) +* [lua-resty-lock](https://github.com/openresty/lua-resty-lock) +* [lua-resty-logger-socket](https://github.com/cloudflare/lua-resty-logger-socket) +* [lua-resty-lrucache](https://github.com/openresty/lua-resty-lrucache) +* [lua-resty-string](https://github.com/openresty/lua-resty-string) +* [ngx_memc](http://github.com/openresty/memc-nginx-module) * [ngx_postgres](https://github.com/FRiCKLE/ngx_postgres) -* [ngx_redis2](http://github.com/agentzh/redis2-nginx-module) +* [ngx_redis2](http://github.com/openresty/redis2-nginx-module) * [ngx_redis](http://wiki.nginx.org/HttpRedisModule) * [ngx_proxy](http://nginx.org/en/docs/http/ngx_http_proxy_module.html) * [ngx_fastcgi](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html) @@ -427,6231 +217,7782 @@ The Lua interpreter or LuaJIT instance is shared across all the requests in a si Loaded Lua modules persist in the nginx worker process level resulting in a small memory footprint in Lua even when under heavy loads. -[Back to TOC](#table-of-contents) - -Directives -========== +This module is plugged into NGINX's "http" subsystem so it can only speaks downstream communication protocols in the HTTP family (HTTP 0.9/1.0/1.1/2.0, WebSockets, and etc). +If you want to do generic TCP communications with the downstream clients, then you should use the [ngx_stream_lua](https://github.com/openresty/stream-lua-nginx-module#readme) module instead +which has a compatible Lua API. [Back to TOC](#table-of-contents) -lua_use_default_type --------------------- -**syntax:** *lua_use_default_type on | off* +Typical Uses +============ -**default:** *lua_use_default_type on* +Just to name a few: -**context:** *http, server, location, location if* +* Mashup'ing and processing outputs of various nginx upstream outputs (proxy, drizzle, postgres, redis, memcached, and etc) in Lua, +* doing arbitrarily complex access control and security checks in Lua before requests actually reach the upstream backends, +* manipulating response headers in an arbitrary way (by Lua) +* fetching backend information from external storage backends (like redis, memcached, mysql, postgresql) and use that information to choose which upstream backend to access on-the-fly, +* coding up arbitrarily complex web applications in a content handler using synchronous but still non-blocking access to the database backends and other storage, +* doing very complex URL dispatch in Lua at rewrite phase, +* using Lua to implement advanced caching mechanism for Nginx's subrequests and arbitrary locations. -Specifies whether to use the MIME type specified by the [default_type](http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type) directive for the default value of the `Content-Type` response header. If you do not want a default `Content-Type` response header for your Lua request handlers, then turn this directive off. +The possibilities are unlimited as the module allows bringing together various elements within Nginx as well as exposing the power of the Lua language to the user. The module provides the full flexibility of scripting while offering performance levels comparable with native C language programs both in terms of CPU time as well as memory footprint. This is particularly the case when LuaJIT 2.x is enabled. -This directive is turned on by default. +Other scripting language implementations typically struggle to match this performance level. -This directive was first introduced in the `v0.9.1` release. +The Lua state (Lua VM instance) is shared across all the requests handled by a single nginx worker process to minimize memory use. [Back to TOC](#table-of-contents) -lua_code_cache --------------- -**syntax:** *lua_code_cache on | off* +Nginx Compatibility +=================== -**default:** *lua_code_cache on* +The latest version of this module is compatible with the following versions of Nginx: -**context:** *http, server, location, location if* +* 1.11.x (last tested: 1.11.2) +* 1.10.x +* 1.9.x (last tested: 1.9.15) +* 1.8.x +* 1.7.x (last tested: 1.7.10) +* 1.6.x -Enables or disables the Lua code cache for Lua code in `*_by_lua_file` directives (like [set_by_lua_file](#set_by_lua_file) and -[content_by_lua_file](#content_by_lua_file)) and Lua modules. +Nginx cores older than 1.6.0 (exclusive) are *not* supported. -When turning off, every request served by ngx_lua will run in a separate Lua VM instance, starting from the `0.9.3` release. So the Lua files referenced in [set_by_lua_file](#set_by_lua_file), -[content_by_lua_file](#content_by_lua_file), [access_by_lua_file](#access_by_lua_file), -and etc will not be cached -and all Lua modules used will be loaded from scratch. With this in place, developers can adopt an edit-and-refresh approach. +[Back to TOC](#table-of-contents) -Please note however, that Lua code written inlined within nginx.conf -such as those specified by [set_by_lua](#set_by_lua), [content_by_lua](#content_by_lua), -[access_by_lua](#access_by_lua), and [rewrite_by_lua](#rewrite_by_lua) will not be updated when you edit the inlined Lua code in your `nginx.conf` file because only the Nginx config file parser can correctly parse the `nginx.conf` -file and the only way is to reload the config file -by sending a `HUP` signal or just to restart Nginx. +Installation +============ -Even when the code cache is enabled, Lua files which are loaded by `dofile` or `loadfile` -in *_by_lua_file cannot be cached (unless you cache the results yourself). Usually you can either use the [init_by_lua](#init_by_lua) -or [init_by_lua_file](#init-by_lua_file) directives to load all such files or just make these Lua files true Lua modules -and load them via `require`. +It is highly recommended to use the [OpenResty bundle](http://openresty.org) that bundles Nginx, ngx_lua, LuaJIT 2.0/2.1 (or the optional standard Lua 5.1 interpreter), as well as a package of powerful companion Nginx modules. The basic installation step is a simple command: `./configure --with-luajit && make && make install`. -The ngx_lua module does not support the `stat` mode available with the -Apache `mod_lua` module (yet). +Alternatively, ngx_lua can be manually compiled into Nginx: -Disabling the Lua code cache is strongly -discouraged for production use and should only be used during -development as it has a significant negative impact on overall performance. For example, the performance a "hello world" Lua example can drop by an order of magnitude after disabling the Lua code cache. +1. Install LuaJIT 2.0 or 2.1 (recommended) or Lua 5.1 (Lua 5.2 is *not* supported yet). LuaJIT can be downloaded from the [LuaJIT project website](http://luajit.org/download.html) and Lua 5.1, from the [Lua project website](http://www.lua.org/). Some distribution package managers also distribute LuaJIT and/or Lua. +1. Download the latest version of the ngx_devel_kit (NDK) module [HERE](https://github.com/simpl/ngx_devel_kit/tags). +1. Download the latest version of ngx_lua [HERE](https://github.com/openresty/lua-nginx-module/tags). +1. Download the latest version of Nginx [HERE](http://nginx.org/) (See [Nginx Compatibility](#nginx-compatibility)) -[Back to TOC](#table-of-contents) +Build the source with this module: -lua_regex_cache_max_entries ---------------------------- -**syntax:** *lua_regex_cache_max_entries <num>* +```bash -**default:** *lua_regex_cache_max_entries 1024* + wget 'http://nginx.org/download/nginx-1.11.2.tar.gz' + tar -xzvf nginx-1.11.2.tar.gz + cd nginx-1.11.2/ -**context:** *http* + # tell nginx's build system where to find LuaJIT 2.0: + export LUAJIT_LIB=/path/to/luajit/lib + export LUAJIT_INC=/path/to/luajit/include/luajit-2.0 -Specifies the maximum number of entries allowed in the worker process level compiled regex cache. + # tell nginx's build system where to find LuaJIT 2.1: + export LUAJIT_LIB=/path/to/luajit/lib + export LUAJIT_INC=/path/to/luajit/include/luajit-2.1 -The regular expressions used in [ngx.re.match](#ngxrematch), [ngx.re.gmatch](#ngxregmatch), [ngx.re.sub](#ngxresub), and [ngx.re.gsub](#ngxregsub) will be cached within this cache if the regex option `o` (i.e., compile-once flag) is specified. + # or tell where to find Lua if using Lua instead: + #export LUA_LIB=/path/to/lua/lib + #export LUA_INC=/path/to/lua/include -The default number of entries allowed is 1024 and when this limit is reached, new regular expressions will not be cached (as if the `o` option was not specified) and there will be one, and only one, warning in the `error.log` file: + # Here we assume Nginx is to be installed under /opt/nginx/. + ./configure --prefix=/opt/nginx \ + --with-ld-opt="-Wl,-rpath,/path/to/luajit-or-lua/lib" \ + --add-module=/path/to/ngx_devel_kit \ + --add-module=/path/to/lua-nginx-module + make -j2 + make install +``` - 2011/08/27 23:18:26 [warn] 31997#0: *1 lua exceeding regex cache max entries (1024), ... +[Back to TOC](#table-of-contents) + +Building as a dynamic module +---------------------------- +Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option instead of `--add-module=PATH` on the +`./configure` command line above. And then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module) +directive, for example, -Do not activate the `o` option for regular expressions (and/or `replace` string arguments for [ngx.re.sub](#ngxresub) and [ngx.re.gsub](#ngxregsub)) that are generated *on the fly* and give rise to infinite variations to avoid hitting the specified limit. +```nginx +load_module /path/to/modules/ndk_http_module.so; # assuming NDK is built as a dynamic module too +load_module /path/to/modules/ngx_http_lua_module.so; +``` [Back to TOC](#table-of-contents) -lua_regex_match_limit ---------------------- -**syntax:** *lua_regex_match_limit <num>* +C Macro Configurations +---------------------- -**default:** *lua_regex_match_limit 0* +While building this module either via OpenResty or with the NGINX core, you can define the following C macros via the C compiler options: -**context:** *http* +* `NGX_LUA_USE_ASSERT` + When defined, will enable assertions in the ngx_lua C code base. Recommended for debugging or testing builds. It can introduce some (small) runtime overhead when enabled. This macro was first introduced in the `v0.9.10` release. +* `NGX_LUA_ABORT_AT_PANIC` + When the Lua/LuaJIT VM panics, ngx_lua will instruct the current nginx worker process to quit gracefully by default. By specifying this C macro, ngx_lua will abort the current nginx worker process (which usually result in a core dump file) immediately. This option is useful for debugging VM panics. This option was first introduced in the `v0.9.8` release. +* `NGX_LUA_NO_FFI_API` + Excludes pure C API functions for FFI-based Lua API for NGINX (as required by [lua-resty-core](https://github.com/openresty/lua-resty-core#readme), for example). Enabling this macro can make the resulting binary code size smaller. -Specifies the "match limit" used by the PCRE library when executing the [ngx.re API](#ngxrematch). To quote the PCRE manpage, "the limit ... has the effect of limiting the amount of backtracking that can take place." +To enable one or more of these macros, just pass extra C compiler options to the `./configure` script of either NGINX or OpenResty. For instance, -When the limit is hit, the error string "pcre_exec() failed: -8" will be returned by the [ngx.re API](#ngxrematch) functions on the Lua land. -When setting the limit to 0, the default "match limit" when compiling the PCRE library is used. And this is the default value of this directive. + ./configure --with-cc-opt="-DNGX_LUA_USE_ASSERT -DNGX_LUA_ABORT_AT_PANIC" -This directive was first introduced in the `v0.8.5` release. [Back to TOC](#table-of-contents) -lua_package_path ----------------- +Installation on Ubuntu 11.10 +---------------------------- -**syntax:** *lua_package_path <lua-style-path-str>* +Note that it is recommended to use LuaJIT 2.0 or LuaJIT 2.1 instead of the standard Lua 5.1 interpreter wherever possible. -**default:** *The content of LUA_PATH environ variable or Lua's compiled-in defaults.* +If the standard Lua 5.1 interpreter is required however, run the following command to install it from the Ubuntu repository: -**context:** *http* +```bash -Sets the Lua module search path used by scripts specified by [set_by_lua](#set_by_lua), -[content_by_lua](#content_by_lua) and others. The path string is in standard Lua path form, and `;;` -can be used to stand for the original search paths. + apt-get install -y lua5.1 liblua5.1-0 liblua5.1-0-dev +``` -As from the `v0.5.0rc29` release, the special notation `$prefix` or `${prefix}` can be used in the search path string to indicate the path of the `server prefix` usually determined by the `-p PATH` command-line option while starting the Nginx server. +Everything should be installed correctly, except for one small tweak. -[Back to TOC](#table-of-contents) +Library name `liblua.so` has been changed in liblua5.1 package, it only comes with `liblua5.1.so`, which needs to be symlinked to `/usr/lib` so it could be found during the configuration process. -lua_package_cpath ------------------ +```bash -**syntax:** *lua_package_cpath <lua-style-cpath-str>* + ln -s /usr/lib/x86_64-linux-gnu/liblua5.1.so /usr/lib/liblua.so +``` -**default:** *The content of LUA_CPATH environment variable or Lua's compiled-in defaults.* +[Back to TOC](#table-of-contents) -**context:** *http* +Community +========= -Sets the Lua C-module search path used by scripts specified by [set_by_lua](#set_by_lua), -[content_by_lua](#content_by_lua) and others. The cpath string is in standard Lua cpath form, and `;;` -can be used to stand for the original cpath. +[Back to TOC](#table-of-contents) -As from the `v0.5.0rc29` release, the special notation `$prefix` or `${prefix}` can be used in the search path string to indicate the path of the `server prefix` usually determined by the `-p PATH` command-line option while starting the Nginx server. +English Mailing List +-------------------- + +The [openresty-en](https://groups.google.com/group/openresty-en) mailing list is for English speakers. [Back to TOC](#table-of-contents) -init_by_lua ------------ +Chinese Mailing List +-------------------- -**syntax:** *init_by_lua <lua-script-str>* +The [openresty](https://groups.google.com/group/openresty) mailing list is for Chinese speakers. -**context:** *http* +[Back to TOC](#table-of-contents) -**phase:** *loading-config* +Code Repository +=============== -Runs the Lua code specified by the argument `` on the global Lua VM level when the Nginx master process (if any) is loading the Nginx config file. +The code repository of this project is hosted on github at [openresty/lua-nginx-module](https://github.com/openresty/lua-nginx-module). -When Nginx receives the `HUP` signal and starts reloading the config file, the Lua VM will also be re-created and `init_by_lua` will run again on the new Lua VM. +[Back to TOC](#table-of-contents) -Usually you can register (true) Lua global variables or pre-load Lua modules at server start-up by means of this hook. Here is an example for pre-loading Lua modules: +Bugs and Patches +================ -```nginx +Please submit bug reports, wishlists, or patches by -init_by_lua 'cjson = require "cjson"'; +1. creating a ticket on the [GitHub Issue Tracker](https://github.com/openresty/lua-nginx-module/issues), +1. or posting to the [OpenResty community](#community). -server { - location = /api { - content_by_lua ' - ngx.say(cjson.encode({dog = 5, cat = 6})) - '; - } -} -``` +[Back to TOC](#table-of-contents) -You can also initialize the [lua_shared_dict](#lua_shared_dict) shm storage at this phase. Here is an example for this: +Lua/LuaJIT bytecode support +=========================== -```nginx +As from the `v0.5.0rc32` release, all `*_by_lua_file` configure directives (such as [content_by_lua_file](#content_by_lua_file)) support loading Lua 5.1 and LuaJIT 2.0/2.1 raw bytecode files directly. -lua_shared_dict dogs 1m; +Please note that the bytecode format used by LuaJIT 2.0/2.1 is not compatible with that used by the standard Lua 5.1 interpreter. So if using LuaJIT 2.0/2.1 with ngx_lua, LuaJIT compatible bytecode files must be generated as shown: -init_by_lua ' - local dogs = ngx.shared.dogs; - dogs:set("Tom", 56) -'; +```bash -server { - location = /api { - content_by_lua ' - local dogs = ngx.shared.dogs; - ngx.say(dogs:get("Tom")) - '; - } -} + /path/to/luajit/bin/luajit -b /path/to/input_file.lua /path/to/output_file.luac ``` -But note that, the [lua_shared_dict](#lua_shared_dict)'s shm storage will not be cleared through a config reload (via the `HUP` signal, for example). So if you do *not* want to re-initialize the shm storage in your `init_by_lua` code in this case, then you just need to set a custom flag in the shm storage and always check the flag in your `init_by_lua` code. +The `-bg` option can be used to include debug information in the LuaJIT bytecode file: -Because the Lua code in this context runs before Nginx forks its worker processes (if any), data or code loaded here will enjoy the [Copy-on-write (COW)](http://en.wikipedia.org/wiki/Copy-on-write) feature provided by many operating systems among all the worker processes, thus saving a lot of memory. +```bash -Only a small set of the [Nginx API for Lua](#nginx-api-for-lua) is supported in this context: + /path/to/luajit/bin/luajit -bg /path/to/input_file.lua /path/to/output_file.luac +``` -* Logging APIs: [ngx.log](#ngxlog) and [print](#print), -* Shared Dictionary API: [ngx.shared.DICT](#ngxshareddict). +Please refer to the official LuaJIT documentation on the `-b` option for more details: -More Nginx APIs for Lua may be supported in this context upon future user requests. + -Basically you can safely use Lua libraries that do blocking I/O in this very context because blocking the master process during server start-up is completely okay. Even the Nginx core does blocking I/O (at least on resolving upstream's host names) at the configure-loading phase. +Also, the bytecode files generated by LuaJIT 2.1 is *not* compatible with LuaJIT 2.0, and vice versa. The support for LuaJIT 2.1 bytecode was first added in ngx_lua v0.9.3. -You should be very careful about potential security vulnerabilities in your Lua code registered in this context because the Nginx master process is often run under the `root` account. +Similarly, if using the standard Lua 5.1 interpreter with ngx_lua, Lua compatible bytecode files must be generated using the `luac` commandline utility as shown: -This directive was first introduced in the `v0.5.5` release. +```bash -[Back to TOC](#table-of-contents) + luac -o /path/to/output_file.luac /path/to/input_file.lua +``` -init_by_lua_file ----------------- +Unlike as with LuaJIT, debug information is included in standard Lua 5.1 bytecode files by default. This can be striped out by specifying the `-s` option as shown: -**syntax:** *init_by_lua_file <path-to-lua-script-file>* +```bash -**context:** *http* + luac -s -o /path/to/output_file.luac /path/to/input_file.lua +``` -**phase:** *loading-config* +Attempts to load standard Lua 5.1 bytecode files into ngx_lua instances linked to LuaJIT 2.0/2.1 or vice versa, will result in an error message, such as that below, being logged into the Nginx `error.log` file: -Equivalent to [init_by_lua](#init_by_lua), except that the file specified by `` contains the Lua code or [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. + [error] 13909#0: *1 failed to load Lua inlined code: bad byte-code header in /path/to/test_file.luac -This directive was first introduced in the `v0.5.5` release. + +Loading bytecode files via the Lua primitives like `require` and `dofile` should always work as expected. [Back to TOC](#table-of-contents) -init_worker_by_lua ------------------- +System Environment Variable Support +=================================== -**syntax:** *init_worker_by_lua <lua-script-str>* - -**context:** *http* - -**phase:** *starting-worker* - -Runs the specified Lua code upon every Nginx worker process's startup when the master process is enabled. When the master process is disabled, this hook will just run after [init_by_lua*](#init_by_lua). - -This hook is often used to create per-worker reoccurring timers (via the [ngx.timer.at](#ngxtimerat) Lua API), either for backend healthcheck or other timed routine work. Below is an example, +If you want to access the system environment variable, say, `foo`, in Lua via the standard Lua API [os.getenv](http://www.lua.org/manual/5.1/manual.html#pdf-os.getenv), then you should also list this environment variable name in your `nginx.conf` file via the [env directive](http://nginx.org/en/docs/ngx_core_module.html#env). For example, ```nginx -init_worker_by_lua ' - local delay = 3 -- in seconds - local new_timer = ngx.timer.at - local log = ngx.log - local ERR = ngx.ERR - local check - - check = function(premature) - if not premature then - -- do the health check or other routine work - local ok, err = new_timer(delay, check) - if not ok then - log(ERR, "failed to create timer: ", err) - return - end - end - end - - local ok, err = new_timer(delay, check) - if not ok then - log(ERR, "failed to create timer: ", err) - return - end -'; + env foo; ``` -This directive was first introduced in the `v0.9.5` release. - [Back to TOC](#table-of-contents) -init_worker_by_lua_file ------------------------ - -**syntax:** *init_worker_by_lua_file <lua-file-path>* - -**context:** *http* +HTTP 1.0 support +================ -**phase:** *starting-worker* +The HTTP 1.0 protocol does not support chunked output and requires an explicit `Content-Length` header when the response body is not empty in order to support the HTTP 1.0 keep-alive. +So when a HTTP 1.0 request is made and the [lua_http10_buffering](#lua_http10_buffering) directive is turned `on`, ngx_lua will buffer the +output of [ngx.say](#ngxsay) and [ngx.print](#ngxprint) calls and also postpone sending response headers until all the response body output is received. +At that time ngx_lua can calculate the total length of the body and construct a proper `Content-Length` header to return to the HTTP 1.0 client. +If the `Content-Length` response header is set in the running Lua code, however, this buffering will be disabled even if the [lua_http10_buffering](#lua_http10_buffering) directive is turned `on`. -Similar to [init_worker_by_lua](#init_worker_by_lua), but accepts the file path to a Lua source file or Lua bytecode file. +For large streaming output responses, it is important to disable the [lua_http10_buffering](#lua_http10_buffering) directive to minimise memory usage. -This directive was first introduced in the `v0.9.5` release. +Note that common HTTP benchmark tools such as `ab` and `http_load` issue HTTP 1.0 requests by default. +To force `curl` to send HTTP 1.0 requests, use the `-0` option. [Back to TOC](#table-of-contents) -set_by_lua ----------- +Statically Linking Pure Lua Modules +=================================== -**syntax:** *set_by_lua $res <lua-script-str> [$arg1 $arg2 ...]* +When LuaJIT 2.x is used, it is possible to statically link the bytecode of pure Lua modules into the Nginx executable. -**context:** *server, server if, location, location if* +Basically you use the `luajit` executable to compile `.lua` Lua module files to `.o` object files containing the exported bytecode data, and then link the `.o` files directly in your Nginx build. -**phase:** *server-rewrite, rewrite* +Below is a trivial example to demonstrate this. Consider that we have the following `.lua` file named `foo.lua`: -Executes code specified in `` with optional input arguments `$arg1 $arg2 ...`, and returns string output to `$res`. -The code in `` can make [API calls](#nginx-api-for-lua) and can retrieve input arguments from the `ngx.arg` table (index starts from `1` and increases sequentially). +```lua -This directive is designed to execute short, fast running code blocks as the Nginx event loop is blocked during code execution. Time consuming code sequences should therefore be avoided. + -- foo.lua + local _M = {} -Note that the following API functions are currently disabled within this context: + function _M.go() + print("Hello from foo") + end -* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) -* Control API functions (e.g., [ngx.exit](#ngxexit)) -* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) -* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). + return _M +``` -In addition, note that this directive can only write out a value to a single Nginx variable at -a time. However, a workaround is possible using the [ngx.var.VARIABLE](#ngxvarvariable) interface. +And then we compile this `.lua` file to `foo.o` file: -```nginx + /path/to/luajit/bin/luajit -bg foo.lua foo.o -location /foo { - set $diff ''; # we have to predefine the $diff variable here - - set_by_lua $sum ' - local a = 32 - local b = 56 - - ngx.var.diff = a - b; -- write to $diff directly - return a + b; -- return the $sum value normally - '; - - echo "sum = $sum, diff = $diff"; -} -``` +What matters here is the name of the `.lua` file, which determines how you use this module later on the Lua land. The file name `foo.o` does not matter at all except the `.o` file extension (which tells `luajit` what output format is used). If you want to strip the Lua debug information from the resulting bytecode, you can just specify the `-b` option above instead of `-bg`. -This directive can be freely mixed with all directives of the [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html), [set-misc-nginx-module](http://github.com/agentzh/set-misc-nginx-module), and [array-var-nginx-module](http://github.com/agentzh/array-var-nginx-module) modules. All of these directives will run in the same order as they appear in the config file. +Then when building Nginx or OpenResty, pass the `--with-ld-opt="foo.o"` option to the `./configure` script: -```nginx +```bash -set $foo 32; -set_by_lua $bar 'tonumber(ngx.var.foo) + 1'; -set $baz "bar: $bar"; # $baz == "bar: 33" + ./configure --with-ld-opt="/path/to/foo.o" ... ``` -As from the `v0.5.0rc29` release, Nginx variable interpolation is disabled in the `` argument of this directive and therefore, the dollar sign character (`$`) can be used directly. +Finally, you can just do the following in any Lua code run by ngx_lua: -This directive requires the [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit) module. +```lua -[Back to TOC](#table-of-contents) + local foo = require "foo" + foo.go() +``` -set_by_lua_file ---------------- -**syntax:** *set_by_lua_file $res <path-to-lua-script-file> [$arg1 $arg2 ...]* +And this piece of code no longer depends on the external `foo.lua` file any more because it has already been compiled into the `nginx` executable. -**context:** *server, server if, location, location if* +If you want to use dot in the Lua module name when calling `require`, as in -**phase:** *server-rewrite, rewrite* +```lua -Equivalent to [set_by_lua](#set_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + local foo = require "resty.foo" +``` -Nginx variable interpolation is supported in the `` argument string of this directive. But special care must be taken for injection attacks. +then you need to rename the `foo.lua` file to `resty_foo.lua` before compiling it down to a `.o` file with the `luajit` command-line utility. -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. +It is important to use exactly the same version of LuaJIT when compiling `.lua` files to `.o` files as building nginx + ngx_lua. This is because the LuaJIT bytecode format may be incompatible between different LuaJIT versions. When the bytecode format is incompatible, you will see a Lua runtime error saying that the Lua module is not found. -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached -and the Nginx config must be reloaded each time the Lua source file is modified. -The Lua code cache can be temporarily disabled during development by -switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx. +When you have multiple `.lua` files to compile and link, then just specify their `.o` files at the same time in the value of the `--with-ld-opt` option. For instance, -This directive requires the [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit) module. +```bash -[Back to TOC](#table-of-contents) + ./configure --with-ld-opt="/path/to/foo.o /path/to/bar.o" ... +``` -content_by_lua --------------- +If you have just too many `.o` files, then it might not be feasible to name them all in a single command. In this case, you can build a static library (or archive) for your `.o` files, as in -**syntax:** *content_by_lua <lua-script-str>* +```bash -**context:** *location, location if* + ar rcus libmyluafiles.a *.o +``` -**phase:** *content* +then you can link the `myluafiles` archive as a whole to your nginx executable: -Acts as a "content handler" and executes Lua code string specified in `` for every request. -The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). +```bash -Do not use this directive and other content handler directives in the same location. For example, this directive and the [proxy_pass](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass) directive should not be used in the same location. + ./configure \ + --with-ld-opt="-L/path/to/lib -Wl,--whole-archive -lmyluafiles -Wl,--no-whole-archive" +``` + +where `/path/to/lib` is the path of the directory containing the `libmyluafiles.a` file. It should be noted that the linker option `--whole-archive` is required here because otherwise our archive will be skipped because no symbols in our archive are mentioned in the main parts of the nginx executable. [Back to TOC](#table-of-contents) -content_by_lua_file -------------------- +Data Sharing within an Nginx Worker +=================================== -**syntax:** *content_by_lua_file <path-to-lua-script-file>* +To globally share data among all the requests handled by the same nginx worker process, encapsulate the shared data into a Lua module, use the Lua `require` builtin to import the module, and then manipulate the shared data in Lua. This works because required Lua modules are loaded only once and all coroutines will share the same copy of the module (both its code and data). Note however that Lua global variables (note, not module-level variables) WILL NOT persist between requests because of the one-coroutine-per-request isolation design. -**context:** *location, location if* +Here is a complete small example: -**phase:** *content* +```lua -Equivalent to [content_by_lua](#content_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + -- mydata.lua + local _M = {} -Nginx variables can be used in the `` string to provide flexibility. This however carries some risks and is not ordinarily recommended. + local data = { + dog = 3, + cat = 4, + pig = 5, + } -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. + function _M.get_age(name) + return data[name] + end -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached -and the Nginx config must be reloaded each time the Lua source file is modified. -The Lua code cache can be temporarily disabled during development by -switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx. + return _M +``` -[Back to TOC](#table-of-contents) +and then accessing it from `nginx.conf`: -rewrite_by_lua --------------- +```nginx -**syntax:** *rewrite_by_lua <lua-script-str>* + location /lua { + content_by_lua_block { + local mydata = require "mydata" + ngx.say(mydata.get_age("dog")) + } + } +``` -**context:** *http, server, location, location if* +The `mydata` module in this example will only be loaded and run on the first request to the location `/lua`, +and all subsequent requests to the same nginx worker process will use the reloaded instance of the +module as well as the same copy of the data in it, until a `HUP` signal is sent to the Nginx master process to force a reload. +This data sharing technique is essential for high performance Lua applications based on this module. -**phase:** *rewrite tail* +Note that this data sharing is on a *per-worker* basis and not on a *per-server* basis. That is, when there are multiple nginx worker processes under an Nginx master, data sharing cannot cross the process boundary between these workers. -Acts as a rewrite phase handler and executes Lua code string specified in `` for every request. -The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). +It is usually recommended to share read-only data this way. You can also share changeable data among all the concurrent requests of each nginx worker process as +long as there is *no* nonblocking I/O operations (including [ngx.sleep](#ngxsleep)) +in the middle of your calculations. As long as you do not give the +control back to the nginx event loop and ngx_lua's light thread +scheduler (even implicitly), there can never be any race conditions in +between. For this reason, always be very careful when you want to share changeable data on the +worker level. Buggy optimizations can easily lead to hard-to-debug +race conditions under load. -Note that this handler always runs *after* the standard [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html). So the following will work as expected: +If server-wide data sharing is required, then use one or more of the following approaches: -```nginx +1. Use the [ngx.shared.DICT](#ngxshareddict) API provided by this module. +1. Use only a single nginx worker and a single server (this is however not recommended when there is a multi core CPU or multiple CPUs in a single machine). +1. Use data storage mechanisms such as `memcached`, `redis`, `MySQL` or `PostgreSQL`. [The OpenResty bundle](http://openresty.org) associated with this module comes with a set of companion Nginx modules and Lua libraries that provide interfaces with these data storage mechanisms. -location /foo { - set $a 12; # create and initialize $a - set $b ""; # create and initialize $b - rewrite_by_lua 'ngx.var.b = tonumber(ngx.var.a) + 1'; - echo "res = $b"; -} -``` +[Back to TOC](#table-of-contents) -because `set $a 12` and `set $b ""` run *before* [rewrite_by_lua](#rewrite_by_lua). +Known Issues +============ -On the other hand, the following will not work as expected: +[Back to TOC](#table-of-contents) -```nginx +TCP socket connect operation issues +----------------------------------- +The [tcpsock:connect](#tcpsockconnect) method may indicate `success` despite connection failures such as with `Connection Refused` errors. -? location /foo { -? set $a 12; # create and initialize $a -? set $b ''; # create and initialize $b -? rewrite_by_lua 'ngx.var.b = tonumber(ngx.var.a) + 1'; -? if ($b = '13') { -? rewrite ^ /bar redirect; -? break; -? } -? -? echo "res = $b"; -? } -``` +However, later attempts to manipulate the cosocket object will fail and return the actual error status message generated by the failed connect operation. -because `if` runs *before* [rewrite_by_lua](#rewrite_by_lua) even if it is placed after [rewrite_by_lua](#rewrite_by_lua) in the config. +This issue is due to limitations in the Nginx event model and only appears to affect Mac OS X. -The right way of doing this is as follows: +[Back to TOC](#table-of-contents) -```nginx +Lua Coroutine Yielding/Resuming +------------------------------- +* Because Lua's `dofile` and `require` builtins are currently implemented as C functions in both Lua 5.1 and LuaJIT 2.0/2.1, if the Lua file being loaded by `dofile` or `require` invokes [ngx.location.capture*](#ngxlocationcapture), [ngx.exec](#ngxexec), [ngx.exit](#ngxexit), or other API functions requiring yielding in the *top-level* scope of the Lua file, then the Lua error "attempt to yield across C-call boundary" will be raised. To avoid this, put these calls requiring yielding into your own Lua functions in the Lua file instead of the top-level scope of the file. +* As the standard Lua 5.1 interpreter's VM is not fully resumable, the methods [ngx.location.capture](#ngxlocationcapture), [ngx.location.capture_multi](#ngxlocationcapture_multi), [ngx.redirect](#ngxredirect), [ngx.exec](#ngxexec), and [ngx.exit](#ngxexit) cannot be used within the context of a Lua [pcall()](http://www.lua.org/manual/5.1/manual.html#pdf-pcall) or [xpcall()](http://www.lua.org/manual/5.1/manual.html#pdf-xpcall) or even the first line of the `for ... in ...` statement when the standard Lua 5.1 interpreter is used and the `attempt to yield across metamethod/C-call boundary` error will be produced. Please use LuaJIT 2.x, which supports a fully resumable VM, to avoid this. -location /foo { - set $a 12; # create and initialize $a - set $b ''; # create and initialize $b - rewrite_by_lua ' - ngx.var.b = tonumber(ngx.var.a) + 1 - if tonumber(ngx.var.b) == 13 then - return ngx.redirect("/bar"); - end - '; - - echo "res = $b"; -} -``` +[Back to TOC](#table-of-contents) -Note that the [ngx_eval](http://www.grid.net.ru/nginx/eval.en.html) module can be approximated by using [rewrite_by_lua](#rewrite_by_lua). For example, +Lua Variable Scope +------------------ +Care must be taken when importing modules and this form should be used: -```nginx +```lua -location / { - eval $res { - proxy_pass http://foo.com/check-spam; - } - - if ($res = 'spam') { - rewrite ^ /terms-of-use.html redirect; - } - - fastcgi_pass ...; -} + local xxx = require('xxx') ``` -can be implemented in ngx_lua as: +instead of the old deprecated form: -```nginx +```lua -location = /check-spam { - internal; - proxy_pass http://foo.com/check-spam; -} - -location / { - rewrite_by_lua ' - local res = ngx.location.capture("/check-spam") - if res.body == "spam" then - return ngx.redirect("/terms-of-use.html") - end - '; - - fastcgi_pass ...; -} + require('xxx') ``` -Just as any other rewrite phase handlers, [rewrite_by_lua](#rewrite_by_lua) also runs in subrequests. +Here is the reason: by design, the global environment has exactly the same lifetime as the Nginx request handler associated with it. Each request handler has its own set of Lua global variables and that is the idea of request isolation. The Lua module is actually loaded by the first Nginx request handler and is cached by the `require()` built-in in the `package.loaded` table for later reference, and the `module()` builtin used by some Lua modules has the side effect of setting a global variable to the loaded module table. But this global variable will be cleared at the end of the request handler, and every subsequent request handler all has its own (clean) global environment. So one will get Lua exception for accessing the `nil` value. -Note that when calling `ngx.exit(ngx.OK)` within a [rewrite_by_lua](#rewrite_by_lua) handler, the nginx request processing control flow will still continue to the content handler. To terminate the current request from within a [rewrite_by_lua](#rewrite_by_lua) handler, calling [ngx.exit](#ngxexit) with status >= 200 (`ngx.HTTP_OK`) and status < 300 (`ngx.HTTP_SPECIAL_RESPONSE`) for successful quits and `ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)` (or its friends) for failures. +Generally, use of Lua global variables is a really really bad idea in the context of ngx_lua because -If the [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)'s [rewrite](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite) directive is used to change the URI and initiate location re-lookups (internal redirections), then any [rewrite_by_lua](#rewrite_by_lua) or [rewrite_by_lua_file](#rewrite_by_lua_file) code sequences within the current location will not be executed. For example, +1. misuse of Lua globals has very bad side effects for concurrent requests when these variables are actually supposed to be local only, +1. Lua global variables require Lua table look-up in the global environment (which is just a Lua table), which is kinda expensive, and +1. some Lua global variable references are just typos, which are hard to debug. -```nginx +It's *highly* recommended to always declare them via "local" in the scope that is reasonable. -location /foo { - rewrite ^ /bar; - rewrite_by_lua 'ngx.exit(503)'; -} -location /bar { - ... -} -``` +To find out all the uses of Lua global variables in your Lua code, you can run the [lua-releng tool](https://github.com/openresty/nginx-devel-utils/blob/master/lua-releng) across all your .lua source files: -Here the Lua code `ngx.exit(503)` will never run. This will be the case if `rewrite ^ /bar last` is used as this will similarly initiate an internal redirection. If the `break` modifier is used instead, there will be no internal redirection and the `rewrite_by_lua` code will be executed. + $ lua-releng + Checking use of Lua global variables in file lib/foo/bar.lua ... + 1 [1489] SETGLOBAL 7 -1 ; contains + 55 [1506] GETGLOBAL 7 -3 ; setvar + 3 [1545] GETGLOBAL 3 -4 ; varexpand -The `rewrite_by_lua` code will always run at the end of the `rewrite` request-processing phase unless [rewrite_by_lua_no_postpone](#rewrite_by_lua_no_postpone) is turned on. +The output says that the line 1489 of file `lib/foo/bar.lua` writes to a global variable named `contains`, the line 1506 reads from the global variable `setvar`, and line 1545 reads the global `varexpand`. + +This tool will guarantee that local variables in the Lua module functions are all declared with the `local` keyword, otherwise a runtime exception will be thrown. It prevents undesirable race conditions while accessing such variables. See [Data Sharing within an Nginx Worker](#data-sharing-within-an-nginx-worker) for the reasons behind this. [Back to TOC](#table-of-contents) -rewrite_by_lua_file -------------------- +Locations Configured by Subrequest Directives of Other Modules +-------------------------------------------------------------- +The [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi) directives cannot capture locations that include the [add_before_body](http://nginx.org/en/docs/http/ngx_http_addition_module.html#add_before_body), [add_after_body](http://nginx.org/en/docs/http/ngx_http_addition_module.html#add_after_body), [auth_request](http://nginx.org/en/docs/http/ngx_http_auth_request_module.html#auth_request), [echo_location](http://github.com/openresty/echo-nginx-module#echo_location), [echo_location_async](http://github.com/openresty/echo-nginx-module#echo_location_async), [echo_subrequest](http://github.com/openresty/echo-nginx-module#echo_subrequest), or [echo_subrequest_async](http://github.com/openresty/echo-nginx-module#echo_subrequest_async) directives. -**syntax:** *rewrite_by_lua_file <path-to-lua-script-file>* +```nginx -**context:** *http, server, location, location if* + location /foo { + content_by_lua_block { + res = ngx.location.capture("/bar") + } + } + location /bar { + echo_location /blah; + } + location /blah { + echo "Success!"; + } +``` -**phase:** *rewrite tail* +```nginx -Equivalent to [rewrite_by_lua](#rewrite_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + $ curl -i http://example.com/foo +``` -Nginx variables can be used in the `` string to provide flexibility. This however carries some risks and is not ordinarily recommended. +will not work as expected. -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. +[Back to TOC](#table-of-contents) -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached and the Nginx config must be reloaded each time the Lua source file is modified. The Lua code cache can be temporarily disabled during development by switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid reloading Nginx. +Cosockets Not Available Everywhere +---------------------------------- -The `rewrite_by_lua_file` code will always run at the end of the `rewrite` request-processing phase unless [rewrite_by_lua_no_postpone](#rewrite_by_lua_no_postpone) is turned on. +Due the internal limitations in the nginx core, the cosocket API are disabled in the following contexts: [set_by_lua*](#set_by_lua), [log_by_lua*](#log_by_lua), [header_filter_by_lua*](#header_filter_by_lua), and [body_filter_by_lua](#body_filter_by_lua). + +The cosockets are currently also disabled in the [init_by_lua*](#init_by_lua) and [init_worker_by_lua*](#init_worker_by_lua) directive contexts but we may add support for these contexts in the future because there is no limitation in the nginx core (or the limitation might be worked around). + +There exists a work-around, however, when the original context does *not* need to wait for the cosocket results. That is, creating a 0-delay timer via the [ngx.timer.at](#ngxtimerat) API and do the cosocket results in the timer handler, which runs asynchronously as to the original context creating the timer. [Back to TOC](#table-of-contents) -access_by_lua -------------- +Special Escaping Sequences +-------------------------- -**syntax:** *access_by_lua <lua-script-str>* +**WARNING** We no longer suffer from this pitfall since the introduction of the +`*_by_lua_block {}` configuration directives. -**context:** *http, server, location, location if* +PCRE sequences such as `\d`, `\s`, or `\w`, require special attention because in string literals, the backslash character, `\`, is stripped out by both the Lua language parser and by the Nginx config file parser before processing. So the following snippet will not work as expected: -**phase:** *access tail* +```nginx -Acts as an access phase handler and executes Lua code string specified in `` for every request. -The Lua code may make [API calls](#nginx-api-for-lua) and is executed as a new spawned coroutine in an independent global environment (i.e. a sandbox). + # nginx.conf + ? location /test { + ? content_by_lua ' + ? local regex = "\d+" -- THIS IS WRONG!! + ? local m = ngx.re.match("hello, 1234", regex) + ? if m then ngx.say(m[0]) else ngx.say("not matched!") end + ? '; + ? } + # evaluates to "not matched!" +``` -Note that this handler always runs *after* the standard [ngx_http_access_module](http://nginx.org/en/docs/http/ngx_http_access_module.html). So the following will work as expected: +To avoid this, *double* escape the backslash: ```nginx -location / { - deny 192.168.1.1; - allow 192.168.1.0/24; - allow 10.1.1.0/16; - deny all; - - access_by_lua ' - local res = ngx.location.capture("/mysql", { ... }) - ... - '; - - # proxy_pass/fastcgi_pass/... -} + # nginx.conf + location /test { + content_by_lua ' + local regex = "\\\\d+" + local m = ngx.re.match("hello, 1234", regex) + if m then ngx.say(m[0]) else ngx.say("not matched!") end + '; + } + # evaluates to "1234" ``` -That is, if a client IP address is in the blacklist, it will be denied before the MySQL query for more complex authentication is executed by [access_by_lua](#access_by_lua). +Here, `\\\\d+` is stripped down to `\\d+` by the Nginx config file parser and this is further stripped down to `\d+` by the Lua language parser before running. -Note that the [ngx_auth_request](http://mdounin.ru/hg/ngx_http_auth_request_module/) module can be approximated by using [access_by_lua](#access_by_lua): +Alternatively, the regex pattern can be presented as a long-bracketed Lua string literal by encasing it in "long brackets", `[[...]]`, in which case backslashes have to only be escaped once for the Nginx config file parser. ```nginx -location / { - auth_request /auth; - - # proxy_pass/fastcgi_pass/postgres_pass/... -} + # nginx.conf + location /test { + content_by_lua ' + local regex = [[\\d+]] + local m = ngx.re.match("hello, 1234", regex) + if m then ngx.say(m[0]) else ngx.say("not matched!") end + '; + } + # evaluates to "1234" ``` -can be implemented in ngx_lua as: +Here, `[[\\d+]]` is stripped down to `[[\d+]]` by the Nginx config file parser and this is processed correctly. + +Note that a longer from of the long bracket, `[=[...]=]`, may be required if the regex pattern contains `[...]` sequences. +The `[=[...]=]` form may be used as the default form if desired. ```nginx -location / { - access_by_lua ' - local res = ngx.location.capture("/auth") - - if res.status == ngx.HTTP_OK then - return - end - - if res.status == ngx.HTTP_FORBIDDEN then - ngx.exit(res.status) - end - - ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) - '; - - # proxy_pass/fastcgi_pass/postgres_pass/... -} + # nginx.conf + location /test { + content_by_lua ' + local regex = [=[[0-9]+]=] + local m = ngx.re.match("hello, 1234", regex) + if m then ngx.say(m[0]) else ngx.say("not matched!") end + '; + } + # evaluates to "1234" ``` -As with other access phase handlers, [access_by_lua](#access_by_lua) will *not* run in subrequests. +An alternative approach to escaping PCRE sequences is to ensure that Lua code is placed in external script files and executed using the various `*_by_lua_file` directives. +With this approach, the backslashes are only stripped by the Lua language parser and therefore only need to be escaped once each. -Note that when calling `ngx.exit(ngx.OK)` within a [access_by_lua](#access_by_lua) handler, the nginx request processing control flow will still continue to the content handler. To terminate the current request from within a [access_by_lua](#access_by_lua) handler, calling [ngx.exit](#ngxexit) with status >= 200 (`ngx.HTTP_OK`) and status < 300 (`ngx.HTTP_SPECIAL_RESPONSE`) for successful quits and `ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)` (or its friends) for failures. +```lua -[Back to TOC](#table-of-contents) + -- test.lua + local regex = "\\d+" + local m = ngx.re.match("hello, 1234", regex) + if m then ngx.say(m[0]) else ngx.say("not matched!") end + -- evaluates to "1234" +``` -access_by_lua_file ------------------- +Within external script files, PCRE sequences presented as long-bracketed Lua string literals do not require modification. + +```lua -**syntax:** *access_by_lua_file <path-to-lua-script-file>* + -- test.lua + local regex = [[\d+]] + local m = ngx.re.match("hello, 1234", regex) + if m then ngx.say(m[0]) else ngx.say("not matched!") end + -- evaluates to "1234" +``` -**context:** *http, server, location, location if* +[Back to TOC](#table-of-contents) -**phase:** *access tail* +Mixing with SSI Not Supported +----------------------------- -Equivalent to [access_by_lua](#access_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. +Mixing SSI with ngx_lua in the same Nginx request is not supported at all. Just use ngx_lua exclusively. Everything you can do with SSI can be done atop ngx_lua anyway and it can be more efficient when using ngx_lua. -Nginx variables can be used in the `` string to provide flexibility. This however carries some risks and is not ordinarily recommended. +[Back to TOC](#table-of-contents) -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. +SPDY Mode Not Fully Supported +----------------------------- -When the Lua code cache is turned on (by default), the user code is loaded once at the first request and cached -and the Nginx config must be reloaded each time the Lua source file is modified. -The Lua code cache can be temporarily disabled during development by switching [lua_code_cache](#lua_code_cache) `off` in `nginx.conf` to avoid repeatedly reloading Nginx. +Certain Lua APIs provided by ngx_lua do not work in Nginx's SPDY mode yet: [ngx.location.capture](#ngxlocationcapture), [ngx.location.capture_multi](#ngxlocationcapture_multi), and [ngx.req.socket](#ngxreqsocket). [Back to TOC](#table-of-contents) -header_filter_by_lua --------------------- +Missing data on short circuited requests +---------------------------------------- -**syntax:** *header_filter_by_lua <lua-script-str>* +Nginx may terminate a request early with (at least): -**context:** *http, server, location, location if* +* 400 (Bad Request) +* 405 (Not Allowed) +* 408 (Request Timeout) +* 414 (Request URI Too Large) +* 494 (Request Headers Too Large) +* 499 (Client Closed Request) +* 500 (Internal Server Error) +* 501 (Not Implemented) -**phase:** *output-header-filter* +This means that phases that normally run are skipped, such as the rewrite or +access phase. This also means that later phases that are run regardless, e.g. +[log_by_lua](#log_by_lua), will not have access to information that is normally set in those +phases. -Uses Lua code specified in `` to define an output header filter. +[Back to TOC](#table-of-contents) -Note that the following API functions are currently disabled within this context: +TODO +==== -* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) -* Control API functions (e.g., [ngx.exit](#ngxexit) and [ngx.exec](#ngxexec)) -* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) -* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). +* cosocket: implement LuaSocket's unconnected UDP API. +* port this module to the "datagram" subsystem of NGINX for implementing general UDP servers instead of HTTP +servers in Lua. For example, +```lua -Here is an example of overriding a response header (or adding one if absent) in our Lua header filter: + datagram { + server { + listen 1953; + handler_by_lua_block { + -- custom Lua code implementing the special UDP server... + } + } + } +``` +* shm: implement a "shared queue API" to complement the existing [shared dict](#lua_shared_dict) API. +* cosocket: add support in the context of [init_by_lua*](#init_by_lua). +* cosocket: implement the `bind()` method for stream-typed cosockets. +* cosocket: pool-based backend concurrency level control: implement automatic `connect` queueing when the backend concurrency exceeds its connection pool limit. +* cosocket: review and merge aviramc's [patch](https://github.com/openresty/lua-nginx-module/pull/290) for adding the `bsdrecv` method. +* add new API function `ngx.resp.add_header` to emulate the standard `add_header` config directive. +* review and apply Jader H. Silva's patch for `ngx.re.split()`. +* review and apply vadim-pavlov's patch for [ngx.location.capture](#ngxlocationcapture)'s `extra_headers` option +* use `ngx_hash_t` to optimize the built-in header look-up process for [ngx.req.set_header](#ngxreqset_header), [ngx.header.HEADER](#ngxheaderheader), and etc. +* add configure options for different strategies of handling the cosocket connection exceeding in the pools. +* add directives to run Lua codes when nginx stops. +* add `ignore_resp_headers`, `ignore_resp_body`, and `ignore_resp` options to [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi) methods, to allow micro performance tuning on the user side. +* add automatic Lua code time slicing support by yielding and resuming the Lua VM actively via Lua's debug hooks. +* add `stat` mode similar to [mod_lua](https://httpd.apache.org/docs/trunk/mod/mod_lua.html). +* cosocket: add client SSL certificiate support. -```nginx +[Back to TOC](#table-of-contents) -location / { - proxy_pass http://mybackend; - header_filter_by_lua 'ngx.header.Foo = "blah"'; -} -``` +Changes +======= -This directive was first introduced in the `v0.2.1rc20` release. +The changes of every release of this module can be obtained from the OpenResty bundle's change logs: -[Back to TOC](#table-of-contents) + -header_filter_by_lua_file -------------------------- +[Back to TOC](#table-of-contents) -**syntax:** *header_filter_by_lua_file <path-to-lua-script-file>* +Test Suite +========== -**context:** *http, server, location, location if* +The following dependencies are required to run the test suite: -**phase:** *output-header-filter* +* Nginx version >= 1.4.2 -Equivalent to [header_filter_by_lua](#header_filter_by_lua), except that the file specified by `` contains the Lua code, or as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. +* Perl modules: + * Test::Nginx: -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. +* Nginx modules: + * [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit) + * [ngx_set_misc](https://github.com/openresty/set-misc-nginx-module) + * [ngx_auth_request](http://mdounin.ru/files/ngx_http_auth_request_module-0.2.tar.gz) (this is not needed if you're using Nginx 1.5.4+. + * [ngx_echo](https://github.com/openresty/echo-nginx-module) + * [ngx_memc](https://github.com/openresty/memc-nginx-module) + * [ngx_srcache](https://github.com/openresty/srcache-nginx-module) + * ngx_lua (i.e., this module) + * [ngx_lua_upstream](https://github.com/openresty/lua-upstream-nginx-module) + * [ngx_headers_more](https://github.com/openresty/headers-more-nginx-module) + * [ngx_drizzle](https://github.com/openresty/drizzle-nginx-module) + * [ngx_rds_json](https://github.com/openresty/rds-json-nginx-module) + * [ngx_coolkit](https://github.com/FRiCKLE/ngx_coolkit) + * [ngx_redis2](https://github.com/openresty/redis2-nginx-module) -This directive was first introduced in the `v0.2.1rc20` release. +The order in which these modules are added during configuration is important because the position of any filter module in the +filtering chain determines the final output, for example. The correct adding order is shown above. -[Back to TOC](#table-of-contents) +* 3rd-party Lua libraries: + * [lua-cjson](http://www.kyne.com.au/~mark/software/lua-cjson.php) -body_filter_by_lua ------------------- +* Applications: + * mysql: create database 'ngx_test', grant all privileges to user 'ngx_test', password is 'ngx_test' + * memcached: listening on the default port, 11211. + * redis: listening on the default port, 6379. -**syntax:** *body_filter_by_lua <lua-script-str>* +See also the [developer build script](https://github.com/openresty/lua-nginx-module/blob/master/util/build.sh) for more details on setting up the testing environment. -**context:** *http, server, location, location if* +To run the whole test suite in the default testing mode: -**phase:** *output-body-filter* + cd /path/to/lua-nginx-module + export PATH=/path/to/your/nginx/sbin:$PATH + prove -I/path/to/test-nginx/lib -r t -Uses Lua code specified in `` to define an output body filter. -The input data chunk is passed via [ngx.arg](#ngxarg)[1] (as a Lua string value) and the "eof" flag indicating the end of the response body data stream is passed via [ngx.arg](#ngxarg)[2] (as a Lua boolean value). +To run specific test files: -Behind the scene, the "eof" flag is just the `last_buf` (for main requests) or `last_in_chain` (for subrequests) flag of the Nginx chain link buffers. (Before the `v0.7.14` release, the "eof" flag does not work at all in subrequests.) + cd /path/to/lua-nginx-module + export PATH=/path/to/your/nginx/sbin:$PATH + prove -I/path/to/test-nginx/lib t/002-content.t t/003-errors.t -The output data stream can be aborted immediately by running the following Lua statement: -```lua +To run a specific test block in a particular test file, add the line `--- ONLY` to the test block you want to run, and then use the `prove` utility to run that `.t` file. -return ngx.ERROR -``` +There are also various testing modes based on mockeagain, valgrind, and etc. Refer to the [Test::Nginx documentation](http://search.cpan.org/perldoc?Test::Nginx) for more details for various advanced testing modes. See also the test reports for the Nginx test cluster running on Amazon EC2: . -This will truncate the response body and usually result in incomplete and also invalid responses. +[Back to TOC](#table-of-contents) -The Lua code can pass its own modified version of the input data chunk to the downstream Nginx output body filters by overriding [ngx.arg](#ngxarg)[1] with a Lua string or a Lua table of strings. For example, to transform all the lowercase letters in the response body, we can just write: +Copyright and License +===================== -```nginx +This module is licensed under the BSD license. -location / { - proxy_pass http://mybackend; - body_filter_by_lua 'ngx.arg[1] = string.upper(ngx.arg[1])'; -} -``` +Copyright (C) 2009-2016, by Xiaozhe Wang (chaoslawful) . -When setting `nil` or an empty Lua string value to `ngx.arg[1]`, no data chunk will be passed to the downstream Nginx output filters at all. +Copyright (C) 2009-2016, by Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. -Likewise, new "eof" flag can also be specified by setting a boolean value to [ngx.arg](#ngxarg)[2]. For example, +All rights reserved. -```nginx +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -location /t { - echo hello world; - echo hiya globe; +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - body_filter_by_lua ' - local chunk = ngx.arg[1] - if string.match(chunk, "hello") then - ngx.arg[2] = true -- new eof - return - end +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -- just throw away any remaining chunk data - ngx.arg[1] = nil - '; -} -``` +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Then `GET /t` will just return the output +[Back to TOC](#table-of-contents) +See Also +======== - hello world +* [ngx_stream_lua_module](https://github.com/openresty/stream-lua-nginx-module#readme) for an official port of this module for the NGINX "stream" subsystem (doing generic downstream TCP communications). +* [lua-resty-memcached](https://github.com/openresty/lua-resty-memcached) library based on ngx_lua cosocket. +* [lua-resty-redis](https://github.com/openresty/lua-resty-redis) library based on ngx_lua cosocket. +* [lua-resty-mysql](https://github.com/openresty/lua-resty-mysql) library based on ngx_lua cosocket. +* [lua-resty-upload](https://github.com/openresty/lua-resty-upload) library based on ngx_lua cosocket. +* [lua-resty-dns](https://github.com/openresty/lua-resty-dns) library based on ngx_lua cosocket. +* [lua-resty-websocket](https://github.com/openresty/lua-resty-websocket) library for both WebSocket server and client, based on ngx_lua cosocket. +* [lua-resty-string](https://github.com/openresty/lua-resty-string) library based on [LuaJIT FFI](http://luajit.org/ext_ffi.html). +* [lua-resty-lock](https://github.com/openresty/lua-resty-lock) library for a nonblocking simple lock API. +* [lua-resty-cookie](https://github.com/cloudflare/lua-resty-cookie) library for HTTP cookie manipulation. +* [Routing requests to different MySQL queries based on URI arguments](http://openresty.org/#RoutingMySQLQueriesBasedOnURIArgs) +* [Dynamic Routing Based on Redis and Lua](http://openresty.org/#DynamicRoutingBasedOnRedis) +* [Using LuaRocks with ngx_lua](http://openresty.org/#UsingLuaRocks) +* [Introduction to ngx_lua](https://github.com/openresty/lua-nginx-module/wiki/Introduction) +* [ngx_devel_kit](https://github.com/simpl/ngx_devel_kit) +* [echo-nginx-module](http://github.com/openresty/echo-nginx-module) +* [drizzle-nginx-module](http://github.com/openresty/drizzle-nginx-module) +* [postgres-nginx-module](https://github.com/FRiCKLE/ngx_postgres) +* [memc-nginx-module](http://github.com/openresty/memc-nginx-module) +* [The OpenResty bundle](http://openresty.org) +* [Nginx Systemtap Toolkit](https://github.com/openresty/nginx-systemtap-toolkit) +[Back to TOC](#table-of-contents) -That is, when the body filter sees a chunk containing the word "hello", then it will set the "eof" flag to true immediately, resulting in truncated but still valid responses. +Directives +========== -When the Lua code may change the length of the response body, then it is required to always clear out the `Content-Length` response header (if any) in a header filter to enforce streaming output, as in +* [lua_use_default_type](#lua_use_default_type) +* [lua_malloc_trim](#lua_malloc_trim) +* [lua_code_cache](#lua_code_cache) +* [lua_regex_cache_max_entries](#lua_regex_cache_max_entries) +* [lua_regex_match_limit](#lua_regex_match_limit) +* [lua_package_path](#lua_package_path) +* [lua_package_cpath](#lua_package_cpath) +* [init_by_lua](#init_by_lua) +* [init_by_lua_block](#init_by_lua_block) +* [init_by_lua_file](#init_by_lua_file) +* [init_worker_by_lua](#init_worker_by_lua) +* [init_worker_by_lua_block](#init_worker_by_lua_block) +* [init_worker_by_lua_file](#init_worker_by_lua_file) +* [set_by_lua](#set_by_lua) +* [set_by_lua_block](#set_by_lua_block) +* [set_by_lua_file](#set_by_lua_file) +* [content_by_lua](#content_by_lua) +* [content_by_lua_block](#content_by_lua_block) +* [content_by_lua_file](#content_by_lua_file) +* [rewrite_by_lua](#rewrite_by_lua) +* [rewrite_by_lua_block](#rewrite_by_lua_block) +* [rewrite_by_lua_file](#rewrite_by_lua_file) +* [access_by_lua](#access_by_lua) +* [access_by_lua_block](#access_by_lua_block) +* [access_by_lua_file](#access_by_lua_file) +* [header_filter_by_lua](#header_filter_by_lua) +* [header_filter_by_lua_block](#header_filter_by_lua_block) +* [header_filter_by_lua_file](#header_filter_by_lua_file) +* [body_filter_by_lua](#body_filter_by_lua) +* [body_filter_by_lua_block](#body_filter_by_lua_block) +* [body_filter_by_lua_file](#body_filter_by_lua_file) +* [log_by_lua](#log_by_lua) +* [log_by_lua_block](#log_by_lua_block) +* [log_by_lua_file](#log_by_lua_file) +* [balancer_by_lua_block](#balancer_by_lua_block) +* [balancer_by_lua_file](#balancer_by_lua_file) +* [lua_need_request_body](#lua_need_request_body) +* [ssl_certificate_by_lua_block](#ssl_certificate_by_lua_block) +* [ssl_certificate_by_lua_file](#ssl_certificate_by_lua_file) +* [ssl_session_fetch_by_lua_block](#ssl_session_fetch_by_lua_block) +* [ssl_session_fetch_by_lua_file](#ssl_session_fetch_by_lua_file) +* [ssl_session_store_by_lua_block](#ssl_session_store_by_lua_block) +* [ssl_session_store_by_lua_file](#ssl_session_store_by_lua_file) +* [lua_shared_dict](#lua_shared_dict) +* [lua_socket_connect_timeout](#lua_socket_connect_timeout) +* [lua_socket_send_timeout](#lua_socket_send_timeout) +* [lua_socket_send_lowat](#lua_socket_send_lowat) +* [lua_socket_read_timeout](#lua_socket_read_timeout) +* [lua_socket_buffer_size](#lua_socket_buffer_size) +* [lua_socket_pool_size](#lua_socket_pool_size) +* [lua_socket_keepalive_timeout](#lua_socket_keepalive_timeout) +* [lua_socket_log_errors](#lua_socket_log_errors) +* [lua_ssl_ciphers](#lua_ssl_ciphers) +* [lua_ssl_crl](#lua_ssl_crl) +* [lua_ssl_protocols](#lua_ssl_protocols) +* [lua_ssl_trusted_certificate](#lua_ssl_trusted_certificate) +* [lua_ssl_verify_depth](#lua_ssl_verify_depth) +* [lua_http10_buffering](#lua_http10_buffering) +* [rewrite_by_lua_no_postpone](#rewrite_by_lua_no_postpone) +* [access_by_lua_no_postpone](#access_by_lua_no_postpone) +* [lua_transform_underscores_in_response_headers](#lua_transform_underscores_in_response_headers) +* [lua_check_client_abort](#lua_check_client_abort) +* [lua_max_pending_timers](#lua_max_pending_timers) +* [lua_max_running_timers](#lua_max_running_timers) + + +The basic building blocks of scripting Nginx with Lua are directives. Directives are used to specify when the user Lua code is run and +how the result will be used. Below is a diagram showing the order in which directives are executed. + +![Lua Nginx Modules Directives](https://cloud.githubusercontent.com/assets/2137369/15272097/77d1c09e-1a37-11e6-97ef-d9767035fc3e.png) -```nginx +[Back to TOC](#table-of-contents) -location /foo { - # fastcgi_pass/proxy_pass/... +lua_use_default_type +-------------------- +**syntax:** *lua_use_default_type on | off* - header_filter_by_lua 'ngx.header.content_length = nil'; - body_filter_by_lua 'ngx.arg[1] = string.len(ngx.arg[1]) .. "\\n"'; -} -``` +**default:** *lua_use_default_type on* -Note that the following API functions are currently disabled within this context: +**context:** *http, server, location, location if* -* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) -* Control API functions (e.g., [ngx.exit](#ngxexit) and [ngx.exec](#ngxexec)) -* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) -* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). +Specifies whether to use the MIME type specified by the [default_type](http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type) directive for the default value of the `Content-Type` response header. If you do not want a default `Content-Type` response header for your Lua request handlers, then turn this directive off. -Nginx output filters may be called multiple times for a single request because response body may be delivered in chunks. Thus, the Lua code specified by in this directive may also run multiple times in the lifetime of a single HTTP request. +This directive is turned on by default. -This directive was first introduced in the `v0.5.0rc32` release. +This directive was first introduced in the `v0.9.1` release. -[Back to TOC](#table-of-contents) +[Back to TOC](#directives) -body_filter_by_lua_file ------------------------ +lua_malloc_trim +--------------- +**syntax:** *lua_malloc_trim <request-count>* -**syntax:** *body_filter_by_lua_file <path-to-lua-script-file>* +**default:** *lua_malloc_trim 1000* -**context:** *http, server, location, location if* +**context:** *http* -**phase:** *output-body-filter* +Asks the underlying `libc` runtime library to release its cached free memory back to the operating system every +`N` requests processed by the NGINX core. By default, `N` is 1000. You can configure the request count +by using your own numbers. Smaller numbers mean more frequent releases, which may introduce higher CPU time consumption and +smaller memory footprint while larger numbers usually lead to less CPU time overhead and relatively larger memory footprint. +Just tune the number for your own use cases. -Equivalent to [body_filter_by_lua](#body_filter_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. +Configuring the argument to `0` essentially turns off the periodical memory trimming altogether. -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. +```nginx -This directive was first introduced in the `v0.5.0rc32` release. + lua_malloc_trim 0; # turn off trimming completely +``` -[Back to TOC](#table-of-contents) +The current implementation uses an NGINX log phase handler to do the request counting. So the appearance of the +[log_subrequest on](http://nginx.org/en/docs/http/ngx_http_core_module.html#log_subrequest) directives in `nginx.conf` +may make the counting faster when subrequests are involved. By default, only "main requests" count. -log_by_lua ----------- +Note that this directive does *not* affect the memory allocated by LuaJIT's own allocator based on the `mmap` +system call. -**syntax:** *log_by_lua <lua-script-str>* +This directive was first introduced in the `v0.10.7` release. -**context:** *http, server, location, location if* +[Back to TOC](#directives) -**phase:** *log* +lua_code_cache +-------------- +**syntax:** *lua_code_cache on | off* -Run the Lua source code inlined as the `` at the `log` request processing phase. This does not replace the current access logs, but runs after. +**default:** *lua_code_cache on* -Note that the following API functions are currently disabled within this context: +**context:** *http, server, location, location if* -* Output API functions (e.g., [ngx.say](#ngxsay) and [ngx.send_headers](#ngxsend_headers)) -* Control API functions (e.g., [ngx.exit](#ngxexit)) -* Subrequest API functions (e.g., [ngx.location.capture](#ngxlocationcapture) and [ngx.location.capture_multi](#ngxlocationcapture_multi)) -* Cosocket API functions (e.g., [ngx.socket.tcp](#ngxsockettcp) and [ngx.req.socket](#ngxreqsocket)). +Enables or disables the Lua code cache for Lua code in `*_by_lua_file` directives (like [set_by_lua_file](#set_by_lua_file) and +[content_by_lua_file](#content_by_lua_file)) and Lua modules. -Here is an example of gathering average data for [$upstream_response_time](http://nginx.org/en/docs/http/ngx_http_upstream_module.html#var_upstream_response_time): +When turning off, every request served by ngx_lua will run in a separate Lua VM instance, starting from the `0.9.3` release. So the Lua files referenced in [set_by_lua_file](#set_by_lua_file), +[content_by_lua_file](#content_by_lua_file), [access_by_lua_file](#access_by_lua_file), +and etc will not be cached +and all Lua modules used will be loaded from scratch. With this in place, developers can adopt an edit-and-refresh approach. -```nginx +Please note however, that Lua code written inlined within nginx.conf +such as those specified by [set_by_lua](#set_by_lua), [content_by_lua](#content_by_lua), +[access_by_lua](#access_by_lua), and [rewrite_by_lua](#rewrite_by_lua) will not be updated when you edit the inlined Lua code in your `nginx.conf` file because only the Nginx config file parser can correctly parse the `nginx.conf` +file and the only way is to reload the config file +by sending a `HUP` signal or just to restart Nginx. -lua_shared_dict log_dict 5M; +Even when the code cache is enabled, Lua files which are loaded by `dofile` or `loadfile` +in *_by_lua_file cannot be cached (unless you cache the results yourself). Usually you can either use the [init_by_lua](#init_by_lua) +or [init_by_lua_file](#init-by_lua_file) directives to load all such files or just make these Lua files true Lua modules +and load them via `require`. -server { - location / { - proxy_pass http://mybackend; +The ngx_lua module does not support the `stat` mode available with the +Apache `mod_lua` module (yet). - log_by_lua ' - local log_dict = ngx.shared.log_dict - local upstream_time = tonumber(ngx.var.upstream_response_time) +Disabling the Lua code cache is strongly +discouraged for production use and should only be used during +development as it has a significant negative impact on overall performance. For example, the performance a "hello world" Lua example can drop by an order of magnitude after disabling the Lua code cache. - local sum = log_dict:get("upstream_time-sum") or 0 - sum = sum + upstream_time - log_dict:set("upstream_time-sum", sum) +[Back to TOC](#directives) - local newval, err = log_dict:incr("upstream_time-nb", 1) - if not newval and err == "not found" then - log_dict:add("upstream_time-nb", 0) - log_dict:incr("upstream_time-nb", 1) - end - '; - } - - location = /status { - content_by_lua ' - local log_dict = ngx.shared.log_dict - local sum = log_dict:get("upstream_time-sum") - local nb = log_dict:get("upstream_time-nb") - - if nb and sum then - ngx.say("average upstream response time: ", sum / nb, - " (", nb, " reqs)") - else - ngx.say("no data yet") - end - '; - } -} -``` +lua_regex_cache_max_entries +--------------------------- +**syntax:** *lua_regex_cache_max_entries <num>* -This directive was first introduced in the `v0.5.0rc31` release. +**default:** *lua_regex_cache_max_entries 1024* -[Back to TOC](#table-of-contents) +**context:** *http* -log_by_lua_file ---------------- +Specifies the maximum number of entries allowed in the worker process level compiled regex cache. -**syntax:** *log_by_lua_file <path-to-lua-script-file>* +The regular expressions used in [ngx.re.match](#ngxrematch), [ngx.re.gmatch](#ngxregmatch), [ngx.re.sub](#ngxresub), and [ngx.re.gsub](#ngxregsub) will be cached within this cache if the regex option `o` (i.e., compile-once flag) is specified. -**context:** *http, server, location, location if* +The default number of entries allowed is 1024 and when this limit is reached, new regular expressions will not be cached (as if the `o` option was not specified) and there will be one, and only one, warning in the `error.log` file: -**phase:** *log* -Equivalent to [log_by_lua](#log_by_lua), except that the file specified by `` contains the Lua code, or, as from the `v0.5.0rc32` release, the [Lua/LuaJIT bytecode](#lualuajit-bytecode-support) to be executed. + 2011/08/27 23:18:26 [warn] 31997#0: *1 lua exceeding regex cache max entries (1024), ... -When a relative path like `foo/bar.lua` is given, they will be turned into the absolute path relative to the `server prefix` path determined by the `-p PATH` command-line option while starting the Nginx server. -This directive was first introduced in the `v0.5.0rc31` release. +Do not activate the `o` option for regular expressions (and/or `replace` string arguments for [ngx.re.sub](#ngxresub) and [ngx.re.gsub](#ngxregsub)) that are generated *on the fly* and give rise to infinite variations to avoid hitting the specified limit. -[Back to TOC](#table-of-contents) +[Back to TOC](#directives) -lua_need_request_body +lua_regex_match_limit --------------------- +**syntax:** *lua_regex_match_limit <num>* -**syntax:** *lua_need_request_body <on|off>* +**default:** *lua_regex_match_limit 0* -**default:** *off* +**context:** *http* -**context:** *main | server | location* +Specifies the "match limit" used by the PCRE library when executing the [ngx.re API](#ngxrematch). To quote the PCRE manpage, "the limit ... has the effect of limiting the amount of backtracking that can take place." -**phase:** *depends on usage* +When the limit is hit, the error string "pcre_exec() failed: -8" will be returned by the [ngx.re API](#ngxrematch) functions on the Lua land. -Determines whether to force the request body data to be read before running rewrite/access/access_by_lua* or not. The Nginx core does not read the client request body by default and if request body data is required, then this directive should be turned `on` or the [ngx.req.read_body](#ngxreqread_body) function should be called within the Lua code. +When setting the limit to 0, the default "match limit" when compiling the PCRE library is used. And this is the default value of this directive. -To read the request body data within the [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) variable, -[client_body_buffer_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size) must have the same value as [client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size). Because when the content length exceeds [client_body_buffer_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size) but less than [client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size), Nginx will buffer the data into a temporary file on the disk, which will lead to empty value in the [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) variable. +This directive was first introduced in the `v0.8.5` release. -If the current location includes [rewrite_by_lua](#rewrite_by_lua) or [rewrite_by_lua_file](#rewrite_by_lua_file) directives, -then the request body will be read just before the [rewrite_by_lua](#rewrite_by_lua) or [rewrite_by_lua_file](#rewrite_by_lua_file) code is run (and also at the -`rewrite` phase). Similarly, if only [content_by_lua](#content_by_lua) is specified, -the request body will not be read until the content handler's Lua code is -about to run (i.e., the request body will be read during the content phase). +[Back to TOC](#directives) -It is recommended however, to use the [ngx.req.read_body](#ngxreqread_body) and [ngx.req.discard_body](#ngxreqdiscard_body) functions for finer control over the request body reading process instead. +lua_package_path +---------------- -This also applies to [access_by_lua](#access_by_lua) and [access_by_lua_file](#access_by_lua_file). +**syntax:** *lua_package_path <lua-style-path-str>* -[Back to TOC](#table-of-contents) +**default:** *The content of LUA_PATH environment variable or Lua's compiled-in defaults.* -lua_shared_dict ---------------- +**context:** *http* -**syntax:** *lua_shared_dict <name> <size>* +Sets the Lua module search path used by scripts specified by [set_by_lua](#set_by_lua), +[content_by_lua](#content_by_lua) and others. The path string is in standard Lua path form, and `;;` +can be used to stand for the original search paths. -**default:** *no* +As from the `v0.5.0rc29` release, the special notation `$prefix` or `${prefix}` can be used in the search path string to indicate the path of the `server prefix` usually determined by the `-p PATH` command-line option while starting the Nginx server. -**context:** *http* +[Back to TOC](#directives) -**phase:** *depends on usage* +lua_package_cpath +----------------- -Declares a shared memory zone, ``, to serve as storage for the shm based Lua dictionary `ngx.shared.`. +**syntax:** *lua_package_cpath <lua-style-cpath-str>* -The `` argument accepts size units such as `k` and `m`: +**default:** *The content of LUA_CPATH environment variable or Lua's compiled-in defaults.* -```nginx +**context:** *http* -http { - lua_shared_dict dogs 10m; - ... -} -``` +Sets the Lua C-module search path used by scripts specified by [set_by_lua](#set_by_lua), +[content_by_lua](#content_by_lua) and others. The cpath string is in standard Lua cpath form, and `;;` +can be used to stand for the original cpath. -See [ngx.shared.DICT](#ngxshareddict) for details. +As from the `v0.5.0rc29` release, the special notation `$prefix` or `${prefix}` can be used in the search path string to indicate the path of the `server prefix` usually determined by the `-p PATH` command-line option while starting the Nginx server. -This directive was first introduced in the `v0.3.1rc22` release. +[Back to TOC](#directives) -[Back to TOC](#table-of-contents) +init_by_lua +----------- -lua_socket_connect_timeout --------------------------- +**syntax:** *init_by_lua <lua-script-str>* -**syntax:** *lua_socket_connect_timeout <time>* +**context:** *http* -**default:** *lua_socket_connect_timeout 60s* +**phase:** *loading-config* -**context:** *http, server, location* +**WARNING** Since the `v0.9.17` release, use of this directive is *discouraged*; +use the new [init_by_lua_block](#init_by_lua_block) directive instead. -This directive controls the default timeout value used in TCP/unix-domain socket object's [connect](#tcpsockconnect) method and can be overridden by the [settimeout](#tcpsocksettimeout) method. +Runs the Lua code specified by the argument `` on the global Lua VM level when the Nginx master process (if any) is loading the Nginx config file. -The `