Skip to content

Commit 07c1459

Browse files
committed
fixup! fixup! fixup! fixup! http,https: add built-in proxy support in http/https.request and Agent
1 parent 62de4f0 commit 07c1459

25 files changed

+104
-26
lines changed

test/client-proxy/test-http-proxy-request.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const expectedLogs = [{
6565
// Check that the lower-cased http_proxy environment variable takes precedence over the
6666
// upper-cased HTTP_PROXY.
6767
// On Windows, environment variables are case-insensitive, so this test is not applicable.
68-
if (common.isWindows) {
68+
if (!common.isWindows) {
6969
const proxy2 = http.createServer(common.mustNotCall());
7070
proxy2.on('connect', common.mustNotCall());
7171
proxy2.listen(0);

test/client-proxy/test-https-proxy-fetch.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if (!common.hasCrypto)
1010

1111
// https must be dynamically imported so that builds without crypto support
1212
// can skip it.
13-
const https = (await import('node:https')).default;
13+
const { default: https } = await import('node:https');
1414

1515
// Start a server to process the final request.
1616
const server = https.createServer({

test/client-proxy/test-https-proxy-request-auth-failure.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ import * as common from '../common/index.mjs';
55
import fixtures from '../common/fixtures.js';
66
import assert from 'node:assert';
77
import { once } from 'events';
8-
import https from 'node:https';
98
import http from 'node:http';
109
import { runProxiedRequest } from '../common/proxy-server.js';
1110

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

14+
// https must be dynamically imported so that builds without crypto support
15+
// can skip it.
16+
const { default: https } = await import('node:https');
17+
1518
const server = https.createServer({
1619
cert: fixtures.readKey('agent8-cert.pem'),
1720
key: fixtures.readKey('agent8-key.pem'),

test/client-proxy/test-https-proxy-request-connection-refused.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,16 @@ import * as common from '../common/index.mjs';
44
import fixtures from '../common/fixtures.js';
55
import assert from 'node:assert';
66
import { once } from 'events';
7-
import https from 'node:https';
87
import { runProxiedRequest } from '../common/proxy-server.js';
98
import dgram from 'node:dgram';
109

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

13+
// https must be dynamically imported so that builds without crypto support
14+
// can skip it.
15+
const { default: https } = await import('node:https');
16+
1417
const server = https.createServer({
1518
cert: fixtures.readKey('agent8-cert.pem'),
1619
key: fixtures.readKey('agent8-key.pem'),

test/client-proxy/test-https-proxy-request-empty-response.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ import * as common from '../common/index.mjs';
55
import fixtures from '../common/fixtures.js';
66
import assert from 'node:assert';
77
import { once } from 'events';
8-
import https from 'node:https';
98
import http from 'node:http';
109
import { runProxiedRequest } from '../common/proxy-server.js';
1110

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

14+
// https must be dynamically imported so that builds without crypto support
15+
// can skip it.
16+
const { default: https } = await import('node:https');
17+
1518
const server = https.createServer({
1619
cert: fixtures.readKey('agent8-cert.pem'),
1720
key: fixtures.readKey('agent8-key.pem'),

test/client-proxy/test-https-proxy-request-handshake-failure.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ import * as common from '../common/index.mjs';
55
import fixtures from '../common/fixtures.js';
66
import assert from 'node:assert';
77
import { once } from 'events';
8-
import https from 'node:https';
98
import { runProxiedRequest, createProxyServer } from '../common/proxy-server.js';
109

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

13+
// https must be dynamically imported so that builds without crypto support
14+
// can skip it.
15+
const { default: https } = await import('node:https');
16+
1417
const server = https.createServer({
1518
cert: fixtures.readKey('agent8-cert.pem'),
1619
key: fixtures.readKey('agent8-key.pem'),

test/client-proxy/test-https-proxy-request-https-proxy.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
import * as common from '../common/index.mjs';
66
import fixtures from '../common/fixtures.js';
77
import assert from 'node:assert';
8-
import https from 'node:https';
98
import { once } from 'events';
109
import { createProxyServer, runProxiedRequest } from '../common/proxy-server.js';
1110

1211
if (!common.hasCrypto) {
1312
common.skip('missing crypto');
1413
}
1514

15+
// https must be dynamically imported so that builds without crypto support
16+
// can skip it.
17+
const { default: https } = await import('node:https');
18+
1619
// Start a server to process the final request.
1720
const server = https.createServer({
1821
cert: fixtures.readKey('agent8-cert.pem'),

test/client-proxy/test-https-proxy-request-incomplete-headers.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ import * as common from '../common/index.mjs';
55
import fixtures from '../common/fixtures.js';
66
import assert from 'node:assert';
77
import { once } from 'events';
8-
import https from 'node:https';
98
import http from 'node:http';
109
import { runProxiedRequest } from '../common/proxy-server.js';
1110
if (!common.hasCrypto)
1211
common.skip('missing crypto');
1312

13+
// https must be dynamically imported so that builds without crypto support
14+
// can skip it.
15+
const { default: https } = await import('node:https');
16+
1417
const server = https.createServer({
1518
cert: fixtures.readKey('agent8-cert.pem'),
1619
key: fixtures.readKey('agent8-key.pem'),

test/client-proxy/test-https-proxy-request-invalid-char-in-options.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33

44
import * as common from '../common/index.mjs';
55
import assert from 'node:assert';
6-
import https from 'node:https';
76
import { once } from 'events';
87
import fixtures from '../common/fixtures.js';
98

9+
if (!common.hasCrypto)
10+
common.skip('missing crypto');
11+
12+
// https must be dynamically imported so that builds without crypto support
13+
// can skip it.
14+
const { default: https } = await import('node:https');
15+
1016
const server = https.createServer({
1117
cert: fixtures.readKey('agent8-cert.pem'),
1218
key: fixtures.readKey('agent8-key.pem'),

test/client-proxy/test-https-proxy-request-invalid-char-in-url.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44
import * as common from '../common/index.mjs';
55
import assert from 'node:assert';
66
import fixtures from '../common/fixtures.js';
7-
import https from 'node:https';
87
import { once } from 'events';
98
import { inspect } from 'node:util';
109
import { createProxyServer } from '../common/proxy-server.js';
1110

1211
if (!common.hasCrypto) {
1312
common.skip('missing crypto');
1413
}
14+
15+
// https must be dynamically imported so that builds without crypto support
16+
// can skip it.
17+
const { default: https } = await import('node:https');
1518
const requests = new Set();
1619

1720
const server = https.createServer({

0 commit comments

Comments
 (0)