From 9ae6a768a78c2588658c4bc6f132c279794d03c1 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Tue, 2 Apr 2019 22:54:38 -0600 Subject: [PATCH] bail when no servername is available --- index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 0852050..a5124ee 100644 --- a/index.js +++ b/index.js @@ -62,10 +62,12 @@ module.exports.create = function (opts) { greenlock.servername = greenlock.approvedDomains[0]; } } + if (!greenlock.servername) { resolve(null); return; } + return greenlock.check({ domains: [ greenlock.servername ] }).then(function (certs) { if (certs) { return { @@ -127,9 +129,11 @@ module.exports.create = function (opts) { greenlock.tlsOptions.SNICallback = function (domain, cb) { sniCallback(domain, function (err, context) { cb(err, context); - if (!context || server._hasDefaultSecureContext) { - return; - } + + if (!context || server._hasDefaultSecureContext) { return; } + if (!domain) { domain = greenlock.servername; } + if (!domain) { return; } + return greenlock.check({ domains: [ domain ] }).then(function (certs) { // ignore the case that check doesn't have all the right args here // to get the same certs that it just got (eventually the right ones will come in)