nginx: add patches to lua modules for experimental PCRE2 support
Add patches to lua modules for experimental PCRE2 support. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
parent
fa1001268c
commit
6bba36078e
|
@ -0,0 +1,389 @@
|
|||
From f72675beb5835b4ac31d7476de1580be767209d8 Mon Sep 17 00:00:00 2001
|
||||
From: swananan <jt26wzz@gmail.com>
|
||||
Date: Thu, 31 Aug 2023 00:12:07 +0800
|
||||
Subject: [PATCH] feature: support pcre2
|
||||
|
||||
---
|
||||
.travis.yml | 26 +++++++++++++-----------
|
||||
lib/resty/core/regex.lua | 43 ++++++++++++++++++++++++++++++----------
|
||||
t/re-base.t | 25 +++++++++++++++++------
|
||||
t/re-gmatch.t | 10 +++++++---
|
||||
t/re-match.t | 7 +++++--
|
||||
t/re-opt.t | 9 +++++++--
|
||||
t/stream/re-base.t | 27 +++++++++++++++++++------
|
||||
t/stream/re-gmatch.t | 10 +++++++---
|
||||
t/stream/re-match.t | 7 +++++--
|
||||
t/stream/re-opt.t | 9 +++++++--
|
||||
10 files changed, 125 insertions(+), 48 deletions(-)
|
||||
|
||||
--- a/nginx-mod-lua-resty-core/.travis.yml
|
||||
+++ b/nginx-mod-lua-resty-core/.travis.yml
|
||||
@@ -34,9 +34,13 @@ env:
|
||||
- LUA_INCLUDE_DIR=$LUAJIT_INC
|
||||
- LUA_CMODULE_DIR=/lib
|
||||
- PCRE_VER=8.45
|
||||
+ - PCRE2_VER=10.37
|
||||
- PCRE_PREFIX=/opt/pcre
|
||||
+ - PCRE2_PREFIX=/opt/pcre2
|
||||
- PCRE_LIB=$PCRE_PREFIX/lib
|
||||
+ - PCRE2_LIB=$PCRE2_PREFIX/lib
|
||||
- PCRE_INC=$PCRE_PREFIX/include
|
||||
+ - PCRE2_INC=$PCRE2_PREFIX/include
|
||||
- OPENSSL_PREFIX=/opt/ssl
|
||||
- OPENSSL_LIB=$OPENSSL_PREFIX/lib
|
||||
- OPENSSL_INC=$OPENSSL_PREFIX/include
|
||||
@@ -45,7 +49,7 @@ env:
|
||||
- TEST_NGINX_RANDOMIZE=1
|
||||
- LUACHECK_VER=0.21.1
|
||||
matrix:
|
||||
- - NGINX_VERSION=1.25.1 OPENSSL_VER=1.1.1u OPENSSL_PATCH_VER=1.1.1f
|
||||
+ - NGINX_VERSION=1.25.1 OPENSSL_VER=1.1.1u OPENSSL_PATCH_VER=1.1.1f USE_PCRE2=Y
|
||||
- NGINX_VERSION=1.21.4 OPENSSL_VER=1.1.1u OPENSSL_PATCH_VER=1.1.1f
|
||||
|
||||
services:
|
||||
@@ -61,11 +65,12 @@ before_install:
|
||||
install:
|
||||
- if [ ! -d download-cache ]; then mkdir download-cache; fi
|
||||
- if [ ! -f download-cache/openssl-$OPENSSL_VER.tar.gz ]; then wget -P download-cache https://www.openssl.org/source/openssl-$OPENSSL_VER.tar.gz || wget -P download-cache https://www.openssl.org/source/old/${OPENSSL_VER//[a-z]/}/openssl-$OPENSSL_VER.tar.gz; fi
|
||||
- - if [ ! -f download-cache/pcre-$PCRE_VER.tar.gz ]; then wget -P download-cache http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-$PCRE_VER.tar.gz; fi
|
||||
+ - if [ "$USE_PCRE2" != "Y" ] && [ ! -f download-cache/pcre-$PCRE_VER.tar.gz ]; then wget -P download-cache http://ftp.cs.stanford.edu/pub/exim/pcre/pcre-$PCRE_VER.tar.gz; fi
|
||||
+ - if [ "$USE_PCRE2" = "Y" ] && [ ! -f download-cache/pcre2-$PCRE2_VER.tar.gz ]; then wget -P download-cache https://downloads.sourceforge.net/project/pcre/pcre2/${PCRE2_VER}/pcre2-${PCRE2_VER}.tar.gz; fi
|
||||
- git clone https://github.com/openresty/openresty.git ../openresty
|
||||
- git clone https://github.com/openresty/openresty-devel-utils.git
|
||||
- git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module
|
||||
- - git clone https://github.com/openresty/lua-nginx-module.git ../lua-nginx-module
|
||||
+ - git clone https://github.com/swananan/lua-nginx-module.git -b support_pcre2 ../lua-nginx-module
|
||||
- git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx
|
||||
- git clone https://github.com/openresty/echo-nginx-module.git ../echo-nginx-module
|
||||
- git clone https://github.com/openresty/lua-resty-lrucache.git
|
||||
@@ -73,8 +78,8 @@ install:
|
||||
- git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git luajit2
|
||||
- git clone https://github.com/openresty/set-misc-nginx-module.git ../set-misc-nginx-module
|
||||
- git clone https://github.com/openresty/mockeagain.git
|
||||
- - git clone https://github.com/openresty/test-nginx.git
|
||||
- - git clone https://github.com/openresty/stream-lua-nginx-module.git ../stream-lua-nginx-module
|
||||
+ - git clone https://github.com/swananan/test-nginx.git -b support_pcre2
|
||||
+ - git clone https://github.com/swananan/stream-lua-nginx-module.git -b support_pcre2 ../stream-lua-nginx-module
|
||||
|
||||
script:
|
||||
- cd luajit2/
|
||||
@@ -89,12 +94,8 @@ script:
|
||||
- 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 ../mockeagain/ && make CC=$CC -j$JOBS && 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 ..
|
||||
+ - if [ "$USE_PCRE2" != "Y" ]; then 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 ..; fi
|
||||
+ - if [ "$USE_PCRE2" = "Y" ]; then tar zxf download-cache/pcre2-$PCRE2_VER.tar.gz; cd pcre2-$PCRE2_VER/; ./configure --prefix=$PCRE2_PREFIX --enable-jit --enable-utf > 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 ..; fi
|
||||
- export PATH=$PWD/work/nginx/sbin:$PWD/openresty-devel-utils:$PATH
|
||||
- export LD_PRELOAD=$PWD/mockeagain/mockeagain.so
|
||||
- export LD_LIBRARY_PATH=$PWD/mockeagain:$LD_LIBRARY_PATH
|
||||
@@ -104,7 +105,8 @@ script:
|
||||
- export disable_pcre2=--without-pcre2
|
||||
- answer=`util/ver-ge "$NGINX_VERSION" 1.25.1`
|
||||
- if [ "$OPENSSL_VER" = "1.1.0l" ] || [ "$answer" = "N" ]; then add_http3_module=""; fi
|
||||
- - if [ "$answer" = "N" ]; then disable_pcre2=""; fi
|
||||
+ - if [ "$answer" = "N" ] || [ "$USE_PCRE2" = "Y" ]; then disable_pcre2=""; fi
|
||||
+ - if [ "$USE_PCRE2" = "Y" ]; then PCRE_INC=$PCRE2_INC; PCRE_LIB=$PCRE2_LIB; fi
|
||||
- ngx-build $NGINX_VERSION --with-ipv6 $disable_pcre2 $add_http3_module --with-http_realip_module --with-http_ssl_module --with-pcre-jit --with-cc-opt="-I$OPENSSL_INC -I$PCRE_INC" --with-ld-opt="-L$OPENSSL_LIB -Wl,-rpath,$OPENSSL_LIB -L$PCRE_LIB -Wl,-rpath,$PCRE_LIB" --add-module=../ndk-nginx-module --add-module=../echo-nginx-module --add-module=../set-misc-nginx-module --add-module=../headers-more-nginx-module --add-module=../lua-nginx-module --with-debug --with-stream_ssl_module --with-stream --with-ipv6 --add-module=../stream-lua-nginx-module > build.log 2>&1 || (cat build.log && exit 1)
|
||||
- nginx -V
|
||||
- ldd `which nginx`|grep -E 'luajit|ssl|pcre'
|
||||
--- a/nginx-mod-lua-resty-core/lib/resty/core/regex.lua
|
||||
+++ b/nginx-mod-lua-resty-core/lib/resty/core/regex.lua
|
||||
@@ -82,7 +82,7 @@ if not pcall(function() pcre_ver = ffi_s
|
||||
end
|
||||
|
||||
|
||||
-local MAX_ERR_MSG_LEN = 128
|
||||
+local MAX_ERR_MSG_LEN = 256
|
||||
|
||||
|
||||
local FLAG_COMPILE_ONCE = 0x01
|
||||
@@ -102,6 +102,7 @@ local PCRE_DUPNAMES = 0x0080000
|
||||
local PCRE_JAVASCRIPT_COMPAT = 0x2000000
|
||||
|
||||
|
||||
+-- PCRE2_ERROR_NOMATCH uses the same value
|
||||
local PCRE_ERROR_NOMATCH = -1
|
||||
|
||||
|
||||
@@ -135,22 +136,44 @@ local ngx_lua_ffi_script_eval_data
|
||||
-- TODO: improve this workaround when PCRE allows for unspecifying the MAP_JIT
|
||||
-- option.
|
||||
local no_jit_in_init
|
||||
+local pcre_ver_num
|
||||
|
||||
-if jit.os == "OSX" then
|
||||
- local maj, min = string.match(pcre_ver, "^(%d+)%.(%d+)")
|
||||
- if maj and min then
|
||||
- local pcre_ver_num = tonumber(maj .. min)
|
||||
-
|
||||
- if pcre_ver_num >= 843 then
|
||||
- no_jit_in_init = true
|
||||
- end
|
||||
+local maj, min = string.match(pcre_ver, "^(%d+)%.(%d+)")
|
||||
+if maj and min then
|
||||
+ pcre_ver_num = tonumber(maj .. min)
|
||||
+end
|
||||
|
||||
- else
|
||||
+if jit.os == "OSX" then
|
||||
+ if pcre_ver_num == nil then
|
||||
-- assume this version is faulty as well
|
||||
no_jit_in_init = true
|
||||
+
|
||||
+ -- PCRE2 is also subject to this issue on macOS
|
||||
+ elseif pcre_ver_num >= 843 then
|
||||
+ no_jit_in_init = true
|
||||
end
|
||||
end
|
||||
|
||||
+-- pcre2
|
||||
+if pcre_ver_num > 845 then
|
||||
+ -- option
|
||||
+ PCRE_CASELESS = 0x00000008
|
||||
+ PCRE_MULTILINE = 0x00000400
|
||||
+ PCRE_DOTALL = 0x00000020
|
||||
+ PCRE_EXTENDED = 0x00000080
|
||||
+ PCRE_ANCHORED = 0x80000000
|
||||
+ PCRE_UTF8 = 0x00080000
|
||||
+ PCRE_DUPNAMES = 0x00000040
|
||||
+ -- In the pcre2, The PCRE_JAVASCRIPT_COMPAT option has been split into
|
||||
+ -- independent functional options PCRE2_ALT_BSUX, PCRE2_ALLOW_EMPTY_CLASS,
|
||||
+ -- and PCRE2_MATCH_UNSET_BACKREF.
|
||||
+ local PCRE2_ALT_BSUX = 0x00000002
|
||||
+ local PCRE2_ALLOW_EMPTY_CLASS = 0x00000001
|
||||
+ local PCRE2_MATCH_UNSET_BACKREF = 0x00000200
|
||||
+ PCRE_JAVASCRIPT_COMPAT = bor(PCRE2_ALT_BSUX, PCRE2_ALLOW_EMPTY_CLASS)
|
||||
+ PCRE_JAVASCRIPT_COMPAT = bor(PCRE2_MATCH_UNSET_BACKREF,
|
||||
+ PCRE_JAVASCRIPT_COMPAT)
|
||||
+end
|
||||
|
||||
if subsystem == 'http' then
|
||||
ffi.cdef[[
|
||||
--- a/nginx-mod-lua-resty-core/t/re-base.t
|
||||
+++ b/nginx-mod-lua-resty-core/t/re-base.t
|
||||
@@ -26,8 +26,11 @@ __DATA__
|
||||
}
|
||||
--- request
|
||||
GET /re
|
||||
---- response_body
|
||||
-error: pcre_compile() failed: missing ) in "(abc"
|
||||
+--- response_body eval
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"error: pcre2_compile() failed: missing closing parenthesis in \"(abc\"\n"
|
||||
+:
|
||||
+"error: pcre_compile() failed: missing ) in \"(abc\"\n"
|
||||
--- no_error_log
|
||||
[error]
|
||||
|
||||
@@ -63,8 +66,11 @@ error: pcre_compile() failed: missing )
|
||||
}
|
||||
--- request
|
||||
GET /t
|
||||
---- response_body_like chop
|
||||
-error: pcre_exec\(\) failed: -10
|
||||
+--- response_body eval
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"error: pcre_exec\(\) failed: -4\n"
|
||||
+:
|
||||
+"error: pcre_exec\(\) failed: -10\n"
|
||||
|
||||
--- no_error_log
|
||||
[error]
|
||||
@@ -128,6 +134,7 @@ probe process("$LIBPCRE_PATH").function(
|
||||
printf("exec opts: %x\n", $options)
|
||||
}
|
||||
|
||||
+# TODO: PCRE2 use different option values from PCRE
|
||||
--- stap_out
|
||||
compile opts: 800
|
||||
exec opts: 0
|
||||
@@ -172,8 +179,14 @@ end
|
||||
|
||||
--- request
|
||||
GET /re
|
||||
---- response_body
|
||||
-error: pcre_exec() failed: -8
|
||||
+--- response_body eval
|
||||
+# lua_regex_match_limit uses pcre_extra->match_limit in the PCRE,
|
||||
+# but PCRE2 replaces this with pcre2_set_match_limit interface,
|
||||
+# which has different effects.
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"failed to match\n"
|
||||
+:
|
||||
+"error: pcre_exec() failed: -8\n"
|
||||
|
||||
|
||||
|
||||
--- a/nginx-mod-lua-resty-core/t/re-gmatch.t
|
||||
+++ b/nginx-mod-lua-resty-core/t/re-gmatch.t
|
||||
@@ -446,9 +446,13 @@ matched: nil
|
||||
}
|
||||
--- request
|
||||
GET /re
|
||||
---- response_body
|
||||
-error: pcre_exec() failed: -10
|
||||
-not matched
|
||||
+--- response_body eval
|
||||
+# PCRE2_ERROR_UTF8_ERR2 (-4)
|
||||
+# PCRE_ERROR_BADUTF8 (-10)
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"error: pcre_exec\(\) failed: -4\nnot matched\n"
|
||||
+:
|
||||
+"error: pcre_exec\(\) failed: -10\nnot matched\n"
|
||||
--- no_error_log
|
||||
[error]
|
||||
|
||||
--- a/nginx-mod-lua-resty-core/t/re-match.t
|
||||
+++ b/nginx-mod-lua-resty-core/t/re-match.t
|
||||
@@ -306,8 +306,11 @@ NYI
|
||||
}
|
||||
--- request
|
||||
GET /re
|
||||
---- response_body_like chop
|
||||
-error: pcre_compile\(\) failed: two named subpatterns have the same name
|
||||
+--- response_body eval
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"error: pcre2_compile\(\) failed: two named subpatterns have the same name \(PCRE2_DUPNAMES not set\) in \"\(\?<first>[a-z])\(\?<first>[a-z]+\), [0-9]+\" at \"[a-z]+\), [0-9]+\"\n"
|
||||
+:
|
||||
+"error: pcre_compile\(\) failed: two named subpatterns have the same name in \"\(\?<first>[a-z])\(\?<first>[a-z]+\), [0-9]+\" at \">[a-z]+\), [0-9]+\"\n"
|
||||
|
||||
--- error_log eval
|
||||
qr/\[TRACE\s+\d+/
|
||||
--- a/nginx-mod-lua-resty-core/t/re-opt.t
|
||||
+++ b/nginx-mod-lua-resty-core/t/re-opt.t
|
||||
@@ -39,8 +39,13 @@ __DATA__
|
||||
}
|
||||
--- request
|
||||
GET /re
|
||||
---- response_body
|
||||
-error: pcre_exec() failed: -27
|
||||
+--- response_body eval
|
||||
+# PCRE2_ERROR_JIT_STACKLIMIT (-46)
|
||||
+# PCRE_ERROR_JIT_STACKLIMIT (-27)
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"error: pcre_exec\(\) failed: -46\n"
|
||||
+:
|
||||
+"error: pcre_exec\(\) failed: -27\n"
|
||||
--- no_error_log
|
||||
[error]
|
||||
--- timeout: 10
|
||||
--- a/nginx-mod-lua-resty-core/t/stream/re-base.t
|
||||
+++ b/nginx-mod-lua-resty-core/t/stream/re-base.t
|
||||
@@ -22,8 +22,11 @@ __DATA__
|
||||
ngx.say("error: ", err)
|
||||
end
|
||||
}
|
||||
---- stream_response
|
||||
-error: pcre_compile() failed: missing ) in "(abc"
|
||||
+--- stream_response eval
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"error: pcre2_compile() failed: missing closing parenthesis in \"(abc\"\n"
|
||||
+:
|
||||
+"error: pcre_compile() failed: missing ) in \"(abc\"\n"
|
||||
--- no_error_log
|
||||
[error]
|
||||
|
||||
@@ -55,12 +58,17 @@ error: pcre_compile() failed: missing )
|
||||
ngx.say("not matched")
|
||||
end
|
||||
}
|
||||
---- stream_response_like chop
|
||||
-error: pcre_exec\(\) failed: -10
|
||||
+--- stream_response eval
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"error: pcre_exec\(\) failed: -4\n"
|
||||
+:
|
||||
+"error: pcre_exec\(\) failed: -10\n"
|
||||
|
||||
--- no_error_log
|
||||
[error]
|
||||
|
||||
+--- ONLY
|
||||
+
|
||||
|
||||
|
||||
=== TEST 3: UTF-8 mode without UTF-8 sequence checks
|
||||
@@ -114,6 +122,7 @@ probe process("$LIBPCRE_PATH").function(
|
||||
printf("exec opts: %x\n", $options)
|
||||
}
|
||||
|
||||
+# TODO: PCRE2 use different option values from PCRE
|
||||
--- stap_out
|
||||
compile opts: 800
|
||||
exec opts: 0
|
||||
@@ -152,8 +161,14 @@ if not res then
|
||||
return
|
||||
end
|
||||
|
||||
---- stream_response
|
||||
-error: pcre_exec() failed: -8
|
||||
+--- stream_response eval
|
||||
+# lua_regex_match_limit uses pcre_extra->match_limit in the PCRE,
|
||||
+# but PCRE2 replaces this with pcre2_set_match_limit interface,
|
||||
+# which has different effects.
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"failed to match\n"
|
||||
+:
|
||||
+"error: pcre_exec() failed: -8\n"
|
||||
|
||||
|
||||
|
||||
--- a/nginx-mod-lua-resty-core/t/stream/re-gmatch.t
|
||||
+++ b/nginx-mod-lua-resty-core/t/stream/re-gmatch.t
|
||||
@@ -394,9 +394,13 @@ matched: nil
|
||||
ngx.say("not matched")
|
||||
end
|
||||
}
|
||||
---- stream_response
|
||||
-error: pcre_exec() failed: -10
|
||||
-not matched
|
||||
+--- stream_response eval
|
||||
+# PCRE2_ERROR_UTF8_ERR2 (-4)
|
||||
+# PCRE_ERROR_BADUTF8 (-10)
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"error: pcre_exec\(\) failed: -4\nnot matched\n"
|
||||
+:
|
||||
+"error: pcre_exec\(\) failed: -10\nnot matched\n"
|
||||
--- no_error_log
|
||||
[error]
|
||||
|
||||
--- a/nginx-mod-lua-resty-core/t/stream/re-match.t
|
||||
+++ b/nginx-mod-lua-resty-core/t/stream/re-match.t
|
||||
@@ -268,8 +268,11 @@ NYI
|
||||
ngx.say("not matched!")
|
||||
end
|
||||
}
|
||||
---- stream_response_like chop
|
||||
-error: pcre_compile\(\) failed: two named subpatterns have the same name
|
||||
+--- stream_response eval
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"error: pcre2_compile\(\) failed: two named subpatterns have the same name \(PCRE2_DUPNAMES not set\) in \"\(\?<first>[a-z])\(\?<first>[a-z]+\), [0-9]+\" at \"[a-z]+\), [0-9]+\"\n"
|
||||
+:
|
||||
+"error: pcre_compile\(\) failed: two named subpatterns have the same name in \"\(\?<first>[a-z])\(\?<first>[a-z]+\), [0-9]+\" at \">[a-z]+\), [0-9]+\"\n"
|
||||
|
||||
--- error_log eval
|
||||
qr/\[TRACE\s+\d+/
|
||||
--- a/nginx-mod-lua-resty-core/t/stream/re-opt.t
|
||||
+++ b/nginx-mod-lua-resty-core/t/stream/re-opt.t
|
||||
@@ -36,8 +36,13 @@ __DATA__
|
||||
ngx.say("not matched!")
|
||||
end
|
||||
}
|
||||
---- stream_response
|
||||
-error: pcre_exec() failed: -27
|
||||
+--- stream_response eval
|
||||
+# PCRE2_ERROR_JIT_STACKLIMIT (-46)
|
||||
+# PCRE_ERROR_JIT_STACKLIMIT (-27)
|
||||
+$Test::Nginx::Util::PcreVersion == 2 ?
|
||||
+"error: pcre_exec\(\) failed: -46\n"
|
||||
+:
|
||||
+"error: pcre_exec\(\) failed: -27\n"
|
||||
--- no_error_log
|
||||
[error]
|
||||
--- timeout: 10
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
--- a/nginx-mod-lua/src/ngx_http_lua_module.c
|
||||
+++ b/nginx-mod-lua/src/ngx_http_lua_module.c
|
||||
@@ -207,12 +207,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -212,12 +212,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
offsetof(ngx_http_lua_loc_conf_t, log_socket_errors),
|
||||
NULL },
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
{ ngx_string("init_by_lua"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
|
||||
@@ -228,12 +230,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -233,12 +235,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_init_by_file },
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
|
||||
{ ngx_string("init_worker_by_lua"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
|
||||
@@ -249,12 +253,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -254,12 +258,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_init_worker_by_file },
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
|
||||
{ ngx_string("exit_worker_by_lua_file"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
|
||||
@@ -264,6 +270,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -269,6 +275,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
(void *) ngx_http_lua_exit_worker_by_file },
|
||||
|
||||
#if defined(NDK) && NDK
|
||||
|
@ -53,7 +53,7 @@
|
|||
/* set_by_lua_block $res { inline Lua code } */
|
||||
{ ngx_string("set_by_lua_block"),
|
||||
NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
||||
@@ -272,6 +279,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -277,6 +284,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
0,
|
||||
(void *) ngx_http_lua_filter_set_by_lua_inline },
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
/* set_by_lua $res <inline script> [$arg1 [$arg2 [...]]] */
|
||||
{ ngx_string("set_by_lua"),
|
||||
@@ -292,6 +300,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -297,6 +305,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
(void *) ngx_http_lua_filter_set_by_lua_file },
|
||||
#endif
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
|||
/* server_rewrite_by_lua_block { <inline script> } */
|
||||
{ ngx_string("server_rewrite_by_lua_block"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
|
||||
@@ -299,6 +308,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -304,6 +313,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
NGX_HTTP_SRV_CONF_OFFSET,
|
||||
0,
|
||||
(void *) ngx_http_lua_server_rewrite_handler_inline },
|
||||
|
@ -77,7 +77,7 @@
|
|||
|
||||
/* server_rewrite_by_lua_file filename; */
|
||||
{ ngx_string("server_rewrite_by_lua_file"),
|
||||
@@ -317,6 +327,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -322,6 +332,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_rewrite_handler_inline },
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
|||
/* rewrite_by_lua_block { <inline script> } */
|
||||
{ ngx_string("rewrite_by_lua_block"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
||||
@@ -325,6 +336,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -330,6 +341,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
0,
|
||||
(void *) ngx_http_lua_rewrite_handler_inline },
|
||||
|
@ -93,7 +93,7 @@
|
|||
|
||||
/* access_by_lua "<inline script>" */
|
||||
{ ngx_string("access_by_lua"),
|
||||
@@ -335,6 +347,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -340,6 +352,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_access_handler_inline },
|
||||
|
||||
|
@ -101,7 +101,7 @@
|
|||
/* access_by_lua_block { <inline script> } */
|
||||
{ ngx_string("access_by_lua_block"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
||||
@@ -343,6 +356,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -348,6 +361,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
0,
|
||||
(void *) ngx_http_lua_access_handler_inline },
|
||||
|
@ -109,7 +109,7 @@
|
|||
|
||||
/* content_by_lua "<inline script>" */
|
||||
{ ngx_string("content_by_lua"),
|
||||
@@ -352,6 +366,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -357,6 +371,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_content_handler_inline },
|
||||
|
||||
|
@ -117,7 +117,7 @@
|
|||
/* content_by_lua_block { <inline script> } */
|
||||
{ ngx_string("content_by_lua_block"),
|
||||
NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_BLOCK|NGX_CONF_NOARGS,
|
||||
@@ -359,6 +374,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -364,6 +379,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
0,
|
||||
(void *) ngx_http_lua_content_handler_inline },
|
||||
|
@ -125,7 +125,7 @@
|
|||
|
||||
/* log_by_lua <inline script> */
|
||||
{ ngx_string("log_by_lua"),
|
||||
@@ -369,6 +385,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -374,6 +390,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_log_handler_inline },
|
||||
|
||||
|
@ -133,7 +133,7 @@
|
|||
/* log_by_lua_block { <inline script> } */
|
||||
{ ngx_string("log_by_lua_block"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
||||
@@ -377,6 +394,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -382,6 +399,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
0,
|
||||
(void *) ngx_http_lua_log_handler_inline },
|
||||
|
@ -141,7 +141,7 @@
|
|||
|
||||
{ ngx_string("rewrite_by_lua_file"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
||||
@@ -433,6 +451,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -438,6 +456,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_header_filter_inline },
|
||||
|
||||
|
@ -149,7 +149,7 @@
|
|||
/* header_filter_by_lua_block { <inline script> } */
|
||||
{ ngx_string("header_filter_by_lua_block"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
||||
@@ -441,6 +460,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -446,6 +465,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
0,
|
||||
(void *) ngx_http_lua_header_filter_inline },
|
||||
|
@ -157,7 +157,7 @@
|
|||
|
||||
{ ngx_string("header_filter_by_lua_file"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
||||
@@ -458,6 +478,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -463,6 +483,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_body_filter_inline },
|
||||
|
||||
|
@ -165,7 +165,7 @@
|
|||
/* body_filter_by_lua_block { <inline script> } */
|
||||
{ ngx_string("body_filter_by_lua_block"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
||||
@@ -466,6 +487,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -471,6 +492,7 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
NGX_HTTP_LOC_CONF_OFFSET,
|
||||
0,
|
||||
(void *) ngx_http_lua_body_filter_inline },
|
||||
|
@ -173,7 +173,7 @@
|
|||
|
||||
{ ngx_string("body_filter_by_lua_file"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
|
||||
@@ -475,12 +497,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -480,12 +502,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_body_filter_file },
|
||||
|
||||
|
@ -188,7 +188,7 @@
|
|||
|
||||
{ ngx_string("balancer_by_lua_file"),
|
||||
NGX_HTTP_UPS_CONF|NGX_CONF_TAKE1,
|
||||
@@ -585,12 +609,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -590,12 +614,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
offsetof(ngx_http_lua_loc_conf_t, ssl_ciphers),
|
||||
NULL },
|
||||
|
||||
|
@ -203,7 +203,7 @@
|
|||
|
||||
{ ngx_string("ssl_client_hello_by_lua_file"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
|
||||
@@ -599,12 +625,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -604,12 +630,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_ssl_client_hello_handler_file },
|
||||
|
||||
|
@ -218,7 +218,7 @@
|
|||
|
||||
{ ngx_string("ssl_certificate_by_lua_file"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
|
||||
@@ -613,12 +641,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -618,12 +646,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_ssl_cert_handler_file },
|
||||
|
||||
|
@ -233,7 +233,7 @@
|
|||
|
||||
{ ngx_string("ssl_session_store_by_lua_file"),
|
||||
NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
|
||||
@@ -627,12 +657,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
@@ -632,12 +662,14 @@ static ngx_command_t ngx_http_lua_cmds[]
|
||||
0,
|
||||
(void *) ngx_http_lua_ssl_sess_store_handler_file },
|
||||
|
||||
|
|
Loading…
Reference in New Issue