@nxtedition/lib 24.1.1 → 24.1.2
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/http.js +49 -43
- package/package.json +1 -1
package/http.js
CHANGED
|
@@ -391,15 +391,18 @@ export class IncomingMessage extends http.IncomingMessage {
|
|
|
391
391
|
export class ServerResponse extends http.ServerResponse {
|
|
392
392
|
#created = 0
|
|
393
393
|
#bytesWritten = 0
|
|
394
|
-
#
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
end: -1,
|
|
399
|
-
}
|
|
394
|
+
#connect = -1
|
|
395
|
+
#headers = -1
|
|
396
|
+
#data = -1
|
|
397
|
+
#end = -1
|
|
400
398
|
|
|
401
399
|
get timing() {
|
|
402
|
-
return
|
|
400
|
+
return {
|
|
401
|
+
connect: this.#connect,
|
|
402
|
+
headers: this.#headers,
|
|
403
|
+
data: this.#data,
|
|
404
|
+
end: this.#end,
|
|
405
|
+
}
|
|
403
406
|
}
|
|
404
407
|
|
|
405
408
|
get bytesWritten() {
|
|
@@ -414,8 +417,8 @@ export class ServerResponse extends http.ServerResponse {
|
|
|
414
417
|
|
|
415
418
|
assignSocket(socket) {
|
|
416
419
|
if (!this.destroyed) {
|
|
417
|
-
if (this.#
|
|
418
|
-
this.#
|
|
420
|
+
if (this.#connect === -1) {
|
|
421
|
+
this.#connect = performance.now() - this.#created
|
|
419
422
|
}
|
|
420
423
|
}
|
|
421
424
|
return super.assignSocket(socket)
|
|
@@ -423,8 +426,8 @@ export class ServerResponse extends http.ServerResponse {
|
|
|
423
426
|
|
|
424
427
|
flushHeaders() {
|
|
425
428
|
if (!this.destroyed) {
|
|
426
|
-
if (this.#
|
|
427
|
-
this.#
|
|
429
|
+
if (this.#headers === -1) {
|
|
430
|
+
this.#headers = performance.now() - this.#created
|
|
428
431
|
}
|
|
429
432
|
}
|
|
430
433
|
return super.flushHeaders()
|
|
@@ -432,12 +435,12 @@ export class ServerResponse extends http.ServerResponse {
|
|
|
432
435
|
|
|
433
436
|
write(chunk, encoding, callback) {
|
|
434
437
|
if (!this.destroyed) {
|
|
435
|
-
if (this.#
|
|
436
|
-
this.#
|
|
438
|
+
if (this.#data === -1) {
|
|
439
|
+
this.#data = performance.now() - this.#created
|
|
437
440
|
}
|
|
438
441
|
|
|
439
|
-
if (this.#
|
|
440
|
-
this.#
|
|
442
|
+
if (this.#headers === -1) {
|
|
443
|
+
this.#headers = this.#data
|
|
441
444
|
}
|
|
442
445
|
}
|
|
443
446
|
|
|
@@ -454,14 +457,14 @@ export class ServerResponse extends http.ServerResponse {
|
|
|
454
457
|
|
|
455
458
|
end(chunk, encoding, callback) {
|
|
456
459
|
if (!this.destroyed) {
|
|
457
|
-
this.#
|
|
460
|
+
this.#end = performance.now() - this.#created
|
|
458
461
|
|
|
459
|
-
if (this.#
|
|
460
|
-
this.#
|
|
462
|
+
if (this.#data === -1) {
|
|
463
|
+
this.#data = this.#end
|
|
461
464
|
}
|
|
462
465
|
|
|
463
|
-
if (this.#
|
|
464
|
-
this.#
|
|
466
|
+
if (this.#headers === -1) {
|
|
467
|
+
this.#headers = this.#end
|
|
465
468
|
}
|
|
466
469
|
}
|
|
467
470
|
|
|
@@ -478,8 +481,8 @@ export class ServerResponse extends http.ServerResponse {
|
|
|
478
481
|
|
|
479
482
|
destroy(err) {
|
|
480
483
|
if (!this.destroyed) {
|
|
481
|
-
if (this.#
|
|
482
|
-
this.#
|
|
484
|
+
if (this.#end === -1) {
|
|
485
|
+
this.#end = performance.now() - this.#created
|
|
483
486
|
}
|
|
484
487
|
}
|
|
485
488
|
|
|
@@ -537,15 +540,18 @@ export class Http2ServerRequest extends http2.Http2ServerRequest {
|
|
|
537
540
|
export class Http2ServerResponse extends http2.Http2ServerResponse {
|
|
538
541
|
#created = 0
|
|
539
542
|
#bytesWritten = 0
|
|
540
|
-
#
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
end: -1,
|
|
545
|
-
}
|
|
543
|
+
#connect = -1
|
|
544
|
+
#headers = -1
|
|
545
|
+
#data = -1
|
|
546
|
+
#end = -1
|
|
546
547
|
|
|
547
548
|
get timing() {
|
|
548
|
-
return
|
|
549
|
+
return {
|
|
550
|
+
connect: this.#connect,
|
|
551
|
+
headers: this.#headers,
|
|
552
|
+
data: this.#data,
|
|
553
|
+
end: this.#end,
|
|
554
|
+
}
|
|
549
555
|
}
|
|
550
556
|
|
|
551
557
|
get bytesWritten() {
|
|
@@ -556,13 +562,13 @@ export class Http2ServerResponse extends http2.Http2ServerResponse {
|
|
|
556
562
|
super(req)
|
|
557
563
|
|
|
558
564
|
this.#created = performance.now()
|
|
559
|
-
this.#
|
|
565
|
+
this.#connect = 0
|
|
560
566
|
}
|
|
561
567
|
|
|
562
568
|
flushHeaders() {
|
|
563
569
|
if (!this.destroyed) {
|
|
564
|
-
if (this.#
|
|
565
|
-
this.#
|
|
570
|
+
if (this.#headers === -1) {
|
|
571
|
+
this.#headers = performance.now() - this.#created
|
|
566
572
|
}
|
|
567
573
|
}
|
|
568
574
|
return super.flushHeaders()
|
|
@@ -570,12 +576,12 @@ export class Http2ServerResponse extends http2.Http2ServerResponse {
|
|
|
570
576
|
|
|
571
577
|
write(chunk, encoding, callback) {
|
|
572
578
|
if (!this.destroyed) {
|
|
573
|
-
if (this.#
|
|
574
|
-
this.#
|
|
579
|
+
if (this.#data === -1) {
|
|
580
|
+
this.#data = performance.now() - this.#created
|
|
575
581
|
}
|
|
576
582
|
|
|
577
|
-
if (this.#
|
|
578
|
-
this.#
|
|
583
|
+
if (this.#headers === -1) {
|
|
584
|
+
this.#headers = this.#data
|
|
579
585
|
}
|
|
580
586
|
}
|
|
581
587
|
|
|
@@ -592,14 +598,14 @@ export class Http2ServerResponse extends http2.Http2ServerResponse {
|
|
|
592
598
|
|
|
593
599
|
end(chunk, encoding, callback) {
|
|
594
600
|
if (!this.destroyed) {
|
|
595
|
-
this.#
|
|
601
|
+
this.#end = performance.now() - this.#created
|
|
596
602
|
|
|
597
|
-
if (this.#
|
|
598
|
-
this.#
|
|
603
|
+
if (this.#data === -1) {
|
|
604
|
+
this.#data = this.#end
|
|
599
605
|
}
|
|
600
606
|
|
|
601
|
-
if (this.#
|
|
602
|
-
this.#
|
|
607
|
+
if (this.#headers === -1) {
|
|
608
|
+
this.#headers = this.#end
|
|
603
609
|
}
|
|
604
610
|
}
|
|
605
611
|
|
|
@@ -616,8 +622,8 @@ export class Http2ServerResponse extends http2.Http2ServerResponse {
|
|
|
616
622
|
|
|
617
623
|
destroy(err) {
|
|
618
624
|
if (!this.destroyed) {
|
|
619
|
-
if (this.#
|
|
620
|
-
this.#
|
|
625
|
+
if (this.#end === -1) {
|
|
626
|
+
this.#end = performance.now() - this.#created
|
|
621
627
|
}
|
|
622
628
|
}
|
|
623
629
|
|