Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
theweakgod committed Nov 30, 2023
1 parent 9b2d0e6 commit 52bd602
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/resty/radixtree.lua
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,8 @@ local function match_route_opts(route, opts, args)
if opts.vars.http_host then
host = opts.vars.http_host
end
else
host = opts.host
end
if match_host(hosts[i], hosts[i + 1], host) then
if opts_matched_exists then
Expand Down
28 changes: 28 additions & 0 deletions t/add.t
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,31 @@ GET /t
--- response_body
pass
true
=== TEST 6: match many host
--- config
location /t {
content_by_lua_block {
local opts = {vars = {http_host = "127.0.0.1:9980"}, host = "127.0.0.1"}
local radix = require("resty.radixtree")
local rx = radix.new({
{
paths = {"/aa*"},
hosts = {"www.foo.com:9080", "127.0.0.1:9991", "www.bar.com:9200", "127.0.0.1"},
handler = function (ctx)
ngx.say("pass")
end
}
})
ngx.say(rx:dispatch("/aa", opts))
}
}
--- request
GET /t
--- no_error_log
[error]
--- response_body
pass
true

0 comments on commit 52bd602

Please sign in to comment.