From 7b2c4ceab8055aee35f48981ae72c22ec5aa51ab Mon Sep 17 00:00:00 2001 From: Nic Date: Thu, 14 Aug 2025 16:35:03 +0800 Subject: [PATCH] feat: enable cosockets in init_worker_by_lua Signed-off-by: Nic --- .../lua-resty-core-init_worker_coroutine.patch | 13 +++++++++++++ patch/1.21.4/ngx_lua-init_worker_coroutine.patch | 13 +++++++++++++ .../lua-resty-core-init_worker_coroutine.patch | 13 +++++++++++++ patch/1.27.1.1/ngx_lua-init_worker_coroutine.patch | 13 +++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 patch/1.21.4/lua-resty-core-init_worker_coroutine.patch create mode 100644 patch/1.21.4/ngx_lua-init_worker_coroutine.patch create mode 100644 patch/1.27.1.1/lua-resty-core-init_worker_coroutine.patch create mode 100644 patch/1.27.1.1/ngx_lua-init_worker_coroutine.patch diff --git a/patch/1.21.4/lua-resty-core-init_worker_coroutine.patch b/patch/1.21.4/lua-resty-core-init_worker_coroutine.patch new file mode 100644 index 0000000..8871e68 --- /dev/null +++ b/patch/1.21.4/lua-resty-core-init_worker_coroutine.patch @@ -0,0 +1,13 @@ +diff --git lib/resty/core/coroutine.lua lib/resty/core/coroutine.lua +index 9c95b16..57cd4c7 100644 +--- lib/resty/core/coroutine.lua ++++ lib/resty/core/coroutine.lua +@@ -13,7 +13,7 @@ do + local r = get_request() + if r ~= nil then + local ctx = get_raw_phase(r, errmsg) +- if ctx ~= 0x020 and ctx ~= 0x040 then ++ if ctx ~= 0x020 and ctx ~= 0x040 and ctx ~= 0x100 then + return ours(...) + end + end diff --git a/patch/1.21.4/ngx_lua-init_worker_coroutine.patch b/patch/1.21.4/ngx_lua-init_worker_coroutine.patch new file mode 100644 index 0000000..0e4cdc0 --- /dev/null +++ b/patch/1.21.4/ngx_lua-init_worker_coroutine.patch @@ -0,0 +1,13 @@ +diff --git src/ngx_http_lua_coroutine.c src/ngx_http_lua_coroutine.c +index 1580c5b2..d0bc045c 100644 +--- src/ngx_http_lua_coroutine.c ++++ src/ngx_http_lua_coroutine.c +@@ -358,7 +358,7 @@ ngx_http_lua_inject_coroutine_api(ngx_log_t *log, lua_State *L) + "local ctx = raw_ctx(r)\n" + #endif + /* ignore header and body filters */ +- "if ctx ~= 0x020 and ctx ~= 0x040 then\n" ++ "if ctx ~= 0x020 and ctx ~= 0x040 and ctx ~= 0x100 then\n" + "return ours(...)\n" + "end\n" + "end\n" diff --git a/patch/1.27.1.1/lua-resty-core-init_worker_coroutine.patch b/patch/1.27.1.1/lua-resty-core-init_worker_coroutine.patch new file mode 100644 index 0000000..8871e68 --- /dev/null +++ b/patch/1.27.1.1/lua-resty-core-init_worker_coroutine.patch @@ -0,0 +1,13 @@ +diff --git lib/resty/core/coroutine.lua lib/resty/core/coroutine.lua +index 9c95b16..57cd4c7 100644 +--- lib/resty/core/coroutine.lua ++++ lib/resty/core/coroutine.lua +@@ -13,7 +13,7 @@ do + local r = get_request() + if r ~= nil then + local ctx = get_raw_phase(r, errmsg) +- if ctx ~= 0x020 and ctx ~= 0x040 then ++ if ctx ~= 0x020 and ctx ~= 0x040 and ctx ~= 0x100 then + return ours(...) + end + end diff --git a/patch/1.27.1.1/ngx_lua-init_worker_coroutine.patch b/patch/1.27.1.1/ngx_lua-init_worker_coroutine.patch new file mode 100644 index 0000000..0e4cdc0 --- /dev/null +++ b/patch/1.27.1.1/ngx_lua-init_worker_coroutine.patch @@ -0,0 +1,13 @@ +diff --git src/ngx_http_lua_coroutine.c src/ngx_http_lua_coroutine.c +index 1580c5b2..d0bc045c 100644 +--- src/ngx_http_lua_coroutine.c ++++ src/ngx_http_lua_coroutine.c +@@ -358,7 +358,7 @@ ngx_http_lua_inject_coroutine_api(ngx_log_t *log, lua_State *L) + "local ctx = raw_ctx(r)\n" + #endif + /* ignore header and body filters */ +- "if ctx ~= 0x020 and ctx ~= 0x040 then\n" ++ "if ctx ~= 0x020 and ctx ~= 0x040 and ctx ~= 0x100 then\n" + "return ours(...)\n" + "end\n" + "end\n"