Skip to content

Use proxy-agent to support $HTTP_PROXY #2400

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 4, 2020
Prev Previous commit
Next Next commit
update.ts: Fix response memory leak
  • Loading branch information
nhooyr committed Dec 4, 2020
commit cee88ad6372d419f533d52513b5d4d161c1156b2
3 changes: 2 additions & 1 deletion src/node/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ export class UpdateProvider {
const httpx = uri.startsWith("https") ? https : http
const client = httpx.get(uri, { headers: { "User-Agent": "code-server" } }, (response) => {
if (!response.statusCode || response.statusCode < 200 || response.statusCode >= 400) {
response.destroy()
return reject(new Error(`${uri}: ${response.statusCode || "500"}`))
}

if (response.statusCode >= 300) {
++redirects
response.destroy()
++redirects
if (redirects > maxRedirects) {
return reject(new Error("reached max redirects"))
}
Expand Down