xyzURL -> xyzUrl
This commit is contained in:
		
							parent
							
								
									5765aa6974
								
							
						
					
					
						commit
						1bb9de56b0
					
				| @ -16,7 +16,7 @@ var Acme = require('./acme-client'); | ||||
| function getCert(options, cb) { | ||||
|   var state={ | ||||
|     validatedDomains:[], | ||||
|     validAuthorizationURLs:[] | ||||
|     validAuthorizationUrls:[] | ||||
|   }; | ||||
| 
 | ||||
|   if (!options.accountPrivateKeyPem) { | ||||
| @ -85,8 +85,8 @@ function getCert(options, cb) { | ||||
|       return handleErr(err, 'Server didn\'t provide information to proceed (2)'); | ||||
|     } | ||||
| 
 | ||||
|     state.authorizationURL=res.headers.location; | ||||
|     state.newCertificateURL=links.next; | ||||
|     state.authorizationUrl=res.headers.location; | ||||
|     state.newCertificateUrl=links.next; | ||||
| 
 | ||||
|     authz=JSON.parse(body); | ||||
| 
 | ||||
| @ -101,13 +101,13 @@ function getCert(options, cb) { | ||||
|     thumbprint=cryptoUtil.thumbprint(state.accountKeyPair.publicKey); | ||||
|     keyAuthorization=challenge.token+'.'+thumbprint; | ||||
|     challengePath='.well-known/acme-challenge/'+challenge.token; | ||||
|     state.responseURL=challenge.uri; | ||||
|     state.responseUrl=challenge.uri; | ||||
|     state.path=challengePath; | ||||
| 
 | ||||
|     options.setChallenge(state.domain, '/'+challengePath, keyAuthorization, challengeDone); | ||||
| 
 | ||||
|     function challengeDone() { | ||||
|       state.acme.post(state.responseURL, { | ||||
|       state.acme.post(state.responseUrl, { | ||||
|         resource:'challenge', | ||||
|         keyAuthorization:keyAuthorization | ||||
|       }, function(err, res, body) { | ||||
| @ -132,14 +132,14 @@ function getCert(options, cb) { | ||||
| 
 | ||||
|     if (authz.status==='pending') { | ||||
|       setTimeout(function() { | ||||
|         request.get(state.authorizationURL, {}, function(err, res, body) { | ||||
|         request.get(state.authorizationUrl, {}, function(err, res, body) { | ||||
|           ensureValidation(err, res, body, unlink); | ||||
|         }); | ||||
|       }, 1000); | ||||
|     } else if (authz.status==='valid') { | ||||
|       log('Validating domain ... done'); | ||||
|       state.validatedDomains.push(state.domain); | ||||
|       state.validAuthorizationURLs.push(state.authorizationURL); | ||||
|       state.validAuthorizationUrls.push(state.authorizationUrl); | ||||
|       unlink(); | ||||
|       nextDomain(); | ||||
|     } else if (authz.status==='invalid') { | ||||
| @ -154,15 +154,15 @@ function getCert(options, cb) { | ||||
|   function getCertificate() { | ||||
|     var csr=cryptoUtil.generateCSR(state.certPrivateKey, state.validatedDomains); | ||||
|     log('Requesting certificate...'); | ||||
|     state.acme.post(state.newCertificateURL, { | ||||
|     state.acme.post(state.newCertificateUrl, { | ||||
|       resource:'new-cert', | ||||
|       csr:csr, | ||||
|       authorizations:state.validAuthorizationURLs | ||||
|       authorizations:state.validAuthorizationUrls | ||||
|     }, downloadCertificate); | ||||
|   } | ||||
| 
 | ||||
|   function downloadCertificate(err, res, body) { | ||||
|     var links, certURL; | ||||
|     var links, certUrl; | ||||
| 
 | ||||
|     if (err || Math.floor(res.statusCode/100)!==2) { | ||||
|       log('Certificate request failed with error ', err); | ||||
| @ -180,21 +180,21 @@ function getCert(options, cb) { | ||||
|     log('Requesting certificate: done'); | ||||
| 
 | ||||
|     state.certificate=body; | ||||
|     certURL=res.headers.location; | ||||
|     certUrl=res.headers.location; | ||||
|     request.get({ | ||||
|       url:certURL, | ||||
|       url:certUrl, | ||||
|       encoding:null | ||||
|     }, function(err, res, body) { | ||||
|       if (err) { | ||||
|         return handleErr(err, 'Failed to fetch cert from '+certURL); | ||||
|         return handleErr(err, 'Failed to fetch cert from '+certUrl); | ||||
|       } | ||||
|       if (res.statusCode!==200) { | ||||
|         return handleErr(err, 'Failed to fetch cert from '+certURL, res.body.toString()); | ||||
|         return handleErr(err, 'Failed to fetch cert from '+certUrl, res.body.toString()); | ||||
|       } | ||||
|       if (body.toString()!==state.certificate.toString()) { | ||||
|         handleErr(null, 'Cert at '+certURL+' did not match returned cert'); | ||||
|         handleErr(null, 'Cert at '+certUrl+' did not match returned cert'); | ||||
|       } else { | ||||
|         log('Successfully verified cert at '+certURL); | ||||
|         log('Successfully verified cert at '+certUrl); | ||||
|         log('Requesting issuer certificate...'); | ||||
|         request.get({ | ||||
|           url:links.up, | ||||
|  | ||||
| @ -62,19 +62,19 @@ function registerNewAccount(options, cb) { | ||||
|     state.termsRequired=('terms-of-service' in links); | ||||
| 
 | ||||
|     if (state.termsRequired) { | ||||
|       state.termsURL=links['terms-of-service']; | ||||
|       options.agreeToTerms(state.termsURL, function (err, agree) { | ||||
|       state.termsUrl=links['terms-of-service']; | ||||
|       options.agreeToTerms(state.termsUrl, function (err, agree) { | ||||
|         if (err) { | ||||
|           return handleErr(err); | ||||
|         } | ||||
|         if (!agree) { | ||||
|           return handleErr(new Error("You must agree to the terms of use at '" + state.termsURL + "'")); | ||||
|           return handleErr(new Error("You must agree to the terms of use at '" + state.termsUrl + "'")); | ||||
|         } | ||||
| 
 | ||||
|         state.agreeTerms = agree; | ||||
|         state.termsURL=links['terms-of-service']; | ||||
|         log(state.termsURL); | ||||
|         request.get(state.termsURL, getAgreement); | ||||
|         state.termsUrl=links['terms-of-service']; | ||||
|         log(state.termsUrl); | ||||
|         request.get(state.termsUrl, getAgreement); | ||||
|       }); | ||||
|     } else { | ||||
|       cb(); | ||||
| @ -85,20 +85,20 @@ function registerNewAccount(options, cb) { | ||||
|     if (err) { | ||||
|       return handleErr(err, 'Couldn\'t get agreement'); | ||||
|     } | ||||
|     log('The CA requires your agreement to terms:\n'+state.termsURL); | ||||
|     log('The CA requires your agreement to terms:\n'+state.termsUrl); | ||||
|     sendAgreement(); | ||||
|   } | ||||
| 
 | ||||
|   function sendAgreement() { | ||||
|     if (state.termsRequired && !state.agreeTerms) { | ||||
|       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); | ||||
| 
 | ||||
|     state.acme.post(state.registrationUrl, { | ||||
|       resource:'reg', | ||||
|       agreement:state.termsURL | ||||
|       agreement:state.termsUrl | ||||
|     }, function(err, res, body) { | ||||
|       if (err || Math.floor(res.statusCode/100)!==2) { | ||||
|         return handleErr(err, 'Couldn\'t POST agreement back to server', body); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user