mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 06:31:11 +00:00

Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
30 lines
799 B
JavaScript
30 lines
799 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
const tls = require('tls');
|
|
|
|
const fs = require('fs');
|
|
|
|
const server = tls.createServer({
|
|
key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'),
|
|
cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem')
|
|
}, function(c) {
|
|
// Send close-notify without shutting down TCP socket
|
|
if (c._handle.shutdownSSL() !== 1)
|
|
c._handle.shutdownSSL();
|
|
}).listen(0, common.mustCall(function() {
|
|
const c = tls.connect(this.address().port, {
|
|
rejectUnauthorized: false
|
|
}, common.mustCall(function() {
|
|
// Ensure that we receive 'end' event anyway
|
|
c.on('end', common.mustCall(function() {
|
|
c.destroy();
|
|
server.close();
|
|
}));
|
|
}));
|
|
}));
|