@e-mc/request 0.5.3 → 0.7.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.
@@ -107,7 +107,7 @@ class HttpHost {
107
107
  });
108
108
  socket
109
109
  .setNoDelay(false)
110
- .setTimeout(5000 /* HOST.TIMEOUT */)
110
+ .setTimeout(10000 /* HOST.TIMEOUT */)
111
111
  .on('timeout', () => {
112
112
  if (this._tlsConnect) {
113
113
  if (this.error(version) >= 10 /* HOST.MAX_ERROR */) {
@@ -173,10 +173,11 @@ class HttpHost {
173
173
  }
174
174
  return false;
175
175
  };
176
- const pattern = new RegExp(`h${i + 1}="([^:]*):(\\d+)"([^,]*)`, 'g');
176
+ const pattern = new RegExp(`h${i + 1}(?:-\\d+)?="([^:]*):(\\d+)"([^,]*)`, 'g');
177
177
  const addresses = [];
178
178
  const time = Date.now();
179
179
  const hostname = this[kHostname];
180
+ const excluded = this[kAltSvcError];
180
181
  let match;
181
182
  while (match = pattern.exec(altSvc)) {
182
183
  const port = match[2];
@@ -187,7 +188,7 @@ class HttpHost {
187
188
  }
188
189
  const address = match[1] || hostname;
189
190
  const ma = +(/ma=(\d+)/.exec(match[3])?.[1] || 86400);
190
- if (!this[kAltSvcError].includes(`h${i + 1}:${address}:${port}`)) {
191
+ if (!excluded.includes(`h${i + 1}:${address}:${port}`)) {
191
192
  addresses.push([
192
193
  address,
193
194
  port,
@@ -278,11 +279,7 @@ class HttpHost {
278
279
  this.closeAltSvc();
279
280
  this[kAltSvcQueue] = [];
280
281
  this[kAltSvcError] = [];
281
- this[kVersionData].forEach(item => {
282
- if (item[3 /* HOST_VERSION.ALPN */] !== 0) {
283
- item[4 /* HOST_VERSION.ALT_SVC */] = -1;
284
- }
285
- });
282
+ this[kVersionData].forEach(item => item[3 /* HOST_VERSION.ALPN */] && (item[4 /* HOST_VERSION.ALT_SVC */] = -1));
286
283
  }
287
284
  }
288
285
  flagAltSvc(version, value) {
package/index.js CHANGED
@@ -53,6 +53,8 @@ const DNS = {
53
53
  };
54
54
  const ARIA2 = {
55
55
  BIN: which.sync(PLATFORM_WIN32 ? 'aria2c.exe' : 'aria2c', { nothrow: true }) || '',
56
+ EXEC_UID: undefined,
57
+ EXEC_GID: undefined,
56
58
  PID_TIMER: null,
57
59
  PID_QUEUE: [],
58
60
  UPDATE_STATUS: 0,
@@ -75,7 +77,16 @@ let READ_TIMEOUT = 0;
75
77
  let AGENT_TIMEOUT = 0;
76
78
  let LOG_HTTP = false;
77
79
  let LOG_TIMEPROCESS = true;
80
+ let LOG_STDOUT = true;
78
81
  let LOG_TIMEFORMAT = 'readable';
82
+ let LIB_ZSTD = null;
83
+ try {
84
+ require('zstd-codec/lib/zstd-stream').run(codec => {
85
+ LIB_ZSTD = codec;
86
+ });
87
+ }
88
+ catch {
89
+ }
79
90
  function getBaseHeaders(uri, headers) {
80
91
  uri = (0, util_1.trimPath)(uri);
81
92
  let result;
@@ -122,7 +133,7 @@ function setOutgoingHeaders(output, headers) {
122
133
  }
123
134
  function getProxySettings(request, agentTimeout) {
124
135
  const proxy = request.proxy;
125
- if ((0, types_1.isObject)(proxy) && proxy.address && proxy.port) {
136
+ if (proxy?.address && proxy.port) {
126
137
  const port = (0, util_1.asInt)(proxy.port);
127
138
  const address = (!module_1.default.isURL(proxy.address) ? port === 80 ? 'http://' : 'https://' : '') + proxy.address;
128
139
  try {
@@ -144,11 +155,9 @@ function getProxySettings(request, agentTimeout) {
144
155
  return null;
145
156
  }
146
157
  function closeTorrent(pid) {
147
- if (pid !== undefined) {
148
- const index = ARIA2.PID_QUEUE.findIndex(value => pid === value[0]);
149
- if (index !== -1) {
150
- ARIA2.PID_QUEUE.splice(index, 1);
151
- }
158
+ const index = ARIA2.PID_QUEUE.findIndex(value => pid === value[0]);
159
+ if (index !== -1) {
160
+ ARIA2.PID_QUEUE.splice(index, 1);
152
161
  }
153
162
  }
154
163
  function clearDnsLookup() {
@@ -266,7 +275,7 @@ class Request extends module_1.default {
266
275
  if (!this.enabled("process.password" /* KEY_NAME.PROCESS_PASSWORD */) || super.loadSettings({ process: settings.process }, password)) {
267
276
  const { request, download } = settings;
268
277
  if (download && (0, types_1.isPlainObject)(download.aria2)) {
269
- let { bin, update_status, max_concurrent_downloads, max_connection_per_server, bt_stop_timeout, bt_tracker_connect_timeout, bt_tracker_timeout, min_split_size, disk_cache, lowest_speed_limit, always_resume, file_allocation, conf_path } = download.aria2;
278
+ let { bin, exec, update_status, max_concurrent_downloads, max_connection_per_server, bt_stop_timeout, bt_tracker_connect_timeout, bt_tracker_timeout, min_split_size, disk_cache, lowest_speed_limit, always_resume, file_allocation, conf_path } = download.aria2;
270
279
  const parseSize = (value, zero) => {
271
280
  if (zero && (value === '0' || value === 0)) {
272
281
  return 0;
@@ -281,6 +290,11 @@ class Request extends module_1.default {
281
290
  else if (bin && this.isPath(bin = path.resolve(bin), true)) {
282
291
  ARIA2.BIN = bin;
283
292
  }
293
+ if ((0, types_1.isPlainObject)(exec)) {
294
+ let { uid, gid } = exec;
295
+ ARIA2.EXEC_UID = (uid = (0, util_1.asInt)(uid)) >= 0 ? uid : undefined;
296
+ ARIA2.EXEC_GID = (gid = (0, util_1.asInt)(gid)) >= 0 ? gid : undefined;
297
+ }
284
298
  if ((0, types_1.isPlainObject)(update_status)) {
285
299
  const { interval, broadcast_only } = update_status;
286
300
  if (typeof broadcast_only === 'boolean') {
@@ -382,9 +396,10 @@ class Request extends module_1.default {
382
396
  LOG_TIMEFORMAT = time_format;
383
397
  break;
384
398
  }
385
- LOG_HTTP = this.hasLogType(1024 /* LOG_TYPE.HTTP */);
386
- LOG_TIMEPROCESS = this.hasLogType(256 /* LOG_TYPE.TIME_PROCESS */);
387
399
  }
400
+ LOG_HTTP = this.hasLogType(1024 /* LOG_TYPE.HTTP */);
401
+ LOG_TIMEPROCESS = this.hasLogType(256 /* LOG_TYPE.TIME_PROCESS */);
402
+ LOG_STDOUT = module_1.default.hasLogType(32768 /* LOG_TYPE.STDOUT */);
388
403
  return true;
389
404
  }
390
405
  return false;
@@ -409,124 +424,141 @@ class Request extends module_1.default {
409
424
  return url.protocol + '//' + (auth && (auth + '@')) + url.hostname + (url.port ? ':' + url.port : '') + (value[0] !== '/' ? '/' : '') + value;
410
425
  }
411
426
  static fromStatusCode(value) {
412
- switch (+value) {
413
- case 100 /* HTTP_STATUS.CONTINUE */:
414
- return 'Continue';
415
- case 101 /* HTTP_STATUS.SWITCHING_PROTOCOL */:
416
- return 'Switching Protocol';
417
- case 102 /* HTTP_STATUS.PROCESSING */:
418
- return 'Processing';
419
- case 103 /* HTTP_STATUS.EARLY_HINTS */:
420
- return 'Early Hints';
421
- case 200 /* HTTP_STATUS.OK */:
422
- return 'OK';
423
- case 201 /* HTTP_STATUS.CREATED */:
424
- return 'Created';
425
- case 202 /* HTTP_STATUS.ACCEPTED */:
426
- return 'Accepted';
427
- case 203 /* HTTP_STATUS.NON_AUTHORITATIVE_INFORMATION */:
428
- return 'Non-Authoritative Information';
429
- case 204 /* HTTP_STATUS.NO_CONTENT */:
430
- return 'No Content';
431
- case 205 /* HTTP_STATUS.RESET_CONTENT */:
432
- return 'Reset Content';
433
- case 206 /* HTTP_STATUS.PARTIAL_CONTENT */:
434
- return 'Partial Content';
435
- case 300 /* HTTP_STATUS.MULTIPLE_CHOICES */:
436
- return 'Multiple Choice';
437
- case 301 /* HTTP_STATUS.MOVED_PERMANENTLY */:
438
- return 'Moved Permanently';
439
- case 302 /* HTTP_STATUS.FOUND */:
440
- return 'Found';
441
- case 303 /* HTTP_STATUS.SEE_OTHER */:
442
- return 'See Other';
443
- case 304 /* HTTP_STATUS.NOT_MODIFIED */:
444
- return 'Not Modified';
445
- case 305 /* HTTP_STATUS.USE_PROXY */:
446
- return 'Use Proxy';
447
- case 307 /* HTTP_STATUS.TEMPORARY_REDIRECT */:
448
- return 'Temporary Redirect';
449
- case 308 /* HTTP_STATUS.PERMANENT_REDIRECT */:
450
- return 'Permanent Redirect';
451
- case 400 /* HTTP_STATUS.BAD_REQUEST */:
452
- return 'Bad Request';
453
- case 401 /* HTTP_STATUS.UNAUTHORIZED */:
454
- return 'Upgrade Required';
455
- case 402 /* HTTP_STATUS.PAYMENT_REQUIRED */:
456
- return 'Payment Required';
457
- case 403 /* HTTP_STATUS.FORBIDDEN */:
458
- return 'Forbidden';
459
- case 404 /* HTTP_STATUS.NOT_FOUND */:
460
- return 'Not Found';
461
- case 405 /* HTTP_STATUS.METHOD_NOT_ALLOWED */:
462
- return 'Method Not Allowed';
463
- case 406 /* HTTP_STATUS.NOT_ACCEPTABLE */:
464
- return 'Not Acceptable';
465
- case 407 /* HTTP_STATUS.PROXY_AUTHENTICATION_REQUIRED */:
466
- return 'Proxy Authentication Required';
467
- case 408 /* HTTP_STATUS.REQUEST_TIMEOUT */:
468
- return 'Request Timeout';
469
- case 409 /* HTTP_STATUS.CONFLICT */:
470
- return 'Conflict';
471
- case 410 /* HTTP_STATUS.GONE */:
472
- return 'Gone';
473
- case 411 /* HTTP_STATUS.LENGTH_REQUIRED */:
474
- return 'Length Required';
475
- case 412 /* HTTP_STATUS.PRECONDITION_FAILED */:
476
- return 'Precondition Failed';
477
- case 413 /* HTTP_STATUS.PAYLOAD_TOO_LARGE */:
478
- return 'Payload Too Large';
479
- case 414 /* HTTP_STATUS.REQUEST_URI_TOO_LONG */:
480
- return 'URI Too Long';
481
- case 415 /* HTTP_STATUS.UNSUPPORTED_MEDIA_TYPE */:
482
- return 'Unsupported Media Type';
483
- case 416 /* HTTP_STATUS.RANGE_NOT_SATISFIABLE */:
484
- return 'Range Not Satisfiable';
485
- case 417 /* HTTP_STATUS.EXPECTATION_FAILED */:
486
- return 'Expectation Failed';
487
- case 421 /* HTTP_STATUS.MISDIRECTED_REQUEST */:
488
- return 'Misdirected Request';
489
- case 422 /* HTTP_STATUS.UNPROCESSABLE_ENTITY */:
490
- return 'Unprocessable Entity';
491
- case 423 /* HTTP_STATUS.LOCKED */:
492
- return 'Locked';
493
- case 424 /* HTTP_STATUS.FAILED_DEPENDENCY */:
494
- return 'Failed Dependency';
495
- case 426 /* HTTP_STATUS.UPGRADE_REQUIRED */:
496
- return 'Upgrade Required';
497
- case 428 /* HTTP_STATUS.PRECONDITION_REQUIRED */:
498
- return 'Precondition Required';
499
- case 429 /* HTTP_STATUS.TOO_MANY_REQUESTS */:
500
- return 'Too Many Requests';
501
- case 431 /* HTTP_STATUS.REQUEST_HEADER_FIELDS_TOO_LARGE */:
502
- return 'Request Header Fields Too Large';
503
- case 451 /* HTTP_STATUS.UNAVAILABLE_FOR_LEGAL_REASONS */:
504
- return 'Unavailable For Legal Reasons';
505
- case 500 /* HTTP_STATUS.INTERNAL_SERVER_ERROR */:
506
- return 'Internal Server Error';
507
- case 501 /* HTTP_STATUS.NOT_IMPLEMENTED */:
508
- return 'Not Implemented';
509
- case 502 /* HTTP_STATUS.BAD_GATEWAY */:
510
- return 'Bad Gateway';
511
- case 503 /* HTTP_STATUS.SERVICE_UNAVAILABLE */:
512
- return 'Service Unavailable';
513
- case 504 /* HTTP_STATUS.GATEWAY_TIMEOUT */:
514
- return 'Gateway Timeout';
515
- case 505 /* HTTP_STATUS.HTTP_VERSION_NOT_SUPPORTED */:
516
- return 'HTTP Version Not Supported';
517
- case 506 /* HTTP_STATUS.VARIANT_ALSO_NEGOTIATES */:
518
- return 'Variant Also Negotiates';
519
- case 507 /* HTTP_STATUS.INSUFFICIENT_STORAGE */:
520
- return 'Insufficient Storage';
521
- case 508 /* HTTP_STATUS.LOOP_DETECTED */:
522
- return 'Loop Detected';
523
- case 510 /* HTTP_STATUS.NOT_EXTENDED */:
524
- return 'Not Extended';
525
- case 511 /* HTTP_STATUS.NETWORK_AUTHENTICATION_REQUIRED */:
526
- return 'Network Authentication Required';
527
- default:
528
- return "Unknown" /* ERR_MESSAGE.UNKNOWN */;
427
+ if ((value = +value) < 200) {
428
+ switch (value) {
429
+ case 100 /* HTTP_STATUS.CONTINUE */:
430
+ return 'Continue';
431
+ case 101 /* HTTP_STATUS.SWITCHING_PROTOCOL */:
432
+ return 'Switching Protocol';
433
+ case 102 /* HTTP_STATUS.PROCESSING */:
434
+ return 'Processing';
435
+ case 103 /* HTTP_STATUS.EARLY_HINTS */:
436
+ return 'Early Hints';
437
+ }
438
+ }
439
+ else if (value < 300) {
440
+ switch (value) {
441
+ case 200 /* HTTP_STATUS.OK */:
442
+ return 'OK';
443
+ case 201 /* HTTP_STATUS.CREATED */:
444
+ return 'Created';
445
+ case 202 /* HTTP_STATUS.ACCEPTED */:
446
+ return 'Accepted';
447
+ case 203 /* HTTP_STATUS.NON_AUTHORITATIVE_INFORMATION */:
448
+ return 'Non-Authoritative Information';
449
+ case 204 /* HTTP_STATUS.NO_CONTENT */:
450
+ return 'No Content';
451
+ case 205 /* HTTP_STATUS.RESET_CONTENT */:
452
+ return 'Reset Content';
453
+ case 206 /* HTTP_STATUS.PARTIAL_CONTENT */:
454
+ return 'Partial Content';
455
+ }
456
+ }
457
+ else if (value < 400) {
458
+ switch (value) {
459
+ case 300 /* HTTP_STATUS.MULTIPLE_CHOICES */:
460
+ return 'Multiple Choice';
461
+ case 301 /* HTTP_STATUS.MOVED_PERMANENTLY */:
462
+ return 'Moved Permanently';
463
+ case 302 /* HTTP_STATUS.FOUND */:
464
+ return 'Found';
465
+ case 303 /* HTTP_STATUS.SEE_OTHER */:
466
+ return 'See Other';
467
+ case 304 /* HTTP_STATUS.NOT_MODIFIED */:
468
+ return 'Not Modified';
469
+ case 305 /* HTTP_STATUS.USE_PROXY */:
470
+ return 'Use Proxy';
471
+ case 307 /* HTTP_STATUS.TEMPORARY_REDIRECT */:
472
+ return 'Temporary Redirect';
473
+ case 308 /* HTTP_STATUS.PERMANENT_REDIRECT */:
474
+ return 'Permanent Redirect';
475
+ }
476
+ }
477
+ else if (value < 500) {
478
+ switch (value) {
479
+ case 400 /* HTTP_STATUS.BAD_REQUEST */:
480
+ return 'Bad Request';
481
+ case 401 /* HTTP_STATUS.UNAUTHORIZED */:
482
+ return 'Upgrade Required';
483
+ case 402 /* HTTP_STATUS.PAYMENT_REQUIRED */:
484
+ return 'Payment Required';
485
+ case 403 /* HTTP_STATUS.FORBIDDEN */:
486
+ return 'Forbidden';
487
+ case 404 /* HTTP_STATUS.NOT_FOUND */:
488
+ return 'Not Found';
489
+ case 405 /* HTTP_STATUS.METHOD_NOT_ALLOWED */:
490
+ return 'Method Not Allowed';
491
+ case 406 /* HTTP_STATUS.NOT_ACCEPTABLE */:
492
+ return 'Not Acceptable';
493
+ case 407 /* HTTP_STATUS.PROXY_AUTHENTICATION_REQUIRED */:
494
+ return 'Proxy Authentication Required';
495
+ case 408 /* HTTP_STATUS.REQUEST_TIMEOUT */:
496
+ return 'Request Timeout';
497
+ case 409 /* HTTP_STATUS.CONFLICT */:
498
+ return 'Conflict';
499
+ case 410 /* HTTP_STATUS.GONE */:
500
+ return 'Gone';
501
+ case 411 /* HTTP_STATUS.LENGTH_REQUIRED */:
502
+ return 'Length Required';
503
+ case 412 /* HTTP_STATUS.PRECONDITION_FAILED */:
504
+ return 'Precondition Failed';
505
+ case 413 /* HTTP_STATUS.PAYLOAD_TOO_LARGE */:
506
+ return 'Payload Too Large';
507
+ case 414 /* HTTP_STATUS.REQUEST_URI_TOO_LONG */:
508
+ return 'URI Too Long';
509
+ case 415 /* HTTP_STATUS.UNSUPPORTED_MEDIA_TYPE */:
510
+ return 'Unsupported Media Type';
511
+ case 416 /* HTTP_STATUS.RANGE_NOT_SATISFIABLE */:
512
+ return 'Range Not Satisfiable';
513
+ case 417 /* HTTP_STATUS.EXPECTATION_FAILED */:
514
+ return 'Expectation Failed';
515
+ case 421 /* HTTP_STATUS.MISDIRECTED_REQUEST */:
516
+ return 'Misdirected Request';
517
+ case 422 /* HTTP_STATUS.UNPROCESSABLE_ENTITY */:
518
+ return 'Unprocessable Entity';
519
+ case 423 /* HTTP_STATUS.LOCKED */:
520
+ return 'Locked';
521
+ case 424 /* HTTP_STATUS.FAILED_DEPENDENCY */:
522
+ return 'Failed Dependency';
523
+ case 426 /* HTTP_STATUS.UPGRADE_REQUIRED */:
524
+ return 'Upgrade Required';
525
+ case 428 /* HTTP_STATUS.PRECONDITION_REQUIRED */:
526
+ return 'Precondition Required';
527
+ case 429 /* HTTP_STATUS.TOO_MANY_REQUESTS */:
528
+ return 'Too Many Requests';
529
+ case 431 /* HTTP_STATUS.REQUEST_HEADER_FIELDS_TOO_LARGE */:
530
+ return 'Request Header Fields Too Large';
531
+ case 451 /* HTTP_STATUS.UNAVAILABLE_FOR_LEGAL_REASONS */:
532
+ return 'Unavailable For Legal Reasons';
533
+ }
529
534
  }
535
+ else {
536
+ switch (value) {
537
+ case 500 /* HTTP_STATUS.INTERNAL_SERVER_ERROR */:
538
+ return 'Internal Server Error';
539
+ case 501 /* HTTP_STATUS.NOT_IMPLEMENTED */:
540
+ return 'Not Implemented';
541
+ case 502 /* HTTP_STATUS.BAD_GATEWAY */:
542
+ return 'Bad Gateway';
543
+ case 503 /* HTTP_STATUS.SERVICE_UNAVAILABLE */:
544
+ return 'Service Unavailable';
545
+ case 504 /* HTTP_STATUS.GATEWAY_TIMEOUT */:
546
+ return 'Gateway Timeout';
547
+ case 505 /* HTTP_STATUS.HTTP_VERSION_NOT_SUPPORTED */:
548
+ return 'HTTP Version Not Supported';
549
+ case 506 /* HTTP_STATUS.VARIANT_ALSO_NEGOTIATES */:
550
+ return 'Variant Also Negotiates';
551
+ case 507 /* HTTP_STATUS.INSUFFICIENT_STORAGE */:
552
+ return 'Insufficient Storage';
553
+ case 508 /* HTTP_STATUS.LOOP_DETECTED */:
554
+ return 'Loop Detected';
555
+ case 510 /* HTTP_STATUS.NOT_EXTENDED */:
556
+ return 'Not Extended';
557
+ case 511 /* HTTP_STATUS.NETWORK_AUTHENTICATION_REQUIRED */:
558
+ return 'Network Authentication Required';
559
+ }
560
+ }
561
+ return "Unknown" /* ERR_MESSAGE.UNKNOWN */;
530
562
  }
531
563
  static defineHttpAgent(options) {
532
564
  const { keepAlive, timeout = 0 } = options;
@@ -609,11 +641,8 @@ class Request extends module_1.default {
609
641
  this.readTimeout = (value = (0, util_1.fromSeconds)(read_timeout)) >= 0 ? value : READ_TIMEOUT;
610
642
  this.keepAlive = typeof (value = agent?.keep_alive) === 'boolean' ? value : KEEP_ALIVE;
611
643
  this.acceptEncoding = typeof (value = use?.accept_encoding) === 'boolean' ? value : ACCEPT_ENCODING;
612
- switch (value = (0, util_1.asInt)(use?.http_version)) {
613
- case 1:
614
- case 2:
615
- this[kHttpVersion] = value;
616
- break;
644
+ if ((value = (0, util_1.asInt)(use?.http_version)) === 1 || value === 2) {
645
+ this[kHttpVersion] = value;
617
646
  }
618
647
  this[kIpVersion] = (value = (0, util_1.asInt)(data.dns?.family)) && (value === 4 || value === 6) ? value : 0;
619
648
  if ((value = (0, util_1.fromSeconds)(agent?.timeout)) >= 0) {
@@ -658,62 +687,60 @@ class Request extends module_1.default {
658
687
  this.module = data;
659
688
  }
660
689
  flushLog() {
690
+ const log = this._logQueued;
661
691
  if (this[kSingleton]) {
662
- this._logQueued.length = 0;
663
- if (LOG_HTTP) {
664
- this[kConnectHttp] = [{}, {}];
665
- }
666
- return;
692
+ log.length = 0;
667
693
  }
668
- if (LOG_HTTP) {
669
- const log = this._logQueued;
670
- const output = [];
671
- let count = 0;
672
- this[kConnectHttp].forEach((protocol, index) => {
673
- const title = 'HTTP' + (index + 1);
674
- for (const origin in protocol) {
675
- const value = protocol[origin];
676
- const args = [];
677
- for (let i = 0; i < log.length; ++i) {
678
- const item = log[i];
679
- if (Array.isArray(item[2]) && item[2][0].startsWith(origin)) {
680
- item[1] = '';
681
- item[2][0] = item[2][0].substring(origin.length);
682
- item[4].titleBgColor = undefined;
683
- item[4].titleJustify = 'right';
684
- args.push(item);
685
- log.splice(i--, 1);
694
+ else {
695
+ if (log.length && !this.host?.aborted) {
696
+ const output = [];
697
+ let count = 0;
698
+ this[kConnectHttp].forEach((protocol, index) => {
699
+ const title = 'HTTP' + (index + 1);
700
+ for (const origin in protocol) {
701
+ const value = protocol[origin];
702
+ const args = [];
703
+ for (let i = 0; i < log.length; ++i) {
704
+ const item = log[i];
705
+ if (Array.isArray(item[2]) && item[2][0].startsWith(origin)) {
706
+ item[1] = '';
707
+ item[2][0] = item[2][0].substring(origin.length);
708
+ item[4].titleBgColor = undefined;
709
+ item[4].titleJustify = 'right';
710
+ args.push(item);
711
+ log.splice(i--, 1);
712
+ }
686
713
  }
687
- }
688
- output.push([title, origin, value, args]);
689
- count = Math.max(count, value);
690
- }
691
- });
692
- if (!this.host?.aborted) {
693
- output.sort((a, b) => b[2] - a[2]);
694
- const width = count.toString().length;
695
- output.forEach(item => {
696
- const [title, origin, downloads, messages] = item;
697
- const options = { ...title === 'HTTP1' ? module_1.default.LOG_STYLE_NOTICE : module_1.default.LOG_STYLE_INFO };
698
- if (messages.length === 1) {
699
- const message = messages[0];
700
- message[1] = title;
701
- message[2] = [origin + message[2][0], message[2][1]];
702
- message[4] = Object.assign(message[4], options);
703
- module_1.default.formatMessage(...message);
704
- }
705
- else {
706
- this.formatMessage(1024 /* LOG_TYPE.HTTP */, title, [origin, 'downloads: ' + downloads.toString().padStart(width)], '', options);
707
- messages.forEach(args => {
708
- args[4].titleIndent = true;
709
- module_1.default.formatMessage(...args);
710
- });
714
+ output.push([title, origin, value, args]);
715
+ count = Math.max(count, value);
711
716
  }
712
717
  });
718
+ if (LOG_STDOUT) {
719
+ output.sort((a, b) => b[2] - a[2]);
720
+ const width = count.toString().length;
721
+ output.forEach(item => {
722
+ const [title, origin, downloads, messages] = item;
723
+ const options = { ...title === 'HTTP1' ? module_1.default.LOG_STYLE_NOTICE : module_1.default.LOG_STYLE_INFO };
724
+ if (messages.length === 1) {
725
+ const message = messages[0];
726
+ message[1] = title;
727
+ message[2] = [origin + message[2][0], message[2][1]];
728
+ message[4] = Object.assign(message[4], options);
729
+ module_1.default.formatMessage(...message);
730
+ }
731
+ else {
732
+ this.formatMessage(1024 /* LOG_TYPE.HTTP */, title, [origin, 'downloads: ' + downloads.toString().padStart(width)], '', options);
733
+ messages.forEach(args => {
734
+ args[4].titleIndent = true;
735
+ module_1.default.formatMessage(...args);
736
+ });
737
+ }
738
+ });
739
+ }
713
740
  }
714
- this[kConnectHttp] = [{}, {}];
741
+ super.flushLog();
715
742
  }
716
- super.flushLog();
743
+ this[kConnectHttp] = [{}, {}];
717
744
  }
718
745
  detach(singleton) {
719
746
  if (typeof singleton === 'boolean') {
@@ -796,28 +823,26 @@ class Request extends module_1.default {
796
823
  return this;
797
824
  }
798
825
  addDns(hostname, address, family) {
799
- if (!this[kConnectDns][hostname]) {
800
- switch (family) {
801
- case 'IPv4':
826
+ switch (family) {
827
+ case 'IPv4':
828
+ family = 4;
829
+ break;
830
+ case 'IPv6':
831
+ family = 6;
832
+ break;
833
+ default:
834
+ if (net.isIPv4(address)) {
802
835
  family = 4;
803
- break;
804
- case 'IPv6':
836
+ }
837
+ else if (net.isIPv6(address)) {
805
838
  family = 6;
806
- break;
807
- default:
808
- if (net.isIPv4(address)) {
809
- family = 4;
810
- }
811
- else if (net.isIPv6(address)) {
812
- family = 6;
813
- }
814
- else {
815
- return;
816
- }
817
- break;
818
- }
819
- setDnsCache(hostname, this[kConnectDns][hostname] = [{ address, family }]);
839
+ }
840
+ else {
841
+ return;
842
+ }
843
+ break;
820
844
  }
845
+ setDnsCache(hostname, this[kConnectDns][hostname] = [{ address, family }]);
821
846
  }
822
847
  lookupDns(hostname) {
823
848
  var _l;
@@ -887,17 +912,18 @@ class Request extends module_1.default {
887
912
  }
888
913
  proxyOf(uri, localhost) {
889
914
  const proxy = this.proxy || this.host && HTTP.PROXY;
890
- if (proxy) {
891
- const { include, exclude } = proxy;
892
- if (!include && !exclude && !localhost) {
893
- return proxy;
894
- }
895
- if ((0, types_1.isArray)(include)) {
896
- return include.some(value => uri.startsWith(value)) ? proxy : undefined;
897
- }
898
- if (Array.isArray(exclude) && !exclude.some(value => uri.startsWith(value))) {
899
- return proxy;
900
- }
915
+ if (!proxy) {
916
+ return;
917
+ }
918
+ const { include, exclude } = proxy;
919
+ if (!include && !exclude && !localhost) {
920
+ return proxy;
921
+ }
922
+ if ((0, types_1.isArray)(include)) {
923
+ return include.some(value => uri.startsWith(value)) ? proxy : undefined;
924
+ }
925
+ if (Array.isArray(exclude) && !exclude.some(value => uri.startsWith(value))) {
926
+ return proxy;
901
927
  }
902
928
  }
903
929
  headersOf(uri) {
@@ -1146,8 +1172,13 @@ class Request extends module_1.default {
1146
1172
  }
1147
1173
  args = binOpts.concat(args);
1148
1174
  }
1149
- if (args.length && module_1.default.hasLogType(32768 /* LOG_TYPE.STDOUT */)) {
1150
- this.formatMessage(32768 /* LOG_TYPE.STDOUT */, 'ARIA2', ARIA2.BIN, args.join(' '), { ...module_1.default.LOG_STYLE_WARN });
1175
+ if (args.length) {
1176
+ if (module_1.default.hasLogType(32768 /* LOG_TYPE.STDOUT */)) {
1177
+ this.formatMessage(32768 /* LOG_TYPE.STDOUT */, 'ARIA2', ARIA2.BIN, args.join(' '), { ...module_1.default.LOG_STYLE_WARN });
1178
+ }
1179
+ else {
1180
+ this.addLog(types_1.STATUS_TYPE.INFO, path.basename(ARIA2.BIN) + ' ' + args.join(' '), "aria2" /* VALUES.ARIA2 */);
1181
+ }
1151
1182
  }
1152
1183
  opts.push(`"${escapeQuote(uri)}"`);
1153
1184
  args = args.concat(init, opts);
@@ -1158,7 +1189,7 @@ class Request extends module_1.default {
1158
1189
  closeTorrent(pid);
1159
1190
  reject(err);
1160
1191
  };
1161
- const { pid, stdout, stderr } = child_process.spawn(module_1.default.sanitizeCmd(ARIA2.BIN), args, { cwd: pathname, shell: true, signal: this.signal })
1192
+ const { pid, stdout, stderr } = child_process.spawn(module_1.default.sanitizeCmd(ARIA2.BIN), args, { cwd: pathname, shell: true, signal: this.signal, uid: ARIA2.EXEC_UID, gid: ARIA2.EXEC_GID })
1162
1193
  .on('exit', code => {
1163
1194
  closeTorrent(pid);
1164
1195
  if (aborted) {
@@ -1195,7 +1226,7 @@ class Request extends module_1.default {
1195
1226
  }
1196
1227
  }
1197
1228
  if (result.length && !silent && LOG_HTTP && LOG_TIMEPROCESS) {
1198
- this.writeTimeProcess("aria2" /* VALUES.ARIA2 */, uri, startTime, { type: 1024 /* LOG_TYPE.HTTP */, queue: true, messageUnit, messageUnitMinWidth: 9 });
1229
+ this.writeTimeProcess("aria2" /* VALUES.ARIA2 */, uri, startTime, { type: 1024 /* LOG_TYPE.HTTP */, queue: true, messageUnit, messageUnitMinWidth: 9, bypassLog: true });
1199
1230
  }
1200
1231
  this.addLog(result.length ? types_1.STATUS_TYPE.INFO : types_1.STATUS_TYPE.ERROR, out, currentTime, currentTime - startTime, "aria2" /* VALUES.ARIA2 */, uri);
1201
1232
  resolve(result);
@@ -1291,23 +1322,23 @@ class Request extends module_1.default {
1291
1322
  headers || (headers = {});
1292
1323
  switch (format = format.trim().toLowerCase()) {
1293
1324
  case 'yaml':
1294
- headers['accept'] = 'application/yaml, application/x-yaml, text/yaml, text/x-yaml';
1325
+ headers.accept = 'application/yaml, application/x-yaml, text/yaml, text/x-yaml';
1295
1326
  break;
1296
1327
  case 'json5':
1297
- headers['accept'] = 'application/json5, application/json, text/javascript';
1328
+ headers.accept = 'application/json5, application/json, text/javascript';
1298
1329
  break;
1299
1330
  case 'xml':
1300
- headers['accept'] = 'application/xml, text/xml';
1331
+ headers.accept = 'application/xml, text/xml';
1301
1332
  break;
1302
1333
  case 'toml':
1303
- headers['accept'] = 'application/toml';
1334
+ headers.accept = 'application/toml';
1304
1335
  break;
1305
1336
  default:
1306
- headers['accept'] = 'application/json, text/javascript';
1337
+ headers.accept = 'application/json, text/javascript';
1307
1338
  format = 'json';
1308
1339
  break;
1309
1340
  }
1310
- headers['accept'] += ', text/plain';
1341
+ headers.accept += ', text/plain';
1311
1342
  options.encoding = (0, types_1.getEncoding)(encoding);
1312
1343
  options.outFormat = { out: format, parser };
1313
1344
  }
@@ -1346,6 +1377,11 @@ class Request extends module_1.default {
1346
1377
  case 'deflate-raw':
1347
1378
  pipeTo = zlib.createInflateRaw({ chunkSize });
1348
1379
  break;
1380
+ case 'zstd':
1381
+ if (LIB_ZSTD) {
1382
+ pipeTo = new LIB_ZSTD.ZstdDecompressTransform({ writableHighWaterMark: chunkSize });
1383
+ }
1384
+ break;
1349
1385
  }
1350
1386
  if (pipeTo) {
1351
1387
  if (outStream) {
@@ -1357,21 +1393,22 @@ class Request extends module_1.default {
1357
1393
  return pipeTo;
1358
1394
  }
1359
1395
  };
1360
- const { hostname, origin } = host;
1396
+ const { hostname, origin, secure, localhost } = host;
1361
1397
  const pathname = url.pathname + (socketPath ? '' : url.search);
1362
- const proxy = this.proxyOf(uri, host.localhost);
1398
+ const proxy = this.proxyOf(uri, localhost);
1399
+ const version = this.httpVersion;
1363
1400
  let request, ca, cert, key, minVersion, baseHeaders = this.headersOf(uri);
1364
- if (getting && this.acceptEncoding && !host.localhost && !baseHeaders?.['accept-encoding']) {
1365
- (_l = (headers || (headers = {})))['accept-encoding'] || (_l['accept-encoding'] = 'gzip, deflate, br');
1401
+ if (getting && this.acceptEncoding && !localhost && !baseHeaders?.['accept-encoding']) {
1402
+ (_l = (headers || (headers = {})))['accept-encoding'] || (_l['accept-encoding'] = 'gzip, deflate, br' + (LIB_ZSTD ? ', zstd' : ''));
1366
1403
  }
1367
- if (host.secure) {
1368
- const secure = this[kCerts]?.[0][origin] || (this.host ? TLS.TEXT[origin] : null);
1369
- if (secure) {
1370
- ({ ca, cert, key, version: minVersion } = secure);
1404
+ if (secure) {
1405
+ const certs = this[kCerts]?.[0][origin] || (this.host ? TLS.TEXT[origin] : null);
1406
+ if (certs) {
1407
+ ({ ca, cert, key, version: minVersion } = certs);
1371
1408
  }
1372
1409
  }
1373
- if (!proxy && httpVersion !== 1 && ((httpVersion || host.version) === 2 && this.httpVersion !== 1 || host.secure && this.httpVersion === 2 && host.failed(2, true) === 0)) {
1374
- request = ((_m = this[kSession][0])[origin] || (_m[origin] = http2.connect(origin, { lookup: this.lookupDns(hostname), ca, cert, key, minVersion }))).request({ ...baseHeaders, ...host_1.default.getBasicAuth(url), ...headers, ':path': pathname, ':method': method });
1410
+ if (!proxy && httpVersion !== 1 && ((httpVersion || host.version) === 2 && version !== 1 || secure && version === 2 && host.failed(2, true) === 0)) {
1411
+ request = ((_m = this[kSession][0])[origin] || (_m[origin] = http2.connect(origin, { lookup: this.lookupDns(hostname), ca, cert, key, minVersion, settings: localhost ? { initialWindowSize: 4294967295 /* CONSTANTS.INITIAL_WINDOW_SIZE */, maxFrameSize: 16777215 /* CONSTANTS.MAX_FRAME_SIZE */, enablePush: false } : { enablePush: false } }))).request({ ...baseHeaders, ...host_1.default.getBasicAuth(url), ...headers, ':path': pathname, ':method': method });
1375
1412
  if (getting) {
1376
1413
  const listenerMap = {};
1377
1414
  const onEvent = request.on.bind(request);
@@ -1451,7 +1488,7 @@ class Request extends module_1.default {
1451
1488
  let agent;
1452
1489
  if (!socketPath) {
1453
1490
  if (proxy) {
1454
- const pkg = host.secure ? 'https-proxy-agent' : 'http-proxy-agent';
1491
+ const pkg = secure ? 'https-proxy-agent' : 'http-proxy-agent';
1455
1492
  try {
1456
1493
  const { protocol, hostname: proxyname, port, username, password, href } = proxy.host;
1457
1494
  keepAlive ?? (keepAlive = proxy.keepAlive || false);
@@ -1467,16 +1504,16 @@ class Request extends module_1.default {
1467
1504
  }
1468
1505
  }
1469
1506
  else if (keepAlive === false) {
1470
- agent = new (host.secure ? https.Agent : http.Agent)({ keepAlive: false });
1507
+ agent = new (secure ? https.Agent : http.Agent)({ keepAlive: false });
1471
1508
  }
1472
1509
  else if (keepAlive === true || agentTimeout > 0) {
1473
- agent = new (host.secure ? https.Agent : http.Agent)({ keepAlive: true, timeout: agentTimeout });
1510
+ agent = new (secure ? https.Agent : http.Agent)({ keepAlive: true, timeout: agentTimeout });
1474
1511
  }
1475
1512
  else if (agentTimeout !== 0) {
1476
1513
  keepAlive = this.keepAlive || false;
1477
1514
  agentTimeout ?? (agentTimeout = this.agentTimeout);
1478
1515
  if (keepAlive || agentTimeout > 0) {
1479
- agent = new (host.secure ? https.Agent : http.Agent)({ keepAlive, timeout: agentTimeout });
1516
+ agent = new (secure ? https.Agent : http.Agent)({ keepAlive, timeout: agentTimeout });
1480
1517
  }
1481
1518
  }
1482
1519
  }
@@ -1484,7 +1521,7 @@ class Request extends module_1.default {
1484
1521
  if (baseHeaders || basicAuth) {
1485
1522
  headers = { ...baseHeaders, ...basicAuth, ...headers };
1486
1523
  }
1487
- request = (host.secure ? https : http).request(socketPath ? { socketPath, path: pathname } : {
1524
+ request = (secure ? https : http).request(socketPath ? { socketPath, path: pathname } : {
1488
1525
  protocol: host.protocol,
1489
1526
  hostname,
1490
1527
  port: host.port,
@@ -1500,7 +1537,8 @@ class Request extends module_1.default {
1500
1537
  }, response => {
1501
1538
  const statusCode = response.statusCode;
1502
1539
  if ((getting || posting) && statusCode >= 200 /* HTTP_STATUS.OK */ && statusCode < 300 /* HTTP_STATUS.MULTIPLE_CHOICES */) {
1503
- let source = checkEncoding(response, statusCode, response.headers['content-encoding']);
1540
+ const incoming = response.headers;
1541
+ let source = checkEncoding(response, statusCode, incoming['content-encoding']);
1504
1542
  if (source) {
1505
1543
  source.once('finish', () => request.emit('end'));
1506
1544
  }
@@ -1531,8 +1569,13 @@ class Request extends module_1.default {
1531
1569
  if (response !== source) {
1532
1570
  source.on('error', err => request.emit('error', err));
1533
1571
  }
1534
- if (!posting && !host.didAltSvc(1)) {
1535
- host.upgrade(1, response.headers['alt-svc']);
1572
+ if (!posting) {
1573
+ if (version === 2 && incoming.upgrade?.includes('h2')) {
1574
+ host.version = 2;
1575
+ }
1576
+ else if (!host.didAltSvc(1)) {
1577
+ host.upgrade(1, incoming['alt-svc']);
1578
+ }
1536
1579
  }
1537
1580
  if (LOG_HTTP) {
1538
1581
  this[kConnectHttp][0][origin] = (this[kConnectHttp][0][origin] || 0) + 1;
@@ -1608,11 +1651,9 @@ class Request extends module_1.default {
1608
1651
  }
1609
1652
  const headers = options.headers || (options.headers = {});
1610
1653
  for (const attr in headers) {
1611
- switch (attr.toLowerCase()) {
1612
- case 'content-type':
1613
- case 'content-length':
1614
- delete headers[attr];
1615
- break;
1654
+ const name = attr.toLowerCase();
1655
+ if (name === 'content-type' || name === 'content-length') {
1656
+ delete headers[attr];
1616
1657
  }
1617
1658
  }
1618
1659
  if (parts || contentType === "multipart/form-data" /* MIME.MULTIPART */ || contentType === 'form-data') {
@@ -1643,53 +1684,54 @@ class Request extends module_1.default {
1643
1684
  }
1644
1685
  }
1645
1686
  for (let { name, data: target, value, contentType: type, filename } of parts) {
1646
- if ((0, types_1.isString)(name)) {
1647
- if (target) {
1648
- try {
1649
- if (typeof target === 'string') {
1650
- filename || (filename = path.basename(target));
1651
- type || (type = module_1.default.lookupMime(filename));
1652
- target = fs.readFileSync(target);
1687
+ if (!(0, types_1.isString)(name)) {
1688
+ continue;
1689
+ }
1690
+ if (target) {
1691
+ try {
1692
+ if (typeof target === 'string') {
1693
+ filename || (filename = path.basename(target));
1694
+ type || (type = module_1.default.lookupMime(filename));
1695
+ target = fs.readFileSync(target);
1696
+ }
1697
+ else if (target instanceof stream.Readable) {
1698
+ const chunks = [];
1699
+ for await (const chunk of target) {
1700
+ chunks.push(chunk);
1653
1701
  }
1654
- else if (target instanceof stream.Readable) {
1655
- const chunks = [];
1656
- for await (const chunk of target) {
1657
- chunks.push(chunk);
1658
- }
1659
- target = Buffer.concat(chunks);
1702
+ target = Buffer.concat(chunks);
1703
+ }
1704
+ if (!Buffer.isBuffer(target)) {
1705
+ throw (0, types_1.errorMessage)('File', "Unknown" /* ERR_MESSAGE.UNKNOWN */, "multipart/form-data" /* MIME.MULTIPART */);
1706
+ }
1707
+ if (!type || !filename) {
1708
+ const result = await module_1.default.resolveMime(target);
1709
+ let ext;
1710
+ if (result) {
1711
+ type || (type = result.mime);
1712
+ ext = result.ext;
1660
1713
  }
1661
- if (!Buffer.isBuffer(target)) {
1662
- throw (0, types_1.errorMessage)('File', "Unknown" /* ERR_MESSAGE.UNKNOWN */, "multipart/form-data" /* MIME.MULTIPART */);
1714
+ else if (type) {
1715
+ ext = module_1.default.lookupMime(type, true);
1663
1716
  }
1664
- if (!type || !filename) {
1665
- const result = await module_1.default.resolveMime(target);
1666
- let ext;
1667
- if (result) {
1668
- type || (type = result.mime);
1669
- ext = result.ext;
1670
- }
1671
- else if (type) {
1672
- ext = module_1.default.lookupMime(type, true);
1673
- }
1674
- if (ext && !filename) {
1675
- filename = (0, types_1.generateUUID)() + '.' + ext;
1676
- }
1717
+ if (ext && !filename) {
1718
+ filename = (0, types_1.generateUUID)() + '.' + ext;
1677
1719
  }
1678
- const disposition = createPart(name, filename, type || "application/octet-stream" /* MIME.OCTET_STREAM */);
1679
- write.append(disposition);
1680
- write.append(target);
1681
- write.append("\r\n" /* FORM_DATA.CRLF */);
1682
- contentLength += Buffer.byteLength(disposition) + target.length + 2 /* FORM_DATA.CRLF_LENGTH */;
1683
- valid = true;
1684
- }
1685
- catch (err) {
1686
- return Promise.reject(err);
1687
1720
  }
1721
+ const disposition = createPart(name, filename, type || "application/octet-stream" /* MIME.OCTET_STREAM */);
1722
+ write.append(disposition);
1723
+ write.append(target);
1724
+ write.append("\r\n" /* FORM_DATA.CRLF */);
1725
+ contentLength += Buffer.byteLength(disposition) + target.length + 2 /* FORM_DATA.CRLF_LENGTH */;
1726
+ valid = true;
1688
1727
  }
1689
- else {
1690
- addValue(name, value);
1728
+ catch (err) {
1729
+ return Promise.reject(err);
1691
1730
  }
1692
1731
  }
1732
+ else {
1733
+ addValue(name, value);
1734
+ }
1693
1735
  }
1694
1736
  if (valid) {
1695
1737
  write.append("--" /* FORM_DATA.BOUNDARY_HASH */ + boundary + "--" /* FORM_DATA.BOUNDARY_HASH */ + "\r\n" /* FORM_DATA.CRLF */);
@@ -1705,17 +1747,15 @@ class Request extends module_1.default {
1705
1747
  if (contentType && !contentType.includes('/')) {
1706
1748
  contentType = 'application/' + contentType.trim();
1707
1749
  }
1708
- if ((0, types_1.isPlainObject)(data)) {
1709
- if (contentType === "application/x-www-form-urlencoded" /* MIME.URLENCODED */) {
1710
- data = qs.stringify(data);
1711
- }
1712
- else {
1713
- data = JSON.stringify(data);
1714
- contentType || (contentType = "application/json" /* MIME.JSON */);
1715
- }
1750
+ if (!(0, types_1.isPlainObject)(data)) {
1751
+ data = module_1.default.asString(data);
1752
+ }
1753
+ else if (contentType === "application/x-www-form-urlencoded" /* MIME.URLENCODED */) {
1754
+ data = qs.stringify(data);
1716
1755
  }
1717
1756
  else {
1718
- data = module_1.default.asString(data);
1757
+ data = JSON.stringify(data);
1758
+ contentType || (contentType = "application/json" /* MIME.JSON */);
1719
1759
  }
1720
1760
  headers['content-length'] = Buffer.byteLength(data, (0, types_1.getEncoding)(dataEncoding)).toString();
1721
1761
  }
@@ -1811,14 +1851,15 @@ class Request extends module_1.default {
1811
1851
  const buffering = request.connected?.call(client, headers);
1812
1852
  const pipeline = pipeTo ? !(0, types_1.isString)(pipeTo) : false;
1813
1853
  const enabled = buffering !== false && !pipeline;
1854
+ const readTimeout = this.readTimeout;
1814
1855
  let mibsTime, delayTime;
1815
- if (log || this.readTimeout > 0) {
1856
+ if (log || readTimeout > 0) {
1816
1857
  client.once('readable', () => {
1817
- if (this.readTimeout > 0) {
1858
+ if (readTimeout > 0) {
1818
1859
  timeout = setTimeout(() => {
1819
1860
  abortResponse();
1820
1861
  throwError((0, types_1.errorValue)("Timeout was exceeded" /* ERR_MESSAGE.TIMEOUT */, href.toString()));
1821
- }, this.readTimeout);
1862
+ }, readTimeout);
1822
1863
  }
1823
1864
  if (log) {
1824
1865
  if (buffering === false) {
@@ -1939,7 +1980,7 @@ class Request extends module_1.default {
1939
1980
  }
1940
1981
  resolve(result);
1941
1982
  if (log) {
1942
- this.writeTimeProcess('HTTP' + httpVersion, request.statusMessage || url.toString(), startTime, { type: 1024 /* LOG_TYPE.HTTP */, queue: !!this.host, titleBgColor, messageUnit, messageUnitMinWidth: 9, delayTime, bypassLog: true });
1983
+ this.writeTimeProcess('HTTP' + httpVersion, request.statusMessage || url.toString(), startTime, { type: 1024 /* LOG_TYPE.HTTP */, queue: !!this.host, titleBgColor, messageUnit, messageUnitMinWidth: 9, delayTime, bypassLog: LOG_STDOUT });
1943
1984
  }
1944
1985
  });
1945
1986
  host.success(httpVersion);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-mc/request",
3
- "version": "0.5.3",
3
+ "version": "0.7.0",
4
4
  "description": "Request constructor for E-mc.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -20,8 +20,8 @@
20
20
  "license": "BSD 3-Clause",
21
21
  "homepage": "https://github.com/anpham6/e-mc#readme",
22
22
  "dependencies": {
23
- "@e-mc/module": "0.5.3",
24
- "@e-mc/types": "0.5.3",
23
+ "@e-mc/module": "0.7.0",
24
+ "@e-mc/types": "0.7.0",
25
25
  "combined-stream": "^1.0.8",
26
26
  "js-yaml": "^4.1.0",
27
27
  "which": "^2.0.2"