Commit dcf9d03
committed
fix: handle invalid HTTP/2 headers gracefully (#4356)
When session.request() throws synchronously due to invalid HTTP/2 headers
(e.g., duplicate headers like 'content-type' and 'Content-Type'), the error
was not being caught, causing an uncaught exception.
The fix wraps all session.request() calls with try-catch blocks. When an
error is caught, only the request is errored (via util.errorRequest) and
the function returns false. The session is not destroyed because the error
is caused by the client sending invalid headers, not the server.
This allows the client to continue using the same session for subsequent
requests, and the error is properly caught by user code.
Closes #43561 parent 77b42a3 commit dcf9d03
2 files changed
Lines changed: 75 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
538 | 538 | | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | 539 | | |
543 | 540 | | |
544 | 541 | | |
| |||
579 | 576 | | |
580 | 577 | | |
581 | 578 | | |
582 | | - | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
583 | 583 | | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | 584 | | |
588 | 585 | | |
589 | 586 | | |
| |||
686 | 683 | | |
687 | 684 | | |
688 | 685 | | |
689 | | - | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
690 | 690 | | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | 691 | | |
695 | 692 | | |
696 | 693 | | |
| |||
703 | 700 | | |
704 | 701 | | |
705 | 702 | | |
706 | | - | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
707 | 707 | | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | 708 | | |
712 | 709 | | |
713 | 710 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
0 commit comments