From 210e6f614791e837818fb7a823777a0b4fb0cb07 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 9 Jul 2024 16:11:15 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Dmitry Gozman Signed-off-by: Max Schmitt --- .../src/server/socksClientCertificatesInterceptor.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts index a05165b549..7f1f0a8457 100644 --- a/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts +++ b/packages/playwright-core/src/server/socksClientCertificatesInterceptor.ts @@ -41,7 +41,7 @@ class SocksProxyConnection { firstPackageReceived: boolean = false; isTLS: boolean = false; - target: net.Socket = null!; + target!: net.Socket; // In case of http, we just pipe data to the target socket and they are |undefined|. internal: stream.Duplex | undefined; @@ -173,7 +173,7 @@ const kClientCertificatesGlobRegex = Symbol('kClientCertificatesGlobRegex'); export function clientCertificatesToTLSOptions( clientCertificates: channels.BrowserNewContextOptions['clientCertificates'], requestURL: string -): Pick | undefined { +): Pick | undefined { const matchingCerts = clientCertificates?.filter(c => { let regex: RegExp | undefined = (c as any)[kClientCertificatesGlobRegex]; if (!regex) { @@ -185,7 +185,7 @@ export function clientCertificatesToTLSOptions( }); if (!matchingCerts || !matchingCerts.length) return; - const requestOptions = { + const tlsOptions = { pfx: [] as { buf: Buffer, passphrase?: string }[], key: [] as { pem: Buffer, passphrase?: string }[], cert: [] as Buffer[], @@ -204,7 +204,6 @@ export function clientCertificatesToTLSOptions( } export function shouldUseMitmSocksProxy(options: { - ca?: Buffer[]; clientCertificates?: channels.BrowserNewContextOptions['clientCertificates']; }) { if (options.clientCertificates && options.clientCertificates.length > 0)