#11 skip challenge when valid

This commit is contained in:
AJ ONeal 2019-02-04 23:04:24 -07:00
parent 8175a08495
commit 6d34655276
1 changed files with 11 additions and 0 deletions

11
node.js
View File

@ -637,6 +637,13 @@ ACME._getCertificate = function (me, options) {
return results.challenges.some(function (ch) {
return ch.type === chType;
});
}).sort(function (aType, bType) {
var a = results.challenges.filter(function (ch) { return ch.type === aType; })[0];
var b = results.challenges.filter(function (ch) { return ch.type === bType; })[0];
if ('valid' === a.status) { return 1; }
if ('valid' === b.status) { return -1; }
return 0;
})[0];
var challenge = results.challenges.filter(function (ch) {
@ -651,6 +658,10 @@ ACME._getCertificate = function (me, options) {
));
}
if ("valid" === challenge.status) {
return;
}
return ACME._postChallenge(me, options, results.identifier, challenge);
}).then(function () {
return next();