mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 23:10:15 +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>
33 lines
860 B
JavaScript
33 lines
860 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
return;
|
|
}
|
|
|
|
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const tls = require('tls');
|
|
|
|
const sslcontext = tls.createSecureContext({
|
|
cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem'),
|
|
key: fs.readFileSync(common.fixturesDir + '/test_key.pem')
|
|
});
|
|
|
|
let catchedServername;
|
|
const pair = tls.createSecurePair(sslcontext, true, false, false, {
|
|
SNICallback: common.mustCall(function(servername, cb) {
|
|
catchedServername = servername;
|
|
})
|
|
});
|
|
|
|
// captured traffic from browser's request to https://www.google.com
|
|
const sslHello = fs.readFileSync(common.fixturesDir + '/google_ssl_hello.bin');
|
|
|
|
pair.encrypted.write(sslHello);
|
|
|
|
process.on('exit', function() {
|
|
assert.strictEqual('www.google.com', catchedServername);
|
|
});
|