Comparison

core/certmanager.lua @ 12105:47c9a76cce7d

core.certmanager: Check index for wildcard certs
author Kim Alvefur <zash@zash.se>
date Wed, 22 Dec 2021 15:13:49 +0100
parent 12104:29765ac7f72f
child 12120:0fcd80a55f15
comparison
equal deleted inserted replaced
12104:29765ac7f72f 12105:47c9a76cce7d
168 local cert_index; 168 local cert_index;
169 169
170 local function find_cert_in_index(index, host) 170 local function find_cert_in_index(index, host)
171 if not host then return nil; end 171 if not host then return nil; end
172 if not index then return nil; end 172 if not index then return nil; end
173 local certs = index[host]; 173 local wildcard_host = host:gsub("^[^.]+%.", "*.");
174 local certs = index[host] or index[wildcard_host];
174 if certs then 175 if certs then
175 local cert_filename, services = next(certs); 176 local cert_filename, services = next(certs);
176 if services["*"] then 177 if services["*"] then
177 log("debug", "Using cert %q from index", cert_filename); 178 log("debug", "Using cert %q from index", cert_filename);
178 return { 179 return {