dv-browser 2.5.5 → 3.1.0
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/index.js +9 -7
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -9,7 +9,6 @@ let DvBrowser = function (_config) {
|
|
|
9
9
|
timeout: 15,
|
|
10
10
|
connectTimeout: 5,
|
|
11
11
|
httpProxy: null,
|
|
12
|
-
httpProxyUserPwd: null,
|
|
13
12
|
allowRedirect: true,
|
|
14
13
|
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36',
|
|
15
14
|
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
@@ -22,6 +21,7 @@ let DvBrowser = function (_config) {
|
|
|
22
21
|
authBasic: null,
|
|
23
22
|
authBearer: null,
|
|
24
23
|
noDeflate: false,
|
|
24
|
+
lowSpeedTimeout: 15,
|
|
25
25
|
}, _config);
|
|
26
26
|
|
|
27
27
|
const cookiejar = new CookieJar(null);
|
|
@@ -121,8 +121,10 @@ let DvBrowser = function (_config) {
|
|
|
121
121
|
curl.setOpt(Curl.option.URL, options.url);
|
|
122
122
|
curl.setOpt(Curl.option.TIMEOUT, options.timeout);
|
|
123
123
|
curl.setOpt(Curl.option.CONNECTTIMEOUT, options.connectTimeout);
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
if (options.lowSpeedTimeout) {
|
|
125
|
+
curl.setOpt(Curl.option.LOW_SPEED_TIME, options.lowSpeedTimeout);
|
|
126
|
+
curl.setOpt(Curl.option.LOW_SPEED_LIMIT, 512);
|
|
127
|
+
}
|
|
126
128
|
curl.setOpt(Curl.option.NOPROGRESS, true);
|
|
127
129
|
curl.setOpt(Curl.option.HTTPHEADER, headers);
|
|
128
130
|
// curl.setOpt(Curl.option.VERBOSE, true);
|
|
@@ -137,10 +139,10 @@ let DvBrowser = function (_config) {
|
|
|
137
139
|
if (!options.noDeflate) {
|
|
138
140
|
curl.setOpt(Curl.option.ACCEPT_ENCODING, 'gzip');
|
|
139
141
|
}
|
|
140
|
-
if (options
|
|
141
|
-
curl.setOpt(Curl.option.PROXY, options.httpProxy);
|
|
142
|
-
if (options.
|
|
143
|
-
curl.setOpt(Curl.option.PROXYUSERPWD, options.
|
|
142
|
+
if (options?.httpProxy?.address && options?.httpProxy?.port) {
|
|
143
|
+
curl.setOpt(Curl.option.PROXY, options.httpProxy.address + ':' + options.httpProxy.port);
|
|
144
|
+
if (options.httpProxy.auth) {
|
|
145
|
+
curl.setOpt(Curl.option.PROXYUSERPWD, options.httpProxy.auth);
|
|
144
146
|
}
|
|
145
147
|
}
|
|
146
148
|
curl.on('header', handleHeader);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dv-browser",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/druidvav/node-browser",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"node-libcurl": "
|
|
20
|
+
"node-libcurl": "4.0.0",
|
|
21
21
|
"tough-cookie": "4.1.3"
|
|
22
22
|
}
|
|
23
23
|
}
|