Upgrade proxy to 2.1.1 (#158764)

## Summary

Bumps the `proxy` dev dependency to `2.1.1`.
This commit is contained in:
Larry Gregory 2023-06-01 12:36:31 -04:00 committed by GitHub
parent e82ef829fb
commit 248a1346af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 66 deletions

View file

@ -1471,7 +1471,7 @@
"postcss-prefix-selector": "^1.16.0",
"postcss-scss": "^4.0.4",
"prettier": "^2.7.1",
"proxy": "^1.0.2",
"proxy": "^2.1.1",
"q": "^1.5.1",
"raw-loader": "^3.1.0",
"react-test-renderer": "^17.0.2",

View file

@ -5,8 +5,7 @@
* 2.0.
*/
// eslint-disable-next-line @typescript-eslint/no-var-requires
const proxySetup = require('proxy');
import * as proxy from 'proxy';
import { readFileSync as fsReadFileSync } from 'fs';
import { resolve as pathResolve, join as pathJoin } from 'path';
@ -263,9 +262,9 @@ describe('axios connections', () => {
});
async function basicProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
ssl: { verificationMode: 'none' },
customHostSettings: [{ url: target.url, ssl: { certificateAuthoritiesData: CA } }],
});
@ -276,9 +275,9 @@ async function basicProxyTest(opts: RunTestOptions) {
}
async function wrongTargetPasswordProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
ssl: { verificationMode: 'none' },
customHostSettings: [{ url: target.url, ssl: { certificateAuthoritiesData: CA } }],
});
@ -290,9 +289,9 @@ async function wrongTargetPasswordProxyTest(opts: RunTestOptions) {
}
async function missingTargetPasswordProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
ssl: { verificationMode: 'none' },
customHostSettings: [{ url: target.url, ssl: { certificateAuthoritiesData: CA } }],
});
@ -304,8 +303,8 @@ async function missingTargetPasswordProxyTest(opts: RunTestOptions) {
}
async function wrongProxyPasswordProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
const wrongUrl = manglePassword(proxy.url);
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const wrongUrl = manglePassword(proxyInstance.url);
const acu = getACUfromConfig({
proxyUrl: wrongUrl,
ssl: { verificationMode: 'none' },
@ -321,8 +320,8 @@ async function wrongProxyPasswordProxyTest(opts: RunTestOptions) {
}
async function missingProxyPasswordProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
const anonUrl = removePassword(proxy.url);
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const anonUrl = removePassword(proxyInstance.url);
const acu = getACUfromConfig({
proxyUrl: anonUrl,
ssl: { verificationMode: 'none' },
@ -338,9 +337,9 @@ async function missingProxyPasswordProxyTest(opts: RunTestOptions) {
}
async function missingCaProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
});
try {
@ -353,9 +352,9 @@ async function missingCaProxyTest(opts: RunTestOptions) {
}
async function rejectUnauthorizedTargetProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
rejectUnauthorized: false,
customHostSettings: [{ url: target.url, ssl: { verificationMode: 'none' } }],
});
@ -366,9 +365,9 @@ async function rejectUnauthorizedTargetProxyTest(opts: RunTestOptions) {
}
async function customCAProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
customHostSettings: [{ url: target.url, ssl: { certificateAuthoritiesData: CA } }],
});
@ -378,9 +377,9 @@ async function customCAProxyTest(opts: RunTestOptions) {
}
async function verModeNoneTargetProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
customHostSettings: [{ url: target.url, ssl: { verificationMode: 'none' } }],
});
@ -410,7 +409,7 @@ async function runWithSetup(opts: RunTestOptions, fn: Test) {
requireAuth: opts.targetAuth,
});
const proxy = await createProxy({
const proxyInstance = await createProxy({
useHttps: opts.proxyHttps,
requireAuth: opts.proxyAuth,
});
@ -421,18 +420,18 @@ async function runWithSetup(opts: RunTestOptions, fn: Test) {
validateStatus,
url: target.url,
configurationUtilities: getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
}),
};
try {
await fn(target, proxy, axiosDefaults);
await fn(target, proxyInstance, axiosDefaults);
} catch (err) {
expect(err).toBeUndefined();
}
target.server.close();
proxy.server.close();
proxyInstance.server.close();
}
function testLabel(type: string, tls: boolean, auth: boolean) {
@ -541,7 +540,7 @@ async function createProxy(options: CreateProxyOptions): Promise<CreateProxyResu
}
proxyServer.unref();
proxySetup(proxyServer);
proxy.createProxy(proxyServer);
if (requireAuth) {
(proxyServer as unknown as IAuthenticate).authenticate = (req, callback) => {
const auth = req.headers['proxy-authorization'];

View file

@ -5,8 +5,7 @@
* 2.0.
*/
// eslint-disable-next-line @typescript-eslint/no-var-requires
const proxySetup = require('proxy');
import * as proxy from 'proxy';
import { readFileSync as fsReadFileSync } from 'fs';
import { resolve as pathResolve, join as pathJoin } from 'path';
@ -271,9 +270,9 @@ describe('axios connections', () => {
});
async function basicProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
ssl: { verificationMode: 'none' },
customHostSettings: [{ url: target.url, ssl: { certificateAuthoritiesData: CA } }],
});
@ -285,9 +284,9 @@ async function basicProxyTest(opts: RunTestOptions) {
}
async function wrongTargetPasswordProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
ssl: { verificationMode: 'none' },
customHostSettings: [{ url: target.url, ssl: { certificateAuthoritiesData: CA } }],
});
@ -299,9 +298,9 @@ async function wrongTargetPasswordProxyTest(opts: RunTestOptions) {
}
async function missingTargetPasswordProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
ssl: { verificationMode: 'none' },
customHostSettings: [{ url: target.url, ssl: { certificateAuthoritiesData: CA } }],
});
@ -313,8 +312,8 @@ async function missingTargetPasswordProxyTest(opts: RunTestOptions) {
}
async function wrongProxyPasswordProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
const wrongUrl = manglePassword(proxy.url);
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const wrongUrl = manglePassword(proxyInstance.url);
const acu = getACUfromConfig({
proxyUrl: wrongUrl,
ssl: { verificationMode: 'none' },
@ -330,8 +329,8 @@ async function wrongProxyPasswordProxyTest(opts: RunTestOptions) {
}
async function missingProxyPasswordProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
const anonUrl = removePassword(proxy.url);
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const anonUrl = removePassword(proxyInstance.url);
const acu = getACUfromConfig({
proxyUrl: anonUrl,
ssl: { verificationMode: 'none' },
@ -347,9 +346,9 @@ async function missingProxyPasswordProxyTest(opts: RunTestOptions) {
}
async function missingCaProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
});
try {
@ -362,9 +361,9 @@ async function missingCaProxyTest(opts: RunTestOptions) {
}
async function rejectUnauthorizedTargetProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
rejectUnauthorized: false,
customHostSettings: [{ url: target.url, ssl: { verificationMode: 'none' } }],
});
@ -376,9 +375,9 @@ async function rejectUnauthorizedTargetProxyTest(opts: RunTestOptions) {
}
async function customCAProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
customHostSettings: [{ url: target.url, ssl: { certificateAuthoritiesData: CA } }],
});
@ -389,9 +388,9 @@ async function customCAProxyTest(opts: RunTestOptions) {
}
async function verModeNoneTargetProxyTest(opts: RunTestOptions) {
await runWithSetup(opts, async (target, proxy, axiosDefaults) => {
await runWithSetup(opts, async (target, proxyInstance, axiosDefaults) => {
const acu = getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
customHostSettings: [{ url: target.url, ssl: { verificationMode: 'none' } }],
});
@ -422,7 +421,7 @@ async function runWithSetup(opts: RunTestOptions, fn: Test) {
requireAuth: opts.targetAuth,
});
const proxy = await createProxy({
const proxyInstance = await createProxy({
useHttps: opts.proxyHttps,
requireAuth: opts.proxyAuth,
});
@ -433,18 +432,18 @@ async function runWithSetup(opts: RunTestOptions, fn: Test) {
validateStatus,
url: target.url,
configurationUtilities: getACUfromConfig({
proxyUrl: proxy.url,
proxyUrl: proxyInstance.url,
}),
};
try {
await fn(target, proxy, axiosDefaults);
await fn(target, proxyInstance, axiosDefaults);
} catch (err) {
expect(err).toBeUndefined();
}
target.server.close();
proxy.server.close();
proxyInstance.server.close();
}
function testLabel(type: string, tls: boolean, auth: boolean) {
@ -553,7 +552,7 @@ async function createProxy(options: CreateProxyOptions): Promise<CreateProxyResu
}
proxyServer.unref();
proxySetup(proxyServer);
proxy.createProxy(proxyServer);
if (requireAuth) {
(proxyServer as unknown as IAuthenticate).authenticate = (req, callback) => {
const auth = req.headers['proxy-authorization'];

View file

@ -10500,10 +10500,10 @@ argparse@^2.0.1:
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
args@5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/args/-/args-5.0.1.tgz#4bf298df90a4799a09521362c579278cc2fdd761"
integrity sha512-1kqmFCFsPffavQFGt8OxJdIcETti99kySRUPMpOhaGjL6mRJn8HFU1OxKY5bMqfZKUwTQc1mZkAjmGYaVOHFtQ==
args@^5.0.3:
version "5.0.3"
resolved "https://registry.yarnpkg.com/args/-/args-5.0.3.tgz#943256db85021a85684be2f0882f25d796278702"
integrity sha512-h6k/zfFgusnv3i5TU08KQkVKuCPBtL/PWQbWkHUxvJrZ2nAyeaUupneemcrgn1xmqxPQsPIzwkUhOpoqPDRZuA==
dependencies:
camelcase "5.0.0"
chalk "2.4.2"
@ -11186,10 +11186,10 @@ base@^0.11.1:
mixin-deep "^1.2.0"
pascalcase "^0.1.1"
basic-auth-parser@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/basic-auth-parser/-/basic-auth-parser-0.0.2.tgz#ce9e71a77f23c1279eecd2659b2a46244c156e41"
integrity sha512-Y7OBvWn+JnW45JWHLY6ybYub2k9cXCMrtCyO1Hds2s6eqClqWhPnOQpgXUPjAiMHj+A8TEPIQQ1dYENnJoBOHQ==
basic-auth-parser@0.0.2-1:
version "0.0.2-1"
resolved "https://registry.yarnpkg.com/basic-auth-parser/-/basic-auth-parser-0.0.2-1.tgz#f1ea575979b27af6a411921d6ff8793d9117347f"
integrity sha512-GFj8iVxo9onSU6BnnQvVwqvxh60UcSHJEDnIk3z4B6iOjsKSmqe+ibW0Rsz7YO7IE1HG3D3tqCNIidP46SZVdQ==
basic-auth@^2.0.1:
version "2.0.1"
@ -23869,14 +23869,14 @@ proxy-from-env@1.1.0, proxy-from-env@^1.1.0:
resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2"
integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==
proxy@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/proxy/-/proxy-1.0.2.tgz#e0cfbe11c0a7a8b238fd2d7134de4e2867578e7f"
integrity sha512-KNac2ueWRpjbUh77OAFPZuNdfEqNynm9DD4xHT14CccGpW8wKZwEkN0yjlb7X9G9Z9F55N0Q+1z+WfgAhwYdzQ==
proxy@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/proxy/-/proxy-2.1.1.tgz#45f9b307508ffcae12bdc71678d44a4ab79cbf8b"
integrity sha512-nLgd7zdUAOpB3ZO/xCkU8gy74UER7P0aihU8DkUsDS5ZoFwVCX7u8dy+cv5tVK8UaB/yminU1GiLWE26TKPYpg==
dependencies:
args "5.0.1"
basic-auth-parser "0.0.2"
debug "^4.1.1"
args "^5.0.3"
basic-auth-parser "0.0.2-1"
debug "^4.3.4"
prr@~1.0.1:
version "1.0.1"