bdy 1.19.2-dev → 1.19.3-dev
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/distTs/package.json +2 -2
- package/distTs/src/texts.js +1 -1
- package/distTs/src/tunnel/http.js +51 -14
- package/distTs/src/tunnel/tcp.js +7 -0
- package/package.json +2 -2
package/distTs/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.19.
|
|
4
|
+
"version": "1.19.3-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -108,6 +108,6 @@
|
|
|
108
108
|
"rollup-plugin-natives": "0.7.8",
|
|
109
109
|
"typescript": "5.9.3",
|
|
110
110
|
"typescript-eslint": "8.54.0",
|
|
111
|
-
"vitest": "
|
|
111
|
+
"vitest": "4.1.3"
|
|
112
112
|
}
|
|
113
113
|
}
|
package/distTs/src/texts.js
CHANGED
|
@@ -829,7 +829,7 @@ exports.TXT_ARTIFACT_DOCKER_LOGIN_SUCCESS = 'Login succeeded';
|
|
|
829
829
|
exports.TXT_ARTIFACT_DOCKER_LOGIN_FAILED = 'Login failed. Check your token and try again later...';
|
|
830
830
|
exports.DESC_COMMAND_ARTIFACT_GET = 'Get artifact by identifier. Required scopes: ARTIFACT_READ';
|
|
831
831
|
exports.DESC_COMMAND_ARTIFACT_CREATE = 'Create a new artifact. Required scopes: ARTIFACT_WRITE';
|
|
832
|
-
exports.OPT_COMMAND_ARTIFACT_TYPE = 'Artifact type: "BUCKET" or "CONTAINER"
|
|
832
|
+
exports.OPT_COMMAND_ARTIFACT_TYPE = 'Artifact type: "BUCKET" or "CONTAINER"';
|
|
833
833
|
exports.OPT_COMMAND_ARTIFACT_NAME = 'Artifact name';
|
|
834
834
|
exports.OPT_COMMAND_ARTIFACT_CREATE_IDENTIFIER = 'Artifact identifier (auto-generated from name if omitted)';
|
|
835
835
|
exports.OPT_COMMAND_ARTIFACT_IDENTIFIER = 'Artifact identifier (human-readable)';
|
|
@@ -97,13 +97,18 @@ class TunnelHttp extends events_1.default {
|
|
|
97
97
|
this.outputEnd(504, html_1.default.get504(this.getDisplayTarget()));
|
|
98
98
|
}
|
|
99
99
|
outputHeaders(statusCode, headers) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
this.
|
|
106
|
-
|
|
100
|
+
try {
|
|
101
|
+
this.res.statusCode = statusCode;
|
|
102
|
+
Object.keys(headers).forEach((name) => {
|
|
103
|
+
this.res.setHeader(name.toLowerCase(), headers[name]);
|
|
104
|
+
});
|
|
105
|
+
Object.keys(this.responseHeaders).forEach((name) => {
|
|
106
|
+
this.res.setHeader(name.toLowerCase(), this.responseHeaders[name]);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// headers already sent
|
|
111
|
+
}
|
|
107
112
|
}
|
|
108
113
|
getHostHeader() {
|
|
109
114
|
if (this.hostHeader)
|
|
@@ -231,6 +236,14 @@ class TunnelHttp extends events_1.default {
|
|
|
231
236
|
r.on('upgrade', (proxyRes, socket, head) => this.upgrade(proxyRes, socket, head));
|
|
232
237
|
r.on('response', (proxyRes) => {
|
|
233
238
|
this.proxyRes = proxyRes;
|
|
239
|
+
this.proxyRes.on('error', () => {
|
|
240
|
+
try {
|
|
241
|
+
this.res.end();
|
|
242
|
+
}
|
|
243
|
+
catch {
|
|
244
|
+
// do nothing
|
|
245
|
+
}
|
|
246
|
+
});
|
|
234
247
|
const statusCode = this.proxyRes.statusCode;
|
|
235
248
|
const resHeaders = this.proxyRes.headers;
|
|
236
249
|
const compressionMethod = compression_1.default.detect(this.compression || false, reqHeaders, resHeaders);
|
|
@@ -278,6 +291,14 @@ class TunnelHttp extends events_1.default {
|
|
|
278
291
|
r.on('upgrade', (proxyRes, socket, head) => this.upgrade(proxyRes, socket, head));
|
|
279
292
|
r.on('response', (proxyRes) => {
|
|
280
293
|
this.proxyRes = proxyRes;
|
|
294
|
+
this.proxyRes.on('error', () => {
|
|
295
|
+
try {
|
|
296
|
+
this.res.end();
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
// do nothing
|
|
300
|
+
}
|
|
301
|
+
});
|
|
281
302
|
const statusCode = this.proxyRes.statusCode;
|
|
282
303
|
const resHeaders = this.proxyRes.headers;
|
|
283
304
|
const compressionMethod = compression_1.default.detect(this.compression || false, reqHeaders, resHeaders);
|
|
@@ -348,6 +369,14 @@ class TunnelHttp extends events_1.default {
|
|
|
348
369
|
if (this.httpLog) {
|
|
349
370
|
this.logRequest = this.httpLog.newRequest(method, headers, path, tunnel_1.TUNNEL_HTTP_IDENTIFY.HTTP2, this.req);
|
|
350
371
|
}
|
|
372
|
+
r.on('error', () => {
|
|
373
|
+
try {
|
|
374
|
+
this.res.end();
|
|
375
|
+
}
|
|
376
|
+
catch {
|
|
377
|
+
// do nothing
|
|
378
|
+
}
|
|
379
|
+
});
|
|
351
380
|
r.on('response', (resHeaders) => {
|
|
352
381
|
const status = resHeaders[':status'] || 200;
|
|
353
382
|
const compressionMethod = compression_1.default.detect(this.compression || false, reqHeaders, resHeaders);
|
|
@@ -423,19 +452,27 @@ class TunnelHttp extends events_1.default {
|
|
|
423
452
|
msg += '\r\n';
|
|
424
453
|
reqSocket.removeAllListeners();
|
|
425
454
|
socket.removeAllListeners();
|
|
426
|
-
|
|
427
|
-
reqSocket.removeAllListeners();
|
|
428
|
-
this.emit(tunnel_1.TUNNEL_HTTP_SOCKET.CLOSED, reqSocket);
|
|
429
|
-
});
|
|
430
|
-
socket.on('close', () => {
|
|
431
|
-
socket.removeAllListeners();
|
|
455
|
+
const cleanup = () => {
|
|
432
456
|
try {
|
|
457
|
+
socket.removeAllListeners();
|
|
458
|
+
socket.destroy();
|
|
459
|
+
}
|
|
460
|
+
catch {
|
|
461
|
+
// do nothing
|
|
462
|
+
}
|
|
463
|
+
try {
|
|
464
|
+
reqSocket.removeAllListeners();
|
|
433
465
|
reqSocket.destroy();
|
|
434
466
|
}
|
|
435
467
|
catch {
|
|
436
468
|
// do nothing
|
|
437
469
|
}
|
|
438
|
-
|
|
470
|
+
this.emit(tunnel_1.TUNNEL_HTTP_SOCKET.CLOSED, reqSocket);
|
|
471
|
+
};
|
|
472
|
+
reqSocket.on('close', cleanup);
|
|
473
|
+
reqSocket.on('error', cleanup);
|
|
474
|
+
socket.on('close', cleanup);
|
|
475
|
+
socket.on('error', cleanup);
|
|
439
476
|
if (head && head.length) {
|
|
440
477
|
socket.unshift(head);
|
|
441
478
|
}
|
package/distTs/src/tunnel/tcp.js
CHANGED
|
@@ -93,12 +93,19 @@ class TunnelTcp extends events_1.default {
|
|
|
93
93
|
this.end();
|
|
94
94
|
});
|
|
95
95
|
try {
|
|
96
|
+
this.socket.setTimeout(utils_1.DEFAULT_TIMEOUT * 1000);
|
|
97
|
+
this.socket.on('timeout', () => {
|
|
98
|
+
this.end();
|
|
99
|
+
});
|
|
96
100
|
this.socket.connect({
|
|
97
101
|
noDelay: true,
|
|
98
102
|
keepAlive: true,
|
|
99
103
|
host: (0, utils_1.getRealTargetHost)(this.host),
|
|
100
104
|
port: this.port || 0,
|
|
101
105
|
}, () => {
|
|
106
|
+
if (this.socket) {
|
|
107
|
+
this.socket.setTimeout(0);
|
|
108
|
+
}
|
|
102
109
|
if (this.socket && this.stream) {
|
|
103
110
|
this.socket.pipe(this.stream).pipe(this.socket);
|
|
104
111
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bdy",
|
|
3
3
|
"preferGlobal": false,
|
|
4
|
-
"version": "1.19.
|
|
4
|
+
"version": "1.19.3-dev",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"scripts": {
|
|
@@ -108,6 +108,6 @@
|
|
|
108
108
|
"rollup-plugin-natives": "0.7.8",
|
|
109
109
|
"typescript": "5.9.3",
|
|
110
110
|
"typescript-eslint": "8.54.0",
|
|
111
|
-
"vitest": "
|
|
111
|
+
"vitest": "4.1.3"
|
|
112
112
|
}
|
|
113
113
|
}
|