cleanup
This commit is contained in:
parent
4490d0e7d7
commit
5765aa6974
|
@ -69,7 +69,7 @@ Acme.prototype.post=function(url, body, cb) {
|
||||||
var parsed;
|
var parsed;
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err.stack);
|
||||||
return cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
if (res) {
|
if (res) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ function getCert(options, cb) {
|
||||||
function getChallenges(domain) {
|
function getChallenges(domain) {
|
||||||
state.domain=domain;
|
state.domain=domain;
|
||||||
|
|
||||||
state.acme.post(state.newAuthorizationURL, {
|
state.acme.post(state.newAuthorizationUrl, {
|
||||||
resource:'new-authz',
|
resource:'new-authz',
|
||||||
identifier:{
|
identifier:{
|
||||||
type:'dns',
|
type:'dns',
|
||||||
|
@ -72,8 +72,12 @@ function getCert(options, cb) {
|
||||||
function getReadyToValidate(err, res, body) {
|
function getReadyToValidate(err, res, body) {
|
||||||
var links, authz, httpChallenges, challenge, thumbprint, keyAuthorization, challengePath;
|
var links, authz, httpChallenges, challenge, thumbprint, keyAuthorization, challengePath;
|
||||||
|
|
||||||
if (err || Math.floor(res.statusCode/100)!==2) {
|
if (err) {
|
||||||
return handleErr(err, 'Authorization request failed ('+res.statusCode+')');
|
return handleErr(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Math.floor(res.statusCode/100)!==2) {
|
||||||
|
return handleErr(null, 'Authorization request failed ('+res.statusCode+')');
|
||||||
}
|
}
|
||||||
|
|
||||||
links=Acme.parseLink(res.headers.link);
|
links=Acme.parseLink(res.headers.link);
|
||||||
|
|
|
@ -56,8 +56,9 @@ function registerNewAccount(options, cb) {
|
||||||
return handleErr(err, 'Server didn\'t provide information to proceed (1)');
|
return handleErr(err, 'Server didn\'t provide information to proceed (1)');
|
||||||
}
|
}
|
||||||
|
|
||||||
state.registrationURL=res.headers.location;
|
state.registrationUrl=res.headers.location;
|
||||||
state.newAuthorizationURL=links.next;
|
// TODO should we pass this along?
|
||||||
|
//state.newAuthorizationUrl=links.next;
|
||||||
state.termsRequired=('terms-of-service' in links);
|
state.termsRequired=('terms-of-service' in links);
|
||||||
|
|
||||||
if (state.termsRequired) {
|
if (state.termsRequired) {
|
||||||
|
@ -93,9 +94,9 @@ function registerNewAccount(options, cb) {
|
||||||
return handleErr(null, 'The CA requires your agreement to terms: '+state.termsURL);
|
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',
|
resource:'reg',
|
||||||
agreement:state.termsURL
|
agreement:state.termsURL
|
||||||
}, function(err, res, body) {
|
}, function(err, res, body) {
|
||||||
|
|
Loading…
Reference in New Issue