mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Signed-off-by: Filip Skokan <panva.ip@gmail.com> PR-URL: https://github.com/nodejs/node/pull/63161 Reviewed-By: Tim Perry <pimterry@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
33 lines
892 B
JavaScript
33 lines
892 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
if (!common.hasCrypto) {
|
|
common.skip('missing crypto');
|
|
}
|
|
|
|
const assert = require('assert');
|
|
const https = require('https');
|
|
const net = require('net');
|
|
|
|
const server = net.createServer(function(s) {
|
|
s.once('data', function() {
|
|
s.end('I was waiting for you, hello!', function() {
|
|
s.destroy();
|
|
});
|
|
});
|
|
});
|
|
|
|
server.listen(0, common.mustCall(function() {
|
|
const req = https.request({ port: this.address().port });
|
|
req.end();
|
|
|
|
// Different OpenSSL versions report different errors for junk data on a
|
|
// TLS connection, depending on which record validation check fires first.
|
|
const expectedErrorMessage =
|
|
/wrong[ _]version[ _]number|packet length too long|bad record type/i;
|
|
req.once('error', common.mustCall(function(err) {
|
|
assert.match(err.message, expectedErrorMessage);
|
|
server.close();
|
|
}));
|
|
}));
|