Fix proxy conflict

This commit is contained in:
Chocobozzz 2025-01-15 14:46:08 +01:00
parent b6eb8de3a0
commit cda0351a2b
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 8 additions and 5 deletions

View File

@ -177,7 +177,14 @@ export function generateRequestStream (url: string, options: PeerTubeRequestOpti
}
export function getProxyAgent () {
if (!isProxyEnabled()) return {}
if (!isProxyEnabled()) {
return {
agent: { // Fix issue https://github.com/node-fetch/node-fetch/issues/1735 with Node 20
http: new http.Agent({ keepAlive: false }),
https: new https.Agent({ keepAlive: false })
}
}
}
const proxy = getProxy()
@ -230,10 +237,6 @@ function buildGotOptions (options: PeerTubeRequestOptions): OptionsOfUnknownResp
return {
method: options.method,
dnsCache: true,
agent: { // Fix issue https://github.com/node-fetch/node-fetch/issues/1735 with Node 20
http: new http.Agent({ keepAlive: false }),
https: new https.Agent({ keepAlive: false })
},
timeout: {
request: options.timeout ?? REQUEST_TIMEOUTS.DEFAULT
},