Skip to content
Closed
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
18 changes: 10 additions & 8 deletions test/parallel/test-double-tls-server.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
'use strict';
const common = require('../common');
const assert = require('assert');
if (!common.hasCrypto) common.skip('missing crypto');
const fixtures = require('../common/fixtures');
const tls = require('tls');
const net = require('net');
const assert = require('node:assert');

if (!common.hasCrypto) common.skip('missing crypto');

const { test } = require('node:test');
const tls = require('node:tls');
const net = require('node:net');

// Sending tls data on a server TLSSocket with an active write led to a crash:
//
Expand All @@ -27,7 +30,7 @@ const net = require('net');

const serverReplaySize = 2 * 1024 * 1024;

(async function() {
test('TLS double handshake test', async (t) => {
const tlsClientHello = await getClientHello();

const subserver = tls.createServer({
Expand Down Expand Up @@ -57,8 +60,7 @@ const serverReplaySize = 2 * 1024 * 1024;
subserver.emit('connection', serverTlsSock);
});


function startClient() {
async function startClient() {
const clientTlsSock = tls.connect({
host: '127.0.0.1',
port: server.address().port,
Expand All @@ -81,7 +83,7 @@ const serverReplaySize = 2 * 1024 * 1024;
// In reality, one may want to send a HTTP CONNECT before starting this double TLS
clientTlsSock.write(tlsClientHello);
}
})().then(common.mustCall());
});

function getClientHello() {
return new Promise((resolve) => {
Expand Down
Loading