Skip to content

Commit

Permalink
Change: use to scan the items in etcd. close apache#1685
Browse files Browse the repository at this point in the history
  • Loading branch information
xxm404 committed Jun 15, 2020
1 parent e2d9932 commit 677f03e
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions apisix/http/router/radixtree_sni.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local get_request = require("resty.core.base").get_request
local radixtree_new = require("resty.radixtree").new
local core = require("apisix.core")
local ngx_ssl = require("ngx.ssl")
local ipairs = ipairs
local config_util = require("apisix.core.config_util")
local type = type
local error = error
local ssl_certificates
Expand All @@ -38,20 +38,18 @@ local function create_router(ssl_items)
local route_items = core.table.new(#ssl_items, 0)
local idx = 0

for _, ssl in ipairs(ssl_items) do
if type(ssl) == "table" then
local sni = ssl.value.sni:reverse()
idx = idx + 1
route_items[idx] = {
paths = sni,
handler = function (api_ctx)
if not api_ctx then
return
end
api_ctx.matched_ssl = ssl
for _, ssl in config_util.iterate_values(ssl_items) do
local sni = ssl.value.sni:reverse()
idx = idx + 1
route_items[idx] = {
paths = sni,
handler = function (api_ctx)
if not api_ctx then
return
end
}
end
api_ctx.matched_ssl = ssl
end
}
end

core.log.info("route items: ", core.json.delay_encode(route_items, true))
Expand Down

0 comments on commit 677f03e

Please sign in to comment.