gologin 3.0.3 → 3.0.4
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/gologin.js +4 -2
- package/src/utils/http.js +33 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Combined changelog for GoLogin node.js SDK
|
|
4
4
|
|
|
5
|
+
## [3.0.4] 2026-09-04
|
|
6
|
+
|
|
7
|
+
### Fixes
|
|
8
|
+
|
|
9
|
+
* Fixed proxy request timeout not aborting hung TCP connects during timezone checks
|
|
10
|
+
* Reduced default proxy check timeout to 10s and attempts to 2
|
|
11
|
+
|
|
5
12
|
## [3.0.3] 2026-08-03
|
|
6
13
|
|
|
7
14
|
### Fixes
|
package/package.json
CHANGED
package/src/gologin.js
CHANGED
|
@@ -85,8 +85,8 @@ export class GoLogin {
|
|
|
85
85
|
this.processKillTimeout = 1 * 1000;
|
|
86
86
|
this.browserMajorVersion = options.browserMajorVersion || 0;
|
|
87
87
|
this.newProxyOrbitaMajorVersion = 135;
|
|
88
|
-
this.proxyCheckTimeout = options.proxyCheckTimeout ||
|
|
89
|
-
this.proxyCheckAttempts = options.proxyCheckAttempts ||
|
|
88
|
+
this.proxyCheckTimeout = options.proxyCheckTimeout || 10 * 1000;
|
|
89
|
+
this.proxyCheckAttempts = options.proxyCheckAttempts || 2;
|
|
90
90
|
this.customChromeFrame = options.customChromeFrame;
|
|
91
91
|
|
|
92
92
|
if (options.tmpdir) {
|
|
@@ -570,6 +570,7 @@ export class GoLogin {
|
|
|
570
570
|
name: 'readPreferences',
|
|
571
571
|
promise: readFile(join(profilePath, 'Default', 'Preferences')),
|
|
572
572
|
});
|
|
573
|
+
|
|
573
574
|
const preferences = JSON.parse(preferences_raw.toString());
|
|
574
575
|
const chromeExtensions = get(profile, 'chromeExtensions') || [];
|
|
575
576
|
const userChromeExtensions = get(profile, 'userChromeExtensions') || [];
|
|
@@ -1042,6 +1043,7 @@ export class GoLogin {
|
|
|
1042
1043
|
name: 'getBrowserChecker',
|
|
1043
1044
|
promise: this.getBrowserChecker(),
|
|
1044
1045
|
});
|
|
1046
|
+
|
|
1045
1047
|
ORBITA_BROWSER = browserChecker.getOrbitaPath;
|
|
1046
1048
|
}
|
|
1047
1049
|
|
package/src/utils/http.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { get as _get, request as httpsRequest } from 'https';
|
|
2
1
|
import { request as httpRequest } from 'http';
|
|
2
|
+
import { get as _get, request as httpsRequest } from 'https';
|
|
3
3
|
|
|
4
4
|
import packageJson from '../../package.json' with { type: 'json' };
|
|
5
5
|
import { loadHttpsProxyAgent } from './lazy-deps.js';
|
|
@@ -115,9 +115,11 @@ const normalizeProxyUrl = (proxyUrl) => {
|
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
const executeProxyRequest = async (url, options, internalOptions) => {
|
|
118
|
-
const HttpsProxyAgent = await loadHttpsProxyAgent();
|
|
119
|
-
const agent = new HttpsProxyAgent(normalizeProxyUrl(options.proxy));
|
|
120
118
|
const timeoutMs = options.timeout || DEFAULT_TIMEOUT_MS;
|
|
119
|
+
const HttpsProxyAgent = await loadHttpsProxyAgent();
|
|
120
|
+
const agent = new HttpsProxyAgent(normalizeProxyUrl(options.proxy), {
|
|
121
|
+
timeout: timeoutMs,
|
|
122
|
+
});
|
|
121
123
|
const headers = buildRequestHeaders({ options, internalOptions });
|
|
122
124
|
const body = buildRequestBody(options);
|
|
123
125
|
const method = options.method || 'GET';
|
|
@@ -139,6 +141,19 @@ const executeProxyRequest = async (url, options, internalOptions) => {
|
|
|
139
141
|
};
|
|
140
142
|
|
|
141
143
|
return new Promise((resolve, reject) => {
|
|
144
|
+
let settled = false;
|
|
145
|
+
let timeoutId;
|
|
146
|
+
|
|
147
|
+
const settle = (handler) => (value) => {
|
|
148
|
+
if (settled) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
settled = true;
|
|
153
|
+
clearTimeout(timeoutId);
|
|
154
|
+
handler(value);
|
|
155
|
+
};
|
|
156
|
+
|
|
142
157
|
const req = requestFn(requestOptions, (response) => {
|
|
143
158
|
let responseText = '';
|
|
144
159
|
|
|
@@ -151,18 +166,28 @@ const executeProxyRequest = async (url, options, internalOptions) => {
|
|
|
151
166
|
const error = new Error(responseText);
|
|
152
167
|
error.statusCode = response.statusCode;
|
|
153
168
|
|
|
154
|
-
reject(error);
|
|
169
|
+
settle(reject)(error);
|
|
155
170
|
|
|
156
171
|
return;
|
|
157
172
|
}
|
|
158
173
|
|
|
159
|
-
resolve(parseProxyResponseBody(responseText, options));
|
|
174
|
+
settle(resolve)(parseProxyResponseBody(responseText, options));
|
|
160
175
|
});
|
|
176
|
+
|
|
177
|
+
response.on('error', settle(reject));
|
|
161
178
|
});
|
|
162
179
|
|
|
163
|
-
|
|
180
|
+
timeoutId = setTimeout(() => {
|
|
181
|
+
const timeoutError = new Error(`Request timeout after ${timeoutMs}ms`);
|
|
182
|
+
settle(reject)(timeoutError);
|
|
183
|
+
req.destroy(timeoutError);
|
|
184
|
+
}, timeoutMs);
|
|
185
|
+
|
|
186
|
+
req.on('error', settle(reject));
|
|
164
187
|
req.on('timeout', () => {
|
|
165
|
-
|
|
188
|
+
const timeoutError = new Error(`Request timeout after ${timeoutMs}ms`);
|
|
189
|
+
settle(reject)(timeoutError);
|
|
190
|
+
req.destroy(timeoutError);
|
|
166
191
|
});
|
|
167
192
|
|
|
168
193
|
if (body) {
|
|
@@ -242,6 +267,7 @@ export const makeRequest = async (url, options = {}, internalOptions) => {
|
|
|
242
267
|
try {
|
|
243
268
|
return await executeFetch(url, options, internalOptions);
|
|
244
269
|
} catch (error) {
|
|
270
|
+
console.log('makeRequest error', error);
|
|
245
271
|
if (internalOptions?.fallbackUrl && !error.statusCode) {
|
|
246
272
|
return executeFetch(internalOptions.fallbackUrl, options, internalOptions);
|
|
247
273
|
}
|