Node.js
Node.js
Transition from Http.GetServerSslCert to Http.GetServerCert
See more HTTP Examples
Provides instructions for replacing deprecated GetServerSslCert method calls with GetServerCert.Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
var http = new chilkat.Http();
var domain = "chilkatsoft.com";
var port = 443;
// ------------------------------------------------------------------------
// The GetServerSslCert method is deprecated:
// cert1: Cert
var cert1 = http.GetServerSslCert(domain,port);
if (http.LastMethodSuccess == false) {
console.log(http.LastErrorText);
return;
}
console.log(cert1.SubjectDN);
// ------------------------------------------------------------------------
// Do the equivalent using GetServerCert.
// Your application creates a new, empty certificate object which is passed
// in the last argument and filled with the server certificate upon success.
var cert2 = new chilkat.Cert();
success = http.GetServerCert(domain,port,cert2);
if (success == false) {
console.log(http.LastErrorText);
return;
}
console.log(cert2.SubjectDN);
}
chilkatExample();