Commit c788f55
committed
http: attach error handler to socket synchronously in onSocket
Between onSocket and onSocketNT, the socket had no error handler,
meaning any errors emitted during that window (e.g. from a blocklist
check or custom lookup) would be unhandled even if the user had set up
a request error handler.
Fix this by attaching socketErrorListener synchronously in onSocket,
setting socket._httpMessage so the listener can forward errors to the
request. tickOnSocket removes and re-adds the listener after the parser
is set up to avoid duplicates. The _destroy path in onSocketNT is also
guarded to prevent double-firing if socketErrorListener already emitted
the error.
Fixes: nodejs#48771
Refs: nodejs#616581 parent 04946a7 commit c788f55
File tree
2 files changed
+22
-7
lines changed- lib
- test/parallel
2 files changed
+22
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
574 | | - | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
575 | 577 | | |
576 | 578 | | |
577 | 579 | | |
| |||
906 | 908 | | |
907 | 909 | | |
908 | 910 | | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
909 | 914 | | |
910 | 915 | | |
911 | 916 | | |
| |||
945 | 950 | | |
946 | 951 | | |
947 | 952 | | |
948 | | - | |
949 | | - | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
950 | 963 | | |
951 | 964 | | |
952 | 965 | | |
| |||
958 | 971 | | |
959 | 972 | | |
960 | 973 | | |
961 | | - | |
962 | | - | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
963 | 978 | | |
964 | 979 | | |
965 | 980 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
0 commit comments