Skip to content

Conversation

@warjiang
Copy link

@warjiang warjiang commented Mar 3, 2025

the proxyConnectOptions should be corrected as proxyRequestOptions. no matter for HttpProxyAgent or HttpsProxyAgent, the agent class use proxyRequestOptions:

for HttpProxyAgent

hpagent/index.js

Lines 17 to 28 in 96f45f1

createConnection (options, callback) {
const requestOptions = {
...this.proxyRequestOptions,
method: 'CONNECT',
host: this.proxy.hostname,
port: this.proxy.port,
path: `${options.host}:${options.port}`,
setHost: false,
headers: { ...this.proxyRequestOptions.headers, connection: this.keepAlive ? 'keep-alive' : 'close', host: `${options.host}:${options.port}` },
agent: false,
timeout: options.timeout || 0
}

for HttpsProxyAgent

hpagent/index.js

Lines 74 to 86 in 96f45f1

createConnection (options, callback) {
const requestOptions = {
...this.proxyRequestOptions,
method: 'CONNECT',
host: this.proxy.hostname,
port: this.proxy.port,
path: `${options.host}:${options.port}`,
setHost: false,
headers: { ...this.proxyRequestOptions.headers, connection: this.keepAlive ? 'keep-alive' : 'close', host: `${options.host}:${options.port}` },
agent: false,
timeout: options.timeout || 0
}

@warjiang
Copy link
Author

warjiang commented Mar 3, 2025

@delvedor could help me review that ~

Copy link

@mbtools mbtools left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mbtools
Copy link

mbtools commented Nov 13, 2025

Duplicate of #117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants