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; var parsed;
if (err) { if (err) {
console.error(err); console.error(err.stack);
return cb(err); return cb(err);
} }
if (res) { if (res) {

View File

@ -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);

View File

@ -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) {