Skip to content

Commit

Permalink
Default keepAlive to true for proxy agent
Browse files Browse the repository at this point in the history
  • Loading branch information
code-asher committed Mar 11, 2024
1 parent 8c65ff8 commit 132f7d1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions patches/keepalive.diff
Original file line number Diff line number Diff line change
@@ -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:'
1 change: 1 addition & 0 deletions patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ display-language.diff
cli-window-open.diff
getting-started.diff
safari.diff
keepalive.diff
1 change: 1 addition & 0 deletions src/node/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export class UpdateProvider {
logger.debug("Making request", field("uri", uri))
const isHttps = uri.startsWith("https")
const agent = new ProxyAgent({
keepAlive: true,
getProxyForUrl: () => httpProxyUri || "",
})
const httpx = isHttps ? https : http
Expand Down

0 comments on commit 132f7d1

Please sign in to comment.