nic-6443 commented on code in PR #12668:
URL: https://github.com/apache/apisix/pull/12668#discussion_r2428094665
##########
apisix/ssl/router/radixtree_sni.lua:
##########
@@ -55,24 +55,30 @@ local function create_router(ssl_items)
if type(ssl.value.snis) == "table" and #ssl.value.snis > 0 then
sni = core.table.new(0, #ssl.value.snis)
for _, s in ipairs(ssl.value.snis) do
- j = j + 1
- sni[j] = s:reverse()
+ if s ~= "*" then
+ j = j + 1
+ sni[j] = s:reverse()
+ end
end
else
- sni = ssl.value.sni:reverse()
+ if ssl.value.sni ~= "*" then
+ sni = ssl.value.sni:reverse()
+ end
end
- idx = idx + 1
- route_items[idx] = {
- paths = sni,
- handler = function (api_ctx)
- if not api_ctx then
- return
+ if sni and (type(sni) == "table" and #sni > 0 or type(sni) ==
"string") then
+ idx = idx + 1
+ route_items[idx] = {
+ paths = sni,
+ handler = function (api_ctx)
+ if not api_ctx then
+ return
+ end
+ api_ctx.matched_ssl = ssl
+ api_ctx.matched_sni = sni
end
- api_ctx.matched_ssl = ssl
- api_ctx.matched_sni = sni
- end
- }
+ }
+ end
Review Comment:
What happened when we put `*` into radixtree? Doesn't it naturally serve as
a catch-all matching case?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]