You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/04/25 06:42:00 UTC
[apisix] branch master updated: fix: upstream nodes cant't include ipv6 addr (#6908)
This is an automated email from the ASF dual-hosted git repository.
spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 0bd8b5cba fix: upstream nodes cant't include ipv6 addr (#6908)
0bd8b5cba is described below
commit 0bd8b5cbad4c5535fda1ce9e756e17777d904871
Author: soulbird <zh...@outlook.com>
AuthorDate: Mon Apr 25 14:41:55 2022 +0800
fix: upstream nodes cant't include ipv6 addr (#6908)
---
apisix/schema_def.lua | 2 +-
t/admin/upstream-array-nodes.t | 35 +++++++++++++++++++++++++++++++++++
t/plugin/referer-restriction.t | 1 -
3 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua
index 3f72111d8..96cc11eaa 100644
--- a/apisix/schema_def.lua
+++ b/apisix/schema_def.lua
@@ -37,7 +37,7 @@ local id_schema = {
}
}
-local host_def_pat = "^\\*?[0-9a-zA-Z-._]+$"
+local host_def_pat = "^\\*?[0-9a-zA-Z-._\\[\\]:]+$"
local host_def = {
type = "string",
pattern = host_def_pat,
diff --git a/t/admin/upstream-array-nodes.t b/t/admin/upstream-array-nodes.t
index d6cfaf012..16855526c 100644
--- a/t/admin/upstream-array-nodes.t
+++ b/t/admin/upstream-array-nodes.t
@@ -450,3 +450,38 @@ GET /t
{"error_msg":"invalid configuration: property \"nodes\" validation failed: object matches none of the required"}
--- no_error_log
[error]
+
+
+
+=== TEST 14: nodes host include ipv6 addr
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ local code, body = t('/apisix/admin/routes/1',
+ ngx.HTTP_PUT,
+ [[{
+ "upstream": {
+ "nodes": [
+ {
+ "host":"[::1]",
+ "port":8082,
+ "weight":1
+ }
+ ],
+ "type": "roundrobin"
+ },
+ "uri": "/index.html"
+ }]]
+ )
+
+ ngx.status = code
+ ngx.say(body)
+ }
+ }
+--- request
+GET /t
+--- response_body
+passed
+--- no_error_log
+[error]
diff --git a/t/plugin/referer-restriction.t b/t/plugin/referer-restriction.t
index 80914cf75..fa4fe5fb4 100644
--- a/t/plugin/referer-restriction.t
+++ b/t/plugin/referer-restriction.t
@@ -173,7 +173,6 @@ hello world
local cases = {
"x.*",
"~y.xn",
- "::1",
}
for _, c in ipairs(cases) do
local ok, err = plugin.check_schema({