This commit is contained in:
AJ ONeal 2015-12-15 15:05:20 +00:00
parent 4490d0e7d7
commit 5765aa6974
3 changed files with 13 additions and 8 deletions

View File

@ -69,7 +69,7 @@ Acme.prototype.post=function(url, body, cb) {
var parsed;
if (err) {
console.error(err);
console.error(err.stack);
return cb(err);
}
if (res) {

View File

@ -60,7 +60,7 @@ function getCert(options, cb) {
function getChallenges(domain) {
state.domain=domain;
state.acme.post(state.newAuthorizationURL, {
state.acme.post(state.newAuthorizationUrl, {
resource:'new-authz',
identifier:{
type:'dns',
@ -72,8 +72,12 @@ function getCert(options, cb) {
function getReadyToValidate(err, res, body) {
var links, authz, httpChallenges, challenge, thumbprint, keyAuthorization, challengePath;
if (err || Math.floor(res.statusCode/100)!==2) {
return handleErr(err, 'Authorization request failed ('+res.statusCode+')');
if (err) {
return handleErr(err);
}
if (Math.floor(res.statusCode/100)!==2) {
return handleErr(null, 'Authorization request failed ('+res.statusCode+')');
}
links=Acme.parseLink(res.headers.link);

View File

@ -56,8 +56,9 @@ function registerNewAccount(options, cb) {
return handleErr(err, 'Server didn\'t provide information to proceed (1)');
}
state.registrationURL=res.headers.location;
state.newAuthorizationURL=links.next;
state.registrationUrl=res.headers.location;
// TODO should we pass this along?
//state.newAuthorizationUrl=links.next;
state.termsRequired=('terms-of-service' in links);
if (state.termsRequired) {
@ -93,9 +94,9 @@ function registerNewAccount(options, cb) {
return handleErr(null, 'The CA requires your agreement to terms: '+state.termsURL);
}
log('Posting agreement to: '+state.registrationURL);
log('Posting agreement to: '+state.registrationUrl);
state.acme.post(state.registrationURL, {
state.acme.post(state.registrationUrl, {
resource:'reg',
agreement:state.termsURL
}, function(err, res, body) {