delvedor / delvedor/hpagent

Issue with secure socket creation errors

Open
#113 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
192
Forks
40
PR merge metrics
No merged PRs in 30d

Description

When using an HTTPS agent, the creation of the secure socket can throw and as a result it raises an exception caught at node process level and the request is hanging forever (or timeout).

https://github.com/delvedor/hpagent/blob/96f45f1d40bfbdfd0fcc84cdba056be6e0fb8f4c/index.js#L102

To reproduce, specify a wrong key/certificate pair to agent options for example :

```js
await request({
method: 'GET',
hostname: SERVER_HOSTNAME,
port: server.address().port,
path: '/',
agent: new HttpsProxyAgent({
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 256,
maxFreeSockets: 256,
scheduling: 'lifo',
/**
* Enable SSL 2 ways and generate a 'createConnection' error with wrong key/cert pair
*/
key: 'wrongkey',
cert: 'wrongca',
proxy: `https://${PROXY_HOSTNAME}:${proxy.address().port}`
})
})
```

The PR is on its way if you wish.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at index.js around line 102 and reproduce the failure with the wrong key and certificate pair shown in the issue. Trace how secure socket creation errors are handled, then verify that the request reports the error instead of hanging or timing out.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.