fix: resolve unambiguous fully-qualified domain name(FQDN), i.e. ended in a dot (#5999)

This commit is contained in:
seven dickens 2022-01-05 09:32:13 +08:00 committed by GitHub
parent c6f1a83c6f
commit 3f66fab63e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 1 deletions

View File

@ -32,7 +32,7 @@ description = {
dependencies = {
"lua-resty-ctxdump = 0.1-0",
"lua-resty-dns-client = 5.2.0",
"lua-resty-dns-client = 5.2.3",
"lua-resty-template = 2.0",
"lua-resty-etcd = 1.6.0",
"api7-lua-resty-http = 0.2.0",

View File

@ -399,3 +399,51 @@ GET /t
1980, 1981, 1981
--- no_error_log
[error]
=== TEST 15: set route(with upstream)
--- 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,
[[{
"uri": "/hello",
"upstream": {
"nodes": {
"foo.com.": 0,
"127.0.0.1:1980": 1
},
"type": "roundrobin",
"desc": "new upstream"
},
"service_id": "1"
}]]
)
if code >= 300 then
ngx.status = code
end
ngx.say(body)
}
}
--- request
GET /t
--- response_body
passed
--- no_error_log
[error]
=== TEST 16: hit routes, parse the domain of upstream node
--- request
GET /hello
--- response_body
hello world
--- error_log eval
qr/dns resolver domain: foo.com. to \d+.\d+.\d+.\d+/
--- no_error_log
[error]