From 2b8b9cf0eb7929b3eba45a51492d272ad9196e91 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Wed, 10 Jan 2024 15:57:33 +0800 Subject: [PATCH 01/17] chore(deps): bump OpenResty to 1.25.3.1 --- .requirements | 2 +- changelog/unreleased/kong/bump-openresty-1.21.4.3.yml | 3 --- changelog/unreleased/kong/bump-openresty.yml | 3 +++ kong/meta.lua | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 changelog/unreleased/kong/bump-openresty-1.21.4.3.yml create mode 100644 changelog/unreleased/kong/bump-openresty.yml diff --git a/.requirements b/.requirements index b730093ddd0..b879f33e921 100644 --- a/.requirements +++ b/.requirements @@ -1,6 +1,6 @@ KONG_PACKAGE_NAME=kong -OPENRESTY=1.21.4.3 +OPENRESTY=1.25.3.1 LUAROCKS=3.9.2 OPENSSL=3.2.0 PCRE=8.45 diff --git a/changelog/unreleased/kong/bump-openresty-1.21.4.3.yml b/changelog/unreleased/kong/bump-openresty-1.21.4.3.yml deleted file mode 100644 index f44f1e9d1b7..00000000000 --- a/changelog/unreleased/kong/bump-openresty-1.21.4.3.yml +++ /dev/null @@ -1,3 +0,0 @@ -message: "Bumped OpenResty from 1.21.4.2 to 1.21.4.3" -type: dependency -scope: Core diff --git a/changelog/unreleased/kong/bump-openresty.yml b/changelog/unreleased/kong/bump-openresty.yml new file mode 100644 index 00000000000..d381f65af73 --- /dev/null +++ b/changelog/unreleased/kong/bump-openresty.yml @@ -0,0 +1,3 @@ +message: "Bumped OpenResty from 1.21.4.2 to 1.25.3.1" +type: dependency +scope: Core diff --git a/kong/meta.lua b/kong/meta.lua index 403d09d69bd..c149073e1dc 100644 --- a/kong/meta.lua +++ b/kong/meta.lua @@ -24,6 +24,6 @@ return { -- third-party dependencies' required version, as they would be specified -- to lua-version's `set()` in the form {from, to} _DEPENDENCIES = { - nginx = { "1.21.4.3" }, + nginx = { "1.25.3.1" }, } } From ce8b63958a7d03a23e7a97443f7203f984d5c036 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 11 Jan 2024 06:45:32 +0800 Subject: [PATCH 02/17] repositories.bzl --- build/openresty/repositories.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/openresty/repositories.bzl b/build/openresty/repositories.bzl index 43ff3faa995..b493dd246fb 100644 --- a/build/openresty/repositories.bzl +++ b/build/openresty/repositories.bzl @@ -30,7 +30,7 @@ def openresty_repositories(): openresty_http_archive_wrapper, name = "openresty", build_file = "//build/openresty:BUILD.openresty.bazel", - sha256 = "33a84c63cfd9e46b0e5c62eb2ddc7b8068bda2e1686314343b89fc3ffd24cdd3", + sha256 = "32ec1a253a5a13250355a075fe65b7d63ec45c560bbe213350f0992a57cd79df", strip_prefix = "openresty-" + openresty_version, urls = [ "https://openresty.org/download/openresty-" + openresty_version + ".tar.gz", From e20cfef122eeafb379c600337d64c30a82966d98 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 11 Jan 2024 08:28:30 +0800 Subject: [PATCH 03/17] update patches --- ...230410_01_patch_macro_luajit_version.patch | 27 -- .../LuaJIT-2.1-20230410_03_arm64_sigill.patch | 26 -- ...aJIT-2.1-20230410_04_arm64_fix_HREFK.patch | 27 -- ...uaJIT-2.1-20230410_05_ldp_stp_fusion.patch | 46 --- ...-2.1-20230410_06_arm64_reg_alloc_fix.patch | 32 -- ...IT-2.1-20230410_07_ldp_stp_unaligned.patch | 23 -- ...uaJIT-2.1-20230410_08_ldoc_error_fix.patch | 22 - ...231117_01_patch_macro_luajit_version.patch | 14 + ... LuaJIT-2.1-20231117_02_pass_cc_env.patch} | 6 +- ....11_01-handle-large-string-correctly.patch | 387 ------------------ ...re-0.1.28_01-dyn_upstream_keepalive.patch} | 6 +- ...a-resty-dns-0.22_01-destroy_resolver.patch | 46 --- ...m_client_certificate_and_ssl_verify.patch} | 6 +- ...okens-from-special-responses-output.patch} | 8 +- ...m_client_certificate_and_ssl_verify.patch} | 10 +- ...x-1.25.3_04-grpc_authority_override.patch} | 4 +- ...aders-from-ngx-header-filter-module.patch} | 8 +- ...> nginx-1.25.3_06-dynamic_log_level.patch} | 12 +- ...ross.patch => nginx-1.25.3_07-cross.patch} | 24 +- ...ginx-1.25.3_08-cross-endianness-fix.patch} | 4 +- ...a-0.10.26_01-dyn_upstream_keepalive.patch} | 32 +- ...gx_lua-0.10.26_02-dynamic_log_level.patch} | 6 +- ...lua-0.0.14_01-expose_request_struct.patch} | 8 +- 23 files changed, 81 insertions(+), 703 deletions(-) delete mode 100644 build/openresty/patches/LuaJIT-2.1-20230410_01_patch_macro_luajit_version.patch delete mode 100644 build/openresty/patches/LuaJIT-2.1-20230410_03_arm64_sigill.patch delete mode 100644 build/openresty/patches/LuaJIT-2.1-20230410_04_arm64_fix_HREFK.patch delete mode 100644 build/openresty/patches/LuaJIT-2.1-20230410_05_ldp_stp_fusion.patch delete mode 100644 build/openresty/patches/LuaJIT-2.1-20230410_06_arm64_reg_alloc_fix.patch delete mode 100644 build/openresty/patches/LuaJIT-2.1-20230410_07_ldp_stp_unaligned.patch delete mode 100644 build/openresty/patches/LuaJIT-2.1-20230410_08_ldoc_error_fix.patch create mode 100644 build/openresty/patches/LuaJIT-2.1-20231117_01_patch_macro_luajit_version.patch rename build/openresty/patches/{LuaJIT-2.1-20230410_02_pass_cc_env.patch => LuaJIT-2.1-20231117_02_pass_cc_env.patch} (85%) delete mode 100644 build/openresty/patches/lua-cjson-2.1.0.11_01-handle-large-string-correctly.patch rename build/openresty/patches/{lua-resty-core-0.1.27_01-dyn_upstream_keepalive.patch => lua-resty-core-0.1.28_01-dyn_upstream_keepalive.patch} (96%) delete mode 100644 build/openresty/patches/lua-resty-dns-0.22_01-destroy_resolver.patch rename build/openresty/patches/{nginx-1.21.4_01-upstream_client_certificate_and_ssl_verify.patch => nginx-1.25.3_01-upstream_client_certificate_and_ssl_verify.patch} (85%) rename build/openresty/patches/{nginx-1.21.4_02-remove-server-tokens-from-special-responses-output.patch => nginx-1.25.3_02-remove-server-tokens-from-special-responses-output.patch} (70%) rename build/openresty/patches/{nginx-1.21.4_03-stream_upstream_client_certificate_and_ssl_verify.patch => nginx-1.25.3_03-stream_upstream_client_certificate_and_ssl_verify.patch} (82%) rename build/openresty/patches/{nginx-1.21.4_04-grpc_authority_override.patch => nginx-1.25.3_04-grpc_authority_override.patch} (85%) rename build/openresty/patches/{nginx-1.21.4_05-remove-server-headers-from-ngx-header-filter-module.patch => nginx-1.25.3_05-remove-server-headers-from-ngx-header-filter-module.patch} (87%) rename build/openresty/patches/{nginx-1.21.4_06-dynamic_log_level.patch => nginx-1.25.3_06-dynamic_log_level.patch} (94%) rename build/openresty/patches/{nginx-1.21.4_07-cross.patch => nginx-1.25.3_07-cross.patch} (91%) rename build/openresty/patches/{nginx-1.21.4_08-cross-endianness-fix.patch => nginx-1.25.3_08-cross-endianness-fix.patch} (96%) rename build/openresty/patches/{ngx_lua-0.10.25_01-dyn_upstream_keepalive.patch => ngx_lua-0.10.26_01-dyn_upstream_keepalive.patch} (97%) rename build/openresty/patches/{ngx_lua-0.10.25_02-dynamic_log_level.patch => ngx_lua-0.10.26_02-dynamic_log_level.patch} (77%) rename build/openresty/patches/{ngx_stream_lua-0.0.13_01-expose_request_struct.patch => ngx_stream_lua-0.0.14_01-expose_request_struct.patch} (58%) diff --git a/build/openresty/patches/LuaJIT-2.1-20230410_01_patch_macro_luajit_version.patch b/build/openresty/patches/LuaJIT-2.1-20230410_01_patch_macro_luajit_version.patch deleted file mode 100644 index 9edd6e5478f..00000000000 --- a/build/openresty/patches/LuaJIT-2.1-20230410_01_patch_macro_luajit_version.patch +++ /dev/null @@ -1,27 +0,0 @@ -From f53c8fa441f4233b9a3f19fcd870207fe8795456 Mon Sep 17 00:00:00 2001 -From: Qi -Date: Wed, 25 May 2022 18:35:08 +0800 -Subject: [PATCH] Patch macro `LUAJIT_VERSION` - ---- - src/luajit.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/bundle/LuaJIT-2.1-20230410/src/luajit.h b/bundle/LuaJIT-2.1-20230410/src/luajit.h -index a4d33001..e35f4e7e 100644 ---- a/bundle/LuaJIT-2.1-20230410/src/luajit.h -+++ b/bundle/LuaJIT-2.1-20230410/src/luajit.h -@@ -32,7 +32,9 @@ - - #define OPENRESTY_LUAJIT - -+#ifndef LUAJIT_VERSION - #define LUAJIT_VERSION "LuaJIT 2.1.0-beta3" -+#endif - #define LUAJIT_VERSION_NUM 20100 /* Version 2.1.0 = 02.01.00. */ - #define LUAJIT_VERSION_SYM luaJIT_version_2_1_0_beta3 - #define LUAJIT_COPYRIGHT "Copyright (C) 2005-2022 Mike Pall" --- -2.34.1 - - diff --git a/build/openresty/patches/LuaJIT-2.1-20230410_03_arm64_sigill.patch b/build/openresty/patches/LuaJIT-2.1-20230410_03_arm64_sigill.patch deleted file mode 100644 index 55fc8831d7b..00000000000 --- a/build/openresty/patches/LuaJIT-2.1-20230410_03_arm64_sigill.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 56f0ff1a7bcb3bacdefa3c0f4b0a6a3efcf90bd5 Mon Sep 17 00:00:00 2001 -From: Zhongwei Yao -Date: Tue, 4 Jul 2023 15:20:19 -0800 -Subject: [PATCH] Fix fuse case for LDP instuction on Arm64 when offset is - negative. - ---- - src/lj_emit_arm64.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h b/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h -index 0ddba4a3..e19a8e4a 100644 ---- a/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h -+++ b/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h -@@ -143,7 +143,7 @@ static void emit_lso(ASMState *as, A64Ins ai, Reg rd, Reg rn, int64_t ofs) - goto nopair; - } - if (ofsm >= (int)((unsigned int)-64<mcp = aip | A64F_N(rn) | ((ofsm >> sc) << 15) | -+ *as->mcp = aip | A64F_N(rn) | (((ofsm >> sc)&0x7f) << 15) | - (ai ^ ((ai == A64I_LDRx || ai == A64I_STRx) ? 0x50000000 : 0x90000000)); - return; - } --- -2.41.0 - diff --git a/build/openresty/patches/LuaJIT-2.1-20230410_04_arm64_fix_HREFK.patch b/build/openresty/patches/LuaJIT-2.1-20230410_04_arm64_fix_HREFK.patch deleted file mode 100644 index d52d51c09a2..00000000000 --- a/build/openresty/patches/LuaJIT-2.1-20230410_04_arm64_fix_HREFK.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 8fbd576fb9414a5fa70dfa6069733d3416a78269 Mon Sep 17 00:00:00 2001 -From: Mike Pall -Date: Sun, 9 Jul 2023 21:15:01 +0200 -Subject: [PATCH] ARM64: Fix assembly of HREFK. - -Reported by caohongqing. #1026 -Fix contributed by Peter Cawley. ---- - src/lj_asm_arm64.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/bundle/LuaJIT-2.1-20230410/src/lj_asm_arm64.h b/bundle/LuaJIT-2.1-20230410/src/lj_asm_arm64.h -index 805ea54b..95138fe9 100644 ---- a/bundle/LuaJIT-2.1-20230410/src/lj_asm_arm64.h -+++ b/bundle/LuaJIT-2.1-20230410/src/lj_asm_arm64.h -@@ -938,7 +938,7 @@ static void asm_hrefk(ASMState *as, IRIns *ir) - IRIns *irkey = IR(kslot->op1); - int32_t ofs = (int32_t)(kslot->op2 * sizeof(Node)); - int32_t kofs = ofs + (int32_t)offsetof(Node, key); -- int bigofs = !emit_checkofs(A64I_LDRx, ofs); -+ int bigofs = !emit_checkofs(A64I_LDRx, kofs); - Reg dest = (ra_used(ir) || bigofs) ? ra_dest(as, ir, RSET_GPR) : RID_NONE; - Reg node = ra_alloc1(as, ir->op1, RSET_GPR); - Reg key, idx = node; --- -2.41.0 - diff --git a/build/openresty/patches/LuaJIT-2.1-20230410_05_ldp_stp_fusion.patch b/build/openresty/patches/LuaJIT-2.1-20230410_05_ldp_stp_fusion.patch deleted file mode 100644 index b61ffba7614..00000000000 --- a/build/openresty/patches/LuaJIT-2.1-20230410_05_ldp_stp_fusion.patch +++ /dev/null @@ -1,46 +0,0 @@ -From b8c6ccd50c61b7a2df5123ddc5a85ac7d089542b Mon Sep 17 00:00:00 2001 -From: Mike Pall -Date: Sat, 9 Sep 2023 18:01:37 +0200 -Subject: [PATCH] ARM64: Fix LDP/STP fusion (again). - -Reported and analyzed by Zhongwei Yao. Fix by Peter Cawley. #1075 ---- - src/lj_emit_arm64.h | 17 +++++++++++++---- - 1 file changed, 13 insertions(+), 4 deletions(-) - -diff --git a/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h b/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h -index d4c542557..9161c9582 100644 ---- a/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h -+++ b/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h -@@ -121,6 +121,17 @@ static int emit_checkofs(A64Ins ai, int64_t ofs) - } - } - -+static LJ_AINLINE uint32_t emit_lso_pair_candidate(A64Ins ai, int ofs, int sc) -+{ -+ if (ofs >= 0) { -+ return ai | A64F_U12(ofs>>sc); /* Subsequent lj_ror checks ofs. */ -+ } else if (ofs >= -256) { -+ return (ai^A64I_LS_U) | A64F_S9(ofs & 0x1ff); -+ } else { -+ return A64F_D(31); /* Will mismatch prev. */ -+ } -+} -+ - static void emit_lso(ASMState *as, A64Ins ai, Reg rd, Reg rn, int64_t ofs) - { - int ot = emit_checkofs(ai, ofs), sc = (ai >> 30) & 3; -@@ -132,11 +143,9 @@ static void emit_lso(ASMState *as, A64Ins ai, Reg rd, Reg rn, int64_t ofs) - uint32_t prev = *as->mcp & ~A64F_D(31); - int ofsm = ofs - (1<>sc)) || -- prev == ((ai^A64I_LS_U) | A64F_N(rn) | A64F_S9(ofsm&0x1ff))) { -+ if (prev == emit_lso_pair_candidate(ai | A64F_N(rn), ofsm, sc)) { - aip = (A64F_A(rd) | A64F_D(*as->mcp & 31)); -- } else if (prev == (ai | A64F_N(rn) | A64F_U12(ofsp>>sc)) || -- prev == ((ai^A64I_LS_U) | A64F_N(rn) | A64F_S9(ofsp&0x1ff))) { -+ } else if (prev == emit_lso_pair_candidate(ai | A64F_N(rn), ofsp, sc)) { - aip = (A64F_D(rd) | A64F_A(*as->mcp & 31)); - ofsm = ofs; - } else { diff --git a/build/openresty/patches/LuaJIT-2.1-20230410_06_arm64_reg_alloc_fix.patch b/build/openresty/patches/LuaJIT-2.1-20230410_06_arm64_reg_alloc_fix.patch deleted file mode 100644 index 7a0d5fb5647..00000000000 --- a/build/openresty/patches/LuaJIT-2.1-20230410_06_arm64_reg_alloc_fix.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 7ff8f26eb852953778736cf244b2884e339d80aa Mon Sep 17 00:00:00 2001 -From: Mike Pall -Date: Tue, 29 Aug 2023 22:35:10 +0200 -Subject: [PATCH] ARM64: Fix register allocation for IR_*LOAD. - -Thanks to Peter Cawley. #1062 ---- - src/lj_asm_arm64.h | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/bundle/LuaJIT-2.1-20230410/src/lj_asm_arm64.h b/bundle/LuaJIT-2.1-20230410/src/lj_asm_arm64.h -index 3889883d..c216fced 100644 ---- a/bundle/LuaJIT-2.1-20230410/src/lj_asm_arm64.h -+++ b/bundle/LuaJIT-2.1-20230410/src/lj_asm_arm64.h -@@ -1133,6 +1133,8 @@ static void asm_ahuvload(ASMState *as, IRIns *ir) - } - type = ra_scratch(as, rset_clear(gpr, tmp)); - idx = asm_fuseahuref(as, ir->op1, &ofs, rset_clear(gpr, type), A64I_LDRx); -+ rset_clear(gpr, idx); -+ if (ofs & FUSE_REG) rset_clear(gpr, ofs & 31); - if (ir->o == IR_VLOAD) ofs += 8 * ir->op2; - /* Always do the type check, even if the load result is unused. */ - asm_guardcc(as, irt_isnum(ir->t) ? CC_LS : CC_NE); -@@ -1140,7 +1142,7 @@ static void asm_ahuvload(ASMState *as, IRIns *ir) - lj_assertA(irt_isinteger(ir->t) || irt_isnum(ir->t), - "bad load type %d", irt_type(ir->t)); - emit_nm(as, A64I_CMPx | A64F_SH(A64SH_LSR, 32), -- ra_allock(as, LJ_TISNUM << 15, rset_exclude(gpr, idx)), tmp); -+ ra_allock(as, LJ_TISNUM << 15, gpr), tmp); - } else if (irt_isaddr(ir->t)) { - emit_n(as, (A64I_CMNx^A64I_K12) | A64F_U12(-irt_toitype(ir->t)), type); - emit_dn(as, A64I_ASRx | A64F_IMMR(47), type, tmp); diff --git a/build/openresty/patches/LuaJIT-2.1-20230410_07_ldp_stp_unaligned.patch b/build/openresty/patches/LuaJIT-2.1-20230410_07_ldp_stp_unaligned.patch deleted file mode 100644 index 714b7047cef..00000000000 --- a/build/openresty/patches/LuaJIT-2.1-20230410_07_ldp_stp_unaligned.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0fa2f1cbcf023ad0549f1428809e506fa2c78552 Mon Sep 17 00:00:00 2001 -From: Mike Pall -Date: Mon, 28 Aug 2023 22:33:54 +0200 -Subject: [PATCH] ARM64: Fix LDP/STP fusing for unaligned accesses. - -Thanks to Peter Cawley. #1056 ---- - src/lj_emit_arm64.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h b/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h -index 52d010b8..6926c71a 100644 ---- a/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h -+++ b/bundle/LuaJIT-2.1-20230410/src/lj_emit_arm64.h -@@ -151,7 +151,7 @@ static void emit_lso(ASMState *as, A64Ins ai, Reg rd, Reg rn, int64_t ofs) - } else { - goto nopair; - } -- if (ofsm >= (int)((unsigned int)-64<mcp = aip | A64F_N(rn) | (((ofsm >> sc)&0x7f) << 15) | - (ai ^ ((ai == A64I_LDRx || ai == A64I_STRx) ? 0x50000000 : 0x90000000)); - return; diff --git a/build/openresty/patches/LuaJIT-2.1-20230410_08_ldoc_error_fix.patch b/build/openresty/patches/LuaJIT-2.1-20230410_08_ldoc_error_fix.patch deleted file mode 100644 index b8d999c25b1..00000000000 --- a/build/openresty/patches/LuaJIT-2.1-20230410_08_ldoc_error_fix.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 65c849390702b1150d52e64db86cbc6b3c98413e Mon Sep 17 00:00:00 2001 -From: Mike Pall -Date: Thu, 9 Nov 2023 11:02:36 +0100 -Subject: [PATCH] Invalidate SCEV entry when returning to lower frame. - -Thanks to Zhongwei Yao. #1115 ---- - src/lj_record.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/bundle/LuaJIT-2.1-20230410/src/lj_record.c b/bundle/LuaJIT-2.1-20230410/src/lj_record.c -index a49f942a..0122105b 100644 ---- a/bundle/LuaJIT-2.1-20230410/src/lj_record.c -+++ b/bundle/LuaJIT-2.1-20230410/src/lj_record.c -@@ -975,6 +975,7 @@ - emitir(IRTG(IR_RETF, IRT_PGC), trpt, trpc); - J->retdepth++; - J->needsnap = 1; -+ J->scev.idx = REF_NIL; - lj_assertJ(J->baseslot == 1+LJ_FR2, "bad baseslot for return"); - /* Shift result slots up and clear the slots of the new frame below. */ - memmove(J->base + cbase, J->base-1-LJ_FR2, sizeof(TRef)*nresults); diff --git a/build/openresty/patches/LuaJIT-2.1-20231117_01_patch_macro_luajit_version.patch b/build/openresty/patches/LuaJIT-2.1-20231117_01_patch_macro_luajit_version.patch new file mode 100644 index 00000000000..6bcfb976bb8 --- /dev/null +++ b/build/openresty/patches/LuaJIT-2.1-20231117_01_patch_macro_luajit_version.patch @@ -0,0 +1,14 @@ +diff --git a/bundle/LuaJIT-2.1-20231117/src/luajit_rolling.h b/bundle/LuaJIT-2.1-20231117/src/luajit_rolling.h +index f082974..d16d66b 100644 +--- a/bundle/LuaJIT-2.1-20231117/src/luajit_rolling.h ++++ b/bundle/LuaJIT-2.1-20231117/src/luajit_rolling.h +@@ -32,7 +32,9 @@ + + #define OPENRESTY_LUAJIT + ++#ifndef LUAJIT_VERSION + #define LUAJIT_VERSION "LuaJIT 2.1.ROLLING" ++#endif + #define LUAJIT_VERSION_NUM 20199 /* Deprecated. */ + #define LUAJIT_VERSION_SYM luaJIT_version_2_1_ROLLING + #define LUAJIT_COPYRIGHT "Copyright (C) 2005-2023 Mike Pall" diff --git a/build/openresty/patches/LuaJIT-2.1-20230410_02_pass_cc_env.patch b/build/openresty/patches/LuaJIT-2.1-20231117_02_pass_cc_env.patch similarity index 85% rename from build/openresty/patches/LuaJIT-2.1-20230410_02_pass_cc_env.patch rename to build/openresty/patches/LuaJIT-2.1-20231117_02_pass_cc_env.patch index 27aede32007..8814c96503b 100644 --- a/build/openresty/patches/LuaJIT-2.1-20230410_02_pass_cc_env.patch +++ b/build/openresty/patches/LuaJIT-2.1-20231117_02_pass_cc_env.patch @@ -1,7 +1,7 @@ -diff --git a/bundle/LuaJIT-2.1-20230410/src/Makefile b/bundle/LuaJIT-2.1-20230410/src/Makefile +diff --git a/bundle/LuaJIT-2.1-20231117/src/Makefile b/bundle/LuaJIT-2.1-20231117/src/Makefile index 68a9a7c..8d2de33 100644 ---- a/bundle/LuaJIT-2.1-20230410/src/Makefile -+++ b/bundle/LuaJIT-2.1-20230410/src/Makefile +--- a/bundle/LuaJIT-2.1-20231117/src/Makefile ++++ b/bundle/LuaJIT-2.1-20231117/src/Makefile @@ -27,7 +27,8 @@ NODOTABIVER= 51 DEFAULT_CC = gcc # diff --git a/build/openresty/patches/lua-cjson-2.1.0.11_01-handle-large-string-correctly.patch b/build/openresty/patches/lua-cjson-2.1.0.11_01-handle-large-string-correctly.patch deleted file mode 100644 index c59b10d2aaf..00000000000 --- a/build/openresty/patches/lua-cjson-2.1.0.11_01-handle-large-string-correctly.patch +++ /dev/null @@ -1,387 +0,0 @@ -diff --git a/bundle/lua-cjson-2.1.0.11/lua_cjson.c b/bundle/lua-cjson-2.1.0.11/lua_cjson.c -index ff61c47..3b055c4 100644 ---- a/bundle/lua-cjson-2.1.0.11/lua_cjson.c -+++ b/bundle/lua-cjson-2.1.0.11/lua_cjson.c -@@ -40,6 +40,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -177,13 +178,13 @@ typedef struct { - - typedef struct { - json_token_type_t type; -- int index; -+ size_t index; - union { - const char *string; - double number; - int boolean; - } value; -- int string_len; -+ size_t string_len; - } json_token_t; - - static const char *char2escape[256] = { -@@ -544,6 +545,8 @@ static void json_append_string(lua_State *l, strbuf_t *json, int lindex) - * This buffer is reused constantly for small strings - * If there are any excess pages, they won't be hit anyway. - * This gains ~5% speedup. */ -+ if (len > SIZE_MAX / 6 - 3) -+ abort(); /* Overflow check */ - strbuf_ensure_empty_length(json, len * 6 + 2); - - strbuf_append_char_unsafe(json, '\"'); -@@ -818,7 +821,7 @@ static int json_encode(lua_State *l) - strbuf_t local_encode_buf; - strbuf_t *encode_buf; - char *json; -- int len; -+ size_t len; - - luaL_argcheck(l, lua_gettop(l) == 1, 1, "expected 1 argument"); - -diff --git a/bundle/lua-cjson-2.1.0.11/strbuf.c b/bundle/lua-cjson-2.1.0.11/strbuf.c -index ed13367..2dc30be 100644 ---- a/bundle/lua-cjson-2.1.0.11/strbuf.c -+++ b/bundle/lua-cjson-2.1.0.11/strbuf.c -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - #include "strbuf.h" - -@@ -38,22 +39,22 @@ static void die(const char *fmt, ...) - va_end(arg); - fprintf(stderr, "\n"); - -- exit(-1); -+ abort(); - } - --void strbuf_init(strbuf_t *s, int len) -+void strbuf_init(strbuf_t *s, size_t len) - { -- int size; -+ size_t size; - -- if (len <= 0) -+ if (!len) - size = STRBUF_DEFAULT_SIZE; - else -- size = len + 1; /* \0 terminator */ -- -+ size = len + 1; -+ if (size < len) -+ die("Overflow, len: %zu", len); - s->buf = NULL; - s->size = size; - s->length = 0; -- s->increment = STRBUF_DEFAULT_INCREMENT; - s->dynamic = 0; - s->reallocs = 0; - s->debug = 0; -@@ -65,7 +66,7 @@ void strbuf_init(strbuf_t *s, int len) - strbuf_ensure_null(s); - } - --strbuf_t *strbuf_new(int len) -+strbuf_t *strbuf_new(size_t len) - { - strbuf_t *s; - -@@ -81,20 +82,10 @@ strbuf_t *strbuf_new(int len) - return s; - } - --void strbuf_set_increment(strbuf_t *s, int increment) --{ -- /* Increment > 0: Linear buffer growth rate -- * Increment < -1: Exponential buffer growth rate */ -- if (increment == 0 || increment == -1) -- die("BUG: Invalid string increment"); -- -- s->increment = increment; --} -- - static inline void debug_stats(strbuf_t *s) - { - if (s->debug) { -- fprintf(stderr, "strbuf(%lx) reallocs: %d, length: %d, size: %d\n", -+ fprintf(stderr, "strbuf(%lx) reallocs: %d, length: %zd, size: %zd\n", - (long)s, s->reallocs, s->length, s->size); - } - } -@@ -113,7 +104,7 @@ void strbuf_free(strbuf_t *s) - free(s); - } - --char *strbuf_free_to_string(strbuf_t *s, int *len) -+char *strbuf_free_to_string(strbuf_t *s, size_t *len) - { - char *buf; - -@@ -131,57 +122,63 @@ char *strbuf_free_to_string(strbuf_t *s, int *len) - return buf; - } - --static int calculate_new_size(strbuf_t *s, int len) -+static size_t calculate_new_size(strbuf_t *s, size_t len) - { -- int reqsize, newsize; -+ size_t reqsize, newsize; - - if (len <= 0) - die("BUG: Invalid strbuf length requested"); - - /* Ensure there is room for optional NULL termination */ - reqsize = len + 1; -+ if (reqsize < len) -+ die("Overflow, len: %zu", len); - - /* If the user has requested to shrink the buffer, do it exactly */ - if (s->size > reqsize) - return reqsize; - - newsize = s->size; -- if (s->increment < 0) { -+ if (reqsize >= SIZE_MAX / 2) { -+ newsize = reqsize; -+ } else { - /* Exponential sizing */ - while (newsize < reqsize) -- newsize *= -s->increment; -- } else if (s->increment != 0) { -- /* Linear sizing */ -- newsize = ((newsize + s->increment - 1) / s->increment) * s->increment; -+ newsize *= 2; - } - -+ if (newsize < reqsize) -+ die("BUG: strbuf length would overflow, len: %zu", len); -+ -+ - return newsize; - } - - - /* Ensure strbuf can handle a string length bytes long (ignoring NULL - * optional termination). */ --void strbuf_resize(strbuf_t *s, int len) -+void strbuf_resize(strbuf_t *s, size_t len) - { -- int newsize; -+ size_t newsize; - - newsize = calculate_new_size(s, len); - - if (s->debug > 1) { -- fprintf(stderr, "strbuf(%lx) resize: %d => %d\n", -+ fprintf(stderr, "strbuf(%lx) resize: %zd => %zd\n", - (long)s, s->size, newsize); - } - - s->size = newsize; - s->buf = realloc(s->buf, s->size); - if (!s->buf) -- die("Out of memory"); -+ die("Out of memory, len: %zu", len); - s->reallocs++; - } - - void strbuf_append_string(strbuf_t *s, const char *str) - { -- int space, i; -+ int i; -+ size_t space; - - space = strbuf_empty_length(s); - -@@ -197,55 +194,6 @@ void strbuf_append_string(strbuf_t *s, const char *str) - } - } - --/* strbuf_append_fmt() should only be used when an upper bound -- * is known for the output string. */ --void strbuf_append_fmt(strbuf_t *s, int len, const char *fmt, ...) --{ -- va_list arg; -- int fmt_len; -- -- strbuf_ensure_empty_length(s, len); -- -- va_start(arg, fmt); -- fmt_len = vsnprintf(s->buf + s->length, len, fmt, arg); -- va_end(arg); -- -- if (fmt_len < 0) -- die("BUG: Unable to convert number"); /* This should never happen.. */ -- -- s->length += fmt_len; --} -- --/* strbuf_append_fmt_retry() can be used when the there is no known -- * upper bound for the output string. */ --void strbuf_append_fmt_retry(strbuf_t *s, const char *fmt, ...) --{ -- va_list arg; -- int fmt_len, try; -- int empty_len; -- -- /* If the first attempt to append fails, resize the buffer appropriately -- * and try again */ -- for (try = 0; ; try++) { -- va_start(arg, fmt); -- /* Append the new formatted string */ -- /* fmt_len is the length of the string required, excluding the -- * trailing NULL */ -- empty_len = strbuf_empty_length(s); -- /* Add 1 since there is also space to store the terminating NULL. */ -- fmt_len = vsnprintf(s->buf + s->length, empty_len + 1, fmt, arg); -- va_end(arg); -- -- if (fmt_len <= empty_len) -- break; /* SUCCESS */ -- if (try > 0) -- die("BUG: length of formatted string changed"); -- -- strbuf_resize(s, s->length + fmt_len); -- } -- -- s->length += fmt_len; --} - - /* vi:ai et sw=4 ts=4: - */ -diff --git a/bundle/lua-cjson-2.1.0.11/strbuf.h b/bundle/lua-cjson-2.1.0.11/strbuf.h -index 5df0b7b..d77e0f4 100644 ---- a/bundle/lua-cjson-2.1.0.11/strbuf.h -+++ b/bundle/lua-cjson-2.1.0.11/strbuf.h -@@ -32,15 +32,13 @@ - - /* Size: Total bytes allocated to *buf - * Length: String length, excluding optional NULL terminator. -- * Increment: Allocation increments when resizing the string buffer. - * Dynamic: True if created via strbuf_new() - */ - - typedef struct { - char *buf; -- int size; -- int length; -- int increment; -+ size_t size; -+ size_t length; - int dynamic; - int reallocs; - int debug; -@@ -49,32 +47,27 @@ typedef struct { - #ifndef STRBUF_DEFAULT_SIZE - #define STRBUF_DEFAULT_SIZE 1023 - #endif --#ifndef STRBUF_DEFAULT_INCREMENT --#define STRBUF_DEFAULT_INCREMENT -2 --#endif - - /* Initialise */ --extern strbuf_t *strbuf_new(int len); --extern void strbuf_init(strbuf_t *s, int len); --extern void strbuf_set_increment(strbuf_t *s, int increment); -+extern strbuf_t *strbuf_new(size_t len); -+extern void strbuf_init(strbuf_t *s, size_t len); - - /* Release */ - extern void strbuf_free(strbuf_t *s); --extern char *strbuf_free_to_string(strbuf_t *s, int *len); -+extern char *strbuf_free_to_string(strbuf_t *s, size_t *len); - - /* Management */ --extern void strbuf_resize(strbuf_t *s, int len); --static int strbuf_empty_length(strbuf_t *s); --static int strbuf_length(strbuf_t *s); --static char *strbuf_string(strbuf_t *s, int *len); --static void strbuf_ensure_empty_length(strbuf_t *s, int len); -+extern void strbuf_resize(strbuf_t *s, size_t len); -+static size_t strbuf_empty_length(strbuf_t *s); -+static size_t strbuf_length(strbuf_t *s); -+static char *strbuf_string(strbuf_t *s, size_t *len); -+static void strbuf_ensure_empty_length(strbuf_t *s, size_t len); - static char *strbuf_empty_ptr(strbuf_t *s); --static void strbuf_extend_length(strbuf_t *s, int len); -+static void strbuf_extend_length(strbuf_t *s, size_t len); -+static void strbuf_set_length(strbuf_t *s, int len); - - /* Update */ --extern void strbuf_append_fmt(strbuf_t *s, int len, const char *fmt, ...); --extern void strbuf_append_fmt_retry(strbuf_t *s, const char *format, ...); --static void strbuf_append_mem(strbuf_t *s, const char *c, int len); -+static void strbuf_append_mem(strbuf_t *s, const char *c, size_t len); - extern void strbuf_append_string(strbuf_t *s, const char *str); - static void strbuf_append_char(strbuf_t *s, const char c); - static void strbuf_ensure_null(strbuf_t *s); -@@ -92,12 +85,12 @@ static inline int strbuf_allocated(strbuf_t *s) - - /* Return bytes remaining in the string buffer - * Ensure there is space for a NULL terminator. */ --static inline int strbuf_empty_length(strbuf_t *s) -+static inline size_t strbuf_empty_length(strbuf_t *s) - { - return s->size - s->length - 1; - } - --static inline void strbuf_ensure_empty_length(strbuf_t *s, int len) -+static inline void strbuf_ensure_empty_length(strbuf_t *s, size_t len) - { - if (len > strbuf_empty_length(s)) - strbuf_resize(s, s->length + len); -@@ -108,12 +101,17 @@ static inline char *strbuf_empty_ptr(strbuf_t *s) - return s->buf + s->length; - } - --static inline void strbuf_extend_length(strbuf_t *s, int len) -+static inline void strbuf_set_length(strbuf_t *s, int len) -+{ -+ s->length = len; -+} -+ -+static inline void strbuf_extend_length(strbuf_t *s, size_t len) - { - s->length += len; - } - --static inline int strbuf_length(strbuf_t *s) -+static inline size_t strbuf_length(strbuf_t *s) - { - return s->length; - } -@@ -129,14 +127,14 @@ static inline void strbuf_append_char_unsafe(strbuf_t *s, const char c) - s->buf[s->length++] = c; - } - --static inline void strbuf_append_mem(strbuf_t *s, const char *c, int len) -+static inline void strbuf_append_mem(strbuf_t *s, const char *c, size_t len) - { - strbuf_ensure_empty_length(s, len); - memcpy(s->buf + s->length, c, len); - s->length += len; - } - --static inline void strbuf_append_mem_unsafe(strbuf_t *s, const char *c, int len) -+static inline void strbuf_append_mem_unsafe(strbuf_t *s, const char *c, size_t len) - { - memcpy(s->buf + s->length, c, len); - s->length += len; -@@ -147,7 +145,7 @@ static inline void strbuf_ensure_null(strbuf_t *s) - s->buf[s->length] = 0; - } - --static inline char *strbuf_string(strbuf_t *s, int *len) -+static inline char *strbuf_string(strbuf_t *s, size_t *len) - { - if (len) - *len = s->length; diff --git a/build/openresty/patches/lua-resty-core-0.1.27_01-dyn_upstream_keepalive.patch b/build/openresty/patches/lua-resty-core-0.1.28_01-dyn_upstream_keepalive.patch similarity index 96% rename from build/openresty/patches/lua-resty-core-0.1.27_01-dyn_upstream_keepalive.patch rename to build/openresty/patches/lua-resty-core-0.1.28_01-dyn_upstream_keepalive.patch index 82107d5c72a..92bb00f7984 100644 --- a/build/openresty/patches/lua-resty-core-0.1.27_01-dyn_upstream_keepalive.patch +++ b/build/openresty/patches/lua-resty-core-0.1.28_01-dyn_upstream_keepalive.patch @@ -1,6 +1,6 @@ -diff -ruN a/bundle/lua-resty-core-0.1.27/lib/ngx/balancer.lua b/bundle/lua-resty-core-0.1.27/lib/ngx/balancer.lua ---- a/bundle/lua-resty-core-0.1.27/lib/ngx/balancer.lua 2022-12-02 10:58:50.078203826 +0800 -+++ b/bundle/lua-resty-core-0.1.27/lib/ngx/balancer.lua 2022-12-03 11:50:57.271540206 +0800 +diff -ruN a/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.lua b/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.lua +--- a/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.lua 2022-12-02 10:58:50.078203826 +0800 ++++ b/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.lua 2022-12-03 11:50:57.271540206 +0800 @@ -19,6 +19,7 @@ local max = math.max local subsystem = ngx.config.subsystem diff --git a/build/openresty/patches/lua-resty-dns-0.22_01-destroy_resolver.patch b/build/openresty/patches/lua-resty-dns-0.22_01-destroy_resolver.patch deleted file mode 100644 index e52797c4b6a..00000000000 --- a/build/openresty/patches/lua-resty-dns-0.22_01-destroy_resolver.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/bundle/lua-resty-dns-0.22/lib/resty/dns/resolver.lua b/bundle/lua-resty-dns-0.22/lib/resty/dns/resolver.lua -index a67b3c1..0305485 100644 ---- a/bundle/lua-resty-dns-0.22/lib/resty/dns/resolver.lua -+++ b/bundle/lua-resty-dns-0.22/lib/resty/dns/resolver.lua -@@ -99,6 +99,26 @@ for i = 2, 64, 2 do - arpa_tmpl[i] = DOT_CHAR - end - -+local function udp_socks_close(self) -+ if self.socks == nil then -+ return -+ end -+ -+ for _, sock in ipairs(self.socks) do -+ sock:close() -+ end -+ -+ self.socks = nil -+end -+ -+local function tcp_socks_close(self) -+ if self.tcp_sock == nil then -+ return -+ end -+ -+ self.tcp_sock:close() -+ self.tcp_sock = nil -+end - - function _M.new(class, opts) - if not opts then -@@ -161,6 +181,14 @@ function _M.new(class, opts) - }, mt) - end - -+function _M:destroy() -+ udp_socks_close(self) -+ tcp_socks_close(self) -+ self.cur = nil -+ self.servers = nil -+ self.retrans = nil -+ self.no_recurse = nil -+end - - local function pick_sock(self, socks) - local cur = self.cur diff --git a/build/openresty/patches/nginx-1.21.4_01-upstream_client_certificate_and_ssl_verify.patch b/build/openresty/patches/nginx-1.25.3_01-upstream_client_certificate_and_ssl_verify.patch similarity index 85% rename from build/openresty/patches/nginx-1.21.4_01-upstream_client_certificate_and_ssl_verify.patch rename to build/openresty/patches/nginx-1.25.3_01-upstream_client_certificate_and_ssl_verify.patch index ddb98273fee..a96f095e034 100644 --- a/build/openresty/patches/nginx-1.21.4_01-upstream_client_certificate_and_ssl_verify.patch +++ b/build/openresty/patches/nginx-1.25.3_01-upstream_client_certificate_and_ssl_verify.patch @@ -1,7 +1,7 @@ -diff --git a/bundle/nginx-1.21.4/src/http/ngx_http_upstream.c b/bundle/nginx-1.21.4/src/http/ngx_http_upstream.c +diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c b/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c index 90710557..539a4db9 100644 ---- a/bundle/nginx-1.21.4/src/http/ngx_http_upstream.c -+++ b/bundle/nginx-1.21.4/src/http/ngx_http_upstream.c +--- a/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c ++++ b/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c @@ -8,6 +8,9 @@ #include #include diff --git a/build/openresty/patches/nginx-1.21.4_02-remove-server-tokens-from-special-responses-output.patch b/build/openresty/patches/nginx-1.25.3_02-remove-server-tokens-from-special-responses-output.patch similarity index 70% rename from build/openresty/patches/nginx-1.21.4_02-remove-server-tokens-from-special-responses-output.patch rename to build/openresty/patches/nginx-1.25.3_02-remove-server-tokens-from-special-responses-output.patch index 51143949e43..5c4afd623dc 100644 --- a/build/openresty/patches/nginx-1.21.4_02-remove-server-tokens-from-special-responses-output.patch +++ b/build/openresty/patches/nginx-1.25.3_02-remove-server-tokens-from-special-responses-output.patch @@ -4,13 +4,13 @@ Date: Fri, 16 Aug 2019 13:41:49 +0300 Subject: [PATCH] remove server tokens from special responses output --- - nginx-1.21.4/src/http/ngx_http_special_response.c | 3 --- + nginx-1.25.3/src/http/ngx_http_special_response.c | 3 --- 1 file changed, 3 deletions(-) -diff --git a/bundle/nginx-1.21.4/src/http/ngx_http_special_response.c b/bundle/nginx-1.21.4/src/http/ngx_http_special_response.c +diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_special_response.c b/bundle/nginx-1.25.3/src/http/ngx_http_special_response.c index 4b8bbf5..524cc7b 100644 ---- a/bundle/nginx-1.21.4/src/http/ngx_http_special_response.c -+++ b/bundle/nginx-1.21.4/src/http/ngx_http_special_response.c +--- a/bundle/nginx-1.25.3/src/http/ngx_http_special_response.c ++++ b/bundle/nginx-1.25.3/src/http/ngx_http_special_response.c @@ -19,21 +19,18 @@ static ngx_int_t ngx_http_send_refresh(ngx_http_request_t *r); diff --git a/build/openresty/patches/nginx-1.21.4_03-stream_upstream_client_certificate_and_ssl_verify.patch b/build/openresty/patches/nginx-1.25.3_03-stream_upstream_client_certificate_and_ssl_verify.patch similarity index 82% rename from build/openresty/patches/nginx-1.21.4_03-stream_upstream_client_certificate_and_ssl_verify.patch rename to build/openresty/patches/nginx-1.25.3_03-stream_upstream_client_certificate_and_ssl_verify.patch index bc9ea8732ec..72240c0c610 100644 --- a/build/openresty/patches/nginx-1.21.4_03-stream_upstream_client_certificate_and_ssl_verify.patch +++ b/build/openresty/patches/nginx-1.25.3_03-stream_upstream_client_certificate_and_ssl_verify.patch @@ -1,7 +1,7 @@ -diff --git a/bundle/nginx-1.21.4/src/stream/ngx_stream_proxy_module.c b/bundle/nginx-1.21.4/src/stream/ngx_stream_proxy_module.c +diff --git a/bundle/nginx-1.25.3/src/stream/ngx_stream_proxy_module.c b/bundle/nginx-1.25.3/src/stream/ngx_stream_proxy_module.c index b11c288..4ae9e7b 100644 ---- a/bundle/nginx-1.21.4/src/stream/ngx_stream_proxy_module.c -+++ b/bundle/nginx-1.21.4/src/stream/ngx_stream_proxy_module.c +--- a/bundle/nginx-1.25.3/src/stream/ngx_stream_proxy_module.c ++++ b/bundle/nginx-1.25.3/src/stream/ngx_stream_proxy_module.c @@ -8,6 +8,9 @@ #include #include @@ -18,13 +18,13 @@ index b11c288..4ae9e7b 100644 +#if (NGX_STREAM_LUA_KONG) + -+ if (pc->type == SOCK_STREAM && pscf->ssl ++ if (pc->type == SOCK_STREAM && pscf->ssl_enable + && !ngx_stream_lua_kong_get_proxy_ssl_disable(s)) + { + +#else + - if (pc->type == SOCK_STREAM && pscf->ssl) { + if (pc->type == SOCK_STREAM && pscf->ssl_enable) { +#endif + diff --git a/build/openresty/patches/nginx-1.21.4_04-grpc_authority_override.patch b/build/openresty/patches/nginx-1.25.3_04-grpc_authority_override.patch similarity index 85% rename from build/openresty/patches/nginx-1.21.4_04-grpc_authority_override.patch rename to build/openresty/patches/nginx-1.25.3_04-grpc_authority_override.patch index 2f7cded8520..bc9107d350e 100644 --- a/build/openresty/patches/nginx-1.21.4_04-grpc_authority_override.patch +++ b/build/openresty/patches/nginx-1.25.3_04-grpc_authority_override.patch @@ -1,7 +1,7 @@ diff --git a/bundle/nginx-1.19.3/src/http/modules/ngx_http_grpc_module.c b/bundle/nginx-1.19.3/src/http/modules/ngx_http_grpc_module.c index d4af66db..10d3aaed 100644 ---- a/bundle/nginx-1.21.4/src/http/modules/ngx_http_grpc_module.c -+++ b/bundle/nginx-1.21.4/src/http/modules/ngx_http_grpc_module.c +--- a/bundle/nginx-1.25.3/src/http/modules/ngx_http_grpc_module.c ++++ b/bundle/nginx-1.25.3/src/http/modules/ngx_http_grpc_module.c @@ -8,6 +8,9 @@ #include #include diff --git a/build/openresty/patches/nginx-1.21.4_05-remove-server-headers-from-ngx-header-filter-module.patch b/build/openresty/patches/nginx-1.25.3_05-remove-server-headers-from-ngx-header-filter-module.patch similarity index 87% rename from build/openresty/patches/nginx-1.21.4_05-remove-server-headers-from-ngx-header-filter-module.patch rename to build/openresty/patches/nginx-1.25.3_05-remove-server-headers-from-ngx-header-filter-module.patch index e76dcb87fbd..0cc3a3a2854 100644 --- a/build/openresty/patches/nginx-1.21.4_05-remove-server-headers-from-ngx-header-filter-module.patch +++ b/build/openresty/patches/nginx-1.25.3_05-remove-server-headers-from-ngx-header-filter-module.patch @@ -4,13 +4,13 @@ Date: Tue, 15 Jun 2021 16:04:06 +0300 Subject: [PATCH] remove server headers from nginx header filter module --- - nginx-1.21.4/src/http/ngx_http_header_filter_module.c | 34 ------------------- + nginx-1.25.3/src/http/ngx_http_header_filter_module.c | 34 ------------------- 1 file changed, 34 deletions(-) -diff --git a/bundle/nginx-1.21.4/src/http/ngx_http_header_filter_module.c b/bundle/nginx-1.21.4/src/http/ngx_http_header_filter_module.c +diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_header_filter_module.c b/bundle/nginx-1.25.3/src/http/ngx_http_header_filter_module.c index ca13f2a..1a07dac 100644 ---- a/bundle/nginx-1.21.4/src/http/ngx_http_header_filter_module.c -+++ b/bundle/nginx-1.21.4/src/http/ngx_http_header_filter_module.c +--- a/bundle/nginx-1.25.3/src/http/ngx_http_header_filter_module.c ++++ b/bundle/nginx-1.25.3/src/http/ngx_http_header_filter_module.c @@ -46,11 +46,6 @@ ngx_module_t ngx_http_header_filter_module = { }; diff --git a/build/openresty/patches/nginx-1.21.4_06-dynamic_log_level.patch b/build/openresty/patches/nginx-1.25.3_06-dynamic_log_level.patch similarity index 94% rename from build/openresty/patches/nginx-1.21.4_06-dynamic_log_level.patch rename to build/openresty/patches/nginx-1.25.3_06-dynamic_log_level.patch index f8fcc9fed0c..278ce22f529 100644 --- a/build/openresty/patches/nginx-1.21.4_06-dynamic_log_level.patch +++ b/build/openresty/patches/nginx-1.25.3_06-dynamic_log_level.patch @@ -1,7 +1,7 @@ -diff --git a/bundle/nginx-1.21.4/src/core/ngx_log.c b/bundle/nginx-1.21.4/src/core/ngx_log.c +diff --git a/bundle/nginx-1.25.3/src/core/ngx_log.c b/bundle/nginx-1.25.3/src/core/ngx_log.c index eb7a989..0862d4d 100644 ---- a/bundle/nginx-1.21.4/src/core/ngx_log.c -+++ b/bundle/nginx-1.21.4/src/core/ngx_log.c +--- a/bundle/nginx-1.25.3/src/core/ngx_log.c ++++ b/bundle/nginx-1.25.3/src/core/ngx_log.c @@ -171,8 +171,12 @@ ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, debug_connection = (log->log_level & NGX_LOG_DEBUG_CONNECTION) != 0; @@ -28,10 +28,10 @@ index eb7a989..0862d4d 100644 va_start(args, fmt); ngx_log_error_core(level, log, err, fmt, args); va_end(args); -diff --git a/bundle/nginx-1.21.4/src/core/ngx_log.h b/bundle/nginx-1.21.4/src/core/ngx_log.h +diff --git a/bundle/nginx-1.25.3/src/core/ngx_log.h b/bundle/nginx-1.25.3/src/core/ngx_log.h index da81cf0..8fd3348 100644 ---- a/bundle/nginx-1.21.4/src/core/ngx_log.h -+++ b/bundle/nginx-1.21.4/src/core/ngx_log.h +--- a/bundle/nginx-1.25.3/src/core/ngx_log.h ++++ b/bundle/nginx-1.25.3/src/core/ngx_log.h @@ -72,6 +72,13 @@ struct ngx_log_s { ngx_log_t *next; }; diff --git a/build/openresty/patches/nginx-1.21.4_07-cross.patch b/build/openresty/patches/nginx-1.25.3_07-cross.patch similarity index 91% rename from build/openresty/patches/nginx-1.21.4_07-cross.patch rename to build/openresty/patches/nginx-1.25.3_07-cross.patch index 53abdfdb151..94f577f2f59 100644 --- a/build/openresty/patches/nginx-1.21.4_07-cross.patch +++ b/build/openresty/patches/nginx-1.25.3_07-cross.patch @@ -2,10 +2,10 @@ Rebased from http://cgit.openembedded.org/meta-openembedded/tree/meta-webserver/ =================================================================== -diff --git a/bundle/nginx-1.21.4/auto/feature b/bundle/nginx-1.21.4/auto/feature +diff --git a/bundle/nginx-1.25.3/auto/feature b/bundle/nginx-1.25.3/auto/feature index 3561f59..d6a2889 100644 ---- a/bundle/nginx-1.21.4/auto/feature -+++ b/bundle/nginx-1.21.4/auto/feature +--- a/bundle/nginx-1.25.3/auto/feature ++++ b/bundle/nginx-1.25.3/auto/feature @@ -49,12 +49,20 @@ eval "/bin/sh -c \"$ngx_test\" >> $NGX_AUTOCONF_ERR 2>&1" if [ -x $NGX_AUTOTEST ]; then @@ -70,10 +70,10 @@ index 3561f59..d6a2889 100644 echo " not found" else -diff --git a/bundle/nginx-1.21.4/auto/options b/bundle/nginx-1.21.4/auto/options +diff --git a/bundle/nginx-1.25.3/auto/options b/bundle/nginx-1.25.3/auto/options index 182c799..e9eb7b8 100644 ---- a/bundle/nginx-1.21.4/auto/options -+++ b/bundle/nginx-1.21.4/auto/options +--- a/bundle/nginx-1.25.3/auto/options ++++ b/bundle/nginx-1.25.3/auto/options @@ -400,6 +400,18 @@ $0: warning: the \"--with-sha1-asm\" option is deprecated" --test-build-epoll) NGX_TEST_BUILD_EPOLL=YES ;; --test-build-solaris-sendfilev) NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;; @@ -120,10 +120,10 @@ index 182c799..e9eb7b8 100644 fi -diff --git a/bundle/nginx-1.21.4/auto/types/sizeof b/bundle/nginx-1.21.4/auto/types/sizeof +diff --git a/bundle/nginx-1.25.3/auto/types/sizeof b/bundle/nginx-1.25.3/auto/types/sizeof index 480d8cf..23c5171 100644 ---- a/bundle/nginx-1.21.4/auto/types/sizeof -+++ b/bundle/nginx-1.21.4/auto/types/sizeof +--- a/bundle/nginx-1.25.3/auto/types/sizeof ++++ b/bundle/nginx-1.25.3/auto/types/sizeof @@ -12,9 +12,12 @@ checking for $ngx_type size END @@ -162,10 +162,10 @@ index 480d8cf..23c5171 100644 fi -diff --git a/bundle/nginx-1.21.4/auto/unix b/bundle/nginx-1.21.4/auto/unix +diff --git a/bundle/nginx-1.25.3/auto/unix b/bundle/nginx-1.25.3/auto/unix index b41c70f..febbf3c 100644 ---- a/bundle/nginx-1.21.4/auto/unix -+++ b/bundle/nginx-1.21.4/auto/unix +--- a/bundle/nginx-1.25.3/auto/unix ++++ b/bundle/nginx-1.25.3/auto/unix @@ -592,13 +592,13 @@ ngx_feature_libs= # C types diff --git a/build/openresty/patches/nginx-1.21.4_08-cross-endianness-fix.patch b/build/openresty/patches/nginx-1.25.3_08-cross-endianness-fix.patch similarity index 96% rename from build/openresty/patches/nginx-1.21.4_08-cross-endianness-fix.patch rename to build/openresty/patches/nginx-1.25.3_08-cross-endianness-fix.patch index 6d9e2e5d709..3ee855fa55b 100644 --- a/build/openresty/patches/nginx-1.21.4_08-cross-endianness-fix.patch +++ b/build/openresty/patches/nginx-1.25.3_08-cross-endianness-fix.patch @@ -15,8 +15,8 @@ Signed-off-by: Derek Straka diff --git a/auto/endianness b/auto/endianness index 1b552b6..be84487 100644 ---- a/bundle/nginx-1.21.4/endianness -+++ b/bundle/nginx-1.21.4/auto/endianness +--- a/bundle/nginx-1.25.3/endianness ++++ b/bundle/nginx-1.25.3/auto/endianness @@ -13,7 +13,13 @@ checking for system byte ordering END diff --git a/build/openresty/patches/ngx_lua-0.10.25_01-dyn_upstream_keepalive.patch b/build/openresty/patches/ngx_lua-0.10.26_01-dyn_upstream_keepalive.patch similarity index 97% rename from build/openresty/patches/ngx_lua-0.10.25_01-dyn_upstream_keepalive.patch rename to build/openresty/patches/ngx_lua-0.10.26_01-dyn_upstream_keepalive.patch index f0b20bdd12d..b19a15ae8c0 100644 --- a/build/openresty/patches/ngx_lua-0.10.25_01-dyn_upstream_keepalive.patch +++ b/build/openresty/patches/ngx_lua-0.10.26_01-dyn_upstream_keepalive.patch @@ -1,7 +1,7 @@ -diff --git a/bundle/ngx_lua-0.10.25/src/ngx_http_lua_balancer.c b/bundle/ngx_lua-0.10.25/src/ngx_http_lua_balancer.c +diff --git a/bundle/ngx_lua-0.10.26/src/ngx_http_lua_balancer.c b/bundle/ngx_lua-0.10.26/src/ngx_http_lua_balancer.c index af4da73..407c115 100644 ---- a/bundle/ngx_lua-0.10.25/src/ngx_http_lua_balancer.c -+++ b/bundle/ngx_lua-0.10.25/src/ngx_http_lua_balancer.c +--- a/bundle/ngx_lua-0.10.26/src/ngx_http_lua_balancer.c ++++ b/bundle/ngx_lua-0.10.26/src/ngx_http_lua_balancer.c @@ -16,46 +16,104 @@ #include "ngx_http_lua_directive.h" @@ -1149,11 +1149,11 @@ index af4da73..407c115 100644 if (r->upstream_states && r->upstream_states->nelts > 1) { state = r->upstream_states->elts; -diff --git a/bundle/ngx_lua-0.10.25/src/ngx_http_lua_common.h b/bundle/ngx_lua-0.10.25/src/ngx_http_lua_common.h -index 8435045..ea45f3a 100644 ---- a/bundle/ngx_lua-0.10.25/src/ngx_http_lua_common.h -+++ b/bundle/ngx_lua-0.10.25/src/ngx_http_lua_common.h -@@ -247,13 +247,6 @@ struct ngx_http_lua_main_conf_s { +diff --git a/bundle/ngx_lua-0.10.26/src/ngx_http_lua_common.h b/bundle/ngx_lua-0.10.26/src/ngx_http_lua_common.h +index 4c94629..bec484e 100644 +--- a/bundle/ngx_lua-0.10.26/src/ngx_http_lua_common.h ++++ b/bundle/ngx_lua-0.10.26/src/ngx_http_lua_common.h +@@ -258,13 +258,6 @@ struct ngx_http_lua_main_conf_s { ngx_str_t exit_worker_src; u_char *exit_worker_chunkname; @@ -1167,7 +1167,7 @@ index 8435045..ea45f3a 100644 ngx_chain_t *body_filter_chain; /* neither yielding nor recursion is possible in * body_filter_by_lua*, so there cannot be any races among -@@ -348,6 +341,10 @@ union ngx_http_lua_srv_conf_u { +@@ -359,6 +352,10 @@ union ngx_http_lua_srv_conf_u { } srv; struct { @@ -1178,13 +1178,13 @@ index 8435045..ea45f3a 100644 ngx_http_lua_srv_conf_handler_pt handler; ngx_str_t src; u_char *src_key; -diff --git a/bundle/ngx_lua-0.10.25/src/ngx_http_lua_module.c b/bundle/ngx_lua-0.10.25/src/ngx_http_lua_module.c -index 16f4424..b3b0d72 100644 ---- a/bundle/ngx_lua-0.10.25/src/ngx_http_lua_module.c -+++ b/bundle/ngx_lua-0.10.25/src/ngx_http_lua_module.c -@@ -1158,6 +1158,9 @@ ngx_http_lua_create_srv_conf(ngx_conf_t *cf) - * lscf->srv.ssl_session_fetch_chunkname = NULL; - * lscf->srv.ssl_session_fetch_src_key = NULL; +diff --git a/bundle/ngx_lua-0.10.26/src/ngx_http_lua_module.c b/bundle/ngx_lua-0.10.26/src/ngx_http_lua_module.c +index fb10bf9..c2f085b 100644 +--- a/bundle/ngx_lua-0.10.26/src/ngx_http_lua_module.c ++++ b/bundle/ngx_lua-0.10.26/src/ngx_http_lua_module.c +@@ -1188,6 +1188,9 @@ ngx_http_lua_create_srv_conf(ngx_conf_t *cf) + * lscf->srv.ssl_sess_fetch_chunkname = NULL; + * lscf->srv.ssl_sess_fetch_src_key = NULL; * + * lscf->balancer.original_init_upstream = NULL; + * lscf->balancer.original_init_peer = NULL; diff --git a/build/openresty/patches/ngx_lua-0.10.25_02-dynamic_log_level.patch b/build/openresty/patches/ngx_lua-0.10.26_02-dynamic_log_level.patch similarity index 77% rename from build/openresty/patches/ngx_lua-0.10.25_02-dynamic_log_level.patch rename to build/openresty/patches/ngx_lua-0.10.26_02-dynamic_log_level.patch index 3bf625a043f..01ecf47f32a 100644 --- a/build/openresty/patches/ngx_lua-0.10.25_02-dynamic_log_level.patch +++ b/build/openresty/patches/ngx_lua-0.10.26_02-dynamic_log_level.patch @@ -1,7 +1,7 @@ -diff --git a/bundle/ngx_lua-0.10.25/src/ngx_http_lua_log.c b/bundle/ngx_lua-0.10.25/src/ngx_http_lua_log.c +diff --git a/bundle/ngx_lua-0.10.26/src/ngx_http_lua_log.c b/bundle/ngx_lua-0.10.26/src/ngx_http_lua_log.c index 43ab820..d18fd05 100644 ---- a/bundle/ngx_lua-0.10.25/src/ngx_http_lua_log.c -+++ b/bundle/ngx_lua-0.10.25/src/ngx_http_lua_log.c +--- a/bundle/ngx_lua-0.10.26/src/ngx_http_lua_log.c ++++ b/bundle/ngx_lua-0.10.26/src/ngx_http_lua_log.c @@ -101,7 +101,11 @@ log_wrapper(ngx_log_t *log, const char *ident, ngx_uint_t level, const char *msg; lua_Debug ar; diff --git a/build/openresty/patches/ngx_stream_lua-0.0.13_01-expose_request_struct.patch b/build/openresty/patches/ngx_stream_lua-0.0.14_01-expose_request_struct.patch similarity index 58% rename from build/openresty/patches/ngx_stream_lua-0.0.13_01-expose_request_struct.patch rename to build/openresty/patches/ngx_stream_lua-0.0.14_01-expose_request_struct.patch index 5cd8001ec56..e758343b236 100644 --- a/build/openresty/patches/ngx_stream_lua-0.0.13_01-expose_request_struct.patch +++ b/build/openresty/patches/ngx_stream_lua-0.0.14_01-expose_request_struct.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Sync with meta-lua-nginx-module 1330009671cd86eaf045f9f2c5cda3727a94570f. --- - ngx_stream_lua-0.0.13/src/api/ngx_stream_lua_api.h | 3 +++ + ngx_stream_lua-0.0.14/src/api/ngx_stream_lua_api.h | 3 +++ 1 file changed, 3 insertions(+) -diff --git a/bundle/ngx_stream_lua-0.0.13/src/api/ngx_stream_lua_api.h b/bundle/ngx_stream_lua-0.0.13/src/api/ngx_stream_lua_api.h +diff --git a/bundle/ngx_stream_lua-0.0.14/src/api/ngx_stream_lua_api.h b/bundle/ngx_stream_lua-0.0.14/src/api/ngx_stream_lua_api.h index 0e5a18f..040ef84 100644 ---- a/bundle/ngx_stream_lua-0.0.13/src/api/ngx_stream_lua_api.h -+++ b/bundle/ngx_stream_lua-0.0.13/src/api/ngx_stream_lua_api.h +--- a/bundle/ngx_stream_lua-0.0.14/src/api/ngx_stream_lua_api.h ++++ b/bundle/ngx_stream_lua-0.0.14/src/api/ngx_stream_lua_api.h @@ -21,6 +21,9 @@ From e6899dcc989cc5d180267b5cbc0d44546a4d0e35 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 11 Jan 2024 09:32:38 +0800 Subject: [PATCH 04/17] default tls1.3 since nginx 1.23.4 --- spec/03-plugins/01-tcp-log/01-tcp-log_spec.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/03-plugins/01-tcp-log/01-tcp-log_spec.lua b/spec/03-plugins/01-tcp-log/01-tcp-log_spec.lua index a2751611fd5..3c97a4c69cb 100644 --- a/spec/03-plugins/01-tcp-log/01-tcp-log_spec.lua +++ b/spec/03-plugins/01-tcp-log/01-tcp-log_spec.lua @@ -473,7 +473,7 @@ for _, strategy in helpers.each_strategy() do -- Making sure it's alright local log_message = cjson.decode(res) - assert.equal("TLSv1.2", log_message.request.tls.version) + assert.equal("TLSv1.3", log_message.request.tls.version) assert.is_string(log_message.request.tls.cipher) assert.equal("NONE", log_message.request.tls.client_verify) end) @@ -500,7 +500,7 @@ for _, strategy in helpers.each_strategy() do -- Making sure it's alright local log_message = cjson.decode(res) - assert.equal("TLSv1.2", log_message.request.tls.version) + assert.equal("TLSv1.3", log_message.request.tls.version) assert.is_string(log_message.request.tls.cipher) assert.equal("SUCCESS", log_message.request.tls.client_verify) end) From 235b1873c0e9a7b104280405232a409e82cae9cf Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 11 Jan 2024 09:45:08 +0800 Subject: [PATCH 05/17] disable listen http2 warning temporarily --- .../nginx-1.25.3_09-listen-http2-warning-fix.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 build/openresty/patches/nginx-1.25.3_09-listen-http2-warning-fix.patch diff --git a/build/openresty/patches/nginx-1.25.3_09-listen-http2-warning-fix.patch b/build/openresty/patches/nginx-1.25.3_09-listen-http2-warning-fix.patch new file mode 100644 index 00000000000..7073b372ff1 --- /dev/null +++ b/build/openresty/patches/nginx-1.25.3_09-listen-http2-warning-fix.patch @@ -0,0 +1,13 @@ +diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_core_module.c b/bundle/nginx-1.25.3/src/http/ngx_http_core_module.c +index 7845f8f..1676116 100644 +--- a/bundle/nginx-1.25.3/src/http/ngx_http_core_module.c ++++ b/bundle/nginx-1.25.3/src/http/ngx_http_core_module.c +@@ -4184,7 +4184,7 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) + + if (ngx_strcmp(value[n].data, "http2") == 0) { + #if (NGX_HTTP_V2) +- ngx_conf_log_error(NGX_LOG_WARN, cf, 0, ++ ngx_conf_log_error(NGX_LOG_NOTICE, cf, 0, + "the \"listen ... http2\" directive " + "is deprecated, use " + "the \"http2\" directive instead"); From be13077ca6df6f43a48a0f0926f09653ede6f445 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 11 Jan 2024 10:52:58 +0800 Subject: [PATCH 06/17] fix pdk.request.get_header --- kong/pdk/request.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kong/pdk/request.lua b/kong/pdk/request.lua index 10bb08dfe5d..d23ee85a02d 100644 --- a/kong/pdk/request.lua +++ b/kong/pdk/request.lua @@ -625,7 +625,17 @@ local function new(self) error("header name must be a string", 2) end - return var["http_" .. replace_dashes(name)] + local value = var["http_" .. replace_dashes(name)] + + if value then + local p = find(value, ",", 1, true) -- changed since nginx 1.23.0 + + if p then + value = sub(value, 1, p - 1) + end + end + + return value end From bec270d470bc4530fa8f902a9c0889a3f7c217b3 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 11 Jan 2024 12:48:24 +0800 Subject: [PATCH 07/17] clean patches --- .../LuaJIT-2.1-20231117_02_pass_cc_env.patch | 12 +++++----- ...am_client_certificate_and_ssl_verify.patch | 24 +++++++++---------- ...am_client_certificate_and_ssl_verify.patch | 10 ++++---- ...nx-1.25.3_04-grpc_authority_override.patch | 14 +++++------ ...eaders-from-ngx-header-filter-module.patch | 17 +++---------- .../patches/nginx-1.25.3_07-cross.patch | 20 +++++++--------- .../openresty_01-custom_prefix_and_cc.patch | 14 +++++------ 7 files changed, 48 insertions(+), 63 deletions(-) diff --git a/build/openresty/patches/LuaJIT-2.1-20231117_02_pass_cc_env.patch b/build/openresty/patches/LuaJIT-2.1-20231117_02_pass_cc_env.patch index 8814c96503b..450682ff2ac 100644 --- a/build/openresty/patches/LuaJIT-2.1-20231117_02_pass_cc_env.patch +++ b/build/openresty/patches/LuaJIT-2.1-20231117_02_pass_cc_env.patch @@ -1,8 +1,8 @@ diff --git a/bundle/LuaJIT-2.1-20231117/src/Makefile b/bundle/LuaJIT-2.1-20231117/src/Makefile -index 68a9a7c..8d2de33 100644 +index d80e45a..f87762e 100644 --- a/bundle/LuaJIT-2.1-20231117/src/Makefile +++ b/bundle/LuaJIT-2.1-20231117/src/Makefile -@@ -27,7 +27,8 @@ NODOTABIVER= 51 +@@ -26,7 +26,8 @@ NODOTABIVER= 51 DEFAULT_CC = gcc # # LuaJIT builds as a native 32 or 64 bit binary by default. @@ -12,18 +12,18 @@ index 68a9a7c..8d2de33 100644 # # Use this if you want to force a 32 bit build on a 64 bit multilib OS. #CC= $(DEFAULT_CC) -m32 -@@ -211,7 +212,7 @@ TARGET_CC= $(STATIC_CC) +@@ -210,7 +211,7 @@ TARGET_CC= $(STATIC_CC) TARGET_STCC= $(STATIC_CC) TARGET_DYNCC= $(DYNAMIC_CC) TARGET_LD= $(CROSS)$(CC) -TARGET_AR= $(CROSS)ar rcus +TARGET_AR= $(CROSS)$(AR) rcus TARGET_STRIP= $(CROSS)strip - + TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib) -@@ -291,11 +292,11 @@ TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) +@@ -290,11 +291,11 @@ TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH)) - + ifneq (,$(PREFIX)) -ifneq (/usr/local,$(PREFIX)) - TARGET_XCFLAGS+= -DLUA_ROOT=\"$(PREFIX)\" diff --git a/build/openresty/patches/nginx-1.25.3_01-upstream_client_certificate_and_ssl_verify.patch b/build/openresty/patches/nginx-1.25.3_01-upstream_client_certificate_and_ssl_verify.patch index a96f095e034..6fb22a4acd9 100644 --- a/build/openresty/patches/nginx-1.25.3_01-upstream_client_certificate_and_ssl_verify.patch +++ b/build/openresty/patches/nginx-1.25.3_01-upstream_client_certificate_and_ssl_verify.patch @@ -1,5 +1,5 @@ diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c b/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c -index 90710557..539a4db9 100644 +index 2be233c..f364448 100644 --- a/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c +++ b/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c @@ -8,6 +8,9 @@ @@ -9,13 +9,13 @@ index 90710557..539a4db9 100644 +#if (NGX_HTTP_LUA_KONG) +#include +#endif - - + + #if (NGX_HTTP_CACHE) -@@ -1698,7 +1698,14 @@ +@@ -1714,7 +1717,14 @@ ngx_http_upstream_ssl_init_connection(ngx_http_request_t *r, return; } - + + +#if (NGX_HTTP_LUA_KONG) + if (u->conf->ssl_server_name @@ -27,26 +27,26 @@ index 90710557..539a4db9 100644 if (ngx_http_upstream_ssl_name(r, u, c) != NGX_OK) { ngx_http_upstream_finalize_request(r, u, NGX_HTTP_INTERNAL_SERVER_ERROR); -@@ -1736,6 +1739,10 @@ ngx_http_upstream_ssl_init_connection(ngx_http_request_t *r, +@@ -1754,6 +1764,10 @@ ngx_http_upstream_ssl_init_connection(ngx_http_request_t *r, } } - + +#if (NGX_HTTP_LUA_KONG) + ngx_http_lua_kong_set_upstream_ssl(r, c); +#endif + r->connection->log->action = "SSL handshaking to upstream"; - + rc = ngx_ssl_handshake(c); -@@ -1785,7 +1785,11 @@ - +@@ -1803,7 +1817,11 @@ ngx_http_upstream_ssl_handshake(ngx_http_request_t *r, ngx_http_upstream_t *u, + if (c->ssl->handshaked) { - + +#if (NGX_HTTP_LUA_KONG) + if (ngx_http_lua_kong_get_upstream_ssl_verify(r, u->conf->ssl_verify)) { +#else if (u->conf->ssl_verify) { +#endif rc = SSL_get_verify_result(c->ssl->connection); - + if (rc != X509_V_OK) { diff --git a/build/openresty/patches/nginx-1.25.3_03-stream_upstream_client_certificate_and_ssl_verify.patch b/build/openresty/patches/nginx-1.25.3_03-stream_upstream_client_certificate_and_ssl_verify.patch index 72240c0c610..36fc66d4062 100644 --- a/build/openresty/patches/nginx-1.25.3_03-stream_upstream_client_certificate_and_ssl_verify.patch +++ b/build/openresty/patches/nginx-1.25.3_03-stream_upstream_client_certificate_and_ssl_verify.patch @@ -1,5 +1,5 @@ diff --git a/bundle/nginx-1.25.3/src/stream/ngx_stream_proxy_module.c b/bundle/nginx-1.25.3/src/stream/ngx_stream_proxy_module.c -index b11c288..4ae9e7b 100644 +index 82dca1e..f12cda2 100644 --- a/bundle/nginx-1.25.3/src/stream/ngx_stream_proxy_module.c +++ b/bundle/nginx-1.25.3/src/stream/ngx_stream_proxy_module.c @@ -8,6 +8,9 @@ @@ -12,7 +12,7 @@ index b11c288..4ae9e7b 100644 typedef struct { -@@ -821,8 +824,18 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s) +@@ -823,8 +826,18 @@ ngx_stream_proxy_init_upstream(ngx_stream_session_t *s) #if (NGX_STREAM_SSL) @@ -31,7 +31,7 @@ index b11c288..4ae9e7b 100644 if (u->proxy_protocol) { if (ngx_stream_proxy_send_proxy_protocol(s) != NGX_OK) { return; -@@ -1085,7 +1098,16 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s) +@@ -1089,7 +1102,16 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s) return; } @@ -49,7 +49,7 @@ index b11c288..4ae9e7b 100644 if (ngx_stream_proxy_ssl_name(s) != NGX_OK) { ngx_stream_proxy_finalize(s, NGX_STREAM_INTERNAL_SERVER_ERROR); return; -@@ -1110,6 +1132,10 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s) +@@ -1116,6 +1138,10 @@ ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s) } } @@ -60,7 +60,7 @@ index b11c288..4ae9e7b 100644 s->connection->log->action = "SSL handshaking to upstream"; rc = ngx_ssl_handshake(pc); -@@ -1142,7 +1168,15 @@ ngx_stream_proxy_ssl_handshake(ngx_connection_t *pc) +@@ -1148,7 +1174,15 @@ ngx_stream_proxy_ssl_handshake(ngx_connection_t *pc) if (pc->ssl->handshaked) { diff --git a/build/openresty/patches/nginx-1.25.3_04-grpc_authority_override.patch b/build/openresty/patches/nginx-1.25.3_04-grpc_authority_override.patch index bc9107d350e..3b9d137e00e 100644 --- a/build/openresty/patches/nginx-1.25.3_04-grpc_authority_override.patch +++ b/build/openresty/patches/nginx-1.25.3_04-grpc_authority_override.patch @@ -1,5 +1,5 @@ -diff --git a/bundle/nginx-1.19.3/src/http/modules/ngx_http_grpc_module.c b/bundle/nginx-1.19.3/src/http/modules/ngx_http_grpc_module.c -index d4af66db..10d3aaed 100644 +diff --git a/bundle/nginx-1.25.3/src/http/modules/ngx_http_grpc_module.c b/bundle/nginx-1.25.3/src/http/modules/ngx_http_grpc_module.c +index dfe49c5..db85ca3 100644 --- a/bundle/nginx-1.25.3/src/http/modules/ngx_http_grpc_module.c +++ b/bundle/nginx-1.25.3/src/http/modules/ngx_http_grpc_module.c @@ -8,6 +8,9 @@ @@ -9,17 +9,17 @@ index d4af66db..10d3aaed 100644 +#if (NGX_HTTP_LUA_KONG) +#include +#endif - - + + typedef struct { -@@ -731,6 +734,10 @@ ngx_http_grpc_create_request(ngx_http_request_t *r) +@@ -733,6 +736,10 @@ ngx_http_grpc_create_request(ngx_http_request_t *r) len = sizeof(ngx_http_grpc_connection_start) - 1 + sizeof(ngx_http_grpc_frame_t); /* headers frame */ - + +#if (NGX_HTTP_LUA_KONG) + ngx_http_lua_kong_set_grpc_authority(r, &ctx->host); +#endif + /* :method header */ - + if (r->method == NGX_HTTP_GET || r->method == NGX_HTTP_POST) { diff --git a/build/openresty/patches/nginx-1.25.3_05-remove-server-headers-from-ngx-header-filter-module.patch b/build/openresty/patches/nginx-1.25.3_05-remove-server-headers-from-ngx-header-filter-module.patch index 0cc3a3a2854..be45f17137a 100644 --- a/build/openresty/patches/nginx-1.25.3_05-remove-server-headers-from-ngx-header-filter-module.patch +++ b/build/openresty/patches/nginx-1.25.3_05-remove-server-headers-from-ngx-header-filter-module.patch @@ -1,14 +1,5 @@ -From 42a44843445e9db12a8fc5eaf1f3e10b22a0065b Mon Sep 17 00:00:00 2001 -From: Aapo Talvensaari -Date: Tue, 15 Jun 2021 16:04:06 +0300 -Subject: [PATCH] remove server headers from nginx header filter module - ---- - nginx-1.25.3/src/http/ngx_http_header_filter_module.c | 34 ------------------- - 1 file changed, 34 deletions(-) - diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_header_filter_module.c b/bundle/nginx-1.25.3/src/http/ngx_http_header_filter_module.c -index ca13f2a..1a07dac 100644 +index 90525ef..2c75594 100644 --- a/bundle/nginx-1.25.3/src/http/ngx_http_header_filter_module.c +++ b/bundle/nginx-1.25.3/src/http/ngx_http_header_filter_module.c @@ -46,11 +46,6 @@ ngx_module_t ngx_http_header_filter_module = { @@ -23,7 +14,7 @@ index ca13f2a..1a07dac 100644 static ngx_str_t ngx_http_status_lines[] = { ngx_string("200 OK"), -@@ -279,18 +274,6 @@ ngx_http_header_filter(ngx_http_request_t *r) +@@ -283,18 +278,6 @@ ngx_http_header_filter(ngx_http_request_t *r) clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); @@ -42,7 +33,7 @@ index ca13f2a..1a07dac 100644 if (r->headers_out.date == NULL) { len += sizeof("Date: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1; } -@@ -448,23 +431,6 @@ ngx_http_header_filter(ngx_http_request_t *r) +@@ -452,23 +435,6 @@ ngx_http_header_filter(ngx_http_request_t *r) } *b->last++ = CR; *b->last++ = LF; @@ -66,5 +57,3 @@ index ca13f2a..1a07dac 100644 if (r->headers_out.date == NULL) { b->last = ngx_cpymem(b->last, "Date: ", sizeof("Date: ") - 1); b->last = ngx_cpymem(b->last, ngx_cached_http_time.data, --- -2.31.1 diff --git a/build/openresty/patches/nginx-1.25.3_07-cross.patch b/build/openresty/patches/nginx-1.25.3_07-cross.patch index 94f577f2f59..d03d8471344 100644 --- a/build/openresty/patches/nginx-1.25.3_07-cross.patch +++ b/build/openresty/patches/nginx-1.25.3_07-cross.patch @@ -1,7 +1,3 @@ -Rebased from http://cgit.openembedded.org/meta-openembedded/tree/meta-webserver/recipes-httpd/nginx/files/nginx-cross.patch - - -=================================================================== diff --git a/bundle/nginx-1.25.3/auto/feature b/bundle/nginx-1.25.3/auto/feature index 3561f59..d6a2889 100644 --- a/bundle/nginx-1.25.3/auto/feature @@ -71,10 +67,10 @@ index 3561f59..d6a2889 100644 else diff --git a/bundle/nginx-1.25.3/auto/options b/bundle/nginx-1.25.3/auto/options -index 182c799..e9eb7b8 100644 +index e6e0cd3..5117342 100644 --- a/bundle/nginx-1.25.3/auto/options +++ b/bundle/nginx-1.25.3/auto/options -@@ -400,6 +400,18 @@ $0: warning: the \"--with-sha1-asm\" option is deprecated" +@@ -411,6 +411,18 @@ $0: warning: the \"--with-sha1-asm\" option is deprecated" --test-build-epoll) NGX_TEST_BUILD_EPOLL=YES ;; --test-build-solaris-sendfilev) NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;; @@ -93,7 +89,7 @@ index 182c799..e9eb7b8 100644 *) echo "$0: error: invalid option \"$option\"" exit 1 -@@ -590,6 +602,17 @@ cat << END +@@ -605,6 +617,17 @@ cat << END --with-debug enable debug logging @@ -111,7 +107,7 @@ index 182c799..e9eb7b8 100644 END exit 1 -@@ -598,6 +621,8 @@ fi +@@ -613,6 +636,8 @@ fi if [ ".$NGX_PLATFORM" = ".win32" ]; then NGX_WINE=$WINE @@ -163,10 +159,10 @@ index 480d8cf..23c5171 100644 diff --git a/bundle/nginx-1.25.3/auto/unix b/bundle/nginx-1.25.3/auto/unix -index b41c70f..febbf3c 100644 +index 6b44fc9..7410746 100644 --- a/bundle/nginx-1.25.3/auto/unix +++ b/bundle/nginx-1.25.3/auto/unix -@@ -592,13 +592,13 @@ ngx_feature_libs= +@@ -640,13 +640,13 @@ ngx_feature_libs= # C types @@ -184,7 +180,7 @@ index b41c70f..febbf3c 100644 ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value -@@ -609,7 +609,7 @@ NGX_INCLUDE_AUTO_CONFIG_H="#include \"ngx_auto_config.h\"" +@@ -657,7 +657,7 @@ NGX_INCLUDE_AUTO_CONFIG_H="#include \"ngx_auto_config.h\"" ngx_type="uint32_t"; ngx_types="u_int32_t"; . auto/types/typedef ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef @@ -193,7 +189,7 @@ index b41c70f..febbf3c 100644 . auto/types/sizeof ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value -@@ -625,15 +625,15 @@ ngx_type="rlim_t"; ngx_types="int"; . auto/types/typedef +@@ -673,15 +673,15 @@ ngx_type="rlim_t"; ngx_types="int"; . auto/types/typedef . auto/endianness diff --git a/build/openresty/patches/openresty_01-custom_prefix_and_cc.patch b/build/openresty/patches/openresty_01-custom_prefix_and_cc.patch index f90925125df..73f31a4de43 100644 --- a/build/openresty/patches/openresty_01-custom_prefix_and_cc.patch +++ b/build/openresty/patches/openresty_01-custom_prefix_and_cc.patch @@ -1,5 +1,5 @@ diff --git a/configure b/configure -index d461294..2e8d3e2 100755 +index 5d7d717..969b075 100755 --- a/configure +++ b/configure @@ -128,7 +128,7 @@ my $ngx_sbin; @@ -21,7 +21,7 @@ index d461294..2e8d3e2 100755 } elsif ($opt =~ /^--sbin-path=(.*)/) { $ngx_sbin = $1; push @ngx_opts, $opt; -@@ -696,7 +699,12 @@ _END_ +@@ -699,7 +702,12 @@ _END_ #unshift @ngx_ld_opts, "-L$lib"; #unshift @ngx_cc_opts, "-I$inc"; @@ -35,7 +35,7 @@ index d461294..2e8d3e2 100755 } elsif ($opts->{luajit}) { my $luajit_src = auto_complete 'LuaJIT'; -@@ -862,7 +870,12 @@ _END_ +@@ -865,7 +873,12 @@ _END_ #unshift @ngx_cc_opts, "-I$inc"; if ($platform ne 'msys') { @@ -49,7 +49,7 @@ index d461294..2e8d3e2 100755 } cd '..'; -@@ -871,8 +884,13 @@ _END_ +@@ -874,8 +887,13 @@ _END_ if ($opts->{luajit} || $opts->{luajit_path}) { # build lua modules @@ -65,7 +65,7 @@ index d461294..2e8d3e2 100755 { my $ngx_lua_dir = auto_complete 'ngx_lua'; -@@ -926,6 +944,11 @@ _EOC_ +@@ -929,6 +947,11 @@ _EOC_ close $in; } @@ -77,7 +77,7 @@ index d461294..2e8d3e2 100755 unless ($opts->{no_lua_cjson}) { my $dir = auto_complete 'lua-cjson'; if (!defined $dir) { -@@ -1173,10 +1196,16 @@ _EOC_ +@@ -1176,10 +1199,16 @@ _EOC_ open my $in, $resty_bin or die "Cannot open $resty_bin for reading: $!\n"; my ($new, $found); @@ -95,7 +95,7 @@ index d461294..2e8d3e2 100755 } else { $new .= $_; -@@ -1354,6 +1383,9 @@ _EOC_ +@@ -1357,6 +1386,9 @@ _EOC_ --with-libpq=DIR specify the libpq (or postgresql) installation prefix --with-pg_config=PATH specify the path of the pg_config utility From 3abf5b2980187abb6550a88d5fb5f55df3859bb2 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 11 Jan 2024 13:10:21 +0800 Subject: [PATCH 08/17] patch nginx to restore get single header --- ...inx-1.25.3_10-get-single-http-header.patch | 74 +++++++++++++++++++ kong/pdk/request.lua | 12 +-- 2 files changed, 75 insertions(+), 11 deletions(-) create mode 100644 build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch diff --git a/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch b/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch new file mode 100644 index 00000000000..90138819907 --- /dev/null +++ b/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch @@ -0,0 +1,74 @@ +diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_variables.c b/bundle/nginx-1.25.3/src/http/ngx_http_variables.c +index 4f0bd0e..ea3a2d5 100644 +--- a/bundle/nginx-1.25.3/src/http/ngx_http_variables.c ++++ b/bundle/nginx-1.25.3/src/http/ngx_http_variables.c +@@ -27,6 +27,8 @@ static ngx_int_t ngx_http_variable_header(ngx_http_request_t *r, + + static ngx_int_t ngx_http_variable_cookies(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); ++static ngx_int_t ngx_http_variable_headers(ngx_http_request_t *r, ++ ngx_http_variable_value_t *v, uintptr_t data); + static ngx_int_t ngx_http_variable_headers_internal(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data, u_char sep); + +@@ -178,7 +180,7 @@ static ngx_http_variable_t ngx_http_core_variables[] = { + #endif + + #if (NGX_HTTP_X_FORWARDED_FOR) +- { ngx_string("http_x_forwarded_for"), NULL, ngx_http_variable_header, ++ { ngx_string("http_x_forwarded_for"), NULL, ngx_http_variable_headers, + offsetof(ngx_http_request_t, headers_in.x_forwarded_for), 0, 0 }, + #endif + +@@ -331,10 +333,10 @@ static ngx_http_variable_t ngx_http_core_variables[] = { + { ngx_string("sent_http_transfer_encoding"), NULL, + ngx_http_variable_sent_transfer_encoding, 0, 0, 0 }, + +- { ngx_string("sent_http_cache_control"), NULL, ngx_http_variable_header, ++ { ngx_string("sent_http_cache_control"), NULL, ngx_http_variable_headers, + offsetof(ngx_http_request_t, headers_out.cache_control), 0, 0 }, + +- { ngx_string("sent_http_link"), NULL, ngx_http_variable_header, ++ { ngx_string("sent_http_link"), NULL, ngx_http_variable_headers, + offsetof(ngx_http_request_t, headers_out.link), 0, 0 }, + + { ngx_string("limit_rate"), ngx_http_variable_set_limit_rate, +@@ -811,7 +813,22 @@ static ngx_int_t + ngx_http_variable_header(ngx_http_request_t *r, ngx_http_variable_value_t *v, + uintptr_t data) + { +- return ngx_http_variable_headers_internal(r, v, data, ','); ++ ngx_table_elt_t *h; ++ ++ h = *(ngx_table_elt_t **) ((char *) r + data); ++ ++ if (h) { ++ v->len = h->value.len; ++ v->valid = 1; ++ v->no_cacheable = 0; ++ v->not_found = 0; ++ v->data = h->value.data; ++ ++ } else { ++ v->not_found = 1; ++ } ++ ++ return NGX_OK; + } + + +@@ -823,6 +840,14 @@ ngx_http_variable_cookies(ngx_http_request_t *r, + } + + ++static ngx_int_t ++ngx_http_variable_headers(ngx_http_request_t *r, ++ ngx_http_variable_value_t *v, uintptr_t data) ++{ ++ return ngx_http_variable_headers_internal(r, v, data, ','); ++} ++ ++ + static ngx_int_t + ngx_http_variable_headers_internal(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data, u_char sep) diff --git a/kong/pdk/request.lua b/kong/pdk/request.lua index d23ee85a02d..10bb08dfe5d 100644 --- a/kong/pdk/request.lua +++ b/kong/pdk/request.lua @@ -625,17 +625,7 @@ local function new(self) error("header name must be a string", 2) end - local value = var["http_" .. replace_dashes(name)] - - if value then - local p = find(value, ",", 1, true) -- changed since nginx 1.23.0 - - if p then - value = sub(value, 1, p - 1) - end - end - - return value + return var["http_" .. replace_dashes(name)] end From f3eb239ebf58ca2f32bd6d55a15f02030e4b8dad Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 11 Jan 2024 14:09:28 +0800 Subject: [PATCH 09/17] patch ngx_http_variable_unknown_header --- ...inx-1.25.3_10-get-single-http-header.patch | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch b/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch index 90138819907..d2394a92679 100644 --- a/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch +++ b/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch @@ -1,5 +1,5 @@ diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_variables.c b/bundle/nginx-1.25.3/src/http/ngx_http_variables.c -index 4f0bd0e..ea3a2d5 100644 +index 4f0bd0e..cd20e88 100644 --- a/bundle/nginx-1.25.3/src/http/ngx_http_variables.c +++ b/bundle/nginx-1.25.3/src/http/ngx_http_variables.c @@ -27,6 +27,8 @@ static ngx_int_t ngx_http_variable_header(ngx_http_request_t *r, @@ -72,3 +72,27 @@ index 4f0bd0e..ea3a2d5 100644 static ngx_int_t ngx_http_variable_headers_internal(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data, u_char sep) +@@ -990,6 +1015,15 @@ ngx_http_variable_unknown_header(ngx_http_request_t *r, + return NGX_OK; + } + ++ /* only return one header value */ ++ ++ v->len = h->value.len; ++ v->valid = 1; ++ v->no_cacheable = 0; ++ v->not_found = 0; ++ v->data = h->value.data; ++ ++#if 0 + len -= 2; + + if (h->next == NULL) { +@@ -1026,6 +1060,7 @@ ngx_http_variable_unknown_header(ngx_http_request_t *r, + + h = h->next; + } ++#endif + + return NGX_OK; + } From ad01f24876ba22d62446e0572d021118bec3f9e4 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 11 Jan 2024 15:24:57 +0800 Subject: [PATCH 10/17] remove Transfer-Encoding in mock server --- spec/fixtures/1.2_custom_nginx.template | 1 - .../template_inject/nginx_kong_test_custom_inject_http.lua | 1 - 2 files changed, 2 deletions(-) diff --git a/spec/fixtures/1.2_custom_nginx.template b/spec/fixtures/1.2_custom_nginx.template index a0079cafe8b..24e18558fde 100644 --- a/spec/fixtures/1.2_custom_nginx.template +++ b/spec/fixtures/1.2_custom_nginx.template @@ -332,7 +332,6 @@ http { header["Proxy-Connection"] = "close" header["Proxy-Authenticate"] = "Basic" header["Proxy-Authorization"] = "Basic YWxhZGRpbjpvcGVuc2VzYW1l" - header["Transfer-Encoding"] = "chunked" header["Content-Length"] = nil header["TE"] = "trailers, deflate;q=0.5" header["Trailer"] = "Expires" diff --git a/spec/fixtures/template_inject/nginx_kong_test_custom_inject_http.lua b/spec/fixtures/template_inject/nginx_kong_test_custom_inject_http.lua index f969a7186f0..d66b38e6120 100644 --- a/spec/fixtures/template_inject/nginx_kong_test_custom_inject_http.lua +++ b/spec/fixtures/template_inject/nginx_kong_test_custom_inject_http.lua @@ -107,7 +107,6 @@ lua_shared_dict kong_mock_upstream_loggers 10m; header["Proxy-Connection"] = "close" header["Proxy-Authenticate"] = "Basic" header["Proxy-Authorization"] = "Basic YWxhZGRpbjpvcGVuc2VzYW1l" - header["Transfer-Encoding"] = "chunked" header["Content-Length"] = nil header["TE"] = "trailers, deflate;q=0.5" header["Trailer"] = "Expires" From 693c356c9a4d89c74557021d2169483ccc3349ae Mon Sep 17 00:00:00 2001 From: chronolaw Date: Thu, 11 Jan 2024 20:53:23 +0800 Subject: [PATCH 11/17] update nginx-1.25.3_10-get-single-http-header.patch --- ...inx-1.25.3_10-get-single-http-header.patch | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch b/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch index d2394a92679..ada46588cd0 100644 --- a/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch +++ b/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch @@ -1,5 +1,5 @@ diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_variables.c b/bundle/nginx-1.25.3/src/http/ngx_http_variables.c -index 4f0bd0e..cd20e88 100644 +index 4f0bd0e..785c7dc 100644 --- a/bundle/nginx-1.25.3/src/http/ngx_http_variables.c +++ b/bundle/nginx-1.25.3/src/http/ngx_http_variables.c @@ -27,6 +27,8 @@ static ngx_int_t ngx_http_variable_header(ngx_http_request_t *r, @@ -72,7 +72,21 @@ index 4f0bd0e..cd20e88 100644 static ngx_int_t ngx_http_variable_headers_internal(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data, u_char sep) -@@ -990,6 +1015,15 @@ ngx_http_variable_unknown_header(ngx_http_request_t *r, +@@ -977,10 +1002,12 @@ ngx_http_variable_unknown_header(ngx_http_request_t *r, + continue; + } + +- len += header[i].value.len + 2; ++ /* len += header[i].value.len + 2; */ + + *ph = &header[i]; + ph = &header[i].next; ++ ++ break; /* found then quit loop */ + } + + *ph = NULL; +@@ -990,6 +1017,15 @@ ngx_http_variable_unknown_header(ngx_http_request_t *r, return NGX_OK; } @@ -88,7 +102,7 @@ index 4f0bd0e..cd20e88 100644 len -= 2; if (h->next == NULL) { -@@ -1026,6 +1060,7 @@ ngx_http_variable_unknown_header(ngx_http_request_t *r, +@@ -1026,6 +1062,7 @@ ngx_http_variable_unknown_header(ngx_http_request_t *r, h = h->next; } From ec98b6c6fd98a1fb95b7ea5910c63a203255a55d Mon Sep 17 00:00:00 2001 From: chronolaw Date: Fri, 12 Jan 2024 15:13:19 +0800 Subject: [PATCH 12/17] remove nginx-1.25.3_09-listen-http2-warning-fix.patch --- ...=> nginx-1.25.3_09-get-single-http-header.patch} | 0 .../nginx-1.25.3_09-listen-http2-warning-fix.patch | 13 ------------- 2 files changed, 13 deletions(-) rename build/openresty/patches/{nginx-1.25.3_10-get-single-http-header.patch => nginx-1.25.3_09-get-single-http-header.patch} (100%) delete mode 100644 build/openresty/patches/nginx-1.25.3_09-listen-http2-warning-fix.patch diff --git a/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch b/build/openresty/patches/nginx-1.25.3_09-get-single-http-header.patch similarity index 100% rename from build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch rename to build/openresty/patches/nginx-1.25.3_09-get-single-http-header.patch diff --git a/build/openresty/patches/nginx-1.25.3_09-listen-http2-warning-fix.patch b/build/openresty/patches/nginx-1.25.3_09-listen-http2-warning-fix.patch deleted file mode 100644 index 7073b372ff1..00000000000 --- a/build/openresty/patches/nginx-1.25.3_09-listen-http2-warning-fix.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_core_module.c b/bundle/nginx-1.25.3/src/http/ngx_http_core_module.c -index 7845f8f..1676116 100644 ---- a/bundle/nginx-1.25.3/src/http/ngx_http_core_module.c -+++ b/bundle/nginx-1.25.3/src/http/ngx_http_core_module.c -@@ -4184,7 +4184,7 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - - if (ngx_strcmp(value[n].data, "http2") == 0) { - #if (NGX_HTTP_V2) -- ngx_conf_log_error(NGX_LOG_WARN, cf, 0, -+ ngx_conf_log_error(NGX_LOG_NOTICE, cf, 0, - "the \"listen ... http2\" directive " - "is deprecated, use " - "the \"http2\" directive instead"); From dec7a3794e2eb72eefa7b8d43fbffa709bf67ad4 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Fri, 12 Jan 2024 16:23:46 +0800 Subject: [PATCH 13/17] try to remove `listen http2` --- kong/conf_loader/listeners.lua | 2 +- kong/templates/kong_defaults.lua | 4 +- kong/templates/nginx_kong.lua | 4 ++ spec/01-unit/03-conf_loader_spec.lua | 44 +++++++------------ spec/01-unit/04-prefix_handler_spec.lua | 24 +++++----- .../10-balancer/01-healthchecks_spec.lua | 4 +- .../05-proxy/19-grpc_proxy_spec.lua | 3 +- .../08-status_api/01-core_routes_spec.lua | 2 +- spec/fixtures/1.2_custom_nginx.template | 3 ++ spec/fixtures/mock_webserver_tpl.lua | 6 ++- spec/kong_tests.conf | 1 + 11 files changed, 48 insertions(+), 49 deletions(-) diff --git a/kong/conf_loader/listeners.lua b/kong/conf_loader/listeners.lua index dc7133b296d..50c47665cc0 100644 --- a/kong/conf_loader/listeners.lua +++ b/kong/conf_loader/listeners.lua @@ -14,7 +14,7 @@ local listeners = {} local subsystem_flags = { - http = { "ssl", "http2", "proxy_protocol", "deferred", "bind", "reuseport", + http = { "ssl", "proxy_protocol", "deferred", "bind", "reuseport", "backlog=%d+", "ipv6only=on", "ipv6only=off", "so_keepalive=on", "so_keepalive=off", "so_keepalive=%w*:%w*:%d*" }, stream = { "udp", "ssl", "proxy_protocol", "bind", "reuseport", "backlog=%d+", diff --git a/kong/templates/kong_defaults.lua b/kong/templates/kong_defaults.lua index 2c0802bc72a..2f266c84b52 100644 --- a/kong/templates/kong_defaults.lua +++ b/kong/templates/kong_defaults.lua @@ -24,9 +24,9 @@ error_template_xml = NONE error_template_plain = NONE node_id = NONE -proxy_listen = 0.0.0.0:8000 reuseport backlog=16384, 0.0.0.0:8443 http2 ssl reuseport backlog=16384 +proxy_listen = 0.0.0.0:8000 reuseport backlog=16384, 0.0.0.0:8443 ssl reuseport backlog=16384 stream_listen = off -admin_listen = 127.0.0.1:8001 reuseport backlog=16384, 127.0.0.1:8444 http2 ssl reuseport backlog=16384 +admin_listen = 127.0.0.1:8001 reuseport backlog=16384, 127.0.0.1:8444 ssl reuseport backlog=16384 admin_gui_listen = 0.0.0.0:8002, 0.0.0.0:8445 ssl status_listen = 127.0.0.1:8007 reuseport backlog=16384 cluster_listen = 0.0.0.0:8005 diff --git a/kong/templates/nginx_kong.lua b/kong/templates/nginx_kong.lua index cc2e8c16729..e6e391348ec 100644 --- a/kong/templates/nginx_kong.lua +++ b/kong/templates/nginx_kong.lua @@ -81,6 +81,8 @@ server { listen $(entry.listener); > end + http2 on; + error_page 400 404 405 408 411 412 413 414 417 /kong_error_handler; error_page 494 =494 /kong_error_handler; error_page 500 502 503 504 /kong_error_handler; @@ -391,6 +393,8 @@ server { listen $(entry.listener); > end + http2 on; + access_log ${{ADMIN_ACCESS_LOG}}; error_log ${{ADMIN_ERROR_LOG}} ${{LOG_LEVEL}}; diff --git a/spec/01-unit/03-conf_loader_spec.lua b/spec/01-unit/03-conf_loader_spec.lua index c51b9b46a61..2a9d4898cbe 100644 --- a/spec/01-unit/03-conf_loader_spec.lua +++ b/spec/01-unit/03-conf_loader_spec.lua @@ -56,8 +56,8 @@ describe("Configuration loader", function() end assert.equal("auto", conf.nginx_main_worker_processes) assert.equal("eventual", conf.worker_consistency) - assert.same({"127.0.0.1:8001 reuseport backlog=16384", "127.0.0.1:8444 http2 ssl reuseport backlog=16384"}, conf.admin_listen) - assert.same({"0.0.0.0:8000 reuseport backlog=16384", "0.0.0.0:8443 http2 ssl reuseport backlog=16384"}, conf.proxy_listen) + assert.same({"127.0.0.1:8001 reuseport backlog=16384", "127.0.0.1:8444 ssl reuseport backlog=16384"}, conf.admin_listen) + assert.same({"0.0.0.0:8000 reuseport backlog=16384", "0.0.0.0:8443 ssl reuseport backlog=16384"}, conf.proxy_listen) assert.same({"0.0.0.0:8002", "0.0.0.0:8445 ssl"}, conf.admin_gui_listen) assert.equal("/", conf.admin_gui_path) assert.equal("logs/admin_gui_access.log", conf.admin_gui_access_log) @@ -89,8 +89,8 @@ describe("Configuration loader", function() end assert.equal("1", conf.nginx_main_worker_processes) assert.same({"127.0.0.1:9001"}, conf.admin_listen) - assert.same({"0.0.0.0:9000", "0.0.0.0:9443 http2 ssl", - "0.0.0.0:9002 http2"}, conf.proxy_listen) + assert.same({"0.0.0.0:9000", "0.0.0.0:9443 ssl", + "0.0.0.0:9002"}, conf.proxy_listen) assert.same(KONG_VERSION, conf.lmdb_validation_tag) assert.is_nil(getmetatable(conf)) end) @@ -113,8 +113,8 @@ describe("Configuration loader", function() end assert.equal("auto", conf.nginx_main_worker_processes) assert.same({"127.0.0.1:9001"}, conf.admin_listen) - assert.same({"0.0.0.0:9000", "0.0.0.0:9443 http2 ssl", - "0.0.0.0:9002 http2"}, conf.proxy_listen) + assert.same({"0.0.0.0:9000", "0.0.0.0:9443 ssl", + "0.0.0.0:9002"}, conf.proxy_listen) assert.is_nil(getmetatable(conf)) end) it("strips extraneous properties (not in defaults)", function() @@ -162,38 +162,32 @@ describe("Configuration loader", function() assert.equal("127.0.0.1", conf.admin_listeners[1].ip) assert.equal(8001, conf.admin_listeners[1].port) assert.equal(false, conf.admin_listeners[1].ssl) - assert.equal(false, conf.admin_listeners[1].http2) assert.equal("127.0.0.1:8001 reuseport backlog=16384", conf.admin_listeners[1].listener) assert.equal("127.0.0.1", conf.admin_listeners[2].ip) assert.equal(8444, conf.admin_listeners[2].port) assert.equal(true, conf.admin_listeners[2].ssl) - assert.equal(true, conf.admin_listeners[2].http2) - assert.equal("127.0.0.1:8444 ssl http2 reuseport backlog=16384", conf.admin_listeners[2].listener) + assert.equal("127.0.0.1:8444 ssl reuseport backlog=16384", conf.admin_listeners[2].listener) assert.equal("0.0.0.0", conf.admin_gui_listeners[1].ip) assert.equal(8002, conf.admin_gui_listeners[1].port) assert.equal(false, conf.admin_gui_listeners[1].ssl) - assert.equal(false, conf.admin_gui_listeners[1].http2) assert.equal("0.0.0.0:8002", conf.admin_gui_listeners[1].listener) assert.equal("0.0.0.0", conf.admin_gui_listeners[2].ip) assert.equal(8445, conf.admin_gui_listeners[2].port) assert.equal(true, conf.admin_gui_listeners[2].ssl) - assert.equal(false, conf.admin_gui_listeners[2].http2) assert.equal("0.0.0.0:8445 ssl", conf.admin_gui_listeners[2].listener) assert.equal("0.0.0.0", conf.proxy_listeners[1].ip) assert.equal(8000, conf.proxy_listeners[1].port) assert.equal(false, conf.proxy_listeners[1].ssl) - assert.equal(false, conf.proxy_listeners[1].http2) assert.equal("0.0.0.0:8000 reuseport backlog=16384", conf.proxy_listeners[1].listener) assert.equal("0.0.0.0", conf.proxy_listeners[2].ip) assert.equal(8443, conf.proxy_listeners[2].port) assert.equal(true, conf.proxy_listeners[2].ssl) - assert.equal(true, conf.proxy_listeners[2].http2) - assert.equal("0.0.0.0:8443 ssl http2 reuseport backlog=16384", conf.proxy_listeners[2].listener) + assert.equal("0.0.0.0:8443 ssl reuseport backlog=16384", conf.proxy_listeners[2].listener) end) it("parses IPv6 from proxy_listen/admin_listen/admin_gui_listen", function() local conf = assert(conf_loader(nil, { @@ -204,37 +198,31 @@ describe("Configuration loader", function() assert.equal("[0000:0000:0000:0000:0000:0000:0000:0001]", conf.admin_listeners[1].ip) assert.equal(8001, conf.admin_listeners[1].port) assert.equal(false, conf.admin_listeners[1].ssl) - assert.equal(false, conf.admin_listeners[1].http2) assert.equal("[0000:0000:0000:0000:0000:0000:0000:0001]:8001", conf.admin_listeners[1].listener) assert.equal("[0000:0000:0000:0000:0000:0000:0000:0001]", conf.admin_listeners[2].ip) assert.equal(8444, conf.admin_listeners[2].port) assert.equal(true, conf.admin_listeners[2].ssl) - assert.equal(false, conf.admin_listeners[2].http2) assert.equal("[0000:0000:0000:0000:0000:0000:0000:0001]:8444 ssl", conf.admin_listeners[2].listener) assert.equal("[0000:0000:0000:0000:0000:0000:0000:0001]", conf.admin_gui_listeners[1].ip) assert.equal(8002, conf.admin_gui_listeners[1].port) assert.equal(false, conf.admin_gui_listeners[1].ssl) - assert.equal(false, conf.admin_gui_listeners[1].http2) assert.equal("[0000:0000:0000:0000:0000:0000:0000:0001]:8002", conf.admin_gui_listeners[1].listener) assert.equal("[0000:0000:0000:0000:0000:0000:0000:0001]", conf.admin_gui_listeners[2].ip) assert.equal(8445, conf.admin_gui_listeners[2].port) assert.equal(true, conf.admin_gui_listeners[2].ssl) - assert.equal(false, conf.admin_gui_listeners[2].http2) assert.equal("[0000:0000:0000:0000:0000:0000:0000:0001]:8445 ssl", conf.admin_gui_listeners[2].listener) assert.equal("[0000:0000:0000:0000:0000:0000:0000:0000]", conf.proxy_listeners[1].ip) assert.equal(8000, conf.proxy_listeners[1].port) assert.equal(false, conf.proxy_listeners[1].ssl) - assert.equal(false, conf.proxy_listeners[1].http2) assert.equal("[0000:0000:0000:0000:0000:0000:0000:0000]:8000", conf.proxy_listeners[1].listener) assert.equal("[0000:0000:0000:0000:0000:0000:0000:0000]", conf.proxy_listeners[2].ip) assert.equal(8443, conf.proxy_listeners[2].port) assert.equal(true, conf.proxy_listeners[2].ssl) - assert.equal(false, conf.proxy_listeners[2].http2) assert.equal("[0000:0000:0000:0000:0000:0000:0000:0000]:8443 ssl", conf.proxy_listeners[2].listener) end) it("extracts ssl flags properly when hostnames contain them", function() @@ -693,38 +681,38 @@ describe("Configuration loader", function() admin_listen = "127.0.0.1" }) assert.is_nil(conf) - assert.equal("admin_listen must be of form: [off] | : [ssl] [http2] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) + assert.equal("admin_listen must be of form: [off] | : [ssl] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) conf, err = conf_loader(nil, { proxy_listen = "127.0.0.1" }) assert.is_nil(conf) - assert.equal("proxy_listen must be of form: [off] | : [ssl] [http2] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) + assert.equal("proxy_listen must be of form: [off] | : [ssl] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) conf, err = conf_loader(nil, { admin_gui_listen = "127.0.0.1" }) assert.is_nil(conf) - assert.equal("admin_gui_listen must be of form: [off] | : [ssl] [http2] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) + assert.equal("admin_gui_listen must be of form: [off] | : [ssl] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) end) it("rejects empty string in listen addresses", function() local conf, err = conf_loader(nil, { admin_listen = "" }) assert.is_nil(conf) - assert.equal("admin_listen must be of form: [off] | : [ssl] [http2] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) + assert.equal("admin_listen must be of form: [off] | : [ssl] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) conf, err = conf_loader(nil, { proxy_listen = "" }) assert.is_nil(conf) - assert.equal("proxy_listen must be of form: [off] | : [ssl] [http2] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) + assert.equal("proxy_listen must be of form: [off] | : [ssl] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) conf, err = conf_loader(nil, { admin_gui_listen = "" }) assert.is_nil(conf) - assert.equal("admin_gui_listen must be of form: [off] | : [ssl] [http2] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) + assert.equal("admin_gui_listen must be of form: [off] | : [ssl] [proxy_protocol] [deferred] [bind] [reuseport] [backlog=%d+] [ipv6only=on] [ipv6only=off] [so_keepalive=on] [so_keepalive=off] [so_keepalive=%w*:%w*:%d*], [... next entry ...]", err) end) it("enforces admin_gui_path values", function() local conf, _, errors = conf_loader(nil, { @@ -1570,11 +1558,11 @@ describe("Configuration loader", function() end) it("supports HTTP/2", function() local conf, err = conf_loader(nil, { - status_listen = "127.0.0.1:123 ssl http2", + status_listen = "127.0.0.1:123 ssl", }) assert.is_nil(err) assert.is_table(conf) - assert.same({ "127.0.0.1:123 ssl http2" }, conf.status_listen) + assert.same({ "127.0.0.1:123 ssl" }, conf.status_listen) end) end) diff --git a/spec/01-unit/04-prefix_handler_spec.lua b/spec/01-unit/04-prefix_handler_spec.lua index 63052c965c0..31f6091e506 100644 --- a/spec/01-unit/04-prefix_handler_spec.lua +++ b/spec/01-unit/04-prefix_handler_spec.lua @@ -158,52 +158,52 @@ describe("NGINX conf compiler", function() end) it("enables HTTP/2", function() local conf = assert(conf_loader(helpers.test_conf_path, { - proxy_listen = "0.0.0.0:9000, 0.0.0.0:9443 http2 ssl", - admin_listen = "127.0.0.1:9001, 127.0.0.1:9444 http2 ssl", - admin_gui_listen = "127.0.0.1:9002, 127.0.0.1:9445 http2 ssl", + proxy_listen = "0.0.0.0:9000, 0.0.0.0:9443 ssl", + admin_listen = "127.0.0.1:9001, 127.0.0.1:9444 ssl", + admin_gui_listen = "127.0.0.1:9002, 127.0.0.1:9445 ssl", })) local kong_nginx_conf = prefix_handler.compile_kong_conf(conf) assert.matches("listen%s+0%.0%.0%.0:9000;", kong_nginx_conf) - assert.matches("listen%s+0%.0%.0%.0:9443 ssl http2;", kong_nginx_conf) + assert.matches("listen%s+0%.0%.0%.0:9443 ssl;", kong_nginx_conf) assert.matches("listen%s+127%.0%.0%.1:9001;", kong_nginx_conf) - assert.matches("listen%s+127%.0%.0%.1:9444 ssl http2;", kong_nginx_conf) - assert.matches("listen%s+127%.0%.0%.1:9445 ssl http2;", kong_nginx_conf) + assert.matches("listen%s+127%.0%.0%.1:9444 ssl;", kong_nginx_conf) + assert.matches("listen%s+127%.0%.0%.1:9445 ssl;", kong_nginx_conf) conf = assert(conf_loader(helpers.test_conf_path, { - proxy_listen = "0.0.0.0:9000, 0.0.0.0:9443 http2 ssl", + proxy_listen = "0.0.0.0:9000, 0.0.0.0:9443 ssl", admin_listen = "127.0.0.1:9001, 127.0.0.1:8444 ssl", admin_gui_listen = "127.0.0.1:9002, 127.0.0.1:8445 ssl", })) kong_nginx_conf = prefix_handler.compile_kong_conf(conf) assert.matches("listen%s+0%.0%.0%.0:9000;", kong_nginx_conf) - assert.matches("listen%s+0%.0%.0%.0:9443 ssl http2;", kong_nginx_conf) + assert.matches("listen%s+0%.0%.0%.0:9443 ssl;", kong_nginx_conf) assert.matches("listen%s+127%.0%.0%.1:9001;", kong_nginx_conf) assert.matches("listen%s+127%.0%.0%.1:8444 ssl;", kong_nginx_conf) assert.matches("listen%s+127%.0%.0%.1:8445 ssl;", kong_nginx_conf) conf = assert(conf_loader(helpers.test_conf_path, { proxy_listen = "0.0.0.0:9000, 0.0.0.0:9443 ssl", - admin_listen = "127.0.0.1:9001, 127.0.0.1:8444 http2 ssl", + admin_listen = "127.0.0.1:9001, 127.0.0.1:8444 ssl", admin_gui_listen = "127.0.0.1:9002, 127.0.0.1:8445 ssl", })) kong_nginx_conf = prefix_handler.compile_kong_conf(conf) assert.matches("listen%s+0%.0%.0%.0:9000;", kong_nginx_conf) assert.matches("listen%s+0%.0%.0%.0:9443 ssl;", kong_nginx_conf) assert.matches("listen%s+127%.0%.0%.1:9001;", kong_nginx_conf) - assert.matches("listen%s+127%.0%.0%.1:8444 ssl http2;", kong_nginx_conf) + assert.matches("listen%s+127%.0%.0%.1:8444 ssl;", kong_nginx_conf) assert.matches("listen%s+127%.0%.0%.1:8445 ssl;", kong_nginx_conf) conf = assert(conf_loader(helpers.test_conf_path, { proxy_listen = "0.0.0.0:9000, 0.0.0.0:9443 ssl", admin_listen = "127.0.0.1:9001, 127.0.0.1:8444 ssl", - admin_gui_listen = "127.0.0.1:9002, 127.0.0.1:8445 http2 ssl", + admin_gui_listen = "127.0.0.1:9002, 127.0.0.1:8445 ssl", })) kong_nginx_conf = prefix_handler.compile_kong_conf(conf) assert.matches("listen%s+0%.0%.0%.0:9000;", kong_nginx_conf) assert.matches("listen%s+0%.0%.0%.0:9443 ssl;", kong_nginx_conf) assert.matches("listen%s+127%.0%.0%.1:9001;", kong_nginx_conf) assert.matches("listen%s+127%.0%.0%.1:8444 ssl;", kong_nginx_conf) - assert.matches("listen%s+127%.0%.0%.1:8445 ssl http2;", kong_nginx_conf) + assert.matches("listen%s+127%.0%.0%.1:8445 ssl;", kong_nginx_conf) end) it("enables proxy_protocol", function() local conf = assert(conf_loader(helpers.test_conf_path, { diff --git a/spec/02-integration/05-proxy/10-balancer/01-healthchecks_spec.lua b/spec/02-integration/05-proxy/10-balancer/01-healthchecks_spec.lua index 9de7aacc4f1..c82a3f7b5fd 100644 --- a/spec/02-integration/05-proxy/10-balancer/01-healthchecks_spec.lua +++ b/spec/02-integration/05-proxy/10-balancer/01-healthchecks_spec.lua @@ -20,8 +20,8 @@ for _, strategy in helpers.each_strategy() do local admin_port_1 = 9001 local default_admin_listen = "127.0.0.1:".. admin_port_1 .. ",[::1]:" .. admin_port_1 local default_proxy_listen = "127.0.0.1:".. proxy_port_1 .. ",[::1]:" .. proxy_port_1 .. ", " .. - "127.0.0.1:".. proxy_port_ssl .. " http2 ssl,[::1]:" .. proxy_port_ssl .. " http2 ssl, " .. - "127.0.0.1:".. proxy_port_grpc .. " http2,[::1]:" .. proxy_port_grpc .. " http2" + "127.0.0.1:".. proxy_port_ssl .. " ssl,[::1]:" .. proxy_port_ssl .. " ssl, " .. + "127.0.0.1:".. proxy_port_grpc .. ",[::1]:" .. proxy_port_grpc describe("Healthcheck #" .. strategy, function() lazy_setup(function() diff --git a/spec/02-integration/05-proxy/19-grpc_proxy_spec.lua b/spec/02-integration/05-proxy/19-grpc_proxy_spec.lua index 2d524b085d1..07ea00861df 100644 --- a/spec/02-integration/05-proxy/19-grpc_proxy_spec.lua +++ b/spec/02-integration/05-proxy/19-grpc_proxy_spec.lua @@ -146,7 +146,8 @@ for _, strategy in helpers.each_strategy() do fixtures.http_mock.my_server_block = [[ server { server_name myserver; - listen 8765 http2; + listen 8765; + http2 on; location ~ / { content_by_lua_block { diff --git a/spec/02-integration/08-status_api/01-core_routes_spec.lua b/spec/02-integration/08-status_api/01-core_routes_spec.lua index 123b4c3cca2..8de0ef48daa 100644 --- a/spec/02-integration/08-status_api/01-core_routes_spec.lua +++ b/spec/02-integration/08-status_api/01-core_routes_spec.lua @@ -290,7 +290,7 @@ for _, strategy in helpers.all_strategies() do lazy_setup(function() helpers.get_db_utils(strategy, {}) -- runs migrations assert(helpers.start_kong { - status_listen = "127.0.0.1:9500 ssl http2", + status_listen = "127.0.0.1:9500 ssl", plugins = "admin-api-method", database = strategy, }) diff --git a/spec/fixtures/1.2_custom_nginx.template b/spec/fixtures/1.2_custom_nginx.template index 24e18558fde..4ad26c9710b 100644 --- a/spec/fixtures/1.2_custom_nginx.template +++ b/spec/fixtures/1.2_custom_nginx.template @@ -88,6 +88,8 @@ http { > for i = 1, #proxy_listeners do listen $(proxy_listeners[i].listener); > end + http2 on; + error_page 400 404 408 411 412 413 414 417 494 /kong_error_handler; error_page 500 502 503 504 /kong_error_handler; @@ -192,6 +194,7 @@ http { > for i = 1, #admin_listeners do listen $(admin_listeners[i].listener); > end + http2 on; access_log logs/admin_access.log; diff --git a/spec/fixtures/mock_webserver_tpl.lua b/spec/fixtures/mock_webserver_tpl.lua index c1690cbfb54..598f9ef2ebb 100644 --- a/spec/fixtures/mock_webserver_tpl.lua +++ b/spec/fixtures/mock_webserver_tpl.lua @@ -77,10 +77,12 @@ http { listen [::1]:${http_port}; #end # else - listen 127.0.0.1:${http_port} ssl http2; + listen 127.0.0.1:${http_port} ssl; # if not disable_ipv6 then - listen [::1]:${http_port} ssl http2; + listen [::1]:${http_port} ssl; #end + http2 on; + ssl_certificate ${cert_path}/kong_spec.crt; ssl_certificate_key ${cert_path}/kong_spec.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; diff --git a/spec/kong_tests.conf b/spec/kong_tests.conf index 9e53b8ae254..d0c227ea05c 100644 --- a/spec/kong_tests.conf +++ b/spec/kong_tests.conf @@ -2,6 +2,7 @@ admin_listen = 127.0.0.1:9001 admin_gui_listen = off proxy_listen = 0.0.0.0:9000, 0.0.0.0:9443 http2 ssl, 0.0.0.0:9002 http2 +proxy_listen = 0.0.0.0:9000, 0.0.0.0:9443 ssl, 0.0.0.0:9002 # avoid port conflicts when multiple Kong instances needed for tests status_listen = off stream_listen = off From 9fdec189ea0f6539f82570926c118b95cd8b2be4 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Fri, 12 Jan 2024 16:59:47 +0800 Subject: [PATCH 14/17] fix spec/kong_tests.conf --- spec/kong_tests.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/kong_tests.conf b/spec/kong_tests.conf index d0c227ea05c..bdbb94dacd0 100644 --- a/spec/kong_tests.conf +++ b/spec/kong_tests.conf @@ -1,7 +1,6 @@ # 1st digit is 9 for our test instances admin_listen = 127.0.0.1:9001 admin_gui_listen = off -proxy_listen = 0.0.0.0:9000, 0.0.0.0:9443 http2 ssl, 0.0.0.0:9002 http2 proxy_listen = 0.0.0.0:9000, 0.0.0.0:9443 ssl, 0.0.0.0:9002 # avoid port conflicts when multiple Kong instances needed for tests status_listen = off From 42c02b0ff249e8bfec9b7e51ada92d96491de3f5 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Sat, 13 Jan 2024 08:03:25 +0800 Subject: [PATCH 15/17] change helpers.lua --- spec/helpers.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/helpers.lua b/spec/helpers.lua index 102b2ce45e1..b178b7fce7a 100644 --- a/spec/helpers.lua +++ b/spec/helpers.lua @@ -885,7 +885,7 @@ end local function get_proxy_port(ssl, http2) if ssl == nil then ssl = false end for _, entry in ipairs(conf.proxy_listeners) do - if entry.ssl == ssl and (http2 == nil or entry.http2 == http2) then + if entry.ssl == ssl then return entry.port end end @@ -900,7 +900,7 @@ end local function get_proxy_ip(ssl, http2) if ssl == nil then ssl = false end for _, entry in ipairs(conf.proxy_listeners) do - if entry.ssl == ssl and (http2 == nil or entry.http2 == http2) then + if entry.ssl == ssl then return entry.ip end end From 910edc7f9b6b11dac8c89ab67876439441611269 Mon Sep 17 00:00:00 2001 From: chronolaw Date: Sat, 13 Jan 2024 09:37:29 +0800 Subject: [PATCH 16/17] status_listeners http2 on --- kong/templates/nginx_kong.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kong/templates/nginx_kong.lua b/kong/templates/nginx_kong.lua index e6e391348ec..2482ea2c0f8 100644 --- a/kong/templates/nginx_kong.lua +++ b/kong/templates/nginx_kong.lua @@ -435,6 +435,8 @@ server { listen $(entry.listener); > end + http2 on; + access_log ${{STATUS_ACCESS_LOG}}; error_log ${{STATUS_ERROR_LOG}} ${{LOG_LEVEL}}; From c27b219adf43d5d24f7bf14a6c854b9e8ea0c61a Mon Sep 17 00:00:00 2001 From: chronolaw Date: Sat, 13 Jan 2024 10:10:22 +0800 Subject: [PATCH 17/17] nginx-1.25.3_10-get-single-http-header.patch --- ...-header.patch => nginx-1.25.3_10-get-single-http-header.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename build/openresty/patches/{nginx-1.25.3_09-get-single-http-header.patch => nginx-1.25.3_10-get-single-http-header.patch} (100%) diff --git a/build/openresty/patches/nginx-1.25.3_09-get-single-http-header.patch b/build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch similarity index 100% rename from build/openresty/patches/nginx-1.25.3_09-get-single-http-header.patch rename to build/openresty/patches/nginx-1.25.3_10-get-single-http-header.patch