rezo 1.0.59 → 1.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/index.cjs +6 -6
- package/dist/cache/index.cjs +9 -9
- package/dist/crawler/index.cjs +40 -40
- package/dist/crawler/plugin/index.cjs +1 -1
- package/dist/entries/crawler.cjs +4 -4
- package/dist/index.cjs +27 -27
- package/dist/internal/agents/index.cjs +10 -10
- package/dist/proxy/index.cjs +4 -4
- package/dist/queue/index.cjs +8 -8
- package/dist/responses/universal/index.cjs +11 -11
- package/dist/utils/agent-pool.cjs +49 -2
- package/dist/utils/agent-pool.js +49 -2
- package/package.json +1 -1
package/dist/adapters/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.detectRuntime =
|
|
3
|
-
exports.getAdapterCapabilities =
|
|
4
|
-
exports.buildAdapterContext =
|
|
5
|
-
exports.getAvailableAdapters =
|
|
6
|
-
exports.selectAdapter =
|
|
1
|
+
const _mod_v4c5f2 = require('./picker.cjs');
|
|
2
|
+
exports.detectRuntime = _mod_v4c5f2.detectRuntime;
|
|
3
|
+
exports.getAdapterCapabilities = _mod_v4c5f2.getAdapterCapabilities;
|
|
4
|
+
exports.buildAdapterContext = _mod_v4c5f2.buildAdapterContext;
|
|
5
|
+
exports.getAvailableAdapters = _mod_v4c5f2.getAvailableAdapters;
|
|
6
|
+
exports.selectAdapter = _mod_v4c5f2.selectAdapter;;
|
package/dist/cache/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.LRUCache =
|
|
3
|
-
const
|
|
4
|
-
exports.DNSCache =
|
|
5
|
-
exports.getGlobalDNSCache =
|
|
6
|
-
exports.resetGlobalDNSCache =
|
|
7
|
-
const
|
|
8
|
-
exports.ResponseCache =
|
|
9
|
-
exports.normalizeResponseCacheConfig =
|
|
1
|
+
const _mod_29s8ea = require('./lru-cache.cjs');
|
|
2
|
+
exports.LRUCache = _mod_29s8ea.LRUCache;;
|
|
3
|
+
const _mod_hr6w8b = require('./dns-cache.cjs');
|
|
4
|
+
exports.DNSCache = _mod_hr6w8b.DNSCache;
|
|
5
|
+
exports.getGlobalDNSCache = _mod_hr6w8b.getGlobalDNSCache;
|
|
6
|
+
exports.resetGlobalDNSCache = _mod_hr6w8b.resetGlobalDNSCache;;
|
|
7
|
+
const _mod_6hfo4d = require('./response-cache.cjs');
|
|
8
|
+
exports.ResponseCache = _mod_6hfo4d.ResponseCache;
|
|
9
|
+
exports.normalizeResponseCacheConfig = _mod_6hfo4d.normalizeResponseCacheConfig;;
|
package/dist/crawler/index.cjs
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Crawler =
|
|
3
|
-
const
|
|
4
|
-
exports.CrawlerOptions =
|
|
5
|
-
const
|
|
6
|
-
exports.RobotsTxt =
|
|
7
|
-
const
|
|
8
|
-
exports.FileCacher =
|
|
9
|
-
const
|
|
10
|
-
exports.UrlStore =
|
|
11
|
-
const
|
|
12
|
-
exports.NavigationHistory =
|
|
13
|
-
const
|
|
14
|
-
exports.Oxylabs =
|
|
15
|
-
const
|
|
16
|
-
exports.OXYLABS_BROWSER_TYPES =
|
|
17
|
-
exports.OXYLABS_COMMON_LOCALES =
|
|
18
|
-
exports.OXYLABS_COMMON_GEO_LOCATIONS =
|
|
19
|
-
exports.OXYLABS_US_STATES =
|
|
20
|
-
exports.OXYLABS_EUROPEAN_COUNTRIES =
|
|
21
|
-
exports.OXYLABS_ASIAN_COUNTRIES =
|
|
22
|
-
exports.getRandomOxylabsBrowserType =
|
|
23
|
-
exports.getRandomOxylabsLocale =
|
|
24
|
-
exports.getRandomOxylabsGeoLocation =
|
|
25
|
-
const
|
|
26
|
-
exports.Decodo =
|
|
27
|
-
const
|
|
28
|
-
exports.DECODO_DEVICE_TYPES =
|
|
29
|
-
exports.DECODO_HEADLESS_MODES =
|
|
30
|
-
exports.DECODO_COMMON_LOCALES =
|
|
31
|
-
exports.DECODO_COMMON_COUNTRIES =
|
|
32
|
-
exports.DECODO_EUROPEAN_COUNTRIES =
|
|
33
|
-
exports.DECODO_ASIAN_COUNTRIES =
|
|
34
|
-
exports.DECODO_US_STATES =
|
|
35
|
-
exports.DECODO_COMMON_CITIES =
|
|
36
|
-
exports.getRandomDecodoDeviceType =
|
|
37
|
-
exports.getRandomDecodoLocale =
|
|
38
|
-
exports.getRandomDecodoCountry =
|
|
39
|
-
exports.getRandomDecodoCity =
|
|
40
|
-
exports.generateDecodoSessionId =
|
|
1
|
+
const _mod_pjsv6m = require('./crawler.cjs');
|
|
2
|
+
exports.Crawler = _mod_pjsv6m.Crawler;;
|
|
3
|
+
const _mod_ja9di8 = require('./crawler-options.cjs');
|
|
4
|
+
exports.CrawlerOptions = _mod_ja9di8.CrawlerOptions;;
|
|
5
|
+
const _mod_avcga9 = require('./plugin/robots-txt.cjs');
|
|
6
|
+
exports.RobotsTxt = _mod_avcga9.RobotsTxt;;
|
|
7
|
+
const _mod_ym5hqf = require('./plugin/file-cacher.cjs');
|
|
8
|
+
exports.FileCacher = _mod_ym5hqf.FileCacher;;
|
|
9
|
+
const _mod_x5kf2s = require('./plugin/url-store.cjs');
|
|
10
|
+
exports.UrlStore = _mod_x5kf2s.UrlStore;;
|
|
11
|
+
const _mod_zkw2yc = require('./plugin/navigation-history.cjs');
|
|
12
|
+
exports.NavigationHistory = _mod_zkw2yc.NavigationHistory;;
|
|
13
|
+
const _mod_a34qc5 = require('./addon/oxylabs/index.cjs');
|
|
14
|
+
exports.Oxylabs = _mod_a34qc5.Oxylabs;;
|
|
15
|
+
const _mod_zpgll1 = require('./addon/oxylabs/options.cjs');
|
|
16
|
+
exports.OXYLABS_BROWSER_TYPES = _mod_zpgll1.OXYLABS_BROWSER_TYPES;
|
|
17
|
+
exports.OXYLABS_COMMON_LOCALES = _mod_zpgll1.OXYLABS_COMMON_LOCALES;
|
|
18
|
+
exports.OXYLABS_COMMON_GEO_LOCATIONS = _mod_zpgll1.OXYLABS_COMMON_GEO_LOCATIONS;
|
|
19
|
+
exports.OXYLABS_US_STATES = _mod_zpgll1.OXYLABS_US_STATES;
|
|
20
|
+
exports.OXYLABS_EUROPEAN_COUNTRIES = _mod_zpgll1.OXYLABS_EUROPEAN_COUNTRIES;
|
|
21
|
+
exports.OXYLABS_ASIAN_COUNTRIES = _mod_zpgll1.OXYLABS_ASIAN_COUNTRIES;
|
|
22
|
+
exports.getRandomOxylabsBrowserType = _mod_zpgll1.getRandomBrowserType;
|
|
23
|
+
exports.getRandomOxylabsLocale = _mod_zpgll1.getRandomLocale;
|
|
24
|
+
exports.getRandomOxylabsGeoLocation = _mod_zpgll1.getRandomGeoLocation;;
|
|
25
|
+
const _mod_w5hd29 = require('./addon/decodo/index.cjs');
|
|
26
|
+
exports.Decodo = _mod_w5hd29.Decodo;;
|
|
27
|
+
const _mod_jejdkn = require('./addon/decodo/options.cjs');
|
|
28
|
+
exports.DECODO_DEVICE_TYPES = _mod_jejdkn.DECODO_DEVICE_TYPES;
|
|
29
|
+
exports.DECODO_HEADLESS_MODES = _mod_jejdkn.DECODO_HEADLESS_MODES;
|
|
30
|
+
exports.DECODO_COMMON_LOCALES = _mod_jejdkn.DECODO_COMMON_LOCALES;
|
|
31
|
+
exports.DECODO_COMMON_COUNTRIES = _mod_jejdkn.DECODO_COMMON_COUNTRIES;
|
|
32
|
+
exports.DECODO_EUROPEAN_COUNTRIES = _mod_jejdkn.DECODO_EUROPEAN_COUNTRIES;
|
|
33
|
+
exports.DECODO_ASIAN_COUNTRIES = _mod_jejdkn.DECODO_ASIAN_COUNTRIES;
|
|
34
|
+
exports.DECODO_US_STATES = _mod_jejdkn.DECODO_US_STATES;
|
|
35
|
+
exports.DECODO_COMMON_CITIES = _mod_jejdkn.DECODO_COMMON_CITIES;
|
|
36
|
+
exports.getRandomDecodoDeviceType = _mod_jejdkn.getRandomDeviceType;
|
|
37
|
+
exports.getRandomDecodoLocale = _mod_jejdkn.getRandomLocale;
|
|
38
|
+
exports.getRandomDecodoCountry = _mod_jejdkn.getRandomCountry;
|
|
39
|
+
exports.getRandomDecodoCity = _mod_jejdkn.getRandomCity;
|
|
40
|
+
exports.generateDecodoSessionId = _mod_jejdkn.generateSessionId;;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var r=require("./file-cacher.cjs");exports.FileCacher=r.FileCacher;var e=require("./url-store.cjs");exports.UrlStore=e.UrlStore;
|
package/dist/entries/crawler.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Crawler =
|
|
3
|
-
const
|
|
4
|
-
exports.CrawlerOptions =
|
|
1
|
+
const _mod_3rm3qp = require('../crawler/crawler.cjs');
|
|
2
|
+
exports.Crawler = _mod_3rm3qp.Crawler;;
|
|
3
|
+
const _mod_ovn9ep = require('../crawler/crawler-options.cjs');
|
|
4
|
+
exports.CrawlerOptions = _mod_ovn9ep.CrawlerOptions;;
|
package/dist/index.cjs
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Rezo =
|
|
3
|
-
exports.createRezoInstance =
|
|
4
|
-
exports.createDefaultInstance =
|
|
5
|
-
const
|
|
6
|
-
exports.RezoError =
|
|
7
|
-
exports.RezoErrorCode =
|
|
8
|
-
const
|
|
9
|
-
exports.RezoHeaders =
|
|
10
|
-
const
|
|
11
|
-
exports.RezoFormData =
|
|
12
|
-
const
|
|
13
|
-
exports.RezoCookieJar =
|
|
14
|
-
exports.Cookie =
|
|
15
|
-
const
|
|
16
|
-
exports.toCurl =
|
|
17
|
-
exports.fromCurl =
|
|
18
|
-
const
|
|
19
|
-
exports.createDefaultHooks =
|
|
20
|
-
exports.mergeHooks =
|
|
21
|
-
const
|
|
22
|
-
exports.ProxyManager =
|
|
23
|
-
const
|
|
24
|
-
exports.RezoQueue =
|
|
25
|
-
exports.HttpQueue =
|
|
26
|
-
exports.Priority =
|
|
27
|
-
exports.HttpMethodPriority =
|
|
1
|
+
const _mod_k1xi2g = require('./core/rezo.cjs');
|
|
2
|
+
exports.Rezo = _mod_k1xi2g.Rezo;
|
|
3
|
+
exports.createRezoInstance = _mod_k1xi2g.createRezoInstance;
|
|
4
|
+
exports.createDefaultInstance = _mod_k1xi2g.createDefaultInstance;;
|
|
5
|
+
const _mod_43iwre = require('./errors/rezo-error.cjs');
|
|
6
|
+
exports.RezoError = _mod_43iwre.RezoError;
|
|
7
|
+
exports.RezoErrorCode = _mod_43iwre.RezoErrorCode;;
|
|
8
|
+
const _mod_j7hcxw = require('./utils/headers.cjs');
|
|
9
|
+
exports.RezoHeaders = _mod_j7hcxw.RezoHeaders;;
|
|
10
|
+
const _mod_d6a9p7 = require('./utils/form-data.cjs');
|
|
11
|
+
exports.RezoFormData = _mod_d6a9p7.RezoFormData;;
|
|
12
|
+
const _mod_z9egfa = require('./utils/cookies.cjs');
|
|
13
|
+
exports.RezoCookieJar = _mod_z9egfa.RezoCookieJar;
|
|
14
|
+
exports.Cookie = _mod_z9egfa.Cookie;;
|
|
15
|
+
const _mod_oadyq4 = require('./utils/curl.cjs');
|
|
16
|
+
exports.toCurl = _mod_oadyq4.toCurl;
|
|
17
|
+
exports.fromCurl = _mod_oadyq4.fromCurl;;
|
|
18
|
+
const _mod_7hadvr = require('./core/hooks.cjs');
|
|
19
|
+
exports.createDefaultHooks = _mod_7hadvr.createDefaultHooks;
|
|
20
|
+
exports.mergeHooks = _mod_7hadvr.mergeHooks;;
|
|
21
|
+
const _mod_hxjsb2 = require('./proxy/manager.cjs');
|
|
22
|
+
exports.ProxyManager = _mod_hxjsb2.ProxyManager;;
|
|
23
|
+
const _mod_171fz2 = require('./queue/index.cjs');
|
|
24
|
+
exports.RezoQueue = _mod_171fz2.RezoQueue;
|
|
25
|
+
exports.HttpQueue = _mod_171fz2.HttpQueue;
|
|
26
|
+
exports.Priority = _mod_171fz2.Priority;
|
|
27
|
+
exports.HttpMethodPriority = _mod_171fz2.HttpMethodPriority;;
|
|
28
28
|
const { RezoError } = require('./errors/rezo-error.cjs');
|
|
29
29
|
const isRezoError = exports.isRezoError = RezoError.isRezoError;
|
|
30
30
|
const Cancel = exports.Cancel = RezoError;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.Agent =
|
|
3
|
-
const
|
|
4
|
-
exports.HttpProxyAgent =
|
|
5
|
-
const
|
|
6
|
-
exports.HttpsProxyAgent =
|
|
7
|
-
const
|
|
8
|
-
exports.SocksProxyAgent =
|
|
9
|
-
const
|
|
10
|
-
exports.SocksClient =
|
|
1
|
+
const _mod_aby660 = require('./base.cjs');
|
|
2
|
+
exports.Agent = _mod_aby660.Agent;;
|
|
3
|
+
const _mod_o53zfo = require('./http-proxy.cjs');
|
|
4
|
+
exports.HttpProxyAgent = _mod_o53zfo.HttpProxyAgent;;
|
|
5
|
+
const _mod_htrjvx = require('./https-proxy.cjs');
|
|
6
|
+
exports.HttpsProxyAgent = _mod_htrjvx.HttpsProxyAgent;;
|
|
7
|
+
const _mod_juar6t = require('./socks-proxy.cjs');
|
|
8
|
+
exports.SocksProxyAgent = _mod_juar6t.SocksProxyAgent;;
|
|
9
|
+
const _mod_1ypehb = require('./socks-client.cjs');
|
|
10
|
+
exports.SocksClient = _mod_1ypehb.SocksClient;;
|
package/dist/proxy/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const { Agent, HttpProxyAgent, HttpsProxyAgent, SocksProxyAgent } = require('../internal/agents/index.cjs');
|
|
2
2
|
const { parseProxyString } = require('./parse.cjs');
|
|
3
|
-
const
|
|
4
|
-
exports.ProxyManager =
|
|
5
|
-
const
|
|
6
|
-
exports.parseProxyString =
|
|
3
|
+
const _mod_87mv8a = require('./manager.cjs');
|
|
4
|
+
exports.ProxyManager = _mod_87mv8a.ProxyManager;;
|
|
5
|
+
const _mod_n37alc = require('./parse.cjs');
|
|
6
|
+
exports.parseProxyString = _mod_n37alc.parseProxyString;;
|
|
7
7
|
function createOptions(uri, opts) {
|
|
8
8
|
if (uri instanceof URL || typeof uri === "string") {
|
|
9
9
|
return {
|
package/dist/queue/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.RezoQueue =
|
|
3
|
-
const
|
|
4
|
-
exports.HttpQueue =
|
|
5
|
-
exports.extractDomain =
|
|
6
|
-
const
|
|
7
|
-
exports.Priority =
|
|
8
|
-
exports.HttpMethodPriority =
|
|
1
|
+
const _mod_x2pd1l = require('./queue.cjs');
|
|
2
|
+
exports.RezoQueue = _mod_x2pd1l.RezoQueue;;
|
|
3
|
+
const _mod_nx6gpl = require('./http-queue.cjs');
|
|
4
|
+
exports.HttpQueue = _mod_nx6gpl.HttpQueue;
|
|
5
|
+
exports.extractDomain = _mod_nx6gpl.extractDomain;;
|
|
6
|
+
const _mod_q2nk0x = require('./types.cjs');
|
|
7
|
+
exports.Priority = _mod_q2nk0x.Priority;
|
|
8
|
+
exports.HttpMethodPriority = _mod_q2nk0x.HttpMethodPriority;;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const
|
|
2
|
-
exports.UniversalEventEmitter =
|
|
3
|
-
const
|
|
4
|
-
exports.UniversalStreamResponse =
|
|
5
|
-
exports.StreamResponse =
|
|
6
|
-
const
|
|
7
|
-
exports.UniversalDownloadResponse =
|
|
8
|
-
exports.DownloadResponse =
|
|
9
|
-
const
|
|
10
|
-
exports.UniversalUploadResponse =
|
|
11
|
-
exports.UploadResponse =
|
|
1
|
+
const _mod_c58fz1 = require('./event-emitter.cjs');
|
|
2
|
+
exports.UniversalEventEmitter = _mod_c58fz1.UniversalEventEmitter;;
|
|
3
|
+
const _mod_sj41p1 = require('./stream.cjs');
|
|
4
|
+
exports.UniversalStreamResponse = _mod_sj41p1.UniversalStreamResponse;
|
|
5
|
+
exports.StreamResponse = _mod_sj41p1.StreamResponse;;
|
|
6
|
+
const _mod_rdo4xg = require('./download.cjs');
|
|
7
|
+
exports.UniversalDownloadResponse = _mod_rdo4xg.UniversalDownloadResponse;
|
|
8
|
+
exports.DownloadResponse = _mod_rdo4xg.DownloadResponse;;
|
|
9
|
+
const _mod_uwzrn9 = require('./upload.cjs');
|
|
10
|
+
exports.UniversalUploadResponse = _mod_uwzrn9.UniversalUploadResponse;
|
|
11
|
+
exports.UploadResponse = _mod_uwzrn9.UploadResponse;;
|
|
@@ -69,7 +69,20 @@ class AgentPool {
|
|
|
69
69
|
if (lookup) {
|
|
70
70
|
agentOptions.lookup = lookup;
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
const agent = new http.Agent(agentOptions);
|
|
73
|
+
agent.on("free", (socket) => {
|
|
74
|
+
if (socket && typeof socket.unref === "function") {
|
|
75
|
+
socket.unref();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return agent;
|
|
79
|
+
}
|
|
80
|
+
setupAgentSocketUnref(agent) {
|
|
81
|
+
agent.on("free", (socket) => {
|
|
82
|
+
if (socket && typeof socket.unref === "function") {
|
|
83
|
+
socket.unref();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
73
86
|
}
|
|
74
87
|
createHttpsAgent(key, tlsOptions) {
|
|
75
88
|
const agentOptions = {
|
|
@@ -85,7 +98,13 @@ class AgentPool {
|
|
|
85
98
|
if (lookup) {
|
|
86
99
|
agentOptions.lookup = lookup;
|
|
87
100
|
}
|
|
88
|
-
|
|
101
|
+
const agent = new https.Agent(agentOptions);
|
|
102
|
+
agent.on("free", (socket) => {
|
|
103
|
+
if (socket && typeof socket.unref === "function") {
|
|
104
|
+
socket.unref();
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return agent;
|
|
89
108
|
}
|
|
90
109
|
getHttpAgent(options) {
|
|
91
110
|
const key = this.buildAgentKey(options);
|
|
@@ -160,6 +179,34 @@ class AgentPool {
|
|
|
160
179
|
}
|
|
161
180
|
this.httpsAgents.clear();
|
|
162
181
|
}
|
|
182
|
+
destroyAgentSockets(agent) {
|
|
183
|
+
const sockets = agent.sockets;
|
|
184
|
+
if (sockets && typeof sockets === "object") {
|
|
185
|
+
for (const key of Object.keys(sockets)) {
|
|
186
|
+
const socketList = sockets[key];
|
|
187
|
+
if (Array.isArray(socketList)) {
|
|
188
|
+
for (const socket of socketList) {
|
|
189
|
+
try {
|
|
190
|
+
socket.destroy();
|
|
191
|
+
} catch {}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const freeSockets = agent.freeSockets;
|
|
197
|
+
if (freeSockets && typeof freeSockets === "object") {
|
|
198
|
+
for (const key of Object.keys(freeSockets)) {
|
|
199
|
+
const socketList = freeSockets[key];
|
|
200
|
+
if (Array.isArray(socketList)) {
|
|
201
|
+
for (const socket of socketList) {
|
|
202
|
+
try {
|
|
203
|
+
socket.destroy();
|
|
204
|
+
} catch {}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
163
210
|
clear() {
|
|
164
211
|
this.destroy();
|
|
165
212
|
if (this.config.idleEvictionMs > 0) {
|
package/dist/utils/agent-pool.js
CHANGED
|
@@ -69,7 +69,20 @@ class AgentPool {
|
|
|
69
69
|
if (lookup) {
|
|
70
70
|
agentOptions.lookup = lookup;
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
const agent = new http.Agent(agentOptions);
|
|
73
|
+
agent.on("free", (socket) => {
|
|
74
|
+
if (socket && typeof socket.unref === "function") {
|
|
75
|
+
socket.unref();
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return agent;
|
|
79
|
+
}
|
|
80
|
+
setupAgentSocketUnref(agent) {
|
|
81
|
+
agent.on("free", (socket) => {
|
|
82
|
+
if (socket && typeof socket.unref === "function") {
|
|
83
|
+
socket.unref();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
73
86
|
}
|
|
74
87
|
createHttpsAgent(key, tlsOptions) {
|
|
75
88
|
const agentOptions = {
|
|
@@ -85,7 +98,13 @@ class AgentPool {
|
|
|
85
98
|
if (lookup) {
|
|
86
99
|
agentOptions.lookup = lookup;
|
|
87
100
|
}
|
|
88
|
-
|
|
101
|
+
const agent = new https.Agent(agentOptions);
|
|
102
|
+
agent.on("free", (socket) => {
|
|
103
|
+
if (socket && typeof socket.unref === "function") {
|
|
104
|
+
socket.unref();
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
return agent;
|
|
89
108
|
}
|
|
90
109
|
getHttpAgent(options) {
|
|
91
110
|
const key = this.buildAgentKey(options);
|
|
@@ -160,6 +179,34 @@ class AgentPool {
|
|
|
160
179
|
}
|
|
161
180
|
this.httpsAgents.clear();
|
|
162
181
|
}
|
|
182
|
+
destroyAgentSockets(agent) {
|
|
183
|
+
const sockets = agent.sockets;
|
|
184
|
+
if (sockets && typeof sockets === "object") {
|
|
185
|
+
for (const key of Object.keys(sockets)) {
|
|
186
|
+
const socketList = sockets[key];
|
|
187
|
+
if (Array.isArray(socketList)) {
|
|
188
|
+
for (const socket of socketList) {
|
|
189
|
+
try {
|
|
190
|
+
socket.destroy();
|
|
191
|
+
} catch {}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
const freeSockets = agent.freeSockets;
|
|
197
|
+
if (freeSockets && typeof freeSockets === "object") {
|
|
198
|
+
for (const key of Object.keys(freeSockets)) {
|
|
199
|
+
const socketList = freeSockets[key];
|
|
200
|
+
if (Array.isArray(socketList)) {
|
|
201
|
+
for (const socket of socketList) {
|
|
202
|
+
try {
|
|
203
|
+
socket.destroy();
|
|
204
|
+
} catch {}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
163
210
|
clear() {
|
|
164
211
|
this.destroy();
|
|
165
212
|
if (this.config.idleEvictionMs > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rezo",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.61",
|
|
4
4
|
"description": "Lightning-fast, enterprise-grade HTTP client for modern JavaScript. Full HTTP/2 support, intelligent cookie management, multiple adapters (HTTP, Fetch, cURL, XHR), streaming, proxy support (HTTP/HTTPS/SOCKS), and cross-environment compatibility.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|