File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,10 @@ function parserOnMessageComplete() {
125
125
if ( ! parser . incoming . upgrade ) {
126
126
// For upgraded connections, also emit this after parser.execute
127
127
parser . incoming . readable = false ;
128
- parser . incoming . emit ( 'end' ) ;
128
+ if ( ! parser . incoming . _ended ) {
129
+ parser . incoming . _ended = true ;
130
+ parser . incoming . emit ( 'end' ) ;
131
+ }
129
132
}
130
133
131
134
if ( parser . socket . readable ) {
@@ -1158,7 +1161,10 @@ function socketCloseListener() {
1158
1161
if ( req . res && req . res . readable ) {
1159
1162
// Socket closed before we emitted "end" below.
1160
1163
req . res . emit ( 'aborted' ) ;
1161
- req . res . emit ( 'end' ) ;
1164
+ if ( ! req . res . _ended ) {
1165
+ req . res . _ended = true ;
1166
+ req . res . emit ( 'end' ) ;
1167
+ }
1162
1168
req . res . emit ( 'close' ) ;
1163
1169
} else if ( ! req . res && ! req . _hadError ) {
1164
1170
// This socket error fired before we started to
You can’t perform that action at this time.
0 commit comments