0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-tls-junk-server.js
Michael Dawson c77bcf0187
test: adjust test-tls-junk-server for OpenSSL32
Refs: #53382

OpenSSL32 returns different error text. Looking through
the test it seems like the expected error text has been adjusted
for different OpenSSL versions in the past and what the test
is testing is not related to the error being returned.

Update test to allow for error returned by OpenSSL32

Signed-off-by: Michael Dawson <midawson@redhat.com>
PR-URL: https://github.com/nodejs/node/pull/54926
Refs: https://github.com/nodejs/node/issues/53382
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2024-09-15 16:40:05 +00:00

32 lines
781 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, function() {
const req = https.request({ port: this.address().port });
req.end();
let expectedErrorMessage = new RegExp('wrong version number');
if (common.hasOpenSSL(3, 2)) {
expectedErrorMessage = new RegExp('packet length too long');
};
req.once('error', common.mustCall(function(err) {
assert(expectedErrorMessage.test(err.message));
server.close();
}));
});