Archived
1
0

Default keepAlive to true for proxy agent

This commit is contained in:
Asher 2024-03-11 14:13:21 -08:00
parent 8c65ff8d0d
commit 132f7d1470
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
3 changed files with 17 additions and 0 deletions

15
patches/keepalive.diff Normal file
View File

@ -0,0 +1,15 @@
This can be removed after upgrading to Node >= 19 as keepAlive is defaulted to
true after 19.
Index: code-server/lib/vscode/src/vs/platform/request/node/proxy.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/request/node/proxy.ts
+++ code-server/lib/vscode/src/vs/platform/request/node/proxy.ts
@@ -42,6 +42,7 @@ export async function getProxyAgent(rawR
port: (proxyEndpoint.port ? +proxyEndpoint.port : 0) || (proxyEndpoint.protocol === 'https' ? 443 : 80),
auth: proxyEndpoint.auth,
rejectUnauthorized: isBoolean(options.strictSSL) ? options.strictSSL : true,
+ keepAlive: true,
};
return requestURL.protocol === 'http:'

View File

@ -19,3 +19,4 @@ display-language.diff
cli-window-open.diff cli-window-open.diff
getting-started.diff getting-started.diff
safari.diff safari.diff
keepalive.diff

View File

@ -105,6 +105,7 @@ export class UpdateProvider {
logger.debug("Making request", field("uri", uri)) logger.debug("Making request", field("uri", uri))
const isHttps = uri.startsWith("https") const isHttps = uri.startsWith("https")
const agent = new ProxyAgent({ const agent = new ProxyAgent({
keepAlive: true,
getProxyForUrl: () => httpProxyUri || "", getProxyForUrl: () => httpProxyUri || "",
}) })
const httpx = isHttps ? https : http const httpx = isHttps ? https : http