Skip to content

Commit

Permalink
agent: fix tlsSocket.getPeerCertificate() null reference
Browse files Browse the repository at this point in the history
  • Loading branch information
KSR-Yasuda committed Mar 3, 2020
1 parent 1dc3b23 commit 317dc96
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/ocsp/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ Agent.prototype.createConnection = function createConnection(port,
Agent.prototype.handleOCSPResponse = function handleOCSPResponse(socket,
stapling,
cb) {
var cert = socket.ssl.getPeerCertificate(true);
var issuer = cert.issuerCertificate;
var cert = (socket.ssl || socket).getPeerCertificate(true);
var issuer = cert && cert.issuerCertificate;

cert = cert.raw;
cert = cert && cert.raw;
try {
cert = rfc5280.Certificate.decode(cert, 'der');

Expand Down

0 comments on commit 317dc96

Please sign in to comment.