Skip to content

Commit 1f1c1a3

Browse files
authored
Merge branch 'master' into cp-conn-prom-metric
2 parents 74689f0 + 78c6923 commit 1f1c1a3

File tree

93 files changed

+7646
-1125
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+7646
-1125
lines changed

.github/actions/build-wasm-test-filters/action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ runs:
4141

4242
- name: Install Rust Toolchain
4343
if: steps.restore-cache.outputs.cache-hit != 'true'
44-
uses: actions-rs/toolchain@v1
44+
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1
4545
with:
4646
profile: minimal
4747
toolchain: stable
@@ -51,7 +51,7 @@ runs:
5151

5252
- name: cargo build
5353
if: steps.restore-cache.outputs.cache-hit != 'true'
54-
uses: actions-rs/cargo@v1
54+
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1
5555
with:
5656
command: build
5757
# building in release mode yields smaller library sizes, so it's

.github/workflows/label-schema.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Schema change label found
11-
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # v2
11+
uses: Kong/action-slack-notify@bd750854aaf93c5c6f69799bf813c40e7786368a # v2_node20
1212
continue-on-error: true
1313
env:
1414
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_SCHEMA_CHANGE }}

.github/workflows/release.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on: # yamllint disable-line rule:truthy
3131
env:
3232
# official release repo
3333
DOCKER_REPOSITORY: kong/kong
34-
PRERELEASE_DOCKER_REPOSITORY: kong/kong
34+
PRERELEASE_DOCKER_REPOSITORY: kong/kong-dev
3535
FULL_RELEASE: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.actor == 'dependabot[bot]'}}
3636

3737
# only for PR
@@ -492,7 +492,7 @@ jobs:
492492
- name: Scan AMD64 Image digest
493493
id: sbom_action_amd64
494494
if: steps.image_manifest_metadata.outputs.amd64_sha != ''
495-
uses: Kong/public-shared-actions/security-actions/scan-docker-image@28d20a1f492927f35b00b317acd78f669c45f88b # v2.7.3
495+
uses: Kong/public-shared-actions/security-actions/scan-docker-image@a5b1cfac7d55d8cf9390456a1e6799425e28840d # v4.0.1
496496
with:
497497
asset_prefix: kong-${{ needs.metadata.outputs.commit-sha }}-${{ matrix.label }}-linux-amd64
498498
image: ${{ needs.metadata.outputs.prerelease-docker-repository }}:${{ needs.metadata.outputs.commit-sha }}-${{ matrix.label }}
@@ -501,7 +501,7 @@ jobs:
501501
- name: Scan ARM64 Image digest
502502
if: steps.image_manifest_metadata.outputs.manifest_list_exists == 'true' && steps.image_manifest_metadata.outputs.arm64_sha != ''
503503
id: sbom_action_arm64
504-
uses: Kong/public-shared-actions/security-actions/scan-docker-image@28d20a1f492927f35b00b317acd78f669c45f88b # v2.7.3
504+
uses: Kong/public-shared-actions/security-actions/scan-docker-image@a5b1cfac7d55d8cf9390456a1e6799425e28840d # v4.0.1
505505
with:
506506
asset_prefix: kong-${{ needs.metadata.outputs.commit-sha }}-${{ matrix.label }}-linux-arm64
507507
image: ${{ needs.metadata.outputs.prerelease-docker-repository }}:${{ needs.metadata.outputs.commit-sha }}-${{ matrix.label }}

.requirements

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ OPENRESTY=1.25.3.2
44
OPENRESTY_SHA256=2d564022b06e33b45f7e5cfaf1e5dc571d38d61803af9fa2754dfff353c28d9c
55
LUAROCKS=3.11.1
66
LUAROCKS_SHA256=c3fb3d960dffb2b2fe9de7e3cb004dc4d0b34bb3d342578af84f84325c669102
7-
OPENSSL=3.2.3
8-
OPENSSL_SHA256=52b5f1c6b8022bc5868c308c54fb77705e702d6c6f4594f99a0df216acf46239
7+
OPENSSL=3.4.0
8+
OPENSSL_SHA256=e15dda82fe2fe8139dc2ac21a36d4ca01d5313c75f99f46c4e8a27709b7294bf
99
PCRE=10.44
1010
PCRE_SHA256=86b9cb0aa3bcb7994faa88018292bc704cdbb708e785f7c74352ff6ea7d3175b
1111
ADA=2.9.2
1212
ADA_SHA256=b2cce630590b490d79ea4f4460ba77efd5fb29c5a87a4e8cb7ebc4859bc4b564
13-
LIBEXPAT=2.6.2
14-
LIBEXPAT_SHA256=d4cf38d26e21a56654ffe4acd9cd5481164619626802328506a2869afab29ab3
13+
LIBEXPAT=2.6.4
14+
LIBEXPAT_SHA256=fd03b7172b3bd7427a3e7a812063f74754f24542429b634e0db6511b53fb2278
1515

1616
# Note: git repositories can be loaded from local path if path is set as value
1717

@@ -20,7 +20,7 @@ LUA_RESTY_LMDB=9da0e9f3313960d06e2d8e718b7ac494faa500f1 # 1.6.0
2020
LUA_RESTY_EVENTS=bc85295b7c23eda2dbf2b4acec35c93f77b26787 # 0.3.1
2121
LUA_RESTY_SIMDJSON=7e6466ce91b2bc763b45701a4f055e94b1e8143b # 1.1.0
2222
LUA_RESTY_WEBSOCKET=966c69c39f03029b9b42ec0f8e55aaed7d6eebc0 # 0.4.0.1
23-
ATC_ROUTER=ffd11db657115769bf94f0c4f915f98300bc26b6 # 1.6.2
23+
ATC_ROUTER=4d29e10517e2c9d1dae3966f4034b38c557e2eaa # 1.7.1
2424
SNAPPY=23b3286820105438c5dbb9bc22f1bb85c5812c8a # 1.2.0
2525

2626
KONG_MANAGER=nightly

bin/busted

+4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ if not os.getenv("KONG_BUSTED_RESPAWNED") then
6464
-- create shared dict
6565
resty_flags = resty_flags .. require("spec.fixtures.shared_dict")
6666

67+
-- create lmdb environment
68+
local lmdb_env = os.tmpname()
69+
resty_flags = resty_flags .. string.format(' --main-conf "lmdb_environment_path %s;" ', lmdb_env)
70+
6771
if resty_flags then
6872
table.insert(cmd, cmd_prefix_count+1, resty_flags)
6973
end

build/libexpat/BUILD.libexpat.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ configure_make(
3939
"libexpat.1.dylib",
4040
],
4141
"//conditions:default": [
42-
"libexpat.so.1.9.2",
42+
"libexpat.so.1.10.0",
4343
],
4444
}),
4545
targets = [

build/luarocks/templates/luarocks_make.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mkdir -p $(dirname $@)
1515
# alias LDOC command to true(1) command
1616
export LDOC=true
1717

18-
$luarocks_exec make --no-doc 2>&1 >$@.tmp
18+
$luarocks_exec make --no-doc >$@.tmp 2>&1
1919

2020
# only generate the output when the command succeeds
21-
mv $@.tmp $@
21+
mv $@.tmp $@

build/luarocks/templates/luarocks_target.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ EOF
3333
export LUAROCKS_CONFIG=$ROCKS_CONFIG
3434

3535
$host_luajit $luarocks_wrap_script \
36-
luarocks $rocks_tree $install_destdir 2>&1 > $@.tmp
36+
luarocks $rocks_tree $install_destdir > $@.tmp 2>&1
3737

3838
# write the luarocks config with host configuration
3939
mkdir -p $rocks_tree/etc/luarocks
@@ -55,4 +55,4 @@ sed -i -e "s|$build_destdir|$install_destdir|g" $rocks_tree/bin/luarocks
5555
sed -i -e "s|$rocks_tree|$install_destdir|g" $rocks_tree/bin/luarocks
5656

5757
# only generate the output when the command succeeds
58-
mv $@.tmp $@
58+
mv $@.tmp $@
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
diff --git a/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.lua b/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.lua
2+
index 7d64d63..b0b7543 100644
3+
--- a/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.lua
4+
+++ b/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.lua
5+
@@ -22,6 +22,7 @@ local ngx_lua_ffi_balancer_set_current_peer
6+
local ngx_lua_ffi_balancer_set_more_tries
7+
local ngx_lua_ffi_balancer_get_last_failure
8+
local ngx_lua_ffi_balancer_set_timeouts -- used by both stream and http
9+
+local ngx_lua_ffi_balancer_set_upstream_tls
10+
11+
12+
if subsystem == 'http' then
13+
@@ -41,6 +42,8 @@ if subsystem == 'http' then
14+
15+
int ngx_http_lua_ffi_balancer_recreate_request(ngx_http_request_t *r,
16+
char **err);
17+
+ int ngx_http_lua_ffi_balancer_set_upstream_tls(ngx_http_request_t *r,
18+
+ int on, char **err);
19+
]]
20+
21+
ngx_lua_ffi_balancer_set_current_peer =
22+
@@ -55,6 +58,9 @@ if subsystem == 'http' then
23+
ngx_lua_ffi_balancer_set_timeouts =
24+
C.ngx_http_lua_ffi_balancer_set_timeouts
25+
26+
+ ngx_lua_ffi_balancer_set_upstream_tls =
27+
+ C.ngx_http_lua_ffi_balancer_set_upstream_tls
28+
+
29+
elseif subsystem == 'stream' then
30+
ffi.cdef[[
31+
int ngx_stream_lua_ffi_balancer_set_current_peer(
32+
@@ -228,6 +234,29 @@ if subsystem == 'http' then
33+
34+
return nil, "failed to recreate the upstream request"
35+
end
36+
+
37+
+
38+
+ function _M.set_upstream_tls(on)
39+
+ local r = get_request()
40+
+ if not r then
41+
+ return error("no request found")
42+
+ end
43+
+
44+
+ local rc
45+
+
46+
+ if on == 0 or on == false then
47+
+ on = 0
48+
+ else
49+
+ on = 1
50+
+ end
51+
+
52+
+ rc = ngx_lua_ffi_balancer_set_upstream_tls(r, on, errmsg);
53+
+ if rc == FFI_OK then
54+
+ return true
55+
+ end
56+
+
57+
+ return nil, ffi_str(errmsg[0])
58+
+ end
59+
end
60+
61+
62+
diff --git a/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.md b/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.md
63+
index ef2f124..3ec8cb9 100644
64+
--- a/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.md
65+
+++ b/bundle/lua-resty-core-0.1.28/lib/ngx/balancer.md
66+
@@ -13,11 +13,12 @@ Table of Contents
67+
* [stream subsystem](#stream-subsystem)
68+
* [Description](#description)
69+
* [Methods](#methods)
70+
+ * [get_last_failure](#get_last_failure)
71+
+ * [recreate_request](#recreate_request)
72+
* [set_current_peer](#set_current_peer)
73+
* [set_more_tries](#set_more_tries)
74+
- * [get_last_failure](#get_last_failure)
75+
* [set_timeouts](#set_timeouts)
76+
- * [recreate_request](#recreate_request)
77+
+ * [set_upstream_tls](#set_upstream_tls)
78+
* [Community](#community)
79+
* [English Mailing List](#english-mailing-list)
80+
* [Chinese Mailing List](#chinese-mailing-list)
81+
@@ -270,6 +271,21 @@ This function was first added in the `0.1.20` version of this library.
82+
83+
[Back to TOC](#table-of-contents)
84+
85+
+set_upstream_tls
86+
+------------
87+
+**syntax:** `ok, err = balancer.set_upstream_tls(on)`
88+
+
89+
+**context:** *balancer_by_lua**
90+
+
91+
+Turn off the HTTPs or reenable the HTTPs for the upstream connection.
92+
+
93+
+- If `on` is `true`, then the https protocol will be used to connect to the upstream server.
94+
+- If `on` is `false`, then the http protocol will be used to connect to the upstream server.
95+
+
96+
+This function was first added in the `0.1.29` version of this library.
97+
+
98+
+[Back to TOC](#table-of-contents)
99+
+
100+
Community
101+
=========
102+
103+
diff --git a/bundle/lua-resty-core-0.1.28/t/balancer.t b/bundle/lua-resty-core-0.1.28/t/balancer.t
104+
index 3e9fb2f..6201b47 100644
105+
--- a/bundle/lua-resty-core-0.1.28/t/balancer.t
106+
+++ b/bundle/lua-resty-core-0.1.28/t/balancer.t
107+
@@ -882,3 +882,98 @@ connect() failed (111: Connection refused) while connecting to upstream, client:
108+
--- no_error_log
109+
[warn]
110+
[crit]
111+
+
112+
+
113+
+
114+
+=== TEST 20: set_upstream_tls off
115+
+--- skip_nginx: 5: < 1.7.5
116+
+--- http_config
117+
+ lua_package_path "$TEST_NGINX_LUA_PACKAGE_PATH";
118+
+
119+
+ upstream backend {
120+
+ server 0.0.0.1;
121+
+ balancer_by_lua_block {
122+
+ local b = require "ngx.balancer"
123+
+ b.set_current_peer("127.0.0.1", tonumber(ngx.var.server_port))
124+
+ b.set_upstream_tls(false)
125+
+ }
126+
+ keepalive 1;
127+
+ }
128+
+
129+
+ server {
130+
+ listen $TEST_NGINX_RAND_PORT_1 ssl;
131+
+ ssl_certificate ../../cert/test.crt;
132+
+ ssl_certificate_key ../../cert/test.key;
133+
+
134+
+ server_tokens off;
135+
+ location = /back {
136+
+ return 200 "ok";
137+
+ }
138+
+ }
139+
+--- config
140+
+ location /t {
141+
+ proxy_pass https://backend/back;
142+
+ proxy_http_version 1.1;
143+
+ proxy_set_header Connection "";
144+
+ }
145+
+
146+
+ location /back {
147+
+ echo "Hello world!";
148+
+ }
149+
+--- request
150+
+ GET /t
151+
+--- no_error_log
152+
+[alert]
153+
+[error]
154+
+--- response_body
155+
+Hello world!
156+
+
157+
+--- no_check_leak
158+
+
159+
+
160+
+
161+
+=== TEST 21: set_upstream_tls on
162+
+--- skip_nginx: 5: < 1.7.5
163+
+--- http_config
164+
+ lua_package_path "$TEST_NGINX_LUA_PACKAGE_PATH";
165+
+
166+
+ upstream backend {
167+
+ server 0.0.0.1;
168+
+ balancer_by_lua_block {
169+
+ local b = require "ngx.balancer"
170+
+ b.set_current_peer("127.0.0.1", $TEST_NGINX_RAND_PORT_1)
171+
+ b.set_upstream_tls(false)
172+
+ b.set_upstream_tls(true)
173+
+ }
174+
+
175+
+ keepalive 1;
176+
+ }
177+
+
178+
+ server {
179+
+ listen $TEST_NGINX_RAND_PORT_1 ssl;
180+
+ ssl_certificate ../../cert/test.crt;
181+
+ ssl_certificate_key ../../cert/test.key;
182+
+
183+
+ server_tokens off;
184+
+ location = /back {
185+
+ return 200 "ok";
186+
+ }
187+
+ }
188+
+--- config
189+
+ location /t {
190+
+ proxy_pass https://backend/back;
191+
+ proxy_http_version 1.1;
192+
+ proxy_set_header Connection "";
193+
+ }
194+
+
195+
+ location /back {
196+
+ echo "Hello world!";
197+
+ }
198+
+--- request
199+
+ GET /t
200+
+--- no_error_log
201+
+[alert]
202+
+[error]
203+
+--- response_body chomp
204+
+ok
205+
+--- no_check_leak
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
diff --git a/bundle/nginx-1.25.3/src/http/modules/ngx_http_proxy_module.c b/bundle/nginx-1.25.3/src/http/modules/ngx_http_proxy_module.c
2+
index 4eb6931..9d38e6b 100644
3+
--- a/bundle/nginx-1.25.3/src/http/modules/ngx_http_proxy_module.c
4+
+++ b/bundle/nginx-1.25.3/src/http/modules/ngx_http_proxy_module.c
5+
@@ -1277,6 +1277,22 @@ ngx_http_proxy_create_request(ngx_http_request_t *r)
6+
7+
ctx = ngx_http_get_module_ctx(r, ngx_http_proxy_module);
8+
9+
+ // make sure we refresh the proxy upstream uri in balancer retry scenarios
10+
+ if (r->upstream_states && r->upstream_states->nelts > 0) {
11+
+ if (plcf->proxy_lengths == NULL) {
12+
+ ctx->vars = plcf->vars;
13+
+ u->schema = plcf->vars.schema;
14+
+ #if (NGX_HTTP_SSL)
15+
+ u->ssl = plcf->ssl;
16+
+ #endif
17+
+
18+
+ } else {
19+
+ if (ngx_http_proxy_eval(r, ctx, plcf) != NGX_OK) {
20+
+ return NGX_HTTP_INTERNAL_SERVER_ERROR;
21+
+ }
22+
+ }
23+
+ }
24+
+
25+
if (method.len == 4
26+
&& ngx_strncasecmp(method.data, (u_char *) "HEAD", 4) == 0)
27+
{

0 commit comments

Comments
 (0)