From 16b7c876888277c35fa2a40cc69a93ac44c5a785 Mon Sep 17 00:00:00 2001 From: Yadd Date: Fri, 12 Apr 2024 12:05:59 +0200 Subject: [PATCH] drop SSL tests: key too short Forwarded: no Last-Update: 2022-07-09 Gbp-Pq: Name drop-ssl-tests.patch --- test/proxy-agent.js | 163 -------------------------------------------- 1 file changed, 163 deletions(-) diff --git a/test/proxy-agent.js b/test/proxy-agent.js index 0a92126..e6b3df3 100644 --- a/test/proxy-agent.js +++ b/test/proxy-agent.js @@ -467,169 +467,6 @@ test('pass ProxyAgent proxy status code error when using fetch - #2161', { skip: t.end() }) -test('Proxy via HTTP to HTTPS endpoint', async (t) => { - t.plan(4) - - const server = await buildSSLServer() - const proxy = await buildProxy() - - const serverUrl = `https://localhost:${server.address().port}` - const proxyUrl = `http://localhost:${proxy.address().port}` - const proxyAgent = new ProxyAgent({ - uri: proxyUrl, - requestTls: { - ca: [ - readFileSync(join(__dirname, 'fixtures', 'ca.pem'), 'utf8') - ], - key: readFileSync(join(__dirname, 'fixtures', 'client-key-2048.pem'), 'utf8'), - cert: readFileSync(join(__dirname, 'fixtures', 'client-crt-2048.pem'), 'utf8'), - servername: 'agent1' - } - }) - - server.on('request', function (req, res) { - t.ok(req.connection.encrypted) - res.end(JSON.stringify(req.headers)) - }) - - server.on('secureConnection', () => { - t.pass('server should be connected secured') - }) - - proxy.on('secureConnection', () => { - t.fail('proxy over http should not call secureConnection') - }) - - proxy.on('connect', function () { - t.pass('proxy should be connected') - }) - - proxy.on('request', function () { - t.fail('proxy should never receive requests') - }) - - const data = await request(serverUrl, { dispatcher: proxyAgent }) - const json = await data.body.json() - t.strictSame(json, { - host: `localhost:${server.address().port}`, - connection: 'keep-alive' - }) - - server.close() - proxy.close() - proxyAgent.close() -}) - -test('Proxy via HTTPS to HTTPS endpoint', async (t) => { - t.plan(5) - const server = await buildSSLServer() - const proxy = await buildSSLProxy() - - const serverUrl = `https://localhost:${server.address().port}` - const proxyUrl = `https://localhost:${proxy.address().port}` - const proxyAgent = new ProxyAgent({ - uri: proxyUrl, - proxyTls: { - ca: [ - readFileSync(join(__dirname, 'fixtures', 'ca.pem'), 'utf8') - ], - key: readFileSync(join(__dirname, 'fixtures', 'client-key-2048.pem'), 'utf8'), - cert: readFileSync(join(__dirname, 'fixtures', 'client-crt-2048.pem'), 'utf8'), - servername: 'agent1', - rejectUnauthorized: false - }, - requestTls: { - ca: [ - readFileSync(join(__dirname, 'fixtures', 'ca.pem'), 'utf8') - ], - key: readFileSync(join(__dirname, 'fixtures', 'client-key-2048.pem'), 'utf8'), - cert: readFileSync(join(__dirname, 'fixtures', 'client-crt-2048.pem'), 'utf8'), - servername: 'agent1' - } - }) - - server.on('request', function (req, res) { - t.ok(req.connection.encrypted) - res.end(JSON.stringify(req.headers)) - }) - - server.on('secureConnection', () => { - t.pass('server should be connected secured') - }) - - proxy.on('secureConnection', () => { - t.pass('proxy over http should call secureConnection') - }) - - proxy.on('connect', function () { - t.pass('proxy should be connected') - }) - - proxy.on('request', function () { - t.fail('proxy should never receive requests') - }) - - const data = await request(serverUrl, { dispatcher: proxyAgent }) - const json = await data.body.json() - t.strictSame(json, { - host: `localhost:${server.address().port}`, - connection: 'keep-alive' - }) - - server.close() - proxy.close() - proxyAgent.close() -}) - -test('Proxy via HTTPS to HTTP endpoint', async (t) => { - t.plan(3) - const server = await buildServer() - const proxy = await buildSSLProxy() - - const serverUrl = `http://localhost:${server.address().port}` - const proxyUrl = `https://localhost:${proxy.address().port}` - const proxyAgent = new ProxyAgent({ - uri: proxyUrl, - proxyTls: { - ca: [ - readFileSync(join(__dirname, 'fixtures', 'ca.pem'), 'utf8') - ], - key: readFileSync(join(__dirname, 'fixtures', 'client-key-2048.pem'), 'utf8'), - cert: readFileSync(join(__dirname, 'fixtures', 'client-crt-2048.pem'), 'utf8'), - servername: 'agent1', - rejectUnauthorized: false - } - }) - - server.on('request', function (req, res) { - t.ok(!req.connection.encrypted) - res.end(JSON.stringify(req.headers)) - }) - - server.on('secureConnection', () => { - t.fail('server is http') - }) - - proxy.on('secureConnection', () => { - t.pass('proxy over http should call secureConnection') - }) - - proxy.on('request', function () { - t.fail('proxy should never receive requests') - }) - - const data = await request(serverUrl, { dispatcher: proxyAgent }) - const json = await data.body.json() - t.strictSame(json, { - host: `localhost:${server.address().port}`, - connection: 'keep-alive' - }) - - server.close() - proxy.close() - proxyAgent.close() -}) - test('Proxy via HTTP to HTTP endpoint', async (t) => { t.plan(3) const server = await buildServer() -- 2.30.2