Compare commits

..

2 Commits

Author SHA1 Message Date
AJ ONeal 59f896ac62 v2.2.4 2018-04-19 23:23:05 -06:00
AJ ONeal 825001bfb8 don't promisify node's dns; fix https://github.com/Daplie/node-greenlock/issues/69 2018-04-19 23:19:06 -06:00
2 changed files with 5 additions and 6 deletions

View File

@ -4,8 +4,7 @@ var path = require('path');
var homeRe = new RegExp("^~(\\/|\\\\|\\" + path.sep + ")"); var homeRe = new RegExp("^~(\\/|\\\\|\\" + path.sep + ")");
var re = /^[a-zA-Z0-9\.\-]+$/; var re = /^[a-zA-Z0-9\.\-]+$/;
var punycode = require('punycode'); var punycode = require('punycode');
var PromiseA = require('bluebird'); var dnsResolveMxAsync = require('util').promisify(require('dns').resolveMx);
var dns = PromiseA.promisifyAll(require('dns'));
module.exports.attachCertInfo = function (results) { module.exports.attachCertInfo = function (results) {
// XXX Note: Parsing the certificate info comes at a great cost (~500kb) // XXX Note: Parsing the certificate info comes at a great cost (~500kb)
@ -107,10 +106,10 @@ module.exports.testEmail = function (email) {
if (2 !== parts.length || !parts[0] || !parts[1]) { if (2 !== parts.length || !parts[0] || !parts[1]) {
err = new Error("malformed email address '" + email + "'"); err = new Error("malformed email address '" + email + "'");
err.code = 'E_EMAIL'; err.code = 'E_EMAIL';
return PromiseA.reject(err); return Promise.reject(err);
} }
return dns.resolveMxAsync(parts[1]).then(function (records) { return dnsResolveMxAsync(parts[1]).then(function (records) {
// records only returns when there is data // records only returns when there is data
if (!records.length) { if (!records.length) {
throw new Error("sanity check fail: success, but no MX records returned"); throw new Error("sanity check fail: success, but no MX records returned");
@ -120,7 +119,7 @@ module.exports.testEmail = function (email) {
if ('ENODATA' === err.code) { if ('ENODATA' === err.code) {
err = new Error("no MX records found for '" + parts[1] + "'"); err = new Error("no MX records found for '" + parts[1] + "'");
err.code = 'E_EMAIL'; err.code = 'E_EMAIL';
return PromiseA.reject(err); return Promise.reject(err);
} }
}); });
}; };

View File

@ -1,6 +1,6 @@
{ {
"name": "greenlock", "name": "greenlock",
"version": "2.2.3", "version": "2.2.4",
"description": "Let's Encrypt for node.js on npm", "description": "Let's Encrypt for node.js on npm",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {