mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-06 18:03:19 +08:00
Make sure RequestOptions.keepAlive is applied properly on node20 runtime (#1572)
This commit is contained in:
@@ -649,7 +649,7 @@ export class HttpClient {
|
||||
agent = this._proxyAgent
|
||||
}
|
||||
|
||||
if (this._keepAlive && !useProxy) {
|
||||
if (!useProxy) {
|
||||
agent = this._agent
|
||||
}
|
||||
|
||||
@@ -690,18 +690,13 @@ export class HttpClient {
|
||||
this._proxyAgent = agent
|
||||
}
|
||||
|
||||
// if reusing agent across request and tunneling agent isn't assigned create a new agent
|
||||
if (this._keepAlive && !agent) {
|
||||
// if tunneling agent isn't assigned create a new agent
|
||||
if (!agent) {
|
||||
const options = {keepAlive: this._keepAlive, maxSockets}
|
||||
agent = usingSsl ? new https.Agent(options) : new http.Agent(options)
|
||||
this._agent = agent
|
||||
}
|
||||
|
||||
// if not using private agent and tunnel agent isn't setup then use global agent
|
||||
if (!agent) {
|
||||
agent = usingSsl ? https.globalAgent : http.globalAgent
|
||||
}
|
||||
|
||||
if (usingSsl && this._ignoreSslError) {
|
||||
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
|
||||
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
|
||||
|
||||
Reference in New Issue
Block a user