Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/ocsp/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ Agent.prototype.createConnection = function createConnection(port,
Agent.prototype.handleOCSPResponse = function handleOCSPResponse(socket,
stapling,
cb) {
if (!socket.authorized) {
return cb(new Error(socket.authorizationError))
}

var cert = socket.ssl.getPeerCertificate(true);
var issuer = cert.issuerCertificate;

Expand Down
24 changes: 24 additions & 0 deletions test/agent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,27 @@ describe('OCSP Agent', function() {
});
});
});

describe('OCSP Agent failed', function() {
var a;
beforeEach(function() {
a = new ocsp.Agent();
});

var websites = [
"p.vj-vid.com",
"vast.bp3861034.btrll.com"
];

websites.forEach(function(host) {
it('should connect and emit error ' + host, function(cb) {
var req = https.get({
host: host,
port: 443,
agent: a
}).on('error', (e) => {
cb();
});
})
});
})