Installations
npm install hpagent-catchfix
Developer Guide
Typescript
Yes
Module System
CommonJS, ESM
Min. Node Version
>=14
Node Version
16.15.1
NPM Version
8.11.0
Score
73.4
Supply Chain
99.4
Quality
75.2
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (98.61%)
TypeScript (1.24%)
Shell (0.15%)
Developer
delvedor
Download Statistics
Total Downloads
626
Last Day
1
Last Week
4
Last Month
9
Last Year
190
GitHub Statistics
185 Stars
35 Commits
37 Forks
5 Watching
5 Branches
8 Contributors
Bundle Size
2.63 kB
Minified
798.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.2.0
Package Id
hpagent-catchfix@1.2.0
Unpacked Size
73.17 kB
Size
7.70 kB
File Count
21
NPM Version
8.11.0
Node Version
16.15.1
Publised On
13 May 2023
Total Downloads
Cumulative downloads
Total Downloads
626
Last day
0%
1
Compared to previous day
Last week
300%
4
Compared to previous week
Last month
-67.9%
9
Compared to previous month
Last year
-56.4%
190
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
8
hpagent
A ready to use http and https agent for working with proxies that keeps connections alive!
Install
npm install hpagent
Usage
Based on your infrastructure, you should use the http agent or the https agent. The following table will help you picking the right one.
Type | Proxy | Server |
---|---|---|
HttpProxyAgent | HTTP | HTTP |
HttpProxyAgent | HTTPS | HTTP |
HttpsProxyAgent | HTTP | HTTPS |
HttpsProxyAgent | HTTPS | HTTPS |
1const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent')
Once you have understood the right agent for your use case, you can instance it. It takes the same parameter of the Node.js core's http(s) agent and an additional proxy
option, which is the url of your proxy.
1const http = require('http') 2const { HttpProxyAgent } = require('hpagent') 3 4const agent = new HttpProxyAgent({ 5 keepAlive: true, 6 keepAliveMsecs: 1000, 7 maxSockets: 256, 8 maxFreeSockets: 256, 9 proxy: 'http://localhost:8080' 10}) 11 12http.get('http://localhost:9200', { agent }) 13 .on('response', console.log) 14 .end()
If your proxy requires basic authentication, you can configure it in the proxy url:
1const http = require('http') 2const { HttpProxyAgent } = require('hpagent') 3 4const agent = new HttpProxyAgent({ 5 keepAlive: true, 6 keepAliveMsecs: 1000, 7 maxSockets: 256, 8 maxFreeSockets: 256, 9 proxy: 'http://user:pwd@localhost:8080' 10}) 11 12http.get('http://localhost:9200', { agent }) 13 .on('response', console.log) 14 .end()
You can also pass custom options intended only for the proxy CONNECT request with the proxyConnectOptions
option,
such as headers or tls.connect()
options:
1const fs = require('fs') 2const http = require('http') 3const { HttpProxyAgent } = require('hpagent') 4 5const agent = new HttpProxyAgent({ 6 keepAlive: true, 7 keepAliveMsecs: 1000, 8 maxSockets: 256, 9 maxFreeSockets: 256, 10 proxy: 'https://localhost:8080', 11 proxyConnectOptions: { 12 headers: { 13 'Proxy-Authorization': 'Basic YWxhZGRpbjpvcGVuc2VzYW1l', 14 }, 15 ca: [ fs.readFileSync('custom-proxy-cert.pem') ] 16 } 17}) 18 19http.get('http://localhost:9200', { agent }) 20 .on('response', console.log) 21 .end()
Integrations
Following you can find the list of userland http libraries that are tested with this agent.
got
1got('http://localhost:9200', {
2 agent: {
3 http: new HttpProxyAgent({
4 keepAlive: true,
5 keepAliveMsecs: 1000,
6 maxSockets: 256,
7 maxFreeSockets: 256,
8 scheduling: 'lifo',
9 proxy: 'http://localhost:8080'
10 })
11 }
12})
needle
1needle('get', 'http://localhost:9200', {
2 agent: new HttpProxyAgent({
3 keepAlive: true,
4 keepAliveMsecs: 1000,
5 maxSockets: 256,
6 maxFreeSockets: 256,
7 scheduling: 'lifo',
8 proxy: 'http://localhost:8080'
9 })
10})
node-fetch
1fetch('http://localhost:9200', {
2 agent: new HttpProxyAgent({
3 keepAlive: true,
4 keepAliveMsecs: 1000,
5 maxSockets: 256,
6 maxFreeSockets: 256,
7 scheduling: 'lifo',
8 proxy: 'http://localhost:8080'
9 })
10})
simple-get
1sget.concat({
2 url: `http://${server.address().address}:${server.address().port}`,
3 agent: new HttpProxyAgent({
4 keepAlive: true,
5 keepAliveMsecs: 1000,
6 maxSockets: 256,
7 maxFreeSockets: 256,
8 scheduling: 'lifo',
9 proxy: `https://${proxy.address().address}:${proxy.address().port}`
10 })
11}, function (err, response, data) {
12 // handle the response
13})
License
This software is licensed under the MIT.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 6/23 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/build.yml:1
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/delvedor/hpagent/build.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/delvedor/hpagent/build.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/build.yml:28
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 21 are checked with a SAST tool
Score
3.6
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More